diff options
author | Chris Craik <ccraik@google.com> | 2015-03-13 15:07:52 -0700 |
---|---|---|
committer | Chris Craik <ccraik@google.com> | 2015-03-18 16:10:24 -0700 |
commit | e2bb380bc26749782c873e5488cfdf4e42b27346 (patch) | |
tree | 3e05a9dfe166da3649ac2f1673274785233d6912 /libs/hwui/font/CacheTexture.h | |
parent | 8c6e4b398040ec0b52a7cc0cef54728f126e3841 (diff) | |
download | frameworks_base-e2bb380bc26749782c873e5488cfdf4e42b27346.zip frameworks_base-e2bb380bc26749782c873e5488cfdf4e42b27346.tar.gz frameworks_base-e2bb380bc26749782c873e5488cfdf4e42b27346.tar.bz2 |
Use glops for text rendering
Change-Id: I5e155c8baf3149f0ff231ec3c89dbff6bb8eae92
Diffstat (limited to 'libs/hwui/font/CacheTexture.h')
-rw-r--r-- | libs/hwui/font/CacheTexture.h | 47 |
1 files changed, 25 insertions, 22 deletions
diff --git a/libs/hwui/font/CacheTexture.h b/libs/hwui/font/CacheTexture.h index 5d3f959..6dabc76 100644 --- a/libs/hwui/font/CacheTexture.h +++ b/libs/hwui/font/CacheTexture.h @@ -17,15 +17,15 @@ #ifndef ANDROID_HWUI_CACHE_TEXTURE_H #define ANDROID_HWUI_CACHE_TEXTURE_H -#include <GLES3/gl3.h> +#include "PixelBuffer.h" +#include "Rect.h" +#include "Texture.h" +#include "Vertex.h" +#include <GLES3/gl3.h> #include <SkScalerContext.h> - #include <utils/Log.h> -#include "../PixelBuffer.h" -#include "../Rect.h" -#include "../Vertex.h" namespace android { namespace uirenderer { @@ -80,9 +80,9 @@ public: void init(); void releaseMesh(); - void releaseTexture(); + void releasePixelBuffer(); - void allocateTexture(); + void allocatePixelBuffer(); void allocateMesh(); // Returns true if glPixelStorei(GL_UNPACK_ROW_LENGTH) must be reset @@ -92,11 +92,11 @@ public: bool fitBitmap(const SkGlyph& glyph, uint32_t* retOriginX, uint32_t* retOriginY); inline uint16_t getWidth() const { - return mWidth; + return mTexture.width; } inline uint16_t getHeight() const { - return mHeight; + return mTexture.height; } inline GLenum getFormat() const { @@ -104,7 +104,7 @@ public: } inline uint32_t getOffset(uint16_t x, uint16_t y) const { - return (y * mWidth + x) * PixelBuffer::formatSize(mFormat); + return (y * getWidth() + x) * PixelBuffer::formatSize(mFormat); } inline const Rect* getDirtyRect() const { @@ -112,12 +112,17 @@ public: } inline PixelBuffer* getPixelBuffer() const { + return mPixelBuffer; + } + + Texture& getTexture() { + allocatePixelBuffer(); return mTexture; } GLuint getTextureId() { - allocateTexture(); - return mTextureId; + allocatePixelBuffer(); + return mTexture.id; } inline bool isDirty() const { @@ -131,7 +136,7 @@ public: /** * This method assumes that the proper texture unit is active. */ - void setLinearFiltering(bool linearFiltering, bool bind = true); + void setLinearFiltering(bool linearFiltering); inline uint16_t getGlyphCount() const { return mNumGlyphs; @@ -176,16 +181,14 @@ public: private: void setDirty(bool dirty); - PixelBuffer* mTexture; - GLuint mTextureId; - uint16_t mWidth; - uint16_t mHeight; + PixelBuffer* mPixelBuffer = nullptr; + Texture mTexture; GLenum mFormat; - bool mLinearFiltering; - bool mDirty; - uint16_t mNumGlyphs; - TextureVertex* mMesh; - uint32_t mCurrentQuad; + bool mLinearFiltering = false; + bool mDirty = false; + uint16_t mNumGlyphs = 0; + TextureVertex* mMesh = nullptr; + uint32_t mCurrentQuad = 0; uint32_t mMaxQuadCount; Caches& mCaches; CacheBlock* mCacheBlocks; |