| Romain Guy | 694b519 | 2010-07-21 21:33:20 -0700 | [diff] [blame] | 1 | /* | 
|  | 2 | * Copyright (C) 2010 The Android Open Source Project | 
|  | 3 | * | 
|  | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); | 
|  | 5 | * you may not use this file except in compliance with the License. | 
|  | 6 | * You may obtain a copy of the License at | 
|  | 7 | * | 
|  | 8 | *      http://www.apache.org/licenses/LICENSE-2.0 | 
|  | 9 | * | 
|  | 10 | * Unless required by applicable law or agreed to in writing, software | 
|  | 11 | * distributed under the License is distributed on an "AS IS" BASIS, | 
|  | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 
|  | 13 | * See the License for the specific language governing permissions and | 
|  | 14 | * limitations under the License. | 
|  | 15 | */ | 
|  | 16 |  | 
| Romain Guy | 5b3b352 | 2010-10-27 18:57:51 -0700 | [diff] [blame] | 17 | #ifndef ANDROID_HWUI_FONT_RENDERER_H | 
|  | 18 | #define ANDROID_HWUI_FONT_RENDERER_H | 
| Romain Guy | 694b519 | 2010-07-21 21:33:20 -0700 | [diff] [blame] | 19 |  | 
|  | 20 | #include <utils/String8.h> | 
| Alex Sakhartchouk | 65ef909 | 2010-07-26 11:09:33 -0700 | [diff] [blame] | 21 | #include <utils/String16.h> | 
| Romain Guy | 694b519 | 2010-07-21 21:33:20 -0700 | [diff] [blame] | 22 | #include <utils/Vector.h> | 
|  | 23 | #include <utils/KeyedVector.h> | 
|  | 24 |  | 
|  | 25 | #include <SkScalerContext.h> | 
|  | 26 | #include <SkPaint.h> | 
|  | 27 |  | 
|  | 28 | #include <GLES2/gl2.h> | 
|  | 29 |  | 
| Romain Guy | 09147fb | 2010-07-22 13:08:20 -0700 | [diff] [blame] | 30 | #include "Rect.h" | 
| Romain Guy | 51769a6 | 2010-07-23 00:28:00 -0700 | [diff] [blame] | 31 | #include "Properties.h" | 
| Romain Guy | 09147fb | 2010-07-22 13:08:20 -0700 | [diff] [blame] | 32 |  | 
| Romain Guy | 694b519 | 2010-07-21 21:33:20 -0700 | [diff] [blame] | 33 | namespace android { | 
|  | 34 | namespace uirenderer { | 
|  | 35 |  | 
| Romain Guy | 726aeba | 2011-06-01 14:52:00 -0700 | [diff] [blame] | 36 | /////////////////////////////////////////////////////////////////////////////// | 
|  | 37 | // Defines | 
|  | 38 | /////////////////////////////////////////////////////////////////////////////// | 
|  | 39 |  | 
|  | 40 | #if RENDER_TEXT_AS_GLYPHS | 
|  | 41 | typedef uint16_t glyph_t; | 
|  | 42 | #define GET_METRICS(paint, glyph) paint->getGlyphMetrics(glyph) | 
|  | 43 | #define GET_GLYPH(text) nextGlyph((const uint16_t**) &text) | 
|  | 44 | #define IS_END_OF_STRING(glyph) false | 
|  | 45 | #else | 
|  | 46 | typedef SkUnichar glyph_t; | 
|  | 47 | #define GET_METRICS(paint, glyph) paint->getUnicharMetrics(glyph) | 
|  | 48 | #define GET_GLYPH(text) SkUTF16_NextUnichar((const uint16_t**) &text) | 
|  | 49 | #define IS_END_OF_STRING(glyph) glyph < 0 | 
|  | 50 | #endif | 
|  | 51 |  | 
|  | 52 | /////////////////////////////////////////////////////////////////////////////// | 
|  | 53 | // Declarations | 
|  | 54 | /////////////////////////////////////////////////////////////////////////////// | 
|  | 55 |  | 
| Romain Guy | 694b519 | 2010-07-21 21:33:20 -0700 | [diff] [blame] | 56 | class FontRenderer; | 
|  | 57 |  | 
| Chet Haase | 7de0cb1 | 2011-12-05 16:35:38 -0800 | [diff] [blame^] | 58 | class CacheTexture { | 
|  | 59 | public: | 
|  | 60 | CacheTexture(){} | 
|  | 61 | CacheTexture(uint8_t* texture, GLuint textureId, uint16_t width, uint16_t height) : | 
|  | 62 | mTexture(texture), mTextureId(textureId), mWidth(width), mHeight(height) {} | 
|  | 63 | ~CacheTexture() { | 
|  | 64 | if (mTexture != NULL) { | 
|  | 65 | delete[] mTexture; | 
|  | 66 | } | 
|  | 67 | if (mTextureId != 0) { | 
|  | 68 | glDeleteTextures(1, &mTextureId); | 
|  | 69 | } | 
|  | 70 | } | 
|  | 71 |  | 
|  | 72 | uint8_t* mTexture; | 
|  | 73 | GLuint mTextureId; | 
|  | 74 | uint16_t mWidth; | 
|  | 75 | uint16_t mHeight; | 
|  | 76 | }; | 
|  | 77 |  | 
|  | 78 | class CacheTextureLine { | 
|  | 79 | public: | 
|  | 80 | CacheTextureLine(uint16_t maxWidth, uint16_t maxHeight, uint32_t currentRow, | 
|  | 81 | uint32_t currentCol, CacheTexture* cacheTexture): | 
|  | 82 | mMaxHeight(maxHeight), | 
|  | 83 | mMaxWidth(maxWidth), | 
|  | 84 | mCurrentRow(currentRow), | 
|  | 85 | mCurrentCol(currentCol), | 
|  | 86 | mDirty(false), | 
|  | 87 | mCacheTexture(cacheTexture){ | 
|  | 88 | } | 
|  | 89 |  | 
|  | 90 | bool fitBitmap(const SkGlyph& glyph, uint32_t *retOriginX, uint32_t *retOriginY); | 
|  | 91 |  | 
|  | 92 | uint16_t mMaxHeight; | 
|  | 93 | uint16_t mMaxWidth; | 
|  | 94 | uint32_t mCurrentRow; | 
|  | 95 | uint32_t mCurrentCol; | 
|  | 96 | bool mDirty; | 
|  | 97 | CacheTexture *mCacheTexture; | 
|  | 98 | }; | 
|  | 99 |  | 
|  | 100 | struct CachedGlyphInfo { | 
|  | 101 | // Has the cache been invalidated? | 
|  | 102 | bool mIsValid; | 
|  | 103 | // Location of the cached glyph in the bitmap | 
|  | 104 | // in case we need to resize the texture or | 
|  | 105 | // render to bitmap | 
|  | 106 | uint32_t mStartX; | 
|  | 107 | uint32_t mStartY; | 
|  | 108 | uint32_t mBitmapWidth; | 
|  | 109 | uint32_t mBitmapHeight; | 
|  | 110 | // Also cache texture coords for the quad | 
|  | 111 | float mBitmapMinU; | 
|  | 112 | float mBitmapMinV; | 
|  | 113 | float mBitmapMaxU; | 
|  | 114 | float mBitmapMaxV; | 
|  | 115 | // Minimize how much we call freetype | 
|  | 116 | uint32_t mGlyphIndex; | 
|  | 117 | uint32_t mAdvanceX; | 
|  | 118 | uint32_t mAdvanceY; | 
|  | 119 | // Values below contain a glyph's origin in the bitmap | 
|  | 120 | int32_t mBitmapLeft; | 
|  | 121 | int32_t mBitmapTop; | 
|  | 122 | // Auto-kerning | 
|  | 123 | SkFixed mLsbDelta; | 
|  | 124 | SkFixed mRsbDelta; | 
|  | 125 | CacheTextureLine* mCachedTextureLine; | 
|  | 126 | }; | 
|  | 127 |  | 
|  | 128 |  | 
| Romain Guy | 726aeba | 2011-06-01 14:52:00 -0700 | [diff] [blame] | 129 | /////////////////////////////////////////////////////////////////////////////// | 
|  | 130 | // Font | 
|  | 131 | /////////////////////////////////////////////////////////////////////////////// | 
|  | 132 |  | 
| Romain Guy | 51769a6 | 2010-07-23 00:28:00 -0700 | [diff] [blame] | 133 | /** | 
|  | 134 | * Represents a font, defined by a Skia font id and a font size. A font is used | 
|  | 135 | * to generate glyphs and cache them in the FontState. | 
|  | 136 | */ | 
| Romain Guy | 694b519 | 2010-07-21 21:33:20 -0700 | [diff] [blame] | 137 | class Font { | 
|  | 138 | public: | 
| Romain Guy | 325a0f9 | 2011-01-05 15:26:55 -0800 | [diff] [blame] | 139 | enum Style { | 
| Romain Guy | c7b25be | 2011-03-23 14:59:20 -0700 | [diff] [blame] | 140 | kFakeBold = 1 | 
| Romain Guy | 325a0f9 | 2011-01-05 15:26:55 -0800 | [diff] [blame] | 141 | }; | 
|  | 142 |  | 
| Romain Guy | 694b519 | 2010-07-21 21:33:20 -0700 | [diff] [blame] | 143 | ~Font(); | 
|  | 144 |  | 
| Romain Guy | 51769a6 | 2010-07-23 00:28:00 -0700 | [diff] [blame] | 145 | /** | 
|  | 146 | * Renders the specified string of text. | 
| Alex Sakhartchouk | f18136c | 2010-08-06 14:49:04 -0700 | [diff] [blame] | 147 | * If bitmap is specified, it will be used as the render target | 
| Romain Guy | 51769a6 | 2010-07-23 00:28:00 -0700 | [diff] [blame] | 148 | */ | 
| Romain Guy | 726aeba | 2011-06-01 14:52:00 -0700 | [diff] [blame] | 149 | void render(SkPaint* paint, const char *text, uint32_t start, uint32_t len, | 
|  | 150 | int numGlyphs, int x, int y, uint8_t *bitmap = NULL, | 
|  | 151 | uint32_t bitmapW = 0, uint32_t bitmapH = 0); | 
| Romain Guy | 51769a6 | 2010-07-23 00:28:00 -0700 | [diff] [blame] | 152 | /** | 
|  | 153 | * Creates a new font associated with the specified font state. | 
|  | 154 | */ | 
| Romain Guy | 2577db1 | 2011-01-18 13:02:38 -0800 | [diff] [blame] | 155 | static Font* create(FontRenderer* state, uint32_t fontId, float fontSize, | 
| Romain Guy | bd496bc | 2011-08-02 17:32:41 -0700 | [diff] [blame] | 156 | int flags, uint32_t italicStyle, uint32_t scaleX, SkPaint::Style style, | 
|  | 157 | uint32_t strokeWidth); | 
| Romain Guy | 694b519 | 2010-07-21 21:33:20 -0700 | [diff] [blame] | 158 |  | 
|  | 159 | protected: | 
| Romain Guy | 694b519 | 2010-07-21 21:33:20 -0700 | [diff] [blame] | 160 | friend class FontRenderer; | 
|  | 161 |  | 
| Alex Sakhartchouk | f18136c | 2010-08-06 14:49:04 -0700 | [diff] [blame] | 162 | enum RenderMode { | 
|  | 163 | FRAMEBUFFER, | 
|  | 164 | BITMAP, | 
|  | 165 | MEASURE, | 
|  | 166 | }; | 
|  | 167 |  | 
| Romain Guy | 726aeba | 2011-06-01 14:52:00 -0700 | [diff] [blame] | 168 | void render(SkPaint* paint, const char *text, uint32_t start, uint32_t len, | 
|  | 169 | int numGlyphs, int x, int y, RenderMode mode, uint8_t *bitmap, | 
|  | 170 | uint32_t bitmapW, uint32_t bitmapH, Rect *bounds); | 
| Alex Sakhartchouk | f18136c | 2010-08-06 14:49:04 -0700 | [diff] [blame] | 171 |  | 
| Romain Guy | 726aeba | 2011-06-01 14:52:00 -0700 | [diff] [blame] | 172 | void measure(SkPaint* paint, const char* text, uint32_t start, uint32_t len, | 
|  | 173 | int numGlyphs, Rect *bounds); | 
| Alex Sakhartchouk | f18136c | 2010-08-06 14:49:04 -0700 | [diff] [blame] | 174 |  | 
| Chet Haase | 8668f8a | 2011-03-02 13:51:36 -0800 | [diff] [blame] | 175 | Font(FontRenderer* state, uint32_t fontId, float fontSize, int flags, uint32_t italicStyle, | 
| Romain Guy | bd496bc | 2011-08-02 17:32:41 -0700 | [diff] [blame] | 176 | uint32_t scaleX, SkPaint::Style style, uint32_t strokeWidth); | 
| Romain Guy | 694b519 | 2010-07-21 21:33:20 -0700 | [diff] [blame] | 177 |  | 
| Romain Guy | 726aeba | 2011-06-01 14:52:00 -0700 | [diff] [blame] | 178 | // Cache of glyphs | 
|  | 179 | DefaultKeyedVector<glyph_t, CachedGlyphInfo*> mCachedGlyphs; | 
| Romain Guy | 694b519 | 2010-07-21 21:33:20 -0700 | [diff] [blame] | 180 |  | 
| Romain Guy | bd0e6aa | 2010-07-22 18:50:12 -0700 | [diff] [blame] | 181 | void invalidateTextureCache(); | 
|  | 182 |  | 
| Romain Guy | 726aeba | 2011-06-01 14:52:00 -0700 | [diff] [blame] | 183 | CachedGlyphInfo* cacheGlyph(SkPaint* paint, glyph_t glyph); | 
| Romain Guy | 694b519 | 2010-07-21 21:33:20 -0700 | [diff] [blame] | 184 | void updateGlyphCache(SkPaint* paint, const SkGlyph& skiaGlyph, CachedGlyphInfo *glyph); | 
| Alex Sakhartchouk | f18136c | 2010-08-06 14:49:04 -0700 | [diff] [blame] | 185 | void measureCachedGlyph(CachedGlyphInfo *glyph, int x, int y, Rect *bounds); | 
| Romain Guy | 694b519 | 2010-07-21 21:33:20 -0700 | [diff] [blame] | 186 | void drawCachedGlyph(CachedGlyphInfo *glyph, int x, int y); | 
| Alex Sakhartchouk | 89a524a | 2010-08-02 17:52:30 -0700 | [diff] [blame] | 187 | void drawCachedGlyph(CachedGlyphInfo *glyph, int x, int y, | 
| Romain Guy | 726aeba | 2011-06-01 14:52:00 -0700 | [diff] [blame] | 188 | uint8_t *bitmap, uint32_t bitmapW, uint32_t bitmapH); | 
| Romain Guy | bd0e6aa | 2010-07-22 18:50:12 -0700 | [diff] [blame] | 189 |  | 
| Romain Guy | 726aeba | 2011-06-01 14:52:00 -0700 | [diff] [blame] | 190 | CachedGlyphInfo* getCachedGlyph(SkPaint* paint, glyph_t textUnit); | 
|  | 191 |  | 
|  | 192 | static glyph_t nextGlyph(const uint16_t** srcPtr) { | 
|  | 193 | const uint16_t* src = *srcPtr; | 
|  | 194 | glyph_t g = *src++; | 
|  | 195 | *srcPtr = src; | 
|  | 196 | return g; | 
|  | 197 | } | 
| Alex Sakhartchouk | 65ef909 | 2010-07-26 11:09:33 -0700 | [diff] [blame] | 198 |  | 
| Romain Guy | bd0e6aa | 2010-07-22 18:50:12 -0700 | [diff] [blame] | 199 | FontRenderer* mState; | 
|  | 200 | uint32_t mFontId; | 
|  | 201 | float mFontSize; | 
| Romain Guy | 325a0f9 | 2011-01-05 15:26:55 -0800 | [diff] [blame] | 202 | int mFlags; | 
| Romain Guy | 2577db1 | 2011-01-18 13:02:38 -0800 | [diff] [blame] | 203 | uint32_t mItalicStyle; | 
| Chet Haase | 8668f8a | 2011-03-02 13:51:36 -0800 | [diff] [blame] | 204 | uint32_t mScaleX; | 
| Romain Guy | bd496bc | 2011-08-02 17:32:41 -0700 | [diff] [blame] | 205 | SkPaint::Style mStyle; | 
|  | 206 | uint32_t mStrokeWidth; | 
| Romain Guy | 694b519 | 2010-07-21 21:33:20 -0700 | [diff] [blame] | 207 | }; | 
|  | 208 |  | 
| Romain Guy | 726aeba | 2011-06-01 14:52:00 -0700 | [diff] [blame] | 209 | /////////////////////////////////////////////////////////////////////////////// | 
|  | 210 | // Renderer | 
|  | 211 | /////////////////////////////////////////////////////////////////////////////// | 
|  | 212 |  | 
| Romain Guy | 694b519 | 2010-07-21 21:33:20 -0700 | [diff] [blame] | 213 | class FontRenderer { | 
|  | 214 | public: | 
|  | 215 | FontRenderer(); | 
|  | 216 | ~FontRenderer(); | 
|  | 217 |  | 
|  | 218 | void init(); | 
|  | 219 | void deinit(); | 
|  | 220 |  | 
| Romain Guy | b45c0c9 | 2010-08-26 20:35:23 -0700 | [diff] [blame] | 221 | void setGammaTable(const uint8_t* gammaTable) { | 
|  | 222 | mGammaTable = gammaTable; | 
|  | 223 | } | 
|  | 224 |  | 
| Romain Guy | f3a910b4 | 2011-12-12 20:35:21 -0800 | [diff] [blame] | 225 | inline float* getMeshBuffer() { | 
|  | 226 | checkInit(); | 
|  | 227 | return mTextMeshPtr; | 
|  | 228 | } | 
|  | 229 |  | 
|  | 230 | inline int getMeshTexCoordsOffset() const { | 
|  | 231 | return 2; | 
| Alex Sakhartchouk | 894df17 | 2011-02-17 16:45:37 -0800 | [diff] [blame] | 232 | } | 
|  | 233 |  | 
| Alex Sakhartchouk | 65ef909 | 2010-07-26 11:09:33 -0700 | [diff] [blame] | 234 | void setFont(SkPaint* paint, uint32_t fontId, float fontSize); | 
| Romain Guy | 5b3b352 | 2010-10-27 18:57:51 -0700 | [diff] [blame] | 235 | bool renderText(SkPaint* paint, const Rect* clip, const char *text, uint32_t startIndex, | 
|  | 236 | uint32_t len, int numGlyphs, int x, int y, Rect* bounds); | 
| Romain Guy | 694b519 | 2010-07-21 21:33:20 -0700 | [diff] [blame] | 237 |  | 
| Alex Sakhartchouk | f18136c | 2010-08-06 14:49:04 -0700 | [diff] [blame] | 238 | struct DropShadow { | 
| Romain Guy | 1e45aae | 2010-08-13 19:39:53 -0700 | [diff] [blame] | 239 | DropShadow() { }; | 
|  | 240 |  | 
|  | 241 | DropShadow(const DropShadow& dropShadow): | 
|  | 242 | width(dropShadow.width), height(dropShadow.height), | 
|  | 243 | image(dropShadow.image), penX(dropShadow.penX), | 
|  | 244 | penY(dropShadow.penY) { | 
|  | 245 | } | 
|  | 246 |  | 
| Alex Sakhartchouk | f18136c | 2010-08-06 14:49:04 -0700 | [diff] [blame] | 247 | uint32_t width; | 
|  | 248 | uint32_t height; | 
|  | 249 | uint8_t* image; | 
|  | 250 | int32_t penX; | 
|  | 251 | int32_t penY; | 
|  | 252 | }; | 
|  | 253 |  | 
|  | 254 | // After renderDropShadow returns, the called owns the memory in DropShadow.image | 
|  | 255 | // and is responsible for releasing it when it's done with it | 
|  | 256 | DropShadow renderDropShadow(SkPaint* paint, const char *text, uint32_t startIndex, | 
| Romain Guy | 1e45aae | 2010-08-13 19:39:53 -0700 | [diff] [blame] | 257 | uint32_t len, int numGlyphs, uint32_t radius); | 
| Alex Sakhartchouk | f18136c | 2010-08-06 14:49:04 -0700 | [diff] [blame] | 258 |  | 
| Romain Guy | e8cb9c14 | 2010-10-04 14:14:11 -0700 | [diff] [blame] | 259 | GLuint getTexture(bool linearFiltering = false) { | 
| Romain Guy | 694b519 | 2010-07-21 21:33:20 -0700 | [diff] [blame] | 260 | checkInit(); | 
| Romain Guy | e8cb9c14 | 2010-10-04 14:14:11 -0700 | [diff] [blame] | 261 | if (linearFiltering != mLinearFiltering) { | 
|  | 262 | mLinearFiltering = linearFiltering; | 
|  | 263 | const GLenum filtering = linearFiltering ? GL_LINEAR : GL_NEAREST; | 
|  | 264 |  | 
| Chet Haase | 7de0cb1 | 2011-12-05 16:35:38 -0800 | [diff] [blame^] | 265 | glBindTexture(GL_TEXTURE_2D, mCurrentCacheTexture->mTextureId); | 
| Romain Guy | e8cb9c14 | 2010-10-04 14:14:11 -0700 | [diff] [blame] | 266 | glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, filtering); | 
|  | 267 | glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, filtering); | 
|  | 268 | } | 
| Chet Haase | 7de0cb1 | 2011-12-05 16:35:38 -0800 | [diff] [blame^] | 269 | return mCurrentCacheTexture->mTextureId; | 
| Romain Guy | 694b519 | 2010-07-21 21:33:20 -0700 | [diff] [blame] | 270 | } | 
|  | 271 |  | 
| Chet Haase | 7de0cb1 | 2011-12-05 16:35:38 -0800 | [diff] [blame^] | 272 | uint32_t getCacheSize() const { | 
|  | 273 | uint32_t size = 0; | 
|  | 274 | if (mCacheTextureSmall != NULL && mCacheTextureSmall->mTexture != NULL) { | 
|  | 275 | size += mCacheTextureSmall->mWidth * mCacheTextureSmall->mHeight; | 
|  | 276 | } | 
|  | 277 | if (mCacheTexture128 != NULL && mCacheTexture128->mTexture != NULL) { | 
|  | 278 | size += mCacheTexture128->mWidth * mCacheTexture128->mHeight; | 
|  | 279 | } | 
|  | 280 | if (mCacheTexture256 != NULL && mCacheTexture256->mTexture != NULL) { | 
|  | 281 | size += mCacheTexture256->mWidth * mCacheTexture256->mHeight; | 
|  | 282 | } | 
|  | 283 | if (mCacheTexture512 != NULL && mCacheTexture512->mTexture != NULL) { | 
|  | 284 | size += mCacheTexture512->mWidth * mCacheTexture512->mHeight; | 
|  | 285 | } | 
|  | 286 | return size; | 
| Romain Guy | c15008e | 2010-11-10 11:59:15 -0800 | [diff] [blame] | 287 | } | 
|  | 288 |  | 
| Romain Guy | 694b519 | 2010-07-21 21:33:20 -0700 | [diff] [blame] | 289 | protected: | 
|  | 290 | friend class Font; | 
|  | 291 |  | 
| Romain Guy | b45c0c9 | 2010-08-26 20:35:23 -0700 | [diff] [blame] | 292 | const uint8_t* mGammaTable; | 
|  | 293 |  | 
| Chet Haase | 7de0cb1 | 2011-12-05 16:35:38 -0800 | [diff] [blame^] | 294 | uint8_t* allocateTextureMemory(int width, int height); | 
|  | 295 | void initTextTexture(); | 
|  | 296 | CacheTexture *createCacheTexture(int width, int height, bool allocate); | 
|  | 297 | void cacheBitmap(const SkGlyph& glyph, CachedGlyphInfo* cachedGlyph, | 
|  | 298 | uint32_t *retOriginX, uint32_t *retOriginY); | 
| Romain Guy | 694b519 | 2010-07-21 21:33:20 -0700 | [diff] [blame] | 299 |  | 
|  | 300 | void flushAllAndInvalidate(); | 
|  | 301 | void initVertexArrayBuffers(); | 
|  | 302 |  | 
|  | 303 | void checkInit(); | 
|  | 304 |  | 
| Alex Sakhartchouk | 65ef909 | 2010-07-26 11:09:33 -0700 | [diff] [blame] | 305 | String16 mLatinPrecache; | 
|  | 306 | void precacheLatin(SkPaint* paint); | 
|  | 307 |  | 
| Romain Guy | 694b519 | 2010-07-21 21:33:20 -0700 | [diff] [blame] | 308 | void issueDrawCommand(); | 
| Romain Guy | d71dd36 | 2011-12-12 19:03:35 -0800 | [diff] [blame] | 309 | void appendMeshQuad(float x1, float y1, float u1, float v1, | 
|  | 310 | float x2, float y2, float u2, float v2, | 
|  | 311 | float x3, float y3, float u3, float v3, | 
| Chet Haase | 7de0cb1 | 2011-12-05 16:35:38 -0800 | [diff] [blame^] | 312 | float x4, float y4, float u4, float v4, CacheTexture* texture); | 
| Romain Guy | 694b519 | 2010-07-21 21:33:20 -0700 | [diff] [blame] | 313 |  | 
| Chet Haase | 7de0cb1 | 2011-12-05 16:35:38 -0800 | [diff] [blame^] | 314 | uint32_t mSmallCacheWidth; | 
|  | 315 | uint32_t mSmallCacheHeight; | 
| Romain Guy | 694b519 | 2010-07-21 21:33:20 -0700 | [diff] [blame] | 316 |  | 
| Romain Guy | 694b519 | 2010-07-21 21:33:20 -0700 | [diff] [blame] | 317 | Vector<CacheTextureLine*> mCacheLines; | 
| Alex Sakhartchouk | 65ef909 | 2010-07-26 11:09:33 -0700 | [diff] [blame] | 318 | uint32_t getRemainingCacheCapacity(); | 
| Romain Guy | 694b519 | 2010-07-21 21:33:20 -0700 | [diff] [blame] | 319 |  | 
| Romain Guy | 09147fb | 2010-07-22 13:08:20 -0700 | [diff] [blame] | 320 | Font* mCurrentFont; | 
| Romain Guy | 694b519 | 2010-07-21 21:33:20 -0700 | [diff] [blame] | 321 | Vector<Font*> mActiveFonts; | 
|  | 322 |  | 
| Chet Haase | 7de0cb1 | 2011-12-05 16:35:38 -0800 | [diff] [blame^] | 323 | CacheTexture* mCurrentCacheTexture; | 
|  | 324 | CacheTexture* mLastCacheTexture; | 
|  | 325 | CacheTexture* mCacheTextureSmall; | 
|  | 326 | CacheTexture* mCacheTexture128; | 
|  | 327 | CacheTexture* mCacheTexture256; | 
|  | 328 | CacheTexture* mCacheTexture512; | 
|  | 329 |  | 
|  | 330 |  | 
| Alex Sakhartchouk | 9b9902d | 2010-07-23 14:45:49 -0700 | [diff] [blame] | 331 | void checkTextureUpdate(); | 
| Romain Guy | 694b519 | 2010-07-21 21:33:20 -0700 | [diff] [blame] | 332 | bool mUploadTexture; | 
|  | 333 |  | 
|  | 334 | // Pointer to vertex data to speed up frame to frame work | 
|  | 335 | float *mTextMeshPtr; | 
|  | 336 | uint32_t mCurrentQuadIndex; | 
|  | 337 | uint32_t mMaxNumberOfQuads; | 
|  | 338 |  | 
|  | 339 | uint32_t mIndexBufferID; | 
|  | 340 |  | 
| Romain Guy | 09147fb | 2010-07-22 13:08:20 -0700 | [diff] [blame] | 341 | const Rect* mClip; | 
| Romain Guy | 5b3b352 | 2010-10-27 18:57:51 -0700 | [diff] [blame] | 342 | Rect* mBounds; | 
|  | 343 | bool mDrawn; | 
| Romain Guy | 09147fb | 2010-07-22 13:08:20 -0700 | [diff] [blame] | 344 |  | 
| Romain Guy | 694b519 | 2010-07-21 21:33:20 -0700 | [diff] [blame] | 345 | bool mInitialized; | 
| Alex Sakhartchouk | 89a524a | 2010-08-02 17:52:30 -0700 | [diff] [blame] | 346 |  | 
| Romain Guy | e8cb9c14 | 2010-10-04 14:14:11 -0700 | [diff] [blame] | 347 | bool mLinearFiltering; | 
|  | 348 |  | 
| Alex Sakhartchouk | 89a524a | 2010-08-02 17:52:30 -0700 | [diff] [blame] | 349 | void computeGaussianWeights(float* weights, int32_t radius); | 
|  | 350 | void horizontalBlur(float* weights, int32_t radius, const uint8_t *source, uint8_t *dest, | 
| Romain Guy | 1e45aae | 2010-08-13 19:39:53 -0700 | [diff] [blame] | 351 | int32_t width, int32_t height); | 
| Alex Sakhartchouk | 89a524a | 2010-08-02 17:52:30 -0700 | [diff] [blame] | 352 | void verticalBlur(float* weights, int32_t radius, const uint8_t *source, uint8_t *dest, | 
| Romain Guy | 1e45aae | 2010-08-13 19:39:53 -0700 | [diff] [blame] | 353 | int32_t width, int32_t height); | 
| Alex Sakhartchouk | 89a524a | 2010-08-02 17:52:30 -0700 | [diff] [blame] | 354 | void blurImage(uint8_t* image, int32_t width, int32_t height, int32_t radius); | 
| Romain Guy | 694b519 | 2010-07-21 21:33:20 -0700 | [diff] [blame] | 355 | }; | 
|  | 356 |  | 
|  | 357 | }; // namespace uirenderer | 
|  | 358 | }; // namespace android | 
|  | 359 |  | 
| Romain Guy | 5b3b352 | 2010-10-27 18:57:51 -0700 | [diff] [blame] | 360 | #endif // ANDROID_HWUI_FONT_RENDERER_H |