Loading libs/hwui/PixelBuffer.cpp +8 −2 Original line number Diff line number Diff line Loading @@ -36,12 +36,14 @@ public: CpuPixelBuffer(GLenum format, uint32_t width, uint32_t height); uint8_t* map(AccessMode mode = kAccessMode_ReadWrite) override; void unmap() override; uint8_t* getMappedPointer() const override; void upload(uint32_t x, uint32_t y, uint32_t width, uint32_t height, int offset) override; protected: void unmap() override; private: std::unique_ptr<uint8_t[]> mBuffer; }; Loading Loading @@ -81,12 +83,14 @@ public: ~GpuPixelBuffer(); uint8_t* map(AccessMode mode = kAccessMode_ReadWrite) override; void unmap() override; uint8_t* getMappedPointer() const override; void upload(uint32_t x, uint32_t y, uint32_t width, uint32_t height, int offset) override; protected: void unmap() override; private: GLuint mBuffer; uint8_t* mMappedPointer; Loading Loading @@ -118,6 +122,7 @@ uint8_t* GpuPixelBuffer::map(AccessMode mode) { LOG_ALWAYS_FATAL("Failed to map PBO"); } mAccessMode = mode; mCaches.pixelBufferState().unbind(); } return mMappedPointer; Loading Loading @@ -147,6 +152,7 @@ void GpuPixelBuffer::upload(uint32_t x, uint32_t y, uint32_t width, uint32_t hei unmap(); glTexSubImage2D(GL_TEXTURE_2D, 0, x, y, width, height, mFormat, GL_UNSIGNED_BYTE, reinterpret_cast<void*>(offset)); mCaches.pixelBufferState().unbind(); } /////////////////////////////////////////////////////////////////////////////// Loading libs/hwui/PixelBuffer.h +8 −8 Original line number Diff line number Diff line Loading @@ -90,14 +90,6 @@ public: */ virtual uint8_t* map(AccessMode mode = kAccessMode_ReadWrite) = 0; /** * Unmaps this buffer, if needed. After the buffer is unmapped, * the pointer previously returned by map() becomes invalid and * should not be used. After calling this method, getMappedPointer() * will always return NULL. */ virtual void unmap() = 0; /** * Returns the current access mode for this buffer. If the buffer * is not mapped, this method returns kAccessMode_None. Loading Loading @@ -204,6 +196,14 @@ protected: mFormat(format), mWidth(width), mHeight(height), mAccessMode(kAccessMode_None) { } /** * Unmaps this buffer, if needed. After the buffer is unmapped, * the pointer previously returned by map() becomes invalid and * should not be used. After calling this method, getMappedPointer() * will always return NULL. */ virtual void unmap() = 0; GLenum mFormat; uint32_t mWidth; Loading Loading
libs/hwui/PixelBuffer.cpp +8 −2 Original line number Diff line number Diff line Loading @@ -36,12 +36,14 @@ public: CpuPixelBuffer(GLenum format, uint32_t width, uint32_t height); uint8_t* map(AccessMode mode = kAccessMode_ReadWrite) override; void unmap() override; uint8_t* getMappedPointer() const override; void upload(uint32_t x, uint32_t y, uint32_t width, uint32_t height, int offset) override; protected: void unmap() override; private: std::unique_ptr<uint8_t[]> mBuffer; }; Loading Loading @@ -81,12 +83,14 @@ public: ~GpuPixelBuffer(); uint8_t* map(AccessMode mode = kAccessMode_ReadWrite) override; void unmap() override; uint8_t* getMappedPointer() const override; void upload(uint32_t x, uint32_t y, uint32_t width, uint32_t height, int offset) override; protected: void unmap() override; private: GLuint mBuffer; uint8_t* mMappedPointer; Loading Loading @@ -118,6 +122,7 @@ uint8_t* GpuPixelBuffer::map(AccessMode mode) { LOG_ALWAYS_FATAL("Failed to map PBO"); } mAccessMode = mode; mCaches.pixelBufferState().unbind(); } return mMappedPointer; Loading Loading @@ -147,6 +152,7 @@ void GpuPixelBuffer::upload(uint32_t x, uint32_t y, uint32_t width, uint32_t hei unmap(); glTexSubImage2D(GL_TEXTURE_2D, 0, x, y, width, height, mFormat, GL_UNSIGNED_BYTE, reinterpret_cast<void*>(offset)); mCaches.pixelBufferState().unbind(); } /////////////////////////////////////////////////////////////////////////////// Loading
libs/hwui/PixelBuffer.h +8 −8 Original line number Diff line number Diff line Loading @@ -90,14 +90,6 @@ public: */ virtual uint8_t* map(AccessMode mode = kAccessMode_ReadWrite) = 0; /** * Unmaps this buffer, if needed. After the buffer is unmapped, * the pointer previously returned by map() becomes invalid and * should not be used. After calling this method, getMappedPointer() * will always return NULL. */ virtual void unmap() = 0; /** * Returns the current access mode for this buffer. If the buffer * is not mapped, this method returns kAccessMode_None. Loading Loading @@ -204,6 +196,14 @@ protected: mFormat(format), mWidth(width), mHeight(height), mAccessMode(kAccessMode_None) { } /** * Unmaps this buffer, if needed. After the buffer is unmapped, * the pointer previously returned by map() becomes invalid and * should not be used. After calling this method, getMappedPointer() * will always return NULL. */ virtual void unmap() = 0; GLenum mFormat; uint32_t mWidth; Loading