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 /src/fonts | |
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
Diffstat (limited to 'src/fonts')
-rw-r--r-- | src/fonts/SkGScalerContext.cpp | 76 | ||||
-rw-r--r-- | src/fonts/SkGScalerContext.h | 3 | ||||
-rw-r--r-- | src/fonts/SkRandomScalerContext.cpp | 17 | ||||
-rw-r--r-- | src/fonts/SkRandomScalerContext.h | 3 | ||||
-rw-r--r-- | src/fonts/SkTestScalerContext.cpp | 10 | ||||
-rw-r--r-- | src/fonts/SkTestScalerContext.h | 3 |
6 files changed, 54 insertions, 58 deletions
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, |