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 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 matrix.postTranslate(x, y); | 173 matrix.postTranslate(x, y); |
174 | 174 |
175 const SkPath* iterPath; | 175 const SkPath* iterPath; |
176 SkScalar xpos, prevXPos = 0; | 176 SkScalar xpos, prevXPos = 0; |
177 | 177 |
178 while (iter.next(&iterPath, &xpos)) { | 178 while (iter.next(&iterPath, &xpos)) { |
179 matrix.postTranslate(xpos - prevXPos, 0); | 179 matrix.postTranslate(xpos - prevXPos, 0); |
180 if (iterPath) { | 180 if (iterPath) { |
181 const SkPaint& pnt = iter.getPaint(); | 181 const SkPaint& pnt = iter.getPaint(); |
182 GrBlurUtils::drawPathWithMaskFilter(fContext, dc, rt, clip, *iterPat
h, | 182 GrBlurUtils::drawPathWithMaskFilter(fContext, dc, rt, clip, *iterPat
h, |
183 pnt, viewMatrix, &matrix, clipBo
unds, false); | 183 pnt, viewMatrix, &matrix, clipBo
unds, false, |
| 184 GrTextureProvider::kApprox_SizeC
onstraint); |
184 } | 185 } |
185 prevXPos = xpos; | 186 prevXPos = xpos; |
186 } | 187 } |
187 } | 188 } |
188 | 189 |
189 void GrTextContext::drawPosTextAsPath(GrDrawContext* dc, GrRenderTarget* rt, | 190 void GrTextContext::drawPosTextAsPath(GrDrawContext* dc, GrRenderTarget* rt, |
190 const GrClip& clip, | 191 const GrClip& clip, |
191 const SkPaint& origPaint, const SkMatrix&
viewMatrix, | 192 const SkPaint& origPaint, const SkMatrix&
viewMatrix, |
192 const char text[], size_t byteLength, | 193 const char text[], size_t byteLength, |
193 const SkScalar pos[], int scalarsPerPositi
on, | 194 const SkScalar pos[], int scalarsPerPositi
on, |
(...skipping 27 matching lines...) Expand all Loading... |
221 const SkPath* path = cache->findPath(glyph); | 222 const SkPath* path = cache->findPath(glyph); |
222 if (path) { | 223 if (path) { |
223 SkPoint tmsLoc; | 224 SkPoint tmsLoc; |
224 tmsProc(pos, &tmsLoc); | 225 tmsProc(pos, &tmsLoc); |
225 SkPoint loc; | 226 SkPoint loc; |
226 alignProc(tmsLoc, glyph, &loc); | 227 alignProc(tmsLoc, glyph, &loc); |
227 | 228 |
228 matrix[SkMatrix::kMTransX] = loc.fX; | 229 matrix[SkMatrix::kMTransX] = loc.fX; |
229 matrix[SkMatrix::kMTransY] = loc.fY; | 230 matrix[SkMatrix::kMTransY] = loc.fY; |
230 GrBlurUtils::drawPathWithMaskFilter(fContext, dc, rt, clip, *pat
h, paint, | 231 GrBlurUtils::drawPathWithMaskFilter(fContext, dc, rt, clip, *pat
h, paint, |
231 viewMatrix, &matrix, clipBou
nds, false); | 232 viewMatrix, &matrix, clipBou
nds, false, |
| 233 GrTextureProvider::kApprox_S
izeConstraint); |
232 } | 234 } |
233 } | 235 } |
234 pos += scalarsPerPosition; | 236 pos += scalarsPerPosition; |
235 } | 237 } |
236 } | 238 } |
237 | 239 |
238 // *** change to output positions? | 240 // *** change to output positions? |
239 int GrTextContext::MeasureText(SkGlyphCache* cache, SkDrawCacheProc glyphCachePr
oc, | 241 int GrTextContext::MeasureText(SkGlyphCache* cache, SkDrawCacheProc glyphCachePr
oc, |
240 const char text[], size_t byteLength, SkVector*
stopVector) { | 242 const char text[], size_t byteLength, SkVector*
stopVector) { |
241 SkFixed x = 0, y = 0; | 243 SkFixed x = 0, y = 0; |
(...skipping 30 matching lines...) Expand all Loading... |
272 if (cache->getAuxProcData(GlyphCacheAuxProc, &auxData)) { | 274 if (cache->getAuxProcData(GlyphCacheAuxProc, &auxData)) { |
273 scaler = (GrFontScaler*)auxData; | 275 scaler = (GrFontScaler*)auxData; |
274 } | 276 } |
275 if (nullptr == scaler) { | 277 if (nullptr == scaler) { |
276 scaler = new GrFontScaler(cache); | 278 scaler = new GrFontScaler(cache); |
277 cache->setAuxProc(GlyphCacheAuxProc, scaler); | 279 cache->setAuxProc(GlyphCacheAuxProc, scaler); |
278 } | 280 } |
279 | 281 |
280 return scaler; | 282 return scaler; |
281 } | 283 } |
OLD | NEW |