| 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 // passed-in scaler context flags. (It's only used when we fall-back to bitm
ap text). | 265 // passed-in scaler context flags. (It's only used when we fall-back to bitm
ap text). |
| 265 skPaint.getScalerContextDescriptor(&desc, props, SkPaint::kNone_ScalerContex
tFlags, nullptr); | 266 skPaint.getScalerContextDescriptor(&effects, &desc, props, SkPaint::kNone_Sc
alerContextFlags, |
| 266 SkGlyphCache* origPaintCache = SkGlyphCache::DetachCache(skPaint.getTypeface
(), | 267 nullptr); |
| 268 SkGlyphCache* origPaintCache = SkGlyphCache::DetachCache(skPaint.getTypeface
(), effects, |
| 267 desc.getDesc()); | 269 desc.getDesc()); |
| 268 | 270 |
| 269 SkTArray<SkScalar> positions; | 271 SkTArray<SkScalar> positions; |
| 270 | 272 |
| 271 const char* textPtr = text; | 273 const char* textPtr = text; |
| 272 SkScalar stopX = 0; | 274 SkScalar stopX = 0; |
| 273 SkScalar stopY = 0; | 275 SkScalar stopY = 0; |
| 274 SkScalar origin = 0; | 276 SkScalar origin = 0; |
| 275 switch (skPaint.getTextAlign()) { | 277 switch (skPaint.getTextAlign()) { |
| 276 case SkPaint::kRight_Align: origin = SK_Scalar1; break; | 278 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)) { | 582 if (cache->getAuxProcData(glyph_cache_aux_proc, &auxData)) { |
| 581 scaler = (GrFontScaler*)auxData; | 583 scaler = (GrFontScaler*)auxData; |
| 582 } | 584 } |
| 583 if (nullptr == scaler) { | 585 if (nullptr == scaler) { |
| 584 scaler = new GrFontScaler(cache); | 586 scaler = new GrFontScaler(cache); |
| 585 cache->setAuxProc(glyph_cache_aux_proc, scaler); | 587 cache->setAuxProc(glyph_cache_aux_proc, scaler); |
| 586 } | 588 } |
| 587 | 589 |
| 588 return scaler; | 590 return scaler; |
| 589 } | 591 } |
| OLD | NEW |