diff options
Diffstat (limited to 'src/gpu')
-rw-r--r-- | src/gpu/GrPathRendering.cpp | 13 | ||||
-rw-r--r-- | src/gpu/GrPathRendering.h | 3 | ||||
-rw-r--r-- | src/gpu/GrResourceProvider.cpp | 6 | ||||
-rw-r--r-- | src/gpu/GrResourceProvider.h | 3 | ||||
-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 |
9 files changed, 29 insertions, 14 deletions
diff --git a/src/gpu/GrPathRendering.cpp b/src/gpu/GrPathRendering.cpp index 0287eb08aa..a3bba4bc7f 100644 --- a/src/gpu/GrPathRendering.cpp +++ b/src/gpu/GrPathRendering.cpp @@ -14,8 +14,9 @@ class GlyphGenerator : public GrPathRange::PathGenerator { public: - GlyphGenerator(const SkTypeface& typeface, const SkDescriptor& desc) - : fScalerContext(typeface.createScalerContext(&desc)) + GlyphGenerator(const SkTypeface& typeface, const SkScalerContextEffects& effects, + const SkDescriptor& desc) + : fScalerContext(typeface.createScalerContext(effects, &desc)) #ifdef SK_DEBUG , fDesc(desc.copy()) #endif @@ -51,6 +52,7 @@ private: }; GrPathRange* GrPathRendering::createGlyphs(const SkTypeface* typeface, + const SkScalerContextEffects& effects, const SkDescriptor* desc, const GrStrokeInfo& stroke) { if (nullptr == typeface) { @@ -59,7 +61,7 @@ GrPathRange* GrPathRendering::createGlyphs(const SkTypeface* typeface, } if (desc) { - SkAutoTUnref<GlyphGenerator> generator(new GlyphGenerator(*typeface, *desc)); + SkAutoTUnref<GlyphGenerator> generator(new GlyphGenerator(*typeface, effects, *desc)); return this->createPathRange(generator, stroke); } @@ -76,7 +78,10 @@ GrPathRange* GrPathRendering::createGlyphs(const SkTypeface* typeface, genericDesc->init(); genericDesc->addEntry(kRec_SkDescriptorTag, sizeof(rec), &rec); genericDesc->computeChecksum(); + + // No effects, so we make a dummy struct + SkScalerContextEffects noEffects; - SkAutoTUnref<GlyphGenerator> generator(new GlyphGenerator(*typeface, *genericDesc)); + SkAutoTUnref<GlyphGenerator> generator(new GlyphGenerator(*typeface, noEffects, *genericDesc)); return this->createPathRange(generator, stroke); } diff --git a/src/gpu/GrPathRendering.h b/src/gpu/GrPathRendering.h index b2863b5b36..8ee3d7b3e2 100644 --- a/src/gpu/GrPathRendering.h +++ b/src/gpu/GrPathRendering.h @@ -125,7 +125,8 @@ public: * * @return a new path range populated with glyphs. */ - GrPathRange* createGlyphs(const SkTypeface*, const SkDescriptor*, const GrStrokeInfo&); + GrPathRange* createGlyphs(const SkTypeface*, const SkScalerContextEffects&, + const SkDescriptor*, const GrStrokeInfo&); /** None of these params are optional, pointers used just to avoid making copies. */ struct StencilPathArgs { diff --git a/src/gpu/GrResourceProvider.cpp b/src/gpu/GrResourceProvider.cpp index 4c60f079a7..a8c9e5a3c7 100644 --- a/src/gpu/GrResourceProvider.cpp +++ b/src/gpu/GrResourceProvider.cpp @@ -81,11 +81,13 @@ GrPathRange* GrResourceProvider::createPathRange(GrPathRange::PathGenerator* gen return this->gpu()->pathRendering()->createPathRange(gen, stroke); } -GrPathRange* GrResourceProvider::createGlyphs(const SkTypeface* tf, const SkDescriptor* desc, +GrPathRange* GrResourceProvider::createGlyphs(const SkTypeface* tf, + const SkScalerContextEffects& effects, + const SkDescriptor* desc, const GrStrokeInfo& stroke) { SkASSERT(this->gpu()->pathRendering()); - return this->gpu()->pathRendering()->createGlyphs(tf, desc, stroke); + return this->gpu()->pathRendering()->createGlyphs(tf, effects, desc, stroke); } GrBuffer* GrResourceProvider::createBuffer(size_t size, GrBufferType intendedType, diff --git a/src/gpu/GrResourceProvider.h b/src/gpu/GrResourceProvider.h index d8e595a47b..5beb70a3d8 100644 --- a/src/gpu/GrResourceProvider.h +++ b/src/gpu/GrResourceProvider.h @@ -85,7 +85,8 @@ public: */ GrPath* createPath(const SkPath&, const GrStrokeInfo&); GrPathRange* createPathRange(GrPathRange::PathGenerator*, const GrStrokeInfo&); - GrPathRange* createGlyphs(const SkTypeface*, const SkDescriptor*, const GrStrokeInfo&); + GrPathRange* createGlyphs(const SkTypeface*, const SkScalerContextEffects&, + const SkDescriptor*, const GrStrokeInfo&); using GrTextureProvider::assignUniqueKeyToResource; using GrTextureProvider::findAndRefResourceByUniqueKey; 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; |