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 | |
Romain Guy | 726aeba | 2011-06-01 14:52:00 -0700 | [diff] [blame] | 58 | /////////////////////////////////////////////////////////////////////////////// |
| 59 | // Font |
| 60 | /////////////////////////////////////////////////////////////////////////////// |
| 61 | |
Romain Guy | 51769a6 | 2010-07-23 00:28:00 -0700 | [diff] [blame] | 62 | /** |
| 63 | * Represents a font, defined by a Skia font id and a font size. A font is used |
| 64 | * to generate glyphs and cache them in the FontState. |
| 65 | */ |
Romain Guy | 694b519 | 2010-07-21 21:33:20 -0700 | [diff] [blame] | 66 | class Font { |
| 67 | public: |
Romain Guy | 325a0f9 | 2011-01-05 15:26:55 -0800 | [diff] [blame] | 68 | enum Style { |
Romain Guy | c7b25be | 2011-03-23 14:59:20 -0700 | [diff] [blame] | 69 | kFakeBold = 1 |
Romain Guy | 325a0f9 | 2011-01-05 15:26:55 -0800 | [diff] [blame] | 70 | }; |
| 71 | |
Romain Guy | 694b519 | 2010-07-21 21:33:20 -0700 | [diff] [blame] | 72 | ~Font(); |
| 73 | |
Romain Guy | 51769a6 | 2010-07-23 00:28:00 -0700 | [diff] [blame] | 74 | /** |
| 75 | * Renders the specified string of text. |
Alex Sakhartchouk | f18136c | 2010-08-06 14:49:04 -0700 | [diff] [blame] | 76 | * If bitmap is specified, it will be used as the render target |
Romain Guy | 51769a6 | 2010-07-23 00:28:00 -0700 | [diff] [blame] | 77 | */ |
Romain Guy | 726aeba | 2011-06-01 14:52:00 -0700 | [diff] [blame] | 78 | void render(SkPaint* paint, const char *text, uint32_t start, uint32_t len, |
| 79 | int numGlyphs, int x, int y, uint8_t *bitmap = NULL, |
| 80 | uint32_t bitmapW = 0, uint32_t bitmapH = 0); |
Romain Guy | 51769a6 | 2010-07-23 00:28:00 -0700 | [diff] [blame] | 81 | /** |
| 82 | * Creates a new font associated with the specified font state. |
| 83 | */ |
Romain Guy | 2577db1 | 2011-01-18 13:02:38 -0800 | [diff] [blame] | 84 | static Font* create(FontRenderer* state, uint32_t fontId, float fontSize, |
Romain Guy | bd496bc | 2011-08-02 17:32:41 -0700 | [diff] [blame] | 85 | int flags, uint32_t italicStyle, uint32_t scaleX, SkPaint::Style style, |
| 86 | uint32_t strokeWidth); |
Romain Guy | 694b519 | 2010-07-21 21:33:20 -0700 | [diff] [blame] | 87 | |
| 88 | protected: |
Romain Guy | 694b519 | 2010-07-21 21:33:20 -0700 | [diff] [blame] | 89 | friend class FontRenderer; |
| 90 | |
Alex Sakhartchouk | f18136c | 2010-08-06 14:49:04 -0700 | [diff] [blame] | 91 | enum RenderMode { |
| 92 | FRAMEBUFFER, |
| 93 | BITMAP, |
| 94 | MEASURE, |
| 95 | }; |
| 96 | |
Romain Guy | 726aeba | 2011-06-01 14:52:00 -0700 | [diff] [blame] | 97 | void render(SkPaint* paint, const char *text, uint32_t start, uint32_t len, |
| 98 | int numGlyphs, int x, int y, RenderMode mode, uint8_t *bitmap, |
| 99 | uint32_t bitmapW, uint32_t bitmapH, Rect *bounds); |
Alex Sakhartchouk | f18136c | 2010-08-06 14:49:04 -0700 | [diff] [blame] | 100 | |
Romain Guy | 726aeba | 2011-06-01 14:52:00 -0700 | [diff] [blame] | 101 | void measure(SkPaint* paint, const char* text, uint32_t start, uint32_t len, |
| 102 | int numGlyphs, Rect *bounds); |
Alex Sakhartchouk | f18136c | 2010-08-06 14:49:04 -0700 | [diff] [blame] | 103 | |
Romain Guy | 694b519 | 2010-07-21 21:33:20 -0700 | [diff] [blame] | 104 | struct CachedGlyphInfo { |
| 105 | // Has the cache been invalidated? |
| 106 | bool mIsValid; |
| 107 | // Location of the cached glyph in the bitmap |
Alex Sakhartchouk | 89a524a | 2010-08-02 17:52:30 -0700 | [diff] [blame] | 108 | // in case we need to resize the texture or |
| 109 | // render to bitmap |
| 110 | uint32_t mStartX; |
| 111 | uint32_t mStartY; |
Romain Guy | 694b519 | 2010-07-21 21:33:20 -0700 | [diff] [blame] | 112 | uint32_t mBitmapWidth; |
| 113 | uint32_t mBitmapHeight; |
| 114 | // Also cache texture coords for the quad |
| 115 | float mBitmapMinU; |
| 116 | float mBitmapMinV; |
| 117 | float mBitmapMaxU; |
| 118 | float mBitmapMaxV; |
| 119 | // Minimize how much we call freetype |
| 120 | uint32_t mGlyphIndex; |
| 121 | uint32_t mAdvanceX; |
| 122 | uint32_t mAdvanceY; |
| 123 | // Values below contain a glyph's origin in the bitmap |
Alex Sakhartchouk | 89a524a | 2010-08-02 17:52:30 -0700 | [diff] [blame] | 124 | int32_t mBitmapLeft; |
| 125 | int32_t mBitmapTop; |
Romain Guy | 2bffd26 | 2010-09-12 17:40:02 -0700 | [diff] [blame] | 126 | // Auto-kerning |
| 127 | SkFixed mLsbDelta; |
| 128 | SkFixed mRsbDelta; |
Romain Guy | 694b519 | 2010-07-21 21:33:20 -0700 | [diff] [blame] | 129 | }; |
| 130 | |
Chet Haase | 8668f8a | 2011-03-02 13:51:36 -0800 | [diff] [blame] | 131 | 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] | 132 | uint32_t scaleX, SkPaint::Style style, uint32_t strokeWidth); |
Romain Guy | 694b519 | 2010-07-21 21:33:20 -0700 | [diff] [blame] | 133 | |
Romain Guy | 726aeba | 2011-06-01 14:52:00 -0700 | [diff] [blame] | 134 | // Cache of glyphs |
| 135 | DefaultKeyedVector<glyph_t, CachedGlyphInfo*> mCachedGlyphs; |
Romain Guy | 694b519 | 2010-07-21 21:33:20 -0700 | [diff] [blame] | 136 | |
Romain Guy | bd0e6aa | 2010-07-22 18:50:12 -0700 | [diff] [blame] | 137 | void invalidateTextureCache(); |
| 138 | |
Romain Guy | 726aeba | 2011-06-01 14:52:00 -0700 | [diff] [blame] | 139 | CachedGlyphInfo* cacheGlyph(SkPaint* paint, glyph_t glyph); |
Romain Guy | 694b519 | 2010-07-21 21:33:20 -0700 | [diff] [blame] | 140 | void updateGlyphCache(SkPaint* paint, const SkGlyph& skiaGlyph, CachedGlyphInfo *glyph); |
Alex Sakhartchouk | f18136c | 2010-08-06 14:49:04 -0700 | [diff] [blame] | 141 | void measureCachedGlyph(CachedGlyphInfo *glyph, int x, int y, Rect *bounds); |
Romain Guy | 694b519 | 2010-07-21 21:33:20 -0700 | [diff] [blame] | 142 | void drawCachedGlyph(CachedGlyphInfo *glyph, int x, int y); |
Alex Sakhartchouk | 89a524a | 2010-08-02 17:52:30 -0700 | [diff] [blame] | 143 | void drawCachedGlyph(CachedGlyphInfo *glyph, int x, int y, |
Romain Guy | 726aeba | 2011-06-01 14:52:00 -0700 | [diff] [blame] | 144 | uint8_t *bitmap, uint32_t bitmapW, uint32_t bitmapH); |
Romain Guy | bd0e6aa | 2010-07-22 18:50:12 -0700 | [diff] [blame] | 145 | |
Romain Guy | 726aeba | 2011-06-01 14:52:00 -0700 | [diff] [blame] | 146 | CachedGlyphInfo* getCachedGlyph(SkPaint* paint, glyph_t textUnit); |
| 147 | |
| 148 | static glyph_t nextGlyph(const uint16_t** srcPtr) { |
| 149 | const uint16_t* src = *srcPtr; |
| 150 | glyph_t g = *src++; |
| 151 | *srcPtr = src; |
| 152 | return g; |
| 153 | } |
Alex Sakhartchouk | 65ef909 | 2010-07-26 11:09:33 -0700 | [diff] [blame] | 154 | |
Romain Guy | bd0e6aa | 2010-07-22 18:50:12 -0700 | [diff] [blame] | 155 | FontRenderer* mState; |
| 156 | uint32_t mFontId; |
| 157 | float mFontSize; |
Romain Guy | 325a0f9 | 2011-01-05 15:26:55 -0800 | [diff] [blame] | 158 | int mFlags; |
Romain Guy | 2577db1 | 2011-01-18 13:02:38 -0800 | [diff] [blame] | 159 | uint32_t mItalicStyle; |
Chet Haase | 8668f8a | 2011-03-02 13:51:36 -0800 | [diff] [blame] | 160 | uint32_t mScaleX; |
Romain Guy | bd496bc | 2011-08-02 17:32:41 -0700 | [diff] [blame] | 161 | SkPaint::Style mStyle; |
| 162 | uint32_t mStrokeWidth; |
Romain Guy | 694b519 | 2010-07-21 21:33:20 -0700 | [diff] [blame] | 163 | }; |
| 164 | |
Romain Guy | 726aeba | 2011-06-01 14:52:00 -0700 | [diff] [blame] | 165 | /////////////////////////////////////////////////////////////////////////////// |
| 166 | // Renderer |
| 167 | /////////////////////////////////////////////////////////////////////////////// |
| 168 | |
Romain Guy | 694b519 | 2010-07-21 21:33:20 -0700 | [diff] [blame] | 169 | class FontRenderer { |
| 170 | public: |
| 171 | FontRenderer(); |
| 172 | ~FontRenderer(); |
| 173 | |
| 174 | void init(); |
| 175 | void deinit(); |
| 176 | |
Romain Guy | b45c0c9 | 2010-08-26 20:35:23 -0700 | [diff] [blame] | 177 | void setGammaTable(const uint8_t* gammaTable) { |
| 178 | mGammaTable = gammaTable; |
| 179 | } |
| 180 | |
Alex Sakhartchouk | 894df17 | 2011-02-17 16:45:37 -0800 | [diff] [blame] | 181 | void setAttributeBindingSlots(int positionSlot, int texCoordSlot) { |
| 182 | mPositionAttrSlot = positionSlot; |
| 183 | mTexcoordAttrSlot = texCoordSlot; |
| 184 | } |
| 185 | |
Alex Sakhartchouk | 65ef909 | 2010-07-26 11:09:33 -0700 | [diff] [blame] | 186 | void setFont(SkPaint* paint, uint32_t fontId, float fontSize); |
Romain Guy | 5b3b352 | 2010-10-27 18:57:51 -0700 | [diff] [blame] | 187 | bool renderText(SkPaint* paint, const Rect* clip, const char *text, uint32_t startIndex, |
| 188 | uint32_t len, int numGlyphs, int x, int y, Rect* bounds); |
Romain Guy | 694b519 | 2010-07-21 21:33:20 -0700 | [diff] [blame] | 189 | |
Alex Sakhartchouk | f18136c | 2010-08-06 14:49:04 -0700 | [diff] [blame] | 190 | struct DropShadow { |
Romain Guy | 1e45aae | 2010-08-13 19:39:53 -0700 | [diff] [blame] | 191 | DropShadow() { }; |
| 192 | |
| 193 | DropShadow(const DropShadow& dropShadow): |
| 194 | width(dropShadow.width), height(dropShadow.height), |
| 195 | image(dropShadow.image), penX(dropShadow.penX), |
| 196 | penY(dropShadow.penY) { |
| 197 | } |
| 198 | |
Alex Sakhartchouk | f18136c | 2010-08-06 14:49:04 -0700 | [diff] [blame] | 199 | uint32_t width; |
| 200 | uint32_t height; |
| 201 | uint8_t* image; |
| 202 | int32_t penX; |
| 203 | int32_t penY; |
| 204 | }; |
| 205 | |
| 206 | // After renderDropShadow returns, the called owns the memory in DropShadow.image |
| 207 | // and is responsible for releasing it when it's done with it |
| 208 | DropShadow renderDropShadow(SkPaint* paint, const char *text, uint32_t startIndex, |
Romain Guy | 1e45aae | 2010-08-13 19:39:53 -0700 | [diff] [blame] | 209 | uint32_t len, int numGlyphs, uint32_t radius); |
Alex Sakhartchouk | f18136c | 2010-08-06 14:49:04 -0700 | [diff] [blame] | 210 | |
Romain Guy | e8cb9c14 | 2010-10-04 14:14:11 -0700 | [diff] [blame] | 211 | GLuint getTexture(bool linearFiltering = false) { |
Romain Guy | 694b519 | 2010-07-21 21:33:20 -0700 | [diff] [blame] | 212 | checkInit(); |
Romain Guy | e8cb9c14 | 2010-10-04 14:14:11 -0700 | [diff] [blame] | 213 | if (linearFiltering != mLinearFiltering) { |
| 214 | mLinearFiltering = linearFiltering; |
| 215 | const GLenum filtering = linearFiltering ? GL_LINEAR : GL_NEAREST; |
| 216 | |
| 217 | glBindTexture(GL_TEXTURE_2D, mTextureId); |
| 218 | glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, filtering); |
| 219 | glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, filtering); |
| 220 | } |
Romain Guy | 694b519 | 2010-07-21 21:33:20 -0700 | [diff] [blame] | 221 | return mTextureId; |
| 222 | } |
| 223 | |
Romain Guy | c15008e | 2010-11-10 11:59:15 -0800 | [diff] [blame] | 224 | uint32_t getCacheWidth() const { |
| 225 | return mCacheWidth; |
| 226 | } |
| 227 | |
| 228 | uint32_t getCacheHeight() const { |
| 229 | return mCacheHeight; |
| 230 | } |
| 231 | |
Romain Guy | 694b519 | 2010-07-21 21:33:20 -0700 | [diff] [blame] | 232 | protected: |
| 233 | friend class Font; |
| 234 | |
Romain Guy | b45c0c9 | 2010-08-26 20:35:23 -0700 | [diff] [blame] | 235 | const uint8_t* mGammaTable; |
| 236 | |
Romain Guy | 694b519 | 2010-07-21 21:33:20 -0700 | [diff] [blame] | 237 | struct CacheTextureLine { |
| 238 | uint16_t mMaxHeight; |
| 239 | uint16_t mMaxWidth; |
| 240 | uint32_t mCurrentRow; |
| 241 | uint32_t mCurrentCol; |
Romain Guy | 1e45aae | 2010-08-13 19:39:53 -0700 | [diff] [blame] | 242 | bool mDirty; |
Romain Guy | 694b519 | 2010-07-21 21:33:20 -0700 | [diff] [blame] | 243 | |
Romain Guy | 51769a6 | 2010-07-23 00:28:00 -0700 | [diff] [blame] | 244 | CacheTextureLine(uint16_t maxWidth, uint16_t maxHeight, uint32_t currentRow, |
Romain Guy | 694b519 | 2010-07-21 21:33:20 -0700 | [diff] [blame] | 245 | uint32_t currentCol): |
Romain Guy | 51769a6 | 2010-07-23 00:28:00 -0700 | [diff] [blame] | 246 | mMaxHeight(maxHeight), |
| 247 | mMaxWidth(maxWidth), |
| 248 | mCurrentRow(currentRow), |
Alex Sakhartchouk | 9b9902d | 2010-07-23 14:45:49 -0700 | [diff] [blame] | 249 | mCurrentCol(currentCol), |
| 250 | mDirty(false) { |
Romain Guy | 694b519 | 2010-07-21 21:33:20 -0700 | [diff] [blame] | 251 | } |
| 252 | |
| 253 | bool fitBitmap(const SkGlyph& glyph, uint32_t *retOriginX, uint32_t *retOriginY) { |
Romain Guy | 7975fb6 | 2010-10-01 16:36:14 -0700 | [diff] [blame] | 254 | if (glyph.fHeight + 2 > mMaxHeight) { |
Romain Guy | 694b519 | 2010-07-21 21:33:20 -0700 | [diff] [blame] | 255 | return false; |
| 256 | } |
| 257 | |
Romain Guy | 7975fb6 | 2010-10-01 16:36:14 -0700 | [diff] [blame] | 258 | if (mCurrentCol + glyph.fWidth + 2 < mMaxWidth) { |
| 259 | *retOriginX = mCurrentCol + 1; |
| 260 | *retOriginY = mCurrentRow + 1; |
| 261 | mCurrentCol += glyph.fWidth + 2; |
Alex Sakhartchouk | 9b9902d | 2010-07-23 14:45:49 -0700 | [diff] [blame] | 262 | mDirty = true; |
Romain Guy | 694b519 | 2010-07-21 21:33:20 -0700 | [diff] [blame] | 263 | return true; |
| 264 | } |
| 265 | |
| 266 | return false; |
| 267 | } |
| 268 | }; |
| 269 | |
Chet Haase | 44984ea | 2011-05-19 13:50:47 -0700 | [diff] [blame] | 270 | void initTextTexture(bool largeFonts = false); |
Romain Guy | 694b519 | 2010-07-21 21:33:20 -0700 | [diff] [blame] | 271 | bool cacheBitmap(const SkGlyph& glyph, uint32_t *retOriginX, uint32_t *retOriginY); |
| 272 | |
| 273 | void flushAllAndInvalidate(); |
| 274 | void initVertexArrayBuffers(); |
| 275 | |
| 276 | void checkInit(); |
| 277 | |
Alex Sakhartchouk | 65ef909 | 2010-07-26 11:09:33 -0700 | [diff] [blame] | 278 | String16 mLatinPrecache; |
| 279 | void precacheLatin(SkPaint* paint); |
| 280 | |
Romain Guy | 694b519 | 2010-07-21 21:33:20 -0700 | [diff] [blame] | 281 | void issueDrawCommand(); |
Romain Guy | 694b519 | 2010-07-21 21:33:20 -0700 | [diff] [blame] | 282 | void appendMeshQuad(float x1, float y1, float z1, float u1, float v1, float x2, float y2, |
| 283 | float z2, float u2, float v2, float x3, float y3, float z3, float u3, float v3, |
| 284 | float x4, float y4, float z4, float u4, float v4); |
| 285 | |
| 286 | uint32_t mCacheWidth; |
| 287 | uint32_t mCacheHeight; |
| 288 | |
Romain Guy | 694b519 | 2010-07-21 21:33:20 -0700 | [diff] [blame] | 289 | Vector<CacheTextureLine*> mCacheLines; |
Alex Sakhartchouk | 65ef909 | 2010-07-26 11:09:33 -0700 | [diff] [blame] | 290 | uint32_t getRemainingCacheCapacity(); |
Romain Guy | 694b519 | 2010-07-21 21:33:20 -0700 | [diff] [blame] | 291 | |
Romain Guy | 09147fb | 2010-07-22 13:08:20 -0700 | [diff] [blame] | 292 | Font* mCurrentFont; |
Romain Guy | 694b519 | 2010-07-21 21:33:20 -0700 | [diff] [blame] | 293 | Vector<Font*> mActiveFonts; |
| 294 | |
| 295 | // Texture to cache glyph bitmaps |
Alex Sakhartchouk | 89a524a | 2010-08-02 17:52:30 -0700 | [diff] [blame] | 296 | uint8_t* mTextTexture; |
| 297 | const uint8_t* getTextTextureData() const { |
| 298 | return mTextTexture; |
| 299 | } |
Romain Guy | 694b519 | 2010-07-21 21:33:20 -0700 | [diff] [blame] | 300 | GLuint mTextureId; |
Alex Sakhartchouk | 9b9902d | 2010-07-23 14:45:49 -0700 | [diff] [blame] | 301 | void checkTextureUpdate(); |
Romain Guy | 694b519 | 2010-07-21 21:33:20 -0700 | [diff] [blame] | 302 | bool mUploadTexture; |
| 303 | |
| 304 | // Pointer to vertex data to speed up frame to frame work |
| 305 | float *mTextMeshPtr; |
| 306 | uint32_t mCurrentQuadIndex; |
| 307 | uint32_t mMaxNumberOfQuads; |
| 308 | |
| 309 | uint32_t mIndexBufferID; |
| 310 | |
Alex Sakhartchouk | 894df17 | 2011-02-17 16:45:37 -0800 | [diff] [blame] | 311 | int32_t mPositionAttrSlot; |
| 312 | int32_t mTexcoordAttrSlot; |
| 313 | |
Romain Guy | 09147fb | 2010-07-22 13:08:20 -0700 | [diff] [blame] | 314 | const Rect* mClip; |
Romain Guy | 5b3b352 | 2010-10-27 18:57:51 -0700 | [diff] [blame] | 315 | Rect* mBounds; |
| 316 | bool mDrawn; |
Romain Guy | 09147fb | 2010-07-22 13:08:20 -0700 | [diff] [blame] | 317 | |
Romain Guy | 694b519 | 2010-07-21 21:33:20 -0700 | [diff] [blame] | 318 | bool mInitialized; |
Alex Sakhartchouk | 89a524a | 2010-08-02 17:52:30 -0700 | [diff] [blame] | 319 | |
Romain Guy | e8cb9c14 | 2010-10-04 14:14:11 -0700 | [diff] [blame] | 320 | bool mLinearFiltering; |
| 321 | |
Alex Sakhartchouk | 89a524a | 2010-08-02 17:52:30 -0700 | [diff] [blame] | 322 | void computeGaussianWeights(float* weights, int32_t radius); |
| 323 | 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] | 324 | int32_t width, int32_t height); |
Alex Sakhartchouk | 89a524a | 2010-08-02 17:52:30 -0700 | [diff] [blame] | 325 | 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] | 326 | int32_t width, int32_t height); |
Alex Sakhartchouk | 89a524a | 2010-08-02 17:52:30 -0700 | [diff] [blame] | 327 | 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] | 328 | }; |
| 329 | |
| 330 | }; // namespace uirenderer |
| 331 | }; // namespace android |
| 332 | |
Romain Guy | 5b3b352 | 2010-10-27 18:57:51 -0700 | [diff] [blame] | 333 | #endif // ANDROID_HWUI_FONT_RENDERER_H |