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 | 10 |
(...skipping 23 matching lines...) Expand all Loading... |
34 | 34 |
35 devConservativeBound.roundOut(&fClipRect); | 35 devConservativeBound.roundOut(&fClipRect); |
36 | 36 |
37 fDrawTarget = fContext->getTextTarget(); | 37 fDrawTarget = fContext->getTextTarget(); |
38 | 38 |
39 fPaint = grPaint; | 39 fPaint = grPaint; |
40 fSkPaint = skPaint; | 40 fSkPaint = skPaint; |
41 } | 41 } |
42 | 42 |
43 bool GrTextContext::drawText(const GrPaint& paint, const SkPaint& skPaint, | 43 bool GrTextContext::drawText(const GrPaint& paint, const SkPaint& skPaint, |
| 44 const SkMatrix& viewMatrix, |
44 const char text[], size_t byteLength, | 45 const char text[], size_t byteLength, |
45 SkScalar x, SkScalar y) { | 46 SkScalar x, SkScalar y) { |
46 | 47 |
47 GrTextContext* textContext = this; | 48 GrTextContext* textContext = this; |
48 do { | 49 do { |
49 if (textContext->canDraw(skPaint)) { | 50 if (textContext->canDraw(skPaint, viewMatrix)) { |
50 textContext->onDrawText(paint, skPaint, text, byteLength, x, y); | 51 textContext->onDrawText(paint, skPaint, viewMatrix, text, byteLength
, x, y); |
51 return true; | 52 return true; |
52 } | 53 } |
53 textContext = textContext->fFallbackTextContext; | 54 textContext = textContext->fFallbackTextContext; |
54 } while (textContext); | 55 } while (textContext); |
55 | 56 |
56 return false; | 57 return false; |
57 } | 58 } |
58 | 59 |
59 bool GrTextContext::drawPosText(const GrPaint& paint, const SkPaint& skPaint, | 60 bool GrTextContext::drawPosText(const GrPaint& paint, const SkPaint& skPaint, |
| 61 const SkMatrix& viewMatrix, |
60 const char text[], size_t byteLength, | 62 const char text[], size_t byteLength, |
61 const SkScalar pos[], int scalarsPerPosition, | 63 const SkScalar pos[], int scalarsPerPosition, |
62 const SkPoint& offset) { | 64 const SkPoint& offset) { |
63 | 65 |
64 GrTextContext* textContext = this; | 66 GrTextContext* textContext = this; |
65 do { | 67 do { |
66 if (textContext->canDraw(skPaint)) { | 68 if (textContext->canDraw(skPaint, viewMatrix)) { |
67 textContext->onDrawPosText(paint, skPaint, text, byteLength, pos, sc
alarsPerPosition, | 69 textContext->onDrawPosText(paint, skPaint, viewMatrix, text, byteLen
gth, pos, |
68 offset); | 70 scalarsPerPosition, offset); |
69 return true; | 71 return true; |
70 } | 72 } |
71 textContext = textContext->fFallbackTextContext; | 73 textContext = textContext->fFallbackTextContext; |
72 } while (textContext); | 74 } while (textContext); |
73 | 75 |
74 return false; | 76 return false; |
75 } | 77 } |
76 | 78 |
77 | 79 |
78 //*** change to output positions? | 80 //*** change to output positions? |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 if (cache->getAuxProcData(GlyphCacheAuxProc, &auxData)) { | 114 if (cache->getAuxProcData(GlyphCacheAuxProc, &auxData)) { |
113 scaler = (GrFontScaler*)auxData; | 115 scaler = (GrFontScaler*)auxData; |
114 } | 116 } |
115 if (NULL == scaler) { | 117 if (NULL == scaler) { |
116 scaler = SkNEW_ARGS(GrFontScaler, (cache)); | 118 scaler = SkNEW_ARGS(GrFontScaler, (cache)); |
117 cache->setAuxProc(GlyphCacheAuxProc, scaler); | 119 cache->setAuxProc(GlyphCacheAuxProc, scaler); |
118 } | 120 } |
119 | 121 |
120 return scaler; | 122 return scaler; |
121 } | 123 } |
OLD | NEW |