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; |
263 // We apply the fake-gamma by altering the distance in the shader, so we ign
ore the | 264 // We apply the fake-gamma by altering the distance in the shader, so we ign
ore the |
264 // fakeGamma parameter. (It's only used when we fall-back to bitmap text). | 265 // fakeGamma parameter. (It's only used when we fall-back to bitmap text). |
265 skPaint.getScalerContextDescriptor(&desc, props, SkPaint::FakeGamma::Off, nu
llptr); | 266 skPaint.getScalerContextDescriptor(&desc, &effects, props, SkPaint::FakeGamm
a::Off, nullptr); |
266 SkGlyphCache* origPaintCache = SkGlyphCache::DetachCache(skPaint.getTypeface
(), | 267 SkGlyphCache* origPaintCache = SkGlyphCache::DetachCache(skPaint.getTypeface
(), effects, |
267 desc.getDesc()); | 268 desc.getDesc()); |
268 | 269 |
269 SkTArray<SkScalar> positions; | 270 SkTArray<SkScalar> positions; |
270 | 271 |
271 const char* textPtr = text; | 272 const char* textPtr = text; |
272 SkScalar stopX = 0; | 273 SkScalar stopX = 0; |
273 SkScalar stopY = 0; | 274 SkScalar stopY = 0; |
274 SkScalar origin = 0; | 275 SkScalar origin = 0; |
275 switch (skPaint.getTextAlign()) { | 276 switch (skPaint.getTextAlign()) { |
276 case SkPaint::kRight_Align: origin = SK_Scalar1; break; | 277 case SkPaint::kRight_Align: origin = SK_Scalar1; break; |
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
580 if (cache->getAuxProcData(glyph_cache_aux_proc, &auxData)) { | 581 if (cache->getAuxProcData(glyph_cache_aux_proc, &auxData)) { |
581 scaler = (GrFontScaler*)auxData; | 582 scaler = (GrFontScaler*)auxData; |
582 } | 583 } |
583 if (nullptr == scaler) { | 584 if (nullptr == scaler) { |
584 scaler = new GrFontScaler(cache); | 585 scaler = new GrFontScaler(cache); |
585 cache->setAuxProc(glyph_cache_aux_proc, scaler); | 586 cache->setAuxProc(glyph_cache_aux_proc, scaler); |
586 } | 587 } |
587 | 588 |
588 return scaler; | 589 return scaler; |
589 } | 590 } |
OLD | NEW |