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 "GrContext.h" | 9 #include "GrContext.h" |
10 #include "GrDrawTarget.h" | 10 #include "GrDrawTarget.h" |
(...skipping 27 matching lines...) Expand all Loading... | |
38 | 38 |
39 bool GrTextContext::drawText(GrRenderTarget* rt, const GrClip& clip, const GrPai nt& paint, | 39 bool GrTextContext::drawText(GrRenderTarget* rt, const GrClip& clip, const GrPai nt& paint, |
40 const SkPaint& skPaint, const SkMatrix& viewMatrix, | 40 const SkPaint& skPaint, const SkMatrix& viewMatrix, |
41 const char text[], size_t byteLength, | 41 const char text[], size_t byteLength, |
42 SkScalar x, SkScalar y) { | 42 SkScalar x, SkScalar y) { |
43 if (!fContext->getTextTarget()) { | 43 if (!fContext->getTextTarget()) { |
44 return false; | 44 return false; |
45 } | 45 } |
46 | 46 |
47 GrTextContext* textContext = this; | 47 GrTextContext* textContext = this; |
48 do { | 48 do { |
vbuzinov
2015/03/17 13:06:56
Can we create a pipeline builder here and pass it
bsalomon
2015/03/17 14:45:48
I like that direction (passing a PB here). I know
| |
49 if (textContext->canDraw(skPaint, viewMatrix)) { | 49 if (textContext->canDraw(rt, skPaint, viewMatrix)) { |
50 textContext->onDrawText(rt, clip, paint, skPaint, viewMatrix, text, byteLength, x, y); | 50 textContext->onDrawText(rt, clip, paint, skPaint, viewMatrix, text, byteLength, x, y); |
51 return true; | 51 return true; |
52 } | 52 } |
53 textContext = textContext->fFallbackTextContext; | 53 textContext = textContext->fFallbackTextContext; |
54 } while (textContext); | 54 } while (textContext); |
55 | 55 |
56 return false; | 56 return false; |
57 } | 57 } |
58 | 58 |
59 bool GrTextContext::drawPosText(GrRenderTarget* rt, const GrClip& clip, const Gr Paint& paint, | 59 bool GrTextContext::drawPosText(GrRenderTarget* rt, const GrClip& clip, const Gr Paint& paint, |
60 const SkPaint& skPaint, const SkMatrix& viewMatr ix, | 60 const SkPaint& skPaint, const SkMatrix& viewMatr ix, |
61 const char text[], size_t byteLength, | 61 const char text[], size_t byteLength, |
62 const SkScalar pos[], int scalarsPerPosition, | 62 const SkScalar pos[], int scalarsPerPosition, |
63 const SkPoint& offset) { | 63 const SkPoint& offset) { |
64 if (!fContext->getTextTarget()) { | 64 if (!fContext->getTextTarget()) { |
65 return false; | 65 return false; |
66 } | 66 } |
67 | 67 |
68 GrTextContext* textContext = this; | 68 GrTextContext* textContext = this; |
69 do { | 69 do { |
70 if (textContext->canDraw(skPaint, viewMatrix)) { | 70 if (textContext->canDraw(rt, skPaint, viewMatrix)) { |
71 textContext->onDrawPosText(rt, clip, paint, skPaint, viewMatrix, tex t, byteLength, pos, | 71 textContext->onDrawPosText(rt, clip, paint, skPaint, viewMatrix, tex t, byteLength, pos, |
72 scalarsPerPosition, offset); | 72 scalarsPerPosition, offset); |
73 return true; | 73 return true; |
74 } | 74 } |
75 textContext = textContext->fFallbackTextContext; | 75 textContext = textContext->fFallbackTextContext; |
76 } while (textContext); | 76 } while (textContext); |
77 | 77 |
78 return false; | 78 return false; |
79 } | 79 } |
80 | 80 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
116 if (cache->getAuxProcData(GlyphCacheAuxProc, &auxData)) { | 116 if (cache->getAuxProcData(GlyphCacheAuxProc, &auxData)) { |
117 scaler = (GrFontScaler*)auxData; | 117 scaler = (GrFontScaler*)auxData; |
118 } | 118 } |
119 if (NULL == scaler) { | 119 if (NULL == scaler) { |
120 scaler = SkNEW_ARGS(GrFontScaler, (cache)); | 120 scaler = SkNEW_ARGS(GrFontScaler, (cache)); |
121 cache->setAuxProc(GlyphCacheAuxProc, scaler); | 121 cache->setAuxProc(GlyphCacheAuxProc, scaler); |
122 } | 122 } |
123 | 123 |
124 return scaler; | 124 return scaler; |
125 } | 125 } |
OLD | NEW |