OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 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 "GrTextUtils.h" | 8 #include "GrTextUtils.h" |
9 | 9 |
10 #include "GrAtlasTextBlob.h" | 10 #include "GrAtlasTextBlob.h" |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 SkScalar x, SkScalar y) { | 253 SkScalar x, SkScalar y) { |
254 SkASSERT(byteLength == 0 || text != nullptr); | 254 SkASSERT(byteLength == 0 || text != nullptr); |
255 | 255 |
256 // nothing to draw | 256 // nothing to draw |
257 if (text == nullptr || byteLength == 0) { | 257 if (text == nullptr || byteLength == 0) { |
258 return; | 258 return; |
259 } | 259 } |
260 | 260 |
261 SkPaint::GlyphCacheProc glyphCacheProc = skPaint.getGlyphCacheProc(true); | 261 SkPaint::GlyphCacheProc glyphCacheProc = skPaint.getGlyphCacheProc(true); |
262 SkAutoDescriptor desc; | 262 SkAutoDescriptor desc; |
263 SkScalerContextEffects effects; | |
264 // We apply the fake-gamma by altering the distance in the shader, so we ign
ore the | 263 // We apply the fake-gamma by altering the distance in the shader, so we ign
ore the |
265 // passed-in scaler context flags. (It's only used when we fall-back to bitm
ap text). | 264 // passed-in scaler context flags. (It's only used when we fall-back to bitm
ap text). |
266 skPaint.getScalerContextDescriptor(&effects, &desc, props, SkPaint::kNone_Sc
alerContextFlags, | 265 skPaint.getScalerContextDescriptor(&desc, props, SkPaint::kNone_ScalerContex
tFlags, nullptr); |
267 nullptr); | 266 SkGlyphCache* origPaintCache = SkGlyphCache::DetachCache(skPaint.getTypeface
(), |
268 SkGlyphCache* origPaintCache = SkGlyphCache::DetachCache(skPaint.getTypeface
(), effects, | |
269 desc.getDesc()); | 267 desc.getDesc()); |
270 | 268 |
271 SkTArray<SkScalar> positions; | 269 SkTArray<SkScalar> positions; |
272 | 270 |
273 const char* textPtr = text; | 271 const char* textPtr = text; |
274 SkScalar stopX = 0; | 272 SkScalar stopX = 0; |
275 SkScalar stopY = 0; | 273 SkScalar stopY = 0; |
276 SkScalar origin = 0; | 274 SkScalar origin = 0; |
277 switch (skPaint.getTextAlign()) { | 275 switch (skPaint.getTextAlign()) { |
278 case SkPaint::kRight_Align: origin = SK_Scalar1; break; | 276 case SkPaint::kRight_Align: origin = SK_Scalar1; break; |
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
582 if (cache->getAuxProcData(glyph_cache_aux_proc, &auxData)) { | 580 if (cache->getAuxProcData(glyph_cache_aux_proc, &auxData)) { |
583 scaler = (GrFontScaler*)auxData; | 581 scaler = (GrFontScaler*)auxData; |
584 } | 582 } |
585 if (nullptr == scaler) { | 583 if (nullptr == scaler) { |
586 scaler = new GrFontScaler(cache); | 584 scaler = new GrFontScaler(cache); |
587 cache->setAuxProc(glyph_cache_aux_proc, scaler); | 585 cache->setAuxProc(glyph_cache_aux_proc, scaler); |
588 } | 586 } |
589 | 587 |
590 return scaler; | 588 return scaler; |
591 } | 589 } |
OLD | NEW |