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 | |
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
32 files changed, 208 insertions, 169 deletions
diff --git a/include/core/SkPaint.h b/include/core/SkPaint.h index b2be5041f7..7367fc642d 100644 --- a/include/core/SkPaint.h +++ b/include/core/SkPaint.h @@ -30,6 +30,7 @@ class SkPath; class SkPathEffect; struct SkPoint; class SkRasterizer; +struct SkScalerContextEffects; class SkShader; class SkSurfaceProps; class SkTypeface; @@ -1099,7 +1100,8 @@ private: * Allocs an SkDescriptor on the heap and return it to the caller as a refcnted * SkData. Caller is responsible for managing the lifetime of this object. */ - void getScalerContextDescriptor(SkAutoDescriptor*, const SkSurfaceProps& surfaceProps, + void getScalerContextDescriptor(SkScalerContextEffects*, SkAutoDescriptor*, + const SkSurfaceProps& surfaceProps, uint32_t scalerContextFlags, const SkMatrix*) const; SkGlyphCache* detachCache(const SkSurfaceProps* surfaceProps, uint32_t scalerContextFlags, @@ -1107,7 +1109,8 @@ private: void descriptorProc(const SkSurfaceProps* surfaceProps, uint32_t scalerContextFlags, const SkMatrix* deviceMatrix, - void (*proc)(SkTypeface*, const SkDescriptor*, void*), + void (*proc)(SkTypeface*, const SkScalerContextEffects&, + const SkDescriptor*, void*), void* context) const; /* diff --git a/include/core/SkTypeface.h b/include/core/SkTypeface.h index 0b1ca6a4bd..0fbf6a3e0a 100644 --- a/include/core/SkTypeface.h +++ b/include/core/SkTypeface.h @@ -1,4 +1,3 @@ - /* * Copyright 2006 The Android Open Source Project * @@ -6,7 +5,6 @@ * found in the LICENSE file. */ - #ifndef SkTypeface_DEFINED #define SkTypeface_DEFINED @@ -21,6 +19,7 @@ class SkFontData; class SkFontDescriptor; class SkScalerContext; struct SkScalerContextRec; +struct SkScalerContextEffects; class SkStream; class SkStreamAsset; class SkAdvancedTypefaceMetrics; @@ -295,7 +294,7 @@ public: * if allowFailure is true, this returns NULL, else it returns a * dummy scalercontext that will not crash, but will draw nothing. */ - SkScalerContext* createScalerContext(const SkDescriptor*, + SkScalerContext* createScalerContext(const SkScalerContextEffects&, const SkDescriptor*, bool allowFailure = false) const; /** @@ -336,7 +335,8 @@ protected: friend class SkScalerContext; static SkTypeface* GetDefaultTypeface(Style style = SkTypeface::kNormal); - virtual SkScalerContext* onCreateScalerContext(const SkDescriptor*) const = 0; + virtual SkScalerContext* onCreateScalerContext(const SkScalerContextEffects&, + const SkDescriptor*) const = 0; virtual void onFilterRec(SkScalerContextRec*) const = 0; virtual SkAdvancedTypefaceMetrics* onGetAdvancedTypefaceMetrics( PerGlyphInfo, diff --git a/src/core/SkGlyphCache.cpp b/src/core/SkGlyphCache.cpp index 241854eb5a..309f494828 100644 --- a/src/core/SkGlyphCache.cpp +++ b/src/core/SkGlyphCache.cpp @@ -508,9 +508,10 @@ void SkGlyphCache_Globals::purgeAll() { - call a fontscaler (which might call into the cache) */ SkGlyphCache* SkGlyphCache::VisitCache(SkTypeface* typeface, - const SkDescriptor* desc, - bool (*proc)(const SkGlyphCache*, void*), - void* context) { + const SkScalerContextEffects& effects, + const SkDescriptor* desc, + bool (*proc)(const SkGlyphCache*, void*), + void* context) { if (!typeface) { typeface = SkTypeface::GetDefaultTypeface(); } @@ -542,10 +543,10 @@ SkGlyphCache* SkGlyphCache::VisitCache(SkTypeface* typeface, { // pass true the first time, to notice if the scalercontext failed, // so we can try the purge. - SkScalerContext* ctx = typeface->createScalerContext(desc, true); + SkScalerContext* ctx = typeface->createScalerContext(effects, desc, true); if (!ctx) { get_globals().purgeAll(); - ctx = typeface->createScalerContext(desc, false); + ctx = typeface->createScalerContext(effects, desc, false); SkASSERT(ctx); } cache = new SkGlyphCache(typeface, desc, ctx); diff --git a/src/core/SkGlyphCache.h b/src/core/SkGlyphCache.h index 9ae47c6207..fd3ef66028 100644 --- a/src/core/SkGlyphCache.h +++ b/src/core/SkGlyphCache.h @@ -129,7 +129,7 @@ public: If the proc() returns true, detach the cache and return it, otherwise leave it and return nullptr. */ - static SkGlyphCache* VisitCache(SkTypeface*, const SkDescriptor* desc, + static SkGlyphCache* VisitCache(SkTypeface*, const SkScalerContextEffects&, const SkDescriptor*, bool (*proc)(const SkGlyphCache*, void*), void* context); @@ -146,8 +146,9 @@ public: more than 1 strike for the same descriptor, but that will eventually get purged, and the win is that different thread will never block each other while a strike is being used. */ - static SkGlyphCache* DetachCache(SkTypeface* typeface, const SkDescriptor* desc) { - return VisitCache(typeface, desc, DetachProc, nullptr); + static SkGlyphCache* DetachCache(SkTypeface* typeface, const SkScalerContextEffects& effects, + const SkDescriptor* desc) { + return VisitCache(typeface, effects, desc, DetachProc, nullptr); } static void Dump(); @@ -278,8 +279,9 @@ public: SkGlyphCache* getCache() const { return this->get(); } SkAutoGlyphCache(SkGlyphCache* cache) : INHERITED(cache) {} - SkAutoGlyphCache(SkTypeface* typeface, const SkDescriptor* desc) - : INHERITED(SkGlyphCache::DetachCache(typeface, desc)) + SkAutoGlyphCache(SkTypeface* typeface, const SkScalerContextEffects& effects, + const SkDescriptor* desc) + : INHERITED(SkGlyphCache::DetachCache(typeface, effects, desc)) {} /** deprecated: always enables fake gamma */ SkAutoGlyphCache(const SkPaint& paint, diff --git a/src/core/SkPaint.cpp b/src/core/SkPaint.cpp index c3bf1ba9ac..123f20365e 100644 --- a/src/core/SkPaint.cpp +++ b/src/core/SkPaint.cpp @@ -430,13 +430,12 @@ bool SkPaint::TooBigToUseCache(const SkMatrix& ctm, const SkMatrix& textM) { #include "SkGlyphCache.h" #include "SkUtils.h" -static void DetachDescProc(SkTypeface* typeface, const SkDescriptor* desc, - void* context) { - *((SkGlyphCache**)context) = SkGlyphCache::DetachCache(typeface, desc); +static void DetachDescProc(SkTypeface* typeface, const SkScalerContextEffects& effects, + const SkDescriptor* desc, void* context) { + *((SkGlyphCache**)context) = SkGlyphCache::DetachCache(typeface, effects, desc); } -int SkPaint::textToGlyphs(const void* textData, size_t byteLength, - uint16_t glyphs[]) const { +int SkPaint::textToGlyphs(const void* textData, size_t byteLength, uint16_t glyphs[]) const { if (byteLength == 0) { return 0; } @@ -938,9 +937,9 @@ static bool FontMetricsCacheProc(const SkGlyphCache* cache, void* context) { return false; // don't detach the cache } -static void FontMetricsDescProc(SkTypeface* typeface, const SkDescriptor* desc, - void* context) { - SkGlyphCache::VisitCache(typeface, desc, FontMetricsCacheProc, context); +static void FontMetricsDescProc(SkTypeface* typeface, const SkScalerContextEffects& effects, + const SkDescriptor* desc, void* context) { + SkGlyphCache::VisitCache(typeface, effects, desc, FontMetricsCacheProc, context); } SkScalar SkPaint::getFontMetrics(FontMetrics* metrics, SkScalar zoom) const { @@ -1648,7 +1647,8 @@ static void test_desc(const SkScalerContext::Rec& rec, #endif /* see the note on ignoreGamma on descriptorProc */ -void SkPaint::getScalerContextDescriptor(SkAutoDescriptor* ad, +void SkPaint::getScalerContextDescriptor(SkScalerContextEffects* effects, + SkAutoDescriptor* ad, const SkSurfaceProps& surfaceProps, uint32_t scalerContextFlags, const SkMatrix* deviceMatrix) const { @@ -1674,6 +1674,10 @@ void SkPaint::getScalerContextDescriptor(SkAutoDescriptor* ad, #ifdef TEST_DESC test_desc(rec, pe, &peBuffer, mf, &mfBuffer, ra, &raBuffer, desc, descSize); #endif + + effects->fPathEffect = pe; + effects->fMaskFilter = mf; + effects->fRasterizer = ra; } /* @@ -1684,7 +1688,8 @@ void SkPaint::getScalerContextDescriptor(SkAutoDescriptor* ad, void SkPaint::descriptorProc(const SkSurfaceProps* surfaceProps, uint32_t scalerContextFlags, const SkMatrix* deviceMatrix, - void (*proc)(SkTypeface*, const SkDescriptor*, void*), + void (*proc)(SkTypeface*, const SkScalerContextEffects&, + const SkDescriptor*, void*), void* context) const { SkScalerContext::Rec rec; @@ -1709,7 +1714,7 @@ void SkPaint::descriptorProc(const SkSurfaceProps* surfaceProps, test_desc(rec, pe, &peBuffer, mf, &mfBuffer, ra, &raBuffer, desc, descSize); #endif - proc(fTypeface.get(), desc, context); + proc(fTypeface.get(), { pe, mf, ra }, desc, context); } SkGlyphCache* SkPaint::detachCache(const SkSurfaceProps* surfaceProps, diff --git a/src/core/SkScalerContext.cpp b/src/core/SkScalerContext.cpp index cf4098bbdd..ad753dfd21 100644 --- a/src/core/SkScalerContext.cpp +++ b/src/core/SkScalerContext.cpp @@ -62,30 +62,14 @@ void SkGlyph::zeroMetrics() { #define DUMP_RECx #endif -static SkFlattenable* load_flattenable(const SkDescriptor* desc, uint32_t tag, - SkFlattenable::Type ft) { - SkFlattenable* obj = nullptr; - uint32_t len; - const void* data = desc->findEntry(tag, &len); - - if (data) { - SkReadBuffer buffer(data, len); - obj = buffer.readFlattenable(ft); - SkASSERT(buffer.offset() == buffer.size()); - } - return obj; -} - -SkScalerContext::SkScalerContext(SkTypeface* typeface, const SkDescriptor* desc) +SkScalerContext::SkScalerContext(SkTypeface* typeface, const SkScalerContextEffects& effects, + const SkDescriptor* desc) : fRec(*static_cast<const Rec*>(desc->findEntry(kRec_SkDescriptorTag, nullptr))) - , fTypeface(SkRef(typeface)) - , fPathEffect(static_cast<SkPathEffect*>(load_flattenable(desc, kPathEffect_SkDescriptorTag, - SkFlattenable::kSkPathEffect_Type))) - , fMaskFilter(static_cast<SkMaskFilter*>(load_flattenable(desc, kMaskFilter_SkDescriptorTag, - SkFlattenable::kSkMaskFilter_Type))) - , fRasterizer(static_cast<SkRasterizer*>(load_flattenable(desc, kRasterizer_SkDescriptorTag, - SkFlattenable::kSkRasterizer_Type))) + , fTypeface(sk_ref_sp(typeface)) + , fPathEffect(sk_ref_sp(effects.fPathEffect)) + , fMaskFilter(sk_ref_sp(effects.fMaskFilter)) + , fRasterizer(sk_ref_sp(effects.fRasterizer)) // Initialize based on our settings. Subclasses can also force this. , fGenerateImageFromPath(fRec.fFrameWidth > 0 || fPathEffect != nullptr || fRasterizer != nullptr) @@ -109,11 +93,7 @@ SkScalerContext::SkScalerContext(SkTypeface* typeface, const SkDescriptor* desc) #endif } -SkScalerContext::~SkScalerContext() { - SkSafeUnref(fPathEffect); - SkSafeUnref(fMaskFilter); - SkSafeUnref(fRasterizer); -} +SkScalerContext::~SkScalerContext() {} void SkScalerContext::getAdvance(SkGlyph* glyph) { // mark us as just having a valid advance @@ -156,7 +136,7 @@ void SkScalerContext::getMetrics(SkGlyph* glyph) { SkMask mask; if (fRasterizer->rasterize(fillPath, fillToDevMatrix, nullptr, - fMaskFilter, &mask, + fMaskFilter.get(), &mask, SkMask::kJustComputeBounds_CreateMode)) { glyph->fLeft = mask.fBounds.fLeft; glyph->fTop = mask.fBounds.fTop; @@ -485,10 +465,9 @@ void SkScalerContext::getImage(const SkGlyph& origGlyph) { tmpGlyph.initGlyphIdFrom(origGlyph); // need the original bounds, sans our maskfilter - SkMaskFilter* mf = fMaskFilter; - fMaskFilter = nullptr; // temp disable + SkMaskFilter* mf = fMaskFilter.release(); // temp disable this->getMetrics(&tmpGlyph); - fMaskFilter = mf; // restore + fMaskFilter = sk_sp<SkMaskFilter>(mf); // restore // we need the prefilter bounds to be <= filter bounds SkASSERT(tmpGlyph.fWidth <= origGlyph.fWidth); @@ -516,7 +495,7 @@ void SkScalerContext::getImage(const SkGlyph& origGlyph) { sk_bzero(glyph->fImage, mask.computeImageSize()); if (!fRasterizer->rasterize(fillPath, fillToDevMatrix, nullptr, - fMaskFilter, &mask, + fMaskFilter.get(), &mask, SkMask::kJustRenderImage_CreateMode)) { return; } @@ -851,8 +830,9 @@ SkAxisAlignment SkScalerContext::computeAxisAlignmentForHText() { class SkScalerContext_Empty : public SkScalerContext { public: - SkScalerContext_Empty(SkTypeface* face, const SkDescriptor* desc) - : SkScalerContext(face, desc) {} + SkScalerContext_Empty(SkTypeface* typeface, const SkScalerContextEffects& effects, + const SkDescriptor* desc) + : SkScalerContext(typeface, effects, desc) {} protected: unsigned generateGlyphCount() override { @@ -878,12 +858,13 @@ protected: extern SkScalerContext* SkCreateColorScalerContext(const SkDescriptor* desc); -SkScalerContext* SkTypeface::createScalerContext(const SkDescriptor* desc, +SkScalerContext* SkTypeface::createScalerContext(const SkScalerContextEffects& effects, + const SkDescriptor* desc, bool allowFailure) const { - SkScalerContext* c = this->onCreateScalerContext(desc); + SkScalerContext* c = this->onCreateScalerContext(effects, desc); if (!c && !allowFailure) { - c = new SkScalerContext_Empty(const_cast<SkTypeface*>(this), desc); + c = new SkScalerContext_Empty(const_cast<SkTypeface*>(this), effects, desc); } return c; } diff --git a/src/core/SkScalerContext.h b/src/core/SkScalerContext.h index 96674cd500..ffde83cb0a 100644 --- a/src/core/SkScalerContext.h +++ b/src/core/SkScalerContext.h @@ -20,6 +20,16 @@ class SkMaskFilter; class SkPathEffect; class SkRasterizer; +struct SkScalerContextEffects { + SkScalerContextEffects() : fPathEffect(nullptr), fMaskFilter(nullptr), fRasterizer(nullptr) {} + SkScalerContextEffects(SkPathEffect* pe, SkMaskFilter* mf, SkRasterizer* ra) + : fPathEffect(pe), fMaskFilter(mf), fRasterizer(ra) {} + + SkPathEffect* fPathEffect; + SkMaskFilter* fMaskFilter; + SkRasterizer* fRasterizer; +}; + enum SkAxisAlignment { kNone_SkAxisAlignment, kX_SkAxisAlignment, @@ -200,8 +210,7 @@ public: kHinting_Mask = kHintingBit1_Flag | kHintingBit2_Flag, }; - - SkScalerContext(SkTypeface*, const SkDescriptor*); + SkScalerContext(SkTypeface*, const SkScalerContextEffects&, const SkDescriptor*); virtual ~SkScalerContext(); SkTypeface* getTypeface() const { return fTypeface.get(); } @@ -260,13 +269,16 @@ public: const Rec& getRec() const { return fRec; } + SkScalerContextEffects getEffects() const { + return { fPathEffect.get(), fMaskFilter.get(), fRasterizer.get() }; + } + /** * Return the axis (if any) that the baseline for horizontal text should land on. * As an example, the identity matrix will return kX_SkAxisAlignment */ SkAxisAlignment computeAxisAlignmentForHText(); - protected: Rec fRec; @@ -326,12 +338,12 @@ private: friend class SkRandomScalerContext; // For debug purposes // never null - SkAutoTUnref<SkTypeface> fTypeface; + sk_sp<SkTypeface> fTypeface; - // optional object, which may be null - SkPathEffect* fPathEffect; - SkMaskFilter* fMaskFilter; - SkRasterizer* fRasterizer; + // optional objects, which may be null + sk_sp<SkPathEffect> fPathEffect; + sk_sp<SkMaskFilter> fMaskFilter; + sk_sp<SkRasterizer> fRasterizer; // if this is set, we draw the image from a path, rather than // calling generateImage. diff --git a/src/core/SkTypeface.cpp b/src/core/SkTypeface.cpp index 6024c81a17..dc5306331c 100644 --- a/src/core/SkTypeface.cpp +++ b/src/core/SkTypeface.cpp @@ -40,7 +40,8 @@ protected: SkEmptyTypeface() : SkTypeface(SkFontStyle(), 0, true) { } SkStreamAsset* onOpenStream(int* ttcIndex) const override { return nullptr; } - SkScalerContext* onCreateScalerContext(const SkDescriptor*) const override { + SkScalerContext* onCreateScalerContext(const SkScalerContextEffects&, + const SkDescriptor*) const override { return nullptr; } void onFilterRec(SkScalerContextRec*) const override { } @@ -348,7 +349,8 @@ bool SkTypeface::onComputeBounds(SkRect* bounds) const { desc->init(); desc->addEntry(kRec_SkDescriptorTag, sizeof(rec), &rec); - SkAutoTDelete<SkScalerContext> ctx(this->createScalerContext(desc, true)); + SkScalerContextEffects noeffects; + SkAutoTDelete<SkScalerContext> ctx(this->createScalerContext(noeffects, desc, true)); if (ctx.get()) { SkPaint::FontMetrics fm; ctx->getFontMetrics(&fm); diff --git a/src/fonts/SkGScalerContext.cpp b/src/fonts/SkGScalerContext.cpp index 9766e34ff0..0a9601bd7e 100644 --- a/src/fonts/SkGScalerContext.cpp +++ b/src/fonts/SkGScalerContext.cpp @@ -5,15 +5,46 @@ * found in the LICENSE file. */ +#include "SkDescriptor.h" #include "SkGScalerContext.h" #include "SkGlyph.h" #include "SkPath.h" #include "SkCanvas.h" +#define STD_SIZE 1 + class SkGScalerContext : public SkScalerContext { public: - SkGScalerContext(SkGTypeface*, const SkDescriptor*); - virtual ~SkGScalerContext(); + SkGScalerContext(SkGTypeface* face, const SkScalerContextEffects& effects, + const SkDescriptor* desc) + : SkScalerContext(face, effects, desc) + , fFace(face) + { + + size_t descSize = SkDescriptor::ComputeOverhead(1) + sizeof(SkScalerContext::Rec); + SkAutoDescriptor ad(descSize); + SkDescriptor* newDesc = ad.getDesc(); + + newDesc->init(); + void* entry = newDesc->addEntry(kRec_SkDescriptorTag, + sizeof(SkScalerContext::Rec), &fRec); + { + SkScalerContext::Rec* rec = (SkScalerContext::Rec*)entry; + rec->fTextSize = STD_SIZE; + rec->fPreScaleX = SK_Scalar1; + rec->fPreSkewX = 0; + rec->fPost2x2[0][0] = rec->fPost2x2[1][1] = SK_Scalar1; + rec->fPost2x2[1][0] = rec->fPost2x2[0][1] = 0; + } + SkASSERT(descSize == newDesc->getLength()); + newDesc->computeChecksum(); + + fProxy = face->proxy()->createScalerContext(effects, newDesc); + + fRec.getSingleMatrix(&fMatrix); + fMatrix.preScale(SK_Scalar1 / STD_SIZE, SK_Scalar1 / STD_SIZE); + } + virtual ~SkGScalerContext() { delete fProxy; } protected: unsigned generateGlyphCount() override; @@ -30,41 +61,6 @@ private: SkMatrix fMatrix; }; -#define STD_SIZE 1 - -#include "SkDescriptor.h" - -SkGScalerContext::SkGScalerContext(SkGTypeface* face, const SkDescriptor* desc) - : SkScalerContext(face, desc) - , fFace(face) -{ - - size_t descSize = SkDescriptor::ComputeOverhead(1) + sizeof(SkScalerContext::Rec); - SkAutoDescriptor ad(descSize); - SkDescriptor* newDesc = ad.getDesc(); - - newDesc->init(); - void* entry = newDesc->addEntry(kRec_SkDescriptorTag, - sizeof(SkScalerContext::Rec), &fRec); - { - SkScalerContext::Rec* rec = (SkScalerContext::Rec*)entry; - rec->fTextSize = STD_SIZE; - rec->fPreScaleX = SK_Scalar1; - rec->fPreSkewX = 0; - rec->fPost2x2[0][0] = rec->fPost2x2[1][1] = SK_Scalar1; - rec->fPost2x2[1][0] = rec->fPost2x2[0][1] = 0; - } - SkASSERT(descSize == newDesc->getLength()); - newDesc->computeChecksum(); - - fProxy = face->proxy()->createScalerContext(newDesc); - - fRec.getSingleMatrix(&fMatrix); - fMatrix.preScale(SK_Scalar1 / STD_SIZE, SK_Scalar1 / STD_SIZE); -} - -SkGScalerContext::~SkGScalerContext() { delete fProxy; } - unsigned SkGScalerContext::generateGlyphCount() { return fProxy->getGlyphCount(); } @@ -164,9 +160,9 @@ SkGTypeface::~SkGTypeface() { fProxy->unref(); } -SkScalerContext* SkGTypeface::onCreateScalerContext( - const SkDescriptor* desc) const { - return new SkGScalerContext(const_cast<SkGTypeface*>(this), desc); +SkScalerContext* SkGTypeface::onCreateScalerContext(const SkScalerContextEffects& effects, + const SkDescriptor* desc) const { + return new SkGScalerContext(const_cast<SkGTypeface*>(this), effects, desc); } void SkGTypeface::onFilterRec(SkScalerContextRec* rec) const { diff --git a/src/fonts/SkGScalerContext.h b/src/fonts/SkGScalerContext.h index 75f3ebedbd..69d02ddf11 100644 --- a/src/fonts/SkGScalerContext.h +++ b/src/fonts/SkGScalerContext.h @@ -20,7 +20,8 @@ public: const SkPaint& paint() const { return fPaint; } protected: - SkScalerContext* onCreateScalerContext(const SkDescriptor*) const override; + SkScalerContext* onCreateScalerContext(const SkScalerContextEffects&, + const SkDescriptor*) const override; void onFilterRec(SkScalerContextRec*) const override; SkAdvancedTypefaceMetrics* onGetAdvancedTypefaceMetrics( PerGlyphInfo, diff --git a/src/fonts/SkRandomScalerContext.cpp b/src/fonts/SkRandomScalerContext.cpp index c555dd2294..245052053e 100644 --- a/src/fonts/SkRandomScalerContext.cpp +++ b/src/fonts/SkRandomScalerContext.cpp @@ -13,7 +13,8 @@ class SkRandomScalerContext : public SkScalerContext { public: - SkRandomScalerContext(SkRandomTypeface*, const SkDescriptor*, bool fFakeIt); + SkRandomScalerContext(SkRandomTypeface*, const SkScalerContextEffects&, + const SkDescriptor*, bool fFakeIt); virtual ~SkRandomScalerContext(); protected: @@ -35,12 +36,14 @@ private: #include "SkDescriptor.h" -SkRandomScalerContext::SkRandomScalerContext(SkRandomTypeface* face, const SkDescriptor* desc, +SkRandomScalerContext::SkRandomScalerContext(SkRandomTypeface* face, + const SkScalerContextEffects& effects, + const SkDescriptor* desc, bool fakeIt) - : SkScalerContext(face, desc) + : SkScalerContext(face, effects, desc) , fFace(face) , fFakeIt(fakeIt) { - fProxy = face->proxy()->createScalerContext(desc); + fProxy = face->proxy()->createScalerContext(effects, desc); } SkRandomScalerContext::~SkRandomScalerContext() { delete fProxy; } @@ -197,9 +200,9 @@ SkRandomTypeface::~SkRandomTypeface() { fProxy->unref(); } -SkScalerContext* SkRandomTypeface::onCreateScalerContext( - const SkDescriptor* desc) const { - return new SkRandomScalerContext(const_cast<SkRandomTypeface*>(this), desc, fFakeIt); +SkScalerContext* SkRandomTypeface::onCreateScalerContext(const SkScalerContextEffects& effects, + const SkDescriptor* desc) const { + return new SkRandomScalerContext(const_cast<SkRandomTypeface*>(this), effects, desc, fFakeIt); } void SkRandomTypeface::onFilterRec(SkScalerContextRec* rec) const { diff --git a/src/fonts/SkRandomScalerContext.h b/src/fonts/SkRandomScalerContext.h index 24b203f05c..0e08f4b1ae 100644 --- a/src/fonts/SkRandomScalerContext.h +++ b/src/fonts/SkRandomScalerContext.h @@ -25,7 +25,8 @@ public: const SkPaint& paint() const { return fPaint; } protected: - SkScalerContext* onCreateScalerContext(const SkDescriptor*) const override; + SkScalerContext* onCreateScalerContext(const SkScalerContextEffects&, + const SkDescriptor*) const override; void onFilterRec(SkScalerContextRec*) const override; SkAdvancedTypefaceMetrics* onGetAdvancedTypefaceMetrics( PerGlyphInfo, diff --git a/src/fonts/SkTestScalerContext.cpp b/src/fonts/SkTestScalerContext.cpp index 600e2de609..a2748564a5 100644 --- a/src/fonts/SkTestScalerContext.cpp +++ b/src/fonts/SkTestScalerContext.cpp @@ -183,8 +183,9 @@ SkASSERT(0); // incomplete class SkTestScalerContext : public SkScalerContext { public: - SkTestScalerContext(SkTestTypeface* face, const SkDescriptor* desc) - : SkScalerContext(face, desc) + SkTestScalerContext(SkTestTypeface* face, const SkScalerContextEffects& effects, + const SkDescriptor* desc) + : SkScalerContext(face, effects, desc) , fFace(face) { fRec.getSingleMatrix(&fMatrix); @@ -283,6 +284,7 @@ private: SkMatrix fMatrix; }; -SkScalerContext* SkTestTypeface::onCreateScalerContext(const SkDescriptor* desc) const { - return new SkTestScalerContext(const_cast<SkTestTypeface*>(this), desc); +SkScalerContext* SkTestTypeface::onCreateScalerContext(const SkScalerContextEffects& effects, + const SkDescriptor* desc) const { + return new SkTestScalerContext(const_cast<SkTestTypeface*>(this), effects, desc); } diff --git a/src/fonts/SkTestScalerContext.h b/src/fonts/SkTestScalerContext.h index 4af9bf3dfd..5e772601bb 100644 --- a/src/fonts/SkTestScalerContext.h +++ b/src/fonts/SkTestScalerContext.h @@ -67,7 +67,8 @@ public: void getMetrics(SkGlyph* glyph); void getPath(const SkGlyph& glyph, SkPath* path); protected: - SkScalerContext* onCreateScalerContext(const SkDescriptor* desc) const override; + SkScalerContext* onCreateScalerContext(const SkScalerContextEffects&, + const SkDescriptor* desc) const override; void onFilterRec(SkScalerContextRec* rec) const override; SkAdvancedTypefaceMetrics* onGetAdvancedTypefaceMetrics( PerGlyphInfo, 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; diff --git a/src/ports/SkFontHost_FreeType.cpp b/src/ports/SkFontHost_FreeType.cpp index 44eb50ce40..55eb87fe6d 100644 --- a/src/ports/SkFontHost_FreeType.cpp +++ b/src/ports/SkFontHost_FreeType.cpp @@ -181,7 +181,7 @@ static void unref_ft_library() { class SkScalerContext_FreeType : public SkScalerContext_FreeType_Base { public: - SkScalerContext_FreeType(SkTypeface*, const SkDescriptor* desc); + SkScalerContext_FreeType(SkTypeface*, const SkScalerContextEffects&, const SkDescriptor* desc); virtual ~SkScalerContext_FreeType(); bool success() const { @@ -663,10 +663,10 @@ static bool isAxisAligned(const SkScalerContext::Rec& rec) { bothZero(rec.fPost2x2[0][0], rec.fPost2x2[1][1])); } -SkScalerContext* SkTypeface_FreeType::onCreateScalerContext( - const SkDescriptor* desc) const { +SkScalerContext* SkTypeface_FreeType::onCreateScalerContext(const SkScalerContextEffects& effects, + const SkDescriptor* desc) const { SkScalerContext_FreeType* c = - new SkScalerContext_FreeType(const_cast<SkTypeface_FreeType*>(this), desc); + new SkScalerContext_FreeType(const_cast<SkTypeface_FreeType*>(this), effects, desc); if (!c->success()) { delete c; c = nullptr; @@ -790,8 +790,10 @@ static FT_Int chooseBitmapStrike(FT_Face face, FT_F26Dot6 scaleY) { return chosenStrikeIndex; } -SkScalerContext_FreeType::SkScalerContext_FreeType(SkTypeface* typeface, const SkDescriptor* desc) - : SkScalerContext_FreeType_Base(typeface, desc) +SkScalerContext_FreeType::SkScalerContext_FreeType(SkTypeface* typeface, + const SkScalerContextEffects& effects, + const SkDescriptor* desc) + : SkScalerContext_FreeType_Base(typeface, effects, desc) , fFace(nullptr) , fFTSize(nullptr) , fStrikeIndex(-1) diff --git a/src/ports/SkFontHost_FreeType_common.h b/src/ports/SkFontHost_FreeType_common.h index 99b43dccca..8c13a80aa5 100644 --- a/src/ports/SkFontHost_FreeType_common.h +++ b/src/ports/SkFontHost_FreeType_common.h @@ -26,8 +26,9 @@ protected: // This value was chosen by eyeballing the result in Firefox and trying to match it. static const FT_Pos kBitmapEmboldenStrength = 1 << 6; - SkScalerContext_FreeType_Base(SkTypeface* typeface, const SkDescriptor *desc) - : INHERITED(typeface, desc) + SkScalerContext_FreeType_Base(SkTypeface* typeface, const SkScalerContextEffects& effects, + const SkDescriptor *desc) + : INHERITED(typeface, effects, desc) {} void generateGlyphImage(FT_Face face, const SkGlyph& glyph); @@ -75,8 +76,8 @@ protected: , fGlyphCount(-1) {} - virtual SkScalerContext* onCreateScalerContext( - const SkDescriptor*) const override; + virtual SkScalerContext* onCreateScalerContext(const SkScalerContextEffects&, + const SkDescriptor*) const override; void onFilterRec(SkScalerContextRec*) const override; SkAdvancedTypefaceMetrics* onGetAdvancedTypefaceMetrics( PerGlyphInfo, const uint32_t*, uint32_t) const override; diff --git a/src/ports/SkFontHost_mac.cpp b/src/ports/SkFontHost_mac.cpp index ec35707dd1..8d4a3f8cfc 100644 --- a/src/ports/SkFontHost_mac.cpp +++ b/src/ports/SkFontHost_mac.cpp @@ -473,7 +473,8 @@ protected: int onGetTableTags(SkFontTableTag tags[]) const override; virtual size_t onGetTableData(SkFontTableTag, size_t offset, size_t length, void* data) const override; - SkScalerContext* onCreateScalerContext(const SkDescriptor*) const override; + SkScalerContext* onCreateScalerContext(const SkScalerContextEffects&, + const SkDescriptor*) const override; void onFilterRec(SkScalerContextRec*) const override; void onGetFontDescriptor(SkFontDescriptor*, bool*) const override; virtual SkAdvancedTypefaceMetrics* onGetAdvancedTypefaceMetrics( @@ -629,7 +630,7 @@ struct GlyphRect { class SkScalerContext_Mac : public SkScalerContext { public: - SkScalerContext_Mac(SkTypeface_Mac*, const SkDescriptor*); + SkScalerContext_Mac(SkTypeface_Mac*, const SkScalerContextEffects&, const SkDescriptor*); protected: unsigned generateGlyphCount(void) override; @@ -738,8 +739,9 @@ static CTFontRef ctfont_create_exact_copy(CTFontRef baseFont, CGFloat textSize, } SkScalerContext_Mac::SkScalerContext_Mac(SkTypeface_Mac* typeface, + const SkScalerContextEffects& effects, const SkDescriptor* desc) - : INHERITED(typeface, desc) + : INHERITED(typeface, effects, desc) , fFBoundingBoxes() , fFBoundingBoxesGlyphOffset(0) , fGeneratedFBoundingBoxes(false) @@ -1937,8 +1939,9 @@ size_t SkTypeface_Mac::onGetTableData(SkFontTableTag tag, size_t offset, return length; } -SkScalerContext* SkTypeface_Mac::onCreateScalerContext(const SkDescriptor* desc) const { - return new SkScalerContext_Mac(const_cast<SkTypeface_Mac*>(this), desc); +SkScalerContext* SkTypeface_Mac::onCreateScalerContext(const SkScalerContextEffects& effects, + const SkDescriptor* desc) const { + return new SkScalerContext_Mac(const_cast<SkTypeface_Mac*>(this), effects, desc); } void SkTypeface_Mac::onFilterRec(SkScalerContextRec* rec) const { diff --git a/src/ports/SkFontHost_win.cpp b/src/ports/SkFontHost_win.cpp index f772d8c57e..395307cf04 100644 --- a/src/ports/SkFontHost_win.cpp +++ b/src/ports/SkFontHost_win.cpp @@ -257,7 +257,8 @@ public: protected: SkStreamAsset* onOpenStream(int* ttcIndex) const override; - SkScalerContext* onCreateScalerContext(const SkDescriptor*) const override; + SkScalerContext* onCreateScalerContext(const SkScalerContextEffects&, + const SkDescriptor*) const override; void onFilterRec(SkScalerContextRec*) const override; SkAdvancedTypefaceMetrics* onGetAdvancedTypefaceMetrics( PerGlyphInfo, const uint32_t*, uint32_t) const override; @@ -533,7 +534,7 @@ const void* HDCOffscreen::draw(const SkGlyph& glyph, bool isBW, class SkScalerContext_GDI : public SkScalerContext { public: - SkScalerContext_GDI(SkTypeface*, const SkDescriptor* desc); + SkScalerContext_GDI(SkTypeface*, const SkScalerContextEffects&, const SkDescriptor* desc); virtual ~SkScalerContext_GDI(); // Returns true if the constructor was able to complete all of its @@ -604,8 +605,9 @@ static BYTE compute_quality(const SkScalerContext::Rec& rec) { } SkScalerContext_GDI::SkScalerContext_GDI(SkTypeface* rawTypeface, - const SkDescriptor* desc) - : SkScalerContext(rawTypeface, desc) + const SkScalerContextEffects& effects, + const SkDescriptor* desc) + : SkScalerContext(rawTypeface, effects, desc) , fDDC(0) , fSavefont(0) , fFont(0) @@ -2285,8 +2287,10 @@ size_t LogFontTypeface::onGetTableData(SkFontTableTag tag, size_t offset, return bufferSize == GDI_ERROR ? 0 : bufferSize; } -SkScalerContext* LogFontTypeface::onCreateScalerContext(const SkDescriptor* desc) const { - SkScalerContext_GDI* ctx = new SkScalerContext_GDI(const_cast<LogFontTypeface*>(this), desc); +SkScalerContext* LogFontTypeface::onCreateScalerContext(const SkScalerContextEffects& effects, + const SkDescriptor* desc) const { + SkScalerContext_GDI* ctx = new SkScalerContext_GDI(const_cast<LogFontTypeface*>(this), + effects, desc); if (!ctx->isValid()) { delete ctx; ctx = nullptr; diff --git a/src/ports/SkScalerContext_win_dw.cpp b/src/ports/SkScalerContext_win_dw.cpp index f276762bbf..4609d04851 100644 --- a/src/ports/SkScalerContext_win_dw.cpp +++ b/src/ports/SkScalerContext_win_dw.cpp @@ -204,8 +204,9 @@ static bool is_axis_aligned(const SkScalerContext::Rec& rec) { } SkScalerContext_DW::SkScalerContext_DW(DWriteFontTypeface* typeface, + const SkScalerContextEffects& effects, const SkDescriptor* desc) - : SkScalerContext(typeface, desc) + : SkScalerContext(typeface, effects, desc) , fTypeface(SkRef(typeface)) , fGlyphCount(-1) { diff --git a/src/ports/SkScalerContext_win_dw.h b/src/ports/SkScalerContext_win_dw.h index abf2bc9aa0..9b24772036 100644 --- a/src/ports/SkScalerContext_win_dw.h +++ b/src/ports/SkScalerContext_win_dw.h @@ -20,7 +20,7 @@ class SkDescriptor; class SkScalerContext_DW : public SkScalerContext { public: - SkScalerContext_DW(DWriteFontTypeface*, const SkDescriptor* desc); + SkScalerContext_DW(DWriteFontTypeface*, const SkScalerContextEffects&, const SkDescriptor*); virtual ~SkScalerContext_DW(); protected: diff --git a/src/ports/SkTypeface_win_dw.cpp b/src/ports/SkTypeface_win_dw.cpp index 160c66ed0e..18c63a5089 100644 --- a/src/ports/SkTypeface_win_dw.cpp +++ b/src/ports/SkTypeface_win_dw.cpp @@ -244,8 +244,9 @@ SkStreamAsset* DWriteFontTypeface::onOpenStream(int* ttcIndex) const { return new SkDWriteFontFileStream(fontFileStream.get()); } -SkScalerContext* DWriteFontTypeface::onCreateScalerContext(const SkDescriptor* desc) const { - return new SkScalerContext_DW(const_cast<DWriteFontTypeface*>(this), desc); +SkScalerContext* DWriteFontTypeface::onCreateScalerContext(const SkScalerContextEffects& effects, + const SkDescriptor* desc) const { + return new SkScalerContext_DW(const_cast<DWriteFontTypeface*>(this), effects, desc); } void DWriteFontTypeface::onFilterRec(SkScalerContext::Rec* rec) const { diff --git a/src/ports/SkTypeface_win_dw.h b/src/ports/SkTypeface_win_dw.h index cdbeeaa785..b1237c0e98 100644 --- a/src/ports/SkTypeface_win_dw.h +++ b/src/ports/SkTypeface_win_dw.h @@ -96,7 +96,8 @@ protected: } SkStreamAsset* onOpenStream(int* ttcIndex) const override; - SkScalerContext* onCreateScalerContext(const SkDescriptor*) const override; + SkScalerContext* onCreateScalerContext(const SkScalerContextEffects&, + const SkDescriptor*) const override; void onFilterRec(SkScalerContextRec*) const override; SkAdvancedTypefaceMetrics* onGetAdvancedTypefaceMetrics( PerGlyphInfo, const uint32_t*, uint32_t) const override; diff --git a/tests/FontMgrTest.cpp b/tests/FontMgrTest.cpp index b663b45e1f..96af746ace 100644 --- a/tests/FontMgrTest.cpp +++ b/tests/FontMgrTest.cpp @@ -125,7 +125,8 @@ static void test_matchStyleCSS3(skiatest::Reporter* reporter) { TestTypeface(const SkFontStyle& fontStyle, SkFontID id) : SkTypeface(fontStyle, id, false){} protected: SkStreamAsset* onOpenStream(int* ttcIndex) const override { return nullptr; } - SkScalerContext* onCreateScalerContext(const SkDescriptor*) const override { + SkScalerContext* onCreateScalerContext(const SkScalerContextEffects&, + const SkDescriptor*) const override { return nullptr; } void onFilterRec(SkScalerContextRec*) const override { } |