reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 1 | /* |
epoger@google.com | ec3ed6a | 2011-07-28 14:26:00 +0000 | [diff] [blame] | 2 | * Copyright 2010 Google Inc. |
| 3 | * |
| 4 | * Use of this source code is governed by a BSD-style license that can be |
| 5 | * found in the LICENSE file. |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 6 | */ |
| 7 | |
tomhudson@google.com | 375ff85 | 2012-06-29 18:37:57 +0000 | [diff] [blame] | 8 | #include "GrTextContext.h" |
robertphillips | ccb1b57 | 2015-05-27 11:02:55 -0700 | [diff] [blame] | 9 | #include "GrBlurUtils.h" |
commit-bot@chromium.org | e8612d9 | 2014-01-28 22:02:07 +0000 | [diff] [blame] | 10 | #include "GrContext.h" |
robertphillips | ccb1b57 | 2015-05-27 11:02:55 -0700 | [diff] [blame] | 11 | #include "GrDrawContext.h" |
joshualitt | 570d2f8 | 2015-02-25 13:19:48 -0800 | [diff] [blame] | 12 | #include "GrFontScaler.h" |
commit-bot@chromium.org | e8612d9 | 2014-01-28 22:02:07 +0000 | [diff] [blame] | 13 | |
| 14 | #include "SkAutoKern.h" |
joshualitt | 9c32818 | 2015-03-23 08:13:04 -0700 | [diff] [blame] | 15 | #include "SkDrawFilter.h" |
joshualitt | 6e8cd96 | 2015-03-20 10:30:14 -0700 | [diff] [blame] | 16 | #include "SkDrawProcs.h" |
commit-bot@chromium.org | e8612d9 | 2014-01-28 22:02:07 +0000 | [diff] [blame] | 17 | #include "SkGlyphCache.h" |
joshualitt | 6e8cd96 | 2015-03-20 10:30:14 -0700 | [diff] [blame] | 18 | #include "SkGpuDevice.h" |
joshualitt | 9c32818 | 2015-03-23 08:13:04 -0700 | [diff] [blame] | 19 | #include "SkTextBlob.h" |
joshualitt | 6e8cd96 | 2015-03-20 10:30:14 -0700 | [diff] [blame] | 20 | #include "SkTextMapStateProc.h" |
| 21 | #include "SkTextToPathIter.h" |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 22 | |
robertphillips | 2334fb6 | 2015-06-17 05:43:33 -0700 | [diff] [blame] | 23 | GrTextContext::GrTextContext(GrContext* context, GrDrawContext* drawContext, |
robertphillips | fcf7829 | 2015-06-19 11:49:52 -0700 | [diff] [blame] | 24 | const SkSurfaceProps& surfaceProps) |
joshualitt | 6e8cd96 | 2015-03-20 10:30:14 -0700 | [diff] [blame] | 25 | : fFallbackTextContext(NULL) |
| 26 | , fContext(context) |
robertphillips | fcf7829 | 2015-06-19 11:49:52 -0700 | [diff] [blame] | 27 | , fSurfaceProps(surfaceProps) |
robertphillips | 2334fb6 | 2015-06-17 05:43:33 -0700 | [diff] [blame] | 28 | , fDrawContext(drawContext) { |
commit-bot@chromium.org | cbbc481 | 2014-01-30 22:05:47 +0000 | [diff] [blame] | 29 | } |
tomhudson@google.com | 375ff85 | 2012-06-29 18:37:57 +0000 | [diff] [blame] | 30 | |
jvanverth | 8c27a18 | 2014-10-14 08:45:50 -0700 | [diff] [blame] | 31 | GrTextContext::~GrTextContext() { |
| 32 | SkDELETE(fFallbackTextContext); |
| 33 | } |
| 34 | |
joshualitt | 6e8cd96 | 2015-03-20 10:30:14 -0700 | [diff] [blame] | 35 | void GrTextContext::drawText(GrRenderTarget* rt, const GrClip& clip, const GrPaint& paint, |
joshualitt | 570d2f8 | 2015-02-25 13:19:48 -0800 | [diff] [blame] | 36 | const SkPaint& skPaint, const SkMatrix& viewMatrix, |
jvanverth | 8c27a18 | 2014-10-14 08:45:50 -0700 | [diff] [blame] | 37 | const char text[], size_t byteLength, |
joshualitt | 6e8cd96 | 2015-03-20 10:30:14 -0700 | [diff] [blame] | 38 | SkScalar x, SkScalar y, const SkIRect& clipBounds) { |
robertphillips | 2334fb6 | 2015-06-17 05:43:33 -0700 | [diff] [blame] | 39 | if (fContext->abandoned() || !fDrawContext) { |
robertphillips | ccb1b57 | 2015-05-27 11:02:55 -0700 | [diff] [blame] | 40 | return; |
| 41 | } |
| 42 | |
jvanverth | aab626c | 2014-10-16 08:04:39 -0700 | [diff] [blame] | 43 | GrTextContext* textContext = this; |
| 44 | do { |
cdalton | e68f736 | 2015-03-25 14:02:37 -0700 | [diff] [blame] | 45 | if (textContext->canDraw(rt, clip, paint, skPaint, viewMatrix)) { |
robertphillips | 2334fb6 | 2015-06-17 05:43:33 -0700 | [diff] [blame] | 46 | textContext->onDrawText(rt, clip, paint, skPaint, viewMatrix, |
robertphillips | ccb1b57 | 2015-05-27 11:02:55 -0700 | [diff] [blame] | 47 | text, byteLength, x, y, clipBounds); |
joshualitt | 6e8cd96 | 2015-03-20 10:30:14 -0700 | [diff] [blame] | 48 | return; |
jvanverth | aab626c | 2014-10-16 08:04:39 -0700 | [diff] [blame] | 49 | } |
| 50 | textContext = textContext->fFallbackTextContext; |
| 51 | } while (textContext); |
jvanverth | 8c27a18 | 2014-10-14 08:45:50 -0700 | [diff] [blame] | 52 | |
joshualitt | 6e8cd96 | 2015-03-20 10:30:14 -0700 | [diff] [blame] | 53 | // fall back to drawing as a path |
robertphillips | 2334fb6 | 2015-06-17 05:43:33 -0700 | [diff] [blame] | 54 | this->drawTextAsPath(rt, clip, skPaint, viewMatrix, |
robertphillips | ccb1b57 | 2015-05-27 11:02:55 -0700 | [diff] [blame] | 55 | text, byteLength, x, y, clipBounds); |
jvanverth | 8c27a18 | 2014-10-14 08:45:50 -0700 | [diff] [blame] | 56 | } |
| 57 | |
joshualitt | 6e8cd96 | 2015-03-20 10:30:14 -0700 | [diff] [blame] | 58 | void GrTextContext::drawPosText(GrRenderTarget* rt, const GrClip& clip, const GrPaint& paint, |
joshualitt | 570d2f8 | 2015-02-25 13:19:48 -0800 | [diff] [blame] | 59 | const SkPaint& skPaint, const SkMatrix& viewMatrix, |
jvanverth | 8c27a18 | 2014-10-14 08:45:50 -0700 | [diff] [blame] | 60 | const char text[], size_t byteLength, |
| 61 | const SkScalar pos[], int scalarsPerPosition, |
joshualitt | 6e8cd96 | 2015-03-20 10:30:14 -0700 | [diff] [blame] | 62 | const SkPoint& offset, const SkIRect& clipBounds) { |
robertphillips | 2334fb6 | 2015-06-17 05:43:33 -0700 | [diff] [blame] | 63 | if (fContext->abandoned() || !fDrawContext) { |
robertphillips | ccb1b57 | 2015-05-27 11:02:55 -0700 | [diff] [blame] | 64 | return; |
| 65 | } |
| 66 | |
jvanverth | 8c27a18 | 2014-10-14 08:45:50 -0700 | [diff] [blame] | 67 | GrTextContext* textContext = this; |
| 68 | do { |
cdalton | e68f736 | 2015-03-25 14:02:37 -0700 | [diff] [blame] | 69 | if (textContext->canDraw(rt, clip, paint, skPaint, viewMatrix)) { |
robertphillips | 2334fb6 | 2015-06-17 05:43:33 -0700 | [diff] [blame] | 70 | textContext->onDrawPosText(rt, clip, paint, skPaint, viewMatrix, |
robertphillips | ccb1b57 | 2015-05-27 11:02:55 -0700 | [diff] [blame] | 71 | text, byteLength, pos, |
joshualitt | 6e8cd96 | 2015-03-20 10:30:14 -0700 | [diff] [blame] | 72 | scalarsPerPosition, offset, clipBounds); |
| 73 | return; |
jvanverth | 8c27a18 | 2014-10-14 08:45:50 -0700 | [diff] [blame] | 74 | } |
| 75 | textContext = textContext->fFallbackTextContext; |
| 76 | } while (textContext); |
| 77 | |
joshualitt | 6e8cd96 | 2015-03-20 10:30:14 -0700 | [diff] [blame] | 78 | // fall back to drawing as a path |
robertphillips | 2334fb6 | 2015-06-17 05:43:33 -0700 | [diff] [blame] | 79 | this->drawPosTextAsPath(rt, clip, skPaint, viewMatrix, text, byteLength, pos, |
robertphillips | ccb1b57 | 2015-05-27 11:02:55 -0700 | [diff] [blame] | 80 | scalarsPerPosition, offset, clipBounds); |
jvanverth | 8c27a18 | 2014-10-14 08:45:50 -0700 | [diff] [blame] | 81 | } |
| 82 | |
robertphillips | 9c240a1 | 2015-05-28 07:45:59 -0700 | [diff] [blame] | 83 | bool GrTextContext::ShouldDisableLCD(const SkPaint& paint) { |
| 84 | if (paint.getShader() || |
| 85 | !SkXfermode::IsMode(paint.getXfermode(), SkXfermode::kSrcOver_Mode) || |
| 86 | paint.getMaskFilter() || |
| 87 | paint.getRasterizer() || |
| 88 | paint.getColorFilter() || |
| 89 | paint.getPathEffect() || |
| 90 | paint.isFakeBoldText() || |
| 91 | paint.getStyle() != SkPaint::kFill_Style) |
| 92 | { |
| 93 | return true; |
| 94 | } |
| 95 | return false; |
| 96 | } |
| 97 | |
robertphillips | fcf7829 | 2015-06-19 11:49:52 -0700 | [diff] [blame] | 98 | uint32_t GrTextContext::FilterTextFlags(const SkSurfaceProps& surfaceProps, const SkPaint& paint) { |
robertphillips | 9c240a1 | 2015-05-28 07:45:59 -0700 | [diff] [blame] | 99 | uint32_t flags = paint.getFlags(); |
| 100 | |
| 101 | if (!paint.isLCDRenderText() || !paint.isAntiAlias()) { |
| 102 | return flags; |
| 103 | } |
| 104 | |
robertphillips | fcf7829 | 2015-06-19 11:49:52 -0700 | [diff] [blame] | 105 | if (kUnknown_SkPixelGeometry == surfaceProps.pixelGeometry() || ShouldDisableLCD(paint)) { |
robertphillips | 9c240a1 | 2015-05-28 07:45:59 -0700 | [diff] [blame] | 106 | flags &= ~SkPaint::kLCDRenderText_Flag; |
| 107 | flags |= SkPaint::kGenA8FromLCD_Flag; |
| 108 | } |
| 109 | |
| 110 | return flags; |
| 111 | } |
| 112 | |
| 113 | void GrTextContext::drawTextBlob(GrRenderTarget* rt, |
robertphillips | ccb1b57 | 2015-05-27 11:02:55 -0700 | [diff] [blame] | 114 | const GrClip& clip, const SkPaint& skPaint, |
joshualitt | 9c32818 | 2015-03-23 08:13:04 -0700 | [diff] [blame] | 115 | const SkMatrix& viewMatrix, const SkTextBlob* blob, |
| 116 | SkScalar x, SkScalar y, |
| 117 | SkDrawFilter* drawFilter, const SkIRect& clipBounds) { |
cdalton | e68f736 | 2015-03-25 14:02:37 -0700 | [diff] [blame] | 118 | SkPaint runPaint = skPaint; |
joshualitt | 9c32818 | 2015-03-23 08:13:04 -0700 | [diff] [blame] | 119 | |
cdalton | e68f736 | 2015-03-25 14:02:37 -0700 | [diff] [blame] | 120 | SkTextBlob::RunIterator it(blob); |
| 121 | for (;!it.done(); it.next()) { |
| 122 | size_t textLen = it.glyphCount() * sizeof(uint16_t); |
| 123 | const SkPoint& offset = it.offset(); |
| 124 | // applyFontToPaint() always overwrites the exact same attributes, |
| 125 | // so it is safe to not re-seed the paint for this reason. |
| 126 | it.applyFontToPaint(&runPaint); |
| 127 | |
| 128 | if (drawFilter && !drawFilter->filter(&runPaint, SkDrawFilter::kText_Type)) { |
| 129 | // A false return from filter() means we should abort the current draw. |
| 130 | runPaint = skPaint; |
| 131 | continue; |
joshualitt | 9c32818 | 2015-03-23 08:13:04 -0700 | [diff] [blame] | 132 | } |
cdalton | e68f736 | 2015-03-25 14:02:37 -0700 | [diff] [blame] | 133 | |
robertphillips | fcf7829 | 2015-06-19 11:49:52 -0700 | [diff] [blame] | 134 | runPaint.setFlags(FilterTextFlags(fSurfaceProps, runPaint)); |
cdalton | e68f736 | 2015-03-25 14:02:37 -0700 | [diff] [blame] | 135 | |
| 136 | GrPaint grPaint; |
joshualitt | 9df4659 | 2015-07-09 10:55:28 -0700 | [diff] [blame] | 137 | if (!SkPaint2GrPaint(fContext, rt, runPaint, viewMatrix, true, &grPaint)) { |
bsalomon | bed83a6 | 2015-04-15 14:18:34 -0700 | [diff] [blame] | 138 | return; |
| 139 | } |
cdalton | e68f736 | 2015-03-25 14:02:37 -0700 | [diff] [blame] | 140 | |
| 141 | switch (it.positioning()) { |
| 142 | case SkTextBlob::kDefault_Positioning: |
| 143 | this->drawText(rt, clip, grPaint, runPaint, viewMatrix, (const char *)it.glyphs(), |
| 144 | textLen, x + offset.x(), y + offset.y(), clipBounds); |
| 145 | break; |
| 146 | case SkTextBlob::kHorizontal_Positioning: |
| 147 | this->drawPosText(rt, clip, grPaint, runPaint, viewMatrix, (const char*)it.glyphs(), |
| 148 | textLen, it.pos(), 1, SkPoint::Make(x, y + offset.y()), clipBounds); |
| 149 | break; |
| 150 | case SkTextBlob::kFull_Positioning: |
| 151 | this->drawPosText(rt, clip, grPaint, runPaint, viewMatrix, (const char*)it.glyphs(), |
| 152 | textLen, it.pos(), 2, SkPoint::Make(x, y), clipBounds); |
| 153 | break; |
| 154 | default: |
| 155 | SkFAIL("unhandled positioning mode"); |
| 156 | } |
| 157 | |
| 158 | if (drawFilter) { |
| 159 | // A draw filter may change the paint arbitrarily, so we must re-seed in this case. |
| 160 | runPaint = skPaint; |
| 161 | } |
| 162 | } |
joshualitt | 9c32818 | 2015-03-23 08:13:04 -0700 | [diff] [blame] | 163 | } |
| 164 | |
robertphillips | 2334fb6 | 2015-06-17 05:43:33 -0700 | [diff] [blame] | 165 | void GrTextContext::drawTextAsPath(GrRenderTarget* rt, |
robertphillips | ccb1b57 | 2015-05-27 11:02:55 -0700 | [diff] [blame] | 166 | const GrClip& clip, |
| 167 | const SkPaint& skPaint, const SkMatrix& viewMatrix, |
joshualitt | 6e8cd96 | 2015-03-20 10:30:14 -0700 | [diff] [blame] | 168 | const char text[], size_t byteLength, SkScalar x, SkScalar y, |
| 169 | const SkIRect& clipBounds) { |
| 170 | SkTextToPathIter iter(text, byteLength, skPaint, true); |
| 171 | |
| 172 | SkMatrix matrix; |
| 173 | matrix.setScale(iter.getPathScale(), iter.getPathScale()); |
| 174 | matrix.postTranslate(x, y); |
| 175 | |
| 176 | const SkPath* iterPath; |
| 177 | SkScalar xpos, prevXPos = 0; |
| 178 | |
| 179 | while (iter.next(&iterPath, &xpos)) { |
| 180 | matrix.postTranslate(xpos - prevXPos, 0); |
| 181 | if (iterPath) { |
| 182 | const SkPaint& pnt = iter.getPaint(); |
robertphillips | 2334fb6 | 2015-06-17 05:43:33 -0700 | [diff] [blame] | 183 | GrBlurUtils::drawPathWithMaskFilter(fContext, fDrawContext, rt, clip, *iterPath, |
robertphillips | ccb1b57 | 2015-05-27 11:02:55 -0700 | [diff] [blame] | 184 | pnt, viewMatrix, &matrix, clipBounds, false); |
joshualitt | 6e8cd96 | 2015-03-20 10:30:14 -0700 | [diff] [blame] | 185 | } |
| 186 | prevXPos = xpos; |
| 187 | } |
| 188 | } |
| 189 | |
robertphillips | 2334fb6 | 2015-06-17 05:43:33 -0700 | [diff] [blame] | 190 | void GrTextContext::drawPosTextAsPath(GrRenderTarget* rt, |
robertphillips | ccb1b57 | 2015-05-27 11:02:55 -0700 | [diff] [blame] | 191 | const GrClip& clip, |
| 192 | const SkPaint& origPaint, const SkMatrix& viewMatrix, |
joshualitt | 6e8cd96 | 2015-03-20 10:30:14 -0700 | [diff] [blame] | 193 | const char text[], size_t byteLength, |
| 194 | const SkScalar pos[], int scalarsPerPosition, |
| 195 | const SkPoint& offset, const SkIRect& clipBounds) { |
| 196 | // setup our std paint, in hopes of getting hits in the cache |
| 197 | SkPaint paint(origPaint); |
| 198 | SkScalar matrixScale = paint.setupForAsPaths(); |
| 199 | |
| 200 | SkMatrix matrix; |
| 201 | matrix.setScale(matrixScale, matrixScale); |
| 202 | |
| 203 | // Temporarily jam in kFill, so we only ever ask for the raw outline from the cache. |
| 204 | paint.setStyle(SkPaint::kFill_Style); |
| 205 | paint.setPathEffect(NULL); |
| 206 | |
| 207 | SkDrawCacheProc glyphCacheProc = paint.getDrawCacheProc(); |
robertphillips | 8e0c150 | 2015-07-07 10:28:43 -0700 | [diff] [blame] | 208 | SkAutoGlyphCache autoCache(paint, &fSurfaceProps, NULL); |
joshualitt | 6e8cd96 | 2015-03-20 10:30:14 -0700 | [diff] [blame] | 209 | SkGlyphCache* cache = autoCache.getCache(); |
| 210 | |
| 211 | const char* stop = text + byteLength; |
| 212 | SkTextAlignProc alignProc(paint.getTextAlign()); |
| 213 | SkTextMapStateProc tmsProc(SkMatrix::I(), offset, scalarsPerPosition); |
| 214 | |
| 215 | // Now restore the original settings, so we "draw" with whatever style/stroking. |
| 216 | paint.setStyle(origPaint.getStyle()); |
| 217 | paint.setPathEffect(origPaint.getPathEffect()); |
| 218 | |
| 219 | while (text < stop) { |
| 220 | const SkGlyph& glyph = glyphCacheProc(cache, &text, 0, 0); |
| 221 | if (glyph.fWidth) { |
| 222 | const SkPath* path = cache->findPath(glyph); |
| 223 | if (path) { |
| 224 | SkPoint tmsLoc; |
| 225 | tmsProc(pos, &tmsLoc); |
| 226 | SkPoint loc; |
| 227 | alignProc(tmsLoc, glyph, &loc); |
| 228 | |
| 229 | matrix[SkMatrix::kMTransX] = loc.fX; |
| 230 | matrix[SkMatrix::kMTransY] = loc.fY; |
robertphillips | 2334fb6 | 2015-06-17 05:43:33 -0700 | [diff] [blame] | 231 | GrBlurUtils::drawPathWithMaskFilter(fContext, fDrawContext, rt, clip, *path, paint, |
robertphillips | ccb1b57 | 2015-05-27 11:02:55 -0700 | [diff] [blame] | 232 | viewMatrix, &matrix, clipBounds, false); |
joshualitt | 6e8cd96 | 2015-03-20 10:30:14 -0700 | [diff] [blame] | 233 | } |
| 234 | } |
| 235 | pos += scalarsPerPosition; |
| 236 | } |
| 237 | } |
jvanverth | 8c27a18 | 2014-10-14 08:45:50 -0700 | [diff] [blame] | 238 | |
commit-bot@chromium.org | e8612d9 | 2014-01-28 22:02:07 +0000 | [diff] [blame] | 239 | //*** change to output positions? |
jvanverth | 73f1053 | 2014-10-23 11:57:12 -0700 | [diff] [blame] | 240 | int GrTextContext::MeasureText(SkGlyphCache* cache, SkDrawCacheProc glyphCacheProc, |
commit-bot@chromium.org | e8612d9 | 2014-01-28 22:02:07 +0000 | [diff] [blame] | 241 | const char text[], size_t byteLength, SkVector* stopVector) { |
| 242 | SkFixed x = 0, y = 0; |
| 243 | const char* stop = text + byteLength; |
skia.committer@gmail.com | e5d7015 | 2014-01-29 07:01:48 +0000 | [diff] [blame] | 244 | |
commit-bot@chromium.org | e8612d9 | 2014-01-28 22:02:07 +0000 | [diff] [blame] | 245 | SkAutoKern autokern; |
skia.committer@gmail.com | e5d7015 | 2014-01-29 07:01:48 +0000 | [diff] [blame] | 246 | |
jvanverth | 73f1053 | 2014-10-23 11:57:12 -0700 | [diff] [blame] | 247 | int numGlyphs = 0; |
commit-bot@chromium.org | e8612d9 | 2014-01-28 22:02:07 +0000 | [diff] [blame] | 248 | while (text < stop) { |
| 249 | // don't need x, y here, since all subpixel variants will have the |
| 250 | // same advance |
| 251 | const SkGlyph& glyph = glyphCacheProc(cache, &text, 0, 0); |
skia.committer@gmail.com | e5d7015 | 2014-01-29 07:01:48 +0000 | [diff] [blame] | 252 | |
commit-bot@chromium.org | e8612d9 | 2014-01-28 22:02:07 +0000 | [diff] [blame] | 253 | x += autokern.adjust(glyph) + glyph.fAdvanceX; |
| 254 | y += glyph.fAdvanceY; |
jvanverth | 73f1053 | 2014-10-23 11:57:12 -0700 | [diff] [blame] | 255 | ++numGlyphs; |
commit-bot@chromium.org | e8612d9 | 2014-01-28 22:02:07 +0000 | [diff] [blame] | 256 | } |
| 257 | stopVector->set(SkFixedToScalar(x), SkFixedToScalar(y)); |
skia.committer@gmail.com | e5d7015 | 2014-01-29 07:01:48 +0000 | [diff] [blame] | 258 | |
commit-bot@chromium.org | e8612d9 | 2014-01-28 22:02:07 +0000 | [diff] [blame] | 259 | SkASSERT(text == stop); |
jvanverth | 73f1053 | 2014-10-23 11:57:12 -0700 | [diff] [blame] | 260 | |
| 261 | return numGlyphs; |
commit-bot@chromium.org | e8612d9 | 2014-01-28 22:02:07 +0000 | [diff] [blame] | 262 | } |
| 263 | |
| 264 | static void GlyphCacheAuxProc(void* data) { |
| 265 | GrFontScaler* scaler = (GrFontScaler*)data; |
| 266 | SkSafeUnref(scaler); |
| 267 | } |
| 268 | |
| 269 | GrFontScaler* GrTextContext::GetGrFontScaler(SkGlyphCache* cache) { |
| 270 | void* auxData; |
| 271 | GrFontScaler* scaler = NULL; |
skia.committer@gmail.com | e5d7015 | 2014-01-29 07:01:48 +0000 | [diff] [blame] | 272 | |
commit-bot@chromium.org | e8612d9 | 2014-01-28 22:02:07 +0000 | [diff] [blame] | 273 | if (cache->getAuxProcData(GlyphCacheAuxProc, &auxData)) { |
| 274 | scaler = (GrFontScaler*)auxData; |
| 275 | } |
| 276 | if (NULL == scaler) { |
jvanverth | 733f5f5 | 2014-07-11 19:45:16 -0700 | [diff] [blame] | 277 | scaler = SkNEW_ARGS(GrFontScaler, (cache)); |
commit-bot@chromium.org | e8612d9 | 2014-01-28 22:02:07 +0000 | [diff] [blame] | 278 | cache->setAuxProc(GlyphCacheAuxProc, scaler); |
| 279 | } |
skia.committer@gmail.com | e5d7015 | 2014-01-29 07:01:48 +0000 | [diff] [blame] | 280 | |
commit-bot@chromium.org | e8612d9 | 2014-01-28 22:02:07 +0000 | [diff] [blame] | 281 | return scaler; |
| 282 | } |