diff options
author | reed <reed@google.com> | 2016-04-11 07:51:07 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-04-11 07:51:07 -0700 |
commit | c79172857c3f69cc46837e1beeae0c1ead377bb2 (patch) | |
tree | 4e6eebf5b3b09e91c58287875d24f75d62850818 /src/gpu/text | |
parent | 6dc14aab5ea6be87b5b10f17a19737f586708768 (diff) |
Pass effects directly to fontcache
BUG=skia:5176
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1863013003
Review URL: https://codereview.chromium.org/1863013003
Diffstat (limited to 'src/gpu/text')
-rw-r--r-- | src/gpu/text/GrAtlasTextBlob.cpp | 4 | ||||
-rw-r--r-- | src/gpu/text/GrAtlasTextBlob.h | 1 | ||||
-rw-r--r-- | src/gpu/text/GrAtlasTextBlob_regenInBatch.cpp | 2 | ||||
-rw-r--r-- | src/gpu/text/GrStencilAndCoverTextContext.cpp | 5 | ||||
-rw-r--r-- | src/gpu/text/GrTextUtils.cpp | 6 |
5 files changed, 12 insertions, 6 deletions
diff --git a/src/gpu/text/GrAtlasTextBlob.cpp b/src/gpu/text/GrAtlasTextBlob.cpp index 4b339d4adb..afbff46994 100644 --- a/src/gpu/text/GrAtlasTextBlob.cpp +++ b/src/gpu/text/GrAtlasTextBlob.cpp @@ -59,9 +59,9 @@ SkGlyphCache* GrAtlasTextBlob::setupCache(int runIndex, // if we have an override descriptor for the run, then we should use that SkAutoDescriptor* desc = run->fOverrideDescriptor.get() ? run->fOverrideDescriptor.get() : &run->fDescriptor; - skPaint.getScalerContextDescriptor(desc, props, scalerContextFlags, viewMatrix); + skPaint.getScalerContextDescriptor(&run->fEffects, desc, props, scalerContextFlags, viewMatrix); run->fTypeface.reset(SkSafeRef(skPaint.getTypeface())); - return SkGlyphCache::DetachCache(run->fTypeface, desc->getDesc()); + return SkGlyphCache::DetachCache(run->fTypeface, run->fEffects, desc->getDesc()); } void GrAtlasTextBlob::appendGlyph(int runIndex, diff --git a/src/gpu/text/GrAtlasTextBlob.h b/src/gpu/text/GrAtlasTextBlob.h index 36e45abcff..bc1e0b4afc 100644 --- a/src/gpu/text/GrAtlasTextBlob.h +++ b/src/gpu/text/GrAtlasTextBlob.h @@ -474,6 +474,7 @@ private: SkAutoTUnref<SkTypeface> fTypeface; SkSTArray<kMinSubRuns, SubRunInfo> fSubRunInfo; SkAutoDescriptor fDescriptor; + SkScalerContextEffects fEffects; // Distance field text cannot draw coloremoji, and so has to fall back. However, // though the distance field text and the coloremoji may share the same run, they diff --git a/src/gpu/text/GrAtlasTextBlob_regenInBatch.cpp b/src/gpu/text/GrAtlasTextBlob_regenInBatch.cpp index 7283e6d516..7c3cf68524 100644 --- a/src/gpu/text/GrAtlasTextBlob_regenInBatch.cpp +++ b/src/gpu/text/GrAtlasTextBlob_regenInBatch.cpp @@ -165,7 +165,7 @@ void GrAtlasTextBlob::regenInBatch(GrDrawBatch::Target* target, SkGlyphCache::AttachCache(*cache); } *desc = newDesc; - *cache = SkGlyphCache::DetachCache(run->fTypeface, *desc); + *cache = SkGlyphCache::DetachCache(run->fTypeface, run->fEffects, *desc); *scaler = GrTextUtils::GetGrFontScaler(*cache); *typeface = run->fTypeface; } diff --git a/src/gpu/text/GrStencilAndCoverTextContext.cpp b/src/gpu/text/GrStencilAndCoverTextContext.cpp index f0c66979d5..a8dc20215a 100644 --- a/src/gpu/text/GrStencilAndCoverTextContext.cpp +++ b/src/gpu/text/GrStencilAndCoverTextContext.cpp @@ -539,10 +539,13 @@ GrPathRange* GrStencilAndCoverTextContext::TextRun::createGlyphs(GrContext* ctx) ctx->resourceProvider()->findAndRefResourceByUniqueKey(fGlyphPathsKey)); if (nullptr == glyphs) { if (fUsingRawGlyphPaths) { - glyphs = ctx->resourceProvider()->createGlyphs(fFont.getTypeface(), nullptr, fStroke); + SkScalerContextEffects noeffects; + glyphs = ctx->resourceProvider()->createGlyphs(fFont.getTypeface(), noeffects, + nullptr, fStroke); } else { SkGlyphCache* cache = this->getGlyphCache(); glyphs = ctx->resourceProvider()->createGlyphs(cache->getScalerContext()->getTypeface(), + cache->getScalerContext()->getEffects(), &cache->getDescriptor(), fStroke); } diff --git a/src/gpu/text/GrTextUtils.cpp b/src/gpu/text/GrTextUtils.cpp index 3616bcada1..c368c214e1 100644 --- a/src/gpu/text/GrTextUtils.cpp +++ b/src/gpu/text/GrTextUtils.cpp @@ -260,10 +260,12 @@ void GrTextUtils::DrawDFText(GrAtlasTextBlob* blob, int runIndex, SkPaint::GlyphCacheProc glyphCacheProc = skPaint.getGlyphCacheProc(true); SkAutoDescriptor desc; + SkScalerContextEffects effects; // We apply the fake-gamma by altering the distance in the shader, so we ignore the // passed-in scaler context flags. (It's only used when we fall-back to bitmap text). - skPaint.getScalerContextDescriptor(&desc, props, SkPaint::kNone_ScalerContextFlags, nullptr); - SkGlyphCache* origPaintCache = SkGlyphCache::DetachCache(skPaint.getTypeface(), + skPaint.getScalerContextDescriptor(&effects, &desc, props, SkPaint::kNone_ScalerContextFlags, + nullptr); + SkGlyphCache* origPaintCache = SkGlyphCache::DetachCache(skPaint.getTypeface(), effects, desc.getDesc()); SkTArray<SkScalar> positions; |