diff options
author | borenet <borenet@google.com> | 2016-04-11 10:25:28 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-04-11 10:25:28 -0700 |
commit | 25e0a0416e5b37c1e0bef1934dc67ff62e442916 (patch) | |
tree | 3d172fdc83424f6abc7214979bb05793f5a2c6b0 | |
parent | 29feef80de0af74eb24b703d6675aea1bc17e655 (diff) |
Revert of Pass effects directly to fontcache (patchset #8 id:140001 of https://codereview.chromium.org/1863013003/ )
Reason for revert:
Seems to have broken the DEPS roll.
Original issue's description:
> 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
>
> Committed: https://skia.googlesource.com/skia/+/c79172857c3f69cc46837e1beeae0c1ead377bb2
TBR=djsollen@google.com,bungeman@google.com,mtklein@google.com,fmalita@chromium.org,msarett@google.com,reed@google.com
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=skia:5176
Review URL: https://codereview.chromium.org/1872253004
32 files changed, 169 insertions, 208 deletions
diff --git a/include/core/SkPaint.h b/include/core/SkPaint.h index 7367fc642d..b2be5041f7 100644 --- a/include/core/SkPaint.h +++ b/include/core/SkPaint.h @@ -30,7 +30,6 @@ class SkPath; class SkPathEffect; struct SkPoint; class SkRasterizer; -struct SkScalerContextEffects; class SkShader; class SkSurfaceProps; class SkTypeface; @@ -1100,8 +1099,7 @@ 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(SkScalerContextEffects*, SkAutoDescriptor*, - const SkSurfaceProps& surfaceProps, + void getScalerContextDescriptor(SkAutoDescriptor*, const SkSurfaceProps& surfaceProps, uint32_t scalerContextFlags, const SkMatrix*) const; SkGlyphCache* detachCache(const SkSurfaceProps* surfaceProps, uint32_t scalerContextFlags, @@ -1109,8 +1107,7 @@ private: void descriptorProc(const SkSurfaceProps* surfaceProps, uint32_t scalerContextFlags, const SkMatrix* deviceMatrix, - void (*proc)(SkTypeface*, const SkScalerContextEffects&, - const SkDescriptor*, void*), + void (*proc)(SkTypeface*, const SkDescriptor*, void*), void* context) const; /* diff --git a/include/core/SkTypeface.h b/include/core/SkTypeface.h index 0fbf6a3e0a..0b1ca6a4bd 100644 --- a/include/core/SkTypeface.h +++ b/include/core/SkTypeface.h @@ -1,3 +1,4 @@ + /* * Copyright 2006 The Android Open Source Project * @@ -5,6 +6,7 @@ * found in the LICENSE file. */ + #ifndef SkTypeface_DEFINED #define SkTypeface_DEFINED @@ -19,7 +21,6 @@ class SkFontData; class SkFontDescriptor; class SkScalerContext; struct SkScalerContextRec; -struct SkScalerContextEffects; class SkStream; class SkStreamAsset; class SkAdvancedTypefaceMetrics; @@ -294,7 +295,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 SkScalerContextEffects&, const SkDescriptor*, + SkScalerContext* createScalerContext(const SkDescriptor*, bool allowFailure = false) const; /** @@ -335,8 +336,7 @@ protected: friend class SkScalerContext; static SkTypeface* GetDefaultTypeface(Style style = SkTypeface::kNormal); - virtual SkScalerContext* onCreateScalerContext(const SkScalerContextEffects&, - const SkDescriptor*) const = 0; + virtual SkScalerContext* onCreateScalerContext(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 309f494828..241854eb5a 100644 --- a/src/core/SkGlyphCache.cpp +++ b/src/core/SkGlyphCache.cpp @@ -508,10 +508,9 @@ void SkGlyphCache_Globals::purgeAll() { - call a fontscaler (which might call into the cache) */ SkGlyphCache* SkGlyphCache::VisitCache(SkTypeface* typeface, - const SkScalerContextEffects& effects, - const SkDescriptor* desc, - bool (*proc)(const SkGlyphCache*, void*), - void* context) { + const SkDescriptor* desc, + bool (*proc)(const SkGlyphCache*, void*), + void* context) { if (!typeface) { typeface = SkTypeface::GetDefaultTypeface(); } @@ -543,10 +542,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(effects, desc, true); + SkScalerContext* ctx = typeface->createScalerContext(desc, true); if (!ctx) { get_globals().purgeAll(); - ctx = typeface->createScalerContext(effects, desc, false); + ctx = typeface->createScalerContext(desc, false); SkASSERT(ctx); } cache = new SkGlyphCache(typeface, desc, ctx); diff --git a/src/core/SkGlyphCache.h b/src/core/SkGlyphCache.h index fd3ef66028..9ae47c6207 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 SkScalerContextEffects&, const SkDescriptor*, + static SkGlyphCache* VisitCache(SkTypeface*, const SkDescriptor* desc, bool (*proc)(const SkGlyphCache*, void*), void* context); @@ -146,9 +146,8 @@ 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 SkScalerContextEffects& effects, - const SkDescriptor* desc) { - return VisitCache(typeface, effects, desc, DetachProc, nullptr); + static SkGlyphCache* DetachCache(SkTypeface* typeface, const SkDescriptor* desc) { + return VisitCache(typeface, desc, DetachProc, nullptr); } static void Dump(); @@ -279,9 +278,8 @@ public: SkGlyphCache* getCache() const { return this->get(); } SkAutoGlyphCache(SkGlyphCache* cache) : INHERITED(cache) {} - SkAutoGlyphCache(SkTypeface* typeface, const SkScalerContextEffects& effects, - const SkDescriptor* desc) - : INHERITED(SkGlyphCache::DetachCache(typeface, effects, desc)) + SkAutoGlyphCache(SkTypeface* typeface, const SkDescriptor* desc) + : INHERITED(SkGlyphCache::DetachCache(typeface, desc)) {} /** deprecated: always enables fake gamma */ SkAutoGlyphCache(const SkPaint& paint, diff --git a/src/core/SkPaint.cpp b/src/core/SkPaint.cpp index 123f20365e..c3bf1ba9ac 100644 --- a/src/core/SkPaint.cpp +++ b/src/core/SkPaint.cpp @@ -430,12 +430,13 @@ bool SkPaint::TooBigToUseCache(const SkMatrix& ctm, const SkMatrix& textM) { #include "SkGlyphCache.h" #include "SkUtils.h" -static void DetachDescProc(SkTypeface* typeface, const SkScalerContextEffects& effects, - const SkDescriptor* desc, void* context) { - *((SkGlyphCache**)context) = SkGlyphCache::DetachCache(typeface, effects, desc); +static void DetachDescProc(SkTypeface* typeface, const SkDescriptor* desc, + void* context) { + *((SkGlyphCache**)context) = SkGlyphCache::DetachCache(typeface, 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; } @@ -937,9 +938,9 @@ static bool FontMetricsCacheProc(const SkGlyphCache* cache, void* context) { return false; // don't detach the cache } -static void FontMetricsDescProc(SkTypeface* typeface, const SkScalerContextEffects& effects, - const SkDescriptor* desc, void* context) { - SkGlyphCache::VisitCache(typeface, effects, desc, FontMetricsCacheProc, context); +static void FontMetricsDescProc(SkTypeface* typeface, const SkDescriptor* desc, + void* context) { + SkGlyphCache::VisitCache(typeface, desc, FontMetricsCacheProc, context); } SkScalar SkPaint::getFontMetrics(FontMetrics* metrics, SkScalar zoom) const { @@ -1647,8 +1648,7 @@ static void test_desc(const SkScalerContext::Rec& rec, #endif /* see the note on ignoreGamma on descriptorProc */ -void SkPaint::getScalerContextDescriptor(SkScalerContextEffects* effects, - SkAutoDescriptor* ad, +void SkPaint::getScalerContextDescriptor(SkAutoDescriptor* ad, const SkSurfaceProps& surfaceProps, uint32_t scalerContextFlags, const SkMatrix* deviceMatrix) const { @@ -1674,10 +1674,6 @@ void SkPaint::getScalerContextDescriptor(SkScalerContextEffects* effects, #ifdef TEST_DESC test_desc(rec, pe, &peBuffer, mf, &mfBuffer, ra, &raBuffer, desc, descSize); #endif - - effects->fPathEffect = pe; - effects->fMaskFilter = mf; - effects->fRasterizer = ra; } /* @@ -1688,8 +1684,7 @@ void SkPaint::getScalerContextDescriptor(SkScalerContextEffects* effects, void SkPaint::descriptorProc(const SkSurfaceProps* surfaceProps, uint32_t scalerContextFlags, const SkMatrix* deviceMatrix, - void (*proc)(SkTypeface*, const SkScalerContextEffects&, - const SkDescriptor*, void*), + void (*proc)(SkTypeface*, const SkDescriptor*, void*), void* context) const { SkScalerContext::Rec rec; @@ -1714,7 +1709,7 @@ void SkPaint::descriptorProc(const SkSurfaceProps* surfaceProps, test_desc(rec, pe, &peBuffer, mf, &mfBuffer, ra, &raBuffer, desc, descSize); #endif - proc(fTypeface.get(), { pe, mf, ra }, desc, context); + proc(fTypeface.get(), desc, context); } SkGlyphCache* SkPaint::detachCache(const SkSurfaceProps* surfaceProps, diff --git a/src/core/SkScalerContext.cpp b/src/core/SkScalerContext.cpp index ad753dfd21..cf4098bbdd 100644 --- a/src/core/SkScalerContext.cpp +++ b/src/core/SkScalerContext.cpp @@ -62,14 +62,30 @@ void SkGlyph::zeroMetrics() { #define DUMP_RECx #endif -SkScalerContext::SkScalerContext(SkTypeface* typeface, const SkScalerContextEffects& effects, - const SkDescriptor* desc) +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) : fRec(*static_cast<const Rec*>(desc->findEntry(kRec_SkDescriptorTag, nullptr))) - , fTypeface(sk_ref_sp(typeface)) - , fPathEffect(sk_ref_sp(effects.fPathEffect)) - , fMaskFilter(sk_ref_sp(effects.fMaskFilter)) - , fRasterizer(sk_ref_sp(effects.fRasterizer)) + , 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))) // Initialize based on our settings. Subclasses can also force this. , fGenerateImageFromPath(fRec.fFrameWidth > 0 || fPathEffect != nullptr || fRasterizer != nullptr) @@ -93,7 +109,11 @@ SkScalerContext::SkScalerContext(SkTypeface* typeface, const SkScalerContextEffe #endif } -SkScalerContext::~SkScalerContext() {} +SkScalerContext::~SkScalerContext() { + SkSafeUnref(fPathEffect); + SkSafeUnref(fMaskFilter); + SkSafeUnref(fRasterizer); +} void SkScalerContext::getAdvance(SkGlyph* glyph) { // mark us as just having a valid advance @@ -136,7 +156,7 @@ void SkScalerContext::getMetrics(SkGlyph* glyph) { SkMask mask; if (fRasterizer->rasterize(fillPath, fillToDevMatrix, nullptr, - fMaskFilter.get(), &mask, + fMaskFilter, &mask, SkMask::kJustComputeBounds_CreateMode)) { glyph->fLeft = mask.fBounds.fLeft; glyph->fTop = mask.fBounds.fTop; @@ -465,9 +485,10 @@ void SkScalerContext::getImage(const SkGlyph& origGlyph) { tmpGlyph.initGlyphIdFrom(origGlyph); // need the original bounds, sans our maskfilter - SkMaskFilter* mf = fMaskFilter.release(); // temp disable + SkMaskFilter* mf = fMaskFilter; + fMaskFilter = nullptr; // temp disable this->getMetrics(&tmpGlyph); - fMaskFilter = sk_sp<SkMaskFilter>(mf); // restore + fMaskFilter = mf; // restore // we need the prefilter bounds to be <= filter bounds SkASSERT(tmpGlyph.fWidth <= origGlyph.fWidth); @@ -495,7 +516,7 @@ void SkScalerContext::getImage(const SkGlyph& origGlyph) { sk_bzero(glyph->fImage, mask.computeImageSize()); if (!fRasterizer->rasterize(fillPath, fillToDevMatrix, nullptr, - fMaskFilter.get(), &mask, + fMaskFilter, &mask, SkMask::kJustRenderImage_CreateMode)) { return; } @@ -830,9 +851,8 @@ SkAxisAlignment SkScalerContext::computeAxisAlignmentForHText() { class SkScalerContext_Empty : public SkScalerContext { public: - SkScalerContext_Empty(SkTypeface* typeface, const SkScalerContextEffects& effects, - const SkDescriptor* desc) - : SkScalerContext(typeface, effects, desc) {} + SkScalerContext_Empty(SkTypeface* face, const SkDescriptor* desc) + : SkScalerContext(face, desc) {} protected: unsigned generateGlyphCount() override { @@ -858,13 +878,12 @@ protected: extern SkScalerContext* SkCreateColorScalerContext(const SkDescriptor* desc); -SkScalerContext* SkTypeface::createScalerContext(const SkScalerContextEffects& effects, - const SkDescriptor* desc, +SkScalerContext* SkTypeface::createScalerContext(const SkDescriptor* desc, bool allowFailure) const { - SkScalerContext* c = this->onCreateScalerContext(effects, desc); + SkScalerContext* c = this->onCreateScalerContext(desc); if (!c && !allowFailure) { - c = new SkScalerContext_Empty(const_cast<SkTypeface*>(this), effects, desc); + c = new SkScalerContext_Empty(const_cast<SkTypeface*>(this), desc); } return c; } diff --git a/src/core/SkScalerContext.h b/src/core/SkScalerContext.h index ffde83cb0a..96674cd500 100644 --- a/src/core/SkScalerContext.h +++ b/src/core/SkScalerContext.h @@ -20,16 +20,6 @@ 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, @@ -210,7 +200,8 @@ public: kHinting_Mask = kHintingBit1_Flag | kHintingBit2_Flag, }; - SkScalerContext(SkTypeface*, const SkScalerContextEffects&, const SkDescriptor*); + + SkScalerContext(SkTypeface*, const SkDescriptor*); virtual ~SkScalerContext(); SkTypeface* getTypeface() const { return fTypeface.get(); } @@ -269,16 +260,13 @@ 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; @@ -338,12 +326,12 @@ private: friend class SkRandomScalerContext; // For debug purposes // never null - sk_sp<SkTypeface> fTypeface; + SkAutoTUnref<SkTypeface> fTypeface; - // optional objects, which may be null - sk_sp<SkPathEffect> fPathEffect; - sk_sp<SkMaskFilter> fMaskFilter; - sk_sp<SkRasterizer> fRasterizer; + // optional object, which may be null + SkPathEffect* fPathEffect; + SkMaskFilter* fMaskFilter; + 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 dc5306331c..6024c81a17 100644 --- a/src/core/SkTypeface.cpp +++ b/src/core/SkTypeface.cpp @@ -40,8 +40,7 @@ protected: SkEmptyTypeface() : SkTypeface(SkFontStyle(), 0, true) { } SkStreamAsset* onOpenStream(int* ttcIndex) const override { return nullptr; } - SkScalerContext* onCreateScalerContext(const SkScalerContextEffects&, - const SkDescriptor*) const override { + SkScalerContext* onCreateScalerContext(const SkDescriptor*) const override { return nullptr; } void onFilterRec(SkScalerContextRec*) const override { } @@ -349,8 +348,7 @@ bool SkTypeface::onComputeBounds(SkRect* bounds) const { desc->init(); desc->addEntry(kRec_SkDescriptorTag, sizeof(rec), &rec); - SkScalerContextEffects noeffects; - SkAutoTDelete<SkScalerContext> ctx(this->createScalerContext(noeffects, desc, true)); + SkAutoTDelete<SkScalerContext> ctx(this->createScalerContext(desc, true)); if (ctx.get()) { SkPaint::FontMetrics fm; ctx->getFontMetrics(&fm); diff --git a/src/fonts/SkGScalerContext.cpp b/src/fonts/SkGScalerContext.cpp index 0a9601bd7e..9766e34ff0 100644 --- a/src/fonts/SkGScalerContext.cpp +++ b/src/fonts/SkGScalerContext.cpp @@ -5,46 +5,15 @@ * 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* 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; } + SkGScalerContext(SkGTypeface*, const SkDescriptor*); + virtual ~SkGScalerContext(); protected: unsigned generateGlyphCount() override; @@ -61,6 +30,41 @@ 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(); } @@ -160,9 +164,9 @@ SkGTypeface::~SkGTypeface() { fProxy->unref(); } -SkScalerContext* SkGTypeface::onCreateScalerContext(const SkScalerContextEffects& effects, - const SkDescriptor* desc) const { - return new SkGScalerContext(const_cast<SkGTypeface*>(this), effects, desc); +SkScalerContext* SkGTypeface::onCreateScalerContext( + const SkDescriptor* desc) const { + return new SkGScalerContext(const_cast<SkGTypeface*>(this), desc); } void SkGTypeface::onFilterRec(SkScalerContextRec* rec) const { diff --git a/src/fonts/SkGScalerContext.h b/src/fonts/SkGScalerContext.h index 69d02ddf11..75f3ebedbd 100644 --- a/src/fonts/SkGScalerContext.h +++ b/src/fonts/SkGScalerContext.h @@ -20,8 +20,7 @@ public: const SkPaint& paint() const { return fPaint; } protected: - SkScalerContext* onCreateScalerContext(const SkScalerContextEffects&, - const SkDescriptor*) const override; + SkScalerContext* onCreateScalerContext(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 245052053e..c555dd2294 100644 --- a/src/fonts/SkRandomScalerContext.cpp +++ b/src/fonts/SkRandomScalerContext.cpp @@ -13,8 +13,7 @@ class SkRandomScalerContext : public SkScalerContext { public: - SkRandomScalerContext(SkRandomTypeface*, const SkScalerContextEffects&, - const SkDescriptor*, bool fFakeIt); + SkRandomScalerContext(SkRandomTypeface*, const SkDescriptor*, bool fFakeIt); virtual ~SkRandomScalerContext(); protected: @@ -36,14 +35,12 @@ private: #include "SkDescriptor.h" -SkRandomScalerContext::SkRandomScalerContext(SkRandomTypeface* face, - const SkScalerContextEffects& effects, - const SkDescriptor* desc, +SkRandomScalerContext::SkRandomScalerContext(SkRandomTypeface* face, const SkDescriptor* desc, bool fakeIt) - : SkScalerContext(face, effects, desc) + : SkScalerContext(face, desc) , fFace(face) , fFakeIt(fakeIt) { - fProxy = face->proxy()->createScalerContext(effects, desc); + fProxy = face->proxy()->createScalerContext(desc); } SkRandomScalerContext::~SkRandomScalerContext() { delete fProxy; } @@ -200,9 +197,9 @@ SkRandomTypeface::~SkRandomTypeface() { fProxy->unref(); } -SkScalerContext* SkRandomTypeface::onCreateScalerContext(const SkScalerContextEffects& effects, - const SkDescriptor* desc) const { - return new SkRandomScalerContext(const_cast<SkRandomTypeface*>(this), effects, desc, fFakeIt); +SkScalerContext* SkRandomTypeface::onCreateScalerContext( + const SkDescriptor* desc) const { + return new SkRandomScalerContext(const_cast<SkRandomTypeface*>(this), desc, fFakeIt); } void SkRandomTypeface::onFilterRec(SkScalerContextRec* rec) const { diff --git a/src/fonts/SkRandomScalerContext.h b/src/fonts/SkRandomScalerContext.h index 0e08f4b1ae..24b203f05c 100644 --- a/src/fonts/SkRandomScalerContext.h +++ b/src/fonts/SkRandomScalerContext.h @@ -25,8 +25,7 @@ public: const SkPaint& paint() const { return fPaint; } protected: - SkScalerContext* onCreateScalerContext(const SkScalerContextEffects&, - const SkDescriptor*) const override; + SkScalerContext* onCreateScalerContext(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 a2748564a5..600e2de609 100644 --- a/src/fonts/SkTestScalerContext.cpp +++ b/src/fonts/SkTestScalerContext.cpp @@ -183,9 +183,8 @@ SkASSERT(0); // incomplete class SkTestScalerContext : public SkScalerContext { public: - SkTestScalerContext(SkTestTypeface* face, const SkScalerContextEffects& effects, - const SkDescriptor* desc) - : SkScalerContext(face, effects, desc) + SkTestScalerContext(SkTestTypeface* face, const SkDescriptor* desc) + : SkScalerContext(face, desc) , fFace(face) { fRec.getSingleMatrix(&fMatrix); @@ -284,7 +283,6 @@ private: SkMatrix fMatrix; }; -SkScalerContext* SkTestTypeface::onCreateScalerContext(const SkScalerContextEffects& effects, - const SkDescriptor* desc) const { - return new SkTestScalerContext(const_cast<SkTestTypeface*>(this), effects, desc); +SkScalerContext* SkTestTypeface::onCreateScalerContext(const SkDescriptor* desc) const { + return new SkTestScalerContext(const_cast<SkTestTypeface*>(this), desc); } diff --git a/src/fonts/SkTestScalerContext.h b/src/fonts/SkTestScalerContext.h index 5e772601bb..4af9bf3dfd 100644 --- a/src/fonts/SkTestScalerContext.h +++ b/src/fonts/SkTestScalerContext.h @@ -67,8 +67,7 @@ public: void getMetrics(SkGlyph* glyph); void getPath(const SkGlyph& glyph, SkPath* path); protected: - SkScalerContext* onCreateScalerContext(const SkScalerContextEffects&, - const SkDescriptor* desc) const override; + SkScalerContext* onCreateScalerContext(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 a3bba4bc7f..0287eb08aa 100644 --- a/src/gpu/GrPathRendering.cpp +++ b/src/gpu/GrPathRendering.cpp @@ -14,9 +14,8 @@ class GlyphGenerator : public GrPathRange::PathGenerator { public: - GlyphGenerator(const SkTypeface& typeface, const SkScalerContextEffects& effects, - const SkDescriptor& desc) - : fScalerContext(typeface.createScalerContext(effects, &desc)) + GlyphGenerator(const SkTypeface& typeface, const SkDescriptor& desc) + : fScalerContext(typeface.createScalerContext(&desc)) #ifdef SK_DEBUG , fDesc(desc.copy()) #endif @@ -52,7 +51,6 @@ private: }; GrPathRange* GrPathRendering::createGlyphs(const SkTypeface* typeface, - const SkScalerContextEffects& effects, const SkDescriptor* desc, const GrStrokeInfo& stroke) { if (nullptr == typeface) { @@ -61,7 +59,7 @@ GrPathRange* GrPathRendering::createGlyphs(const SkTypeface* typeface, } if (desc) { - SkAutoTUnref<GlyphGenerator> generator(new GlyphGenerator(*typeface, effects, *desc)); + SkAutoTUnref<GlyphGenerator> generator(new GlyphGenerator(*typeface, *desc)); return this->createPathRange(generator, stroke); } @@ -78,10 +76,7 @@ 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, noEffects, *genericDesc)); + SkAutoTUnref<GlyphGenerator> generator(new GlyphGenerator(*typeface, *genericDesc)); return this->createPathRange(generator, stroke); } diff --git a/src/gpu/GrPathRendering.h b/src/gpu/GrPathRendering.h index 8ee3d7b3e2..b2863b5b36 100644 --- a/src/gpu/GrPathRendering.h +++ b/src/gpu/GrPathRendering.h @@ -125,8 +125,7 @@ public: * * @return a new path range populated with glyphs. */ - GrPathRange* createGlyphs(const SkTypeface*, const SkScalerContextEffects&, - const SkDescriptor*, const GrStrokeInfo&); + GrPathRange* createGlyphs(const SkTypeface*, 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 a8c9e5a3c7..4c60f079a7 100644 --- a/src/gpu/GrResourceProvider.cpp +++ b/src/gpu/GrResourceProvider.cpp @@ -81,13 +81,11 @@ GrPathRange* GrResourceProvider::createPathRange(GrPathRange::PathGenerator* gen return this->gpu()->pathRendering()->createPathRange(gen, stroke); } -GrPathRange* GrResourceProvider::createGlyphs(const SkTypeface* tf, - const SkScalerContextEffects& effects, - const SkDescriptor* desc, +GrPathRange* GrResourceProvider::createGlyphs(const SkTypeface* tf, const SkDescriptor* desc, const GrStrokeInfo& stroke) { SkASSERT(this->gpu()->pathRendering()); - return this->gpu()->pathRendering()->createGlyphs(tf, effects, desc, stroke); + return this->gpu()->pathRendering()->createGlyphs(tf, desc, stroke); } GrBuffer* GrResourceProvider::createBuffer(size_t size, GrBufferType intendedType, diff --git a/src/gpu/GrResourceProvider.h b/src/gpu/GrResourceProvider.h index 5beb70a3d8..d8e595a47b 100644 --- a/src/gpu/GrResourceProvider.h +++ b/src/gpu/GrResourceProvider.h @@ -85,8 +85,7 @@ public: */ GrPath* createPath(const SkPath&, const GrStrokeInfo&); GrPathRange* createPathRange(GrPathRange::PathGenerator*, const GrStrokeInfo&); - GrPathRange* createGlyphs(const SkTypeface*, const SkScalerContextEffects&, - const SkDescriptor*, const GrStrokeInfo&); + GrPathRange* createGlyphs(const SkTypeface*, 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 afbff46994..4b339d4adb 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(&run->fEffects, desc, props, scalerContextFlags, viewMatrix); + skPaint.getScalerContextDescriptor(desc, props, scalerContextFlags, viewMatrix); run->fTypeface.reset(SkSafeRef(skPaint.getTypeface())); - return SkGlyphCache::DetachCache(run->fTypeface, run->fEffects, desc->getDesc()); + return SkGlyphCache::DetachCache(run->fTypeface, desc->getDesc()); } void GrAtlasTextBlob::appendGlyph(int runIndex, diff --git a/src/gpu/text/GrAtlasTextBlob.h b/src/gpu/text/GrAtlasTextBlob.h index bc1e0b4afc..36e45abcff 100644 --- a/src/gpu/text/GrAtlasTextBlob.h +++ b/src/gpu/text/GrAtlasTextBlob.h @@ -474,7 +474,6 @@ 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 7c3cf68524..7283e6d516 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, run->fEffects, *desc); + *cache = SkGlyphCache::DetachCache(run->fTypeface, *desc); *scaler = GrTextUtils::GetGrFontScaler(*cache); *typeface = run->fTypeface; } diff --git a/src/gpu/text/GrStencilAndCoverTextContext.cpp b/src/gpu/text/GrStencilAndCoverTextContext.cpp index a8dc20215a..f0c66979d5 100644 --- a/src/gpu/text/GrStencilAndCoverTextContext.cpp +++ b/src/gpu/text/GrStencilAndCoverTextContext.cpp @@ -539,13 +539,10 @@ GrPathRange* GrStencilAndCoverTextContext::TextRun::createGlyphs(GrContext* ctx) ctx->resourceProvider()->findAndRefResourceByUniqueKey(fGlyphPathsKey)); if (nullptr == glyphs) { if (fUsingRawGlyphPaths) { - SkScalerContextEffects noeffects; - glyphs = ctx->resourceProvider()->createGlyphs(fFont.getTypeface(), noeffects, - nullptr, fStroke); + glyphs = ctx->resourceProvider()->createGlyphs(fFont.getTypeface(), 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 c368c214e1..3616bcada1 100644 --- a/src/gpu/text/GrTextUtils.cpp +++ b/src/gpu/text/GrTextUtils.cpp @@ -260,12 +260,10 @@ 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(&effects, &desc, props, SkPaint::kNone_ScalerContextFlags, - nullptr); - SkGlyphCache* origPaintCache = SkGlyphCache::DetachCache(skPaint.getTypeface(), effects, + skPaint.getScalerContextDescriptor(&desc, props, SkPaint::kNone_ScalerContextFlags, nullptr); + SkGlyphCache* origPaintCache = SkGlyphCache::DetachCache(skPaint.getTypeface(), desc.getDesc()); SkTArray<SkScalar> positions; diff --git a/src/ports/SkFontHost_FreeType.cpp b/src/ports/SkFontHost_FreeType.cpp index 55eb87fe6d..44eb50ce40 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 SkScalerContextEffects&, const SkDescriptor* desc); + SkScalerContext_FreeType(SkTypeface*, 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 SkScalerContextEffects& effects, - const SkDescriptor* desc) const { +SkScalerContext* SkTypeface_FreeType::onCreateScalerContext( + const SkDescriptor* desc) const { SkScalerContext_FreeType* c = - new SkScalerContext_FreeType(const_cast<SkTypeface_FreeType*>(this), effects, desc); + new SkScalerContext_FreeType(const_cast<SkTypeface_FreeType*>(this), desc); if (!c->success()) { delete c; c = nullptr; @@ -790,10 +790,8 @@ static FT_Int chooseBitmapStrike(FT_Face face, FT_F26Dot6 scaleY) { return chosenStrikeIndex; } -SkScalerContext_FreeType::SkScalerContext_FreeType(SkTypeface* typeface, - const SkScalerContextEffects& effects, - const SkDescriptor* desc) - : SkScalerContext_FreeType_Base(typeface, effects, desc) +SkScalerContext_FreeType::SkScalerContext_FreeType(SkTypeface* typeface, const SkDescriptor* desc) + : SkScalerContext_FreeType_Base(typeface, desc) , fFace(nullptr) , fFTSize(nullptr) , fStrikeIndex(-1) diff --git a/src/ports/SkFontHost_FreeType_common.h b/src/ports/SkFontHost_FreeType_common.h index 8c13a80aa5..99b43dccca 100644 --- a/src/ports/SkFontHost_FreeType_common.h +++ b/src/ports/SkFontHost_FreeType_common.h @@ -26,9 +26,8 @@ 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 SkScalerContextEffects& effects, - const SkDescriptor *desc) - : INHERITED(typeface, effects, desc) + SkScalerContext_FreeType_Base(SkTypeface* typeface, const SkDescriptor *desc) + : INHERITED(typeface, desc) {} void generateGlyphImage(FT_Face face, const SkGlyph& glyph); @@ -76,8 +75,8 @@ protected: , fGlyphCount(-1) {} - virtual SkScalerContext* onCreateScalerContext(const SkScalerContextEffects&, - const SkDescriptor*) const override; + virtual SkScalerContext* onCreateScalerContext( + 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 8d4a3f8cfc..ec35707dd1 100644 --- a/src/ports/SkFontHost_mac.cpp +++ b/src/ports/SkFontHost_mac.cpp @@ -473,8 +473,7 @@ 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 SkScalerContextEffects&, - const SkDescriptor*) const override; + SkScalerContext* onCreateScalerContext(const SkDescriptor*) const override; void onFilterRec(SkScalerContextRec*) const override; void onGetFontDescriptor(SkFontDescriptor*, bool*) const override; virtual SkAdvancedTypefaceMetrics* onGetAdvancedTypefaceMetrics( @@ -630,7 +629,7 @@ struct GlyphRect { class SkScalerContext_Mac : public SkScalerContext { public: - SkScalerContext_Mac(SkTypeface_Mac*, const SkScalerContextEffects&, const SkDescriptor*); + SkScalerContext_Mac(SkTypeface_Mac*, const SkDescriptor*); protected: unsigned generateGlyphCount(void) override; @@ -739,9 +738,8 @@ 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, effects, desc) + : INHERITED(typeface, desc) , fFBoundingBoxes() , fFBoundingBoxesGlyphOffset(0) , fGeneratedFBoundingBoxes(false) @@ -1939,9 +1937,8 @@ size_t SkTypeface_Mac::onGetTableData(SkFontTableTag tag, size_t offset, return length; } -SkScalerContext* SkTypeface_Mac::onCreateScalerContext(const SkScalerContextEffects& effects, - const SkDescriptor* desc) const { - return new SkScalerContext_Mac(const_cast<SkTypeface_Mac*>(this), effects, desc); +SkScalerContext* SkTypeface_Mac::onCreateScalerContext(const SkDescriptor* desc) const { + return new SkScalerContext_Mac(const_cast<SkTypeface_Mac*>(this), desc); } void SkTypeface_Mac::onFilterRec(SkScalerContextRec* rec) const { diff --git a/src/ports/SkFontHost_win.cpp b/src/ports/SkFontHost_win.cpp index 395307cf04..f772d8c57e 100644 --- a/src/ports/SkFontHost_win.cpp +++ b/src/ports/SkFontHost_win.cpp @@ -257,8 +257,7 @@ public: protected: SkStreamAsset* onOpenStream(int* ttcIndex) const override; - SkScalerContext* onCreateScalerContext(const SkScalerContextEffects&, - const SkDescriptor*) const override; + SkScalerContext* onCreateScalerContext(const SkDescriptor*) const override; void onFilterRec(SkScalerContextRec*) const override; SkAdvancedTypefaceMetrics* onGetAdvancedTypefaceMetrics( PerGlyphInfo, const uint32_t*, uint32_t) const override; @@ -534,7 +533,7 @@ const void* HDCOffscreen::draw(const SkGlyph& glyph, bool isBW, class SkScalerContext_GDI : public SkScalerContext { public: - SkScalerContext_GDI(SkTypeface*, const SkScalerContextEffects&, const SkDescriptor* desc); + SkScalerContext_GDI(SkTypeface*, const SkDescriptor* desc); virtual ~SkScalerContext_GDI(); // Returns true if the constructor was able to complete all of its @@ -605,9 +604,8 @@ static BYTE compute_quality(const SkScalerContext::Rec& rec) { } SkScalerContext_GDI::SkScalerContext_GDI(SkTypeface* rawTypeface, - const SkScalerContextEffects& effects, - const SkDescriptor* desc) - : SkScalerContext(rawTypeface, effects, desc) + const SkDescriptor* desc) + : SkScalerContext(rawTypeface, desc) , fDDC(0) , fSavefont(0) , fFont(0) @@ -2287,10 +2285,8 @@ size_t LogFontTypeface::onGetTableData(SkFontTableTag tag, size_t offset, return bufferSize == GDI_ERROR ? 0 : bufferSize; } -SkScalerContext* LogFontTypeface::onCreateScalerContext(const SkScalerContextEffects& effects, - const SkDescriptor* desc) const { - SkScalerContext_GDI* ctx = new SkScalerContext_GDI(const_cast<LogFontTypeface*>(this), - effects, desc); +SkScalerContext* LogFontTypeface::onCreateScalerContext(const SkDescriptor* desc) const { + SkScalerContext_GDI* ctx = new SkScalerContext_GDI(const_cast<LogFontTypeface*>(this), 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 4609d04851..f276762bbf 100644 --- a/src/ports/SkScalerContext_win_dw.cpp +++ b/src/ports/SkScalerContext_win_dw.cpp @@ -204,9 +204,8 @@ static bool is_axis_aligned(const SkScalerContext::Rec& rec) { } SkScalerContext_DW::SkScalerContext_DW(DWriteFontTypeface* typeface, - const SkScalerContextEffects& effects, const SkDescriptor* desc) - : SkScalerContext(typeface, effects, desc) + : SkScalerContext(typeface, desc) , fTypeface(SkRef(typeface)) , fGlyphCount(-1) { diff --git a/src/ports/SkScalerContext_win_dw.h b/src/ports/SkScalerContext_win_dw.h index 9b24772036..abf2bc9aa0 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 SkScalerContextEffects&, const SkDescriptor*); + SkScalerContext_DW(DWriteFontTypeface*, const SkDescriptor* desc); virtual ~SkScalerContext_DW(); protected: diff --git a/src/ports/SkTypeface_win_dw.cpp b/src/ports/SkTypeface_win_dw.cpp index 18c63a5089..160c66ed0e 100644 --- a/src/ports/SkTypeface_win_dw.cpp +++ b/src/ports/SkTypeface_win_dw.cpp @@ -244,9 +244,8 @@ SkStreamAsset* DWriteFontTypeface::onOpenStream(int* ttcIndex) const { return new SkDWriteFontFileStream(fontFileStream.get()); } -SkScalerContext* DWriteFontTypeface::onCreateScalerContext(const SkScalerContextEffects& effects, - const SkDescriptor* desc) const { - return new SkScalerContext_DW(const_cast<DWriteFontTypeface*>(this), effects, desc); +SkScalerContext* DWriteFontTypeface::onCreateScalerContext(const SkDescriptor* desc) const { + return new SkScalerContext_DW(const_cast<DWriteFontTypeface*>(this), 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 b1237c0e98..cdbeeaa785 100644 --- a/src/ports/SkTypeface_win_dw.h +++ b/src/ports/SkTypeface_win_dw.h @@ -96,8 +96,7 @@ protected: } SkStreamAsset* onOpenStream(int* ttcIndex) const override; - SkScalerContext* onCreateScalerContext(const SkScalerContextEffects&, - const SkDescriptor*) const override; + SkScalerContext* onCreateScalerContext(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 96af746ace..b663b45e1f 100644 --- a/tests/FontMgrTest.cpp +++ b/tests/FontMgrTest.cpp @@ -125,8 +125,7 @@ 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 SkScalerContextEffects&, - const SkDescriptor*) const override { + SkScalerContext* onCreateScalerContext(const SkDescriptor*) const override { return nullptr; } void onFilterRec(SkScalerContextRec*) const override { } |