OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2010 Google Inc. | 2 * Copyright 2010 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "GrTextContext.h" | 8 #include "GrTextContext.h" |
9 #include "GrBlurUtils.h" | 9 #include "GrBlurUtils.h" |
10 #include "GrContext.h" | 10 #include "GrContext.h" |
(...skipping 24 matching lines...) Expand all Loading... |
35 const GrClip& clip, const GrPaint& paint, | 35 const GrClip& clip, const GrPaint& paint, |
36 const SkPaint& skPaint, const SkMatrix& viewMatrix, | 36 const SkPaint& skPaint, const SkMatrix& viewMatrix, |
37 const char text[], size_t byteLength, | 37 const char text[], size_t byteLength, |
38 SkScalar x, SkScalar y, const SkIRect& clipBounds)
{ | 38 SkScalar x, SkScalar y, const SkIRect& clipBounds)
{ |
39 if (fContext->abandoned()) { | 39 if (fContext->abandoned()) { |
40 return; | 40 return; |
41 } | 41 } |
42 | 42 |
43 GrTextContext* textContext = this; | 43 GrTextContext* textContext = this; |
44 do { | 44 do { |
45 if (textContext->canDraw(rt, clip, paint, skPaint, viewMatrix)) { | 45 if (textContext->canDraw(skPaint, viewMatrix)) { |
46 textContext->onDrawText(dc, rt, clip, paint, skPaint, viewMatrix, | 46 textContext->onDrawText(dc, rt, clip, paint, skPaint, viewMatrix, |
47 text, byteLength, x, y, clipBounds); | 47 text, byteLength, x, y, clipBounds); |
48 return; | 48 return; |
49 } | 49 } |
50 textContext = textContext->fFallbackTextContext; | 50 textContext = textContext->fFallbackTextContext; |
51 } while (textContext); | 51 } while (textContext); |
52 | 52 |
53 // fall back to drawing as a path | 53 // fall back to drawing as a path |
54 this->drawTextAsPath(dc, clip, skPaint, viewMatrix, | 54 this->drawTextAsPath(dc, clip, skPaint, viewMatrix, text, byteLength, x, y,
clipBounds); |
55 text, byteLength, x, y, clipBounds); | |
56 } | 55 } |
57 | 56 |
58 void GrTextContext::drawPosText(GrDrawContext* dc, GrRenderTarget* rt, | 57 void GrTextContext::drawPosText(GrDrawContext* dc, GrRenderTarget* rt, |
59 const GrClip& clip, const GrPaint& paint, | 58 const GrClip& clip, const GrPaint& paint, |
60 const SkPaint& skPaint, const SkMatrix& viewMatr
ix, | 59 const SkPaint& skPaint, const SkMatrix& viewMatr
ix, |
61 const char text[], size_t byteLength, | 60 const char text[], size_t byteLength, |
62 const SkScalar pos[], int scalarsPerPosition, | 61 const SkScalar pos[], int scalarsPerPosition, |
63 const SkPoint& offset, const SkIRect& clipBounds
) { | 62 const SkPoint& offset, const SkIRect& clipBounds
) { |
64 if (fContext->abandoned()) { | 63 if (fContext->abandoned()) { |
65 return; | 64 return; |
66 } | 65 } |
67 | 66 |
68 GrTextContext* textContext = this; | 67 GrTextContext* textContext = this; |
69 do { | 68 do { |
70 if (textContext->canDraw(rt, clip, paint, skPaint, viewMatrix)) { | 69 if (textContext->canDraw(skPaint, viewMatrix)) { |
71 textContext->onDrawPosText(dc, rt, clip, paint, skPaint, viewMatrix, | 70 textContext->onDrawPosText(dc, rt, clip, paint, skPaint, viewMatrix, |
72 text, byteLength, pos, | 71 text, byteLength, pos, |
73 scalarsPerPosition, offset, clipBounds); | 72 scalarsPerPosition, offset, clipBounds); |
74 return; | 73 return; |
75 } | 74 } |
76 textContext = textContext->fFallbackTextContext; | 75 textContext = textContext->fFallbackTextContext; |
77 } while (textContext); | 76 } while (textContext); |
78 | 77 |
79 // fall back to drawing as a path | 78 // fall back to drawing as a path |
80 this->drawPosTextAsPath(dc, clip, skPaint, viewMatrix, text, byteLength, pos
, | 79 this->drawPosTextAsPath(dc, clip, skPaint, viewMatrix, text, byteLength, pos
, |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
272 if (cache->getAuxProcData(GlyphCacheAuxProc, &auxData)) { | 271 if (cache->getAuxProcData(GlyphCacheAuxProc, &auxData)) { |
273 scaler = (GrFontScaler*)auxData; | 272 scaler = (GrFontScaler*)auxData; |
274 } | 273 } |
275 if (nullptr == scaler) { | 274 if (nullptr == scaler) { |
276 scaler = new GrFontScaler(cache); | 275 scaler = new GrFontScaler(cache); |
277 cache->setAuxProc(GlyphCacheAuxProc, scaler); | 276 cache->setAuxProc(GlyphCacheAuxProc, scaler); |
278 } | 277 } |
279 | 278 |
280 return scaler; | 279 return scaler; |
281 } | 280 } |
OLD | NEW |