Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(176)

Unified Diff: src/fonts/SkGScalerContext.cpp

Issue 1872253004: Revert of Pass effects directly to fontcache (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/fonts/SkGScalerContext.h ('k') | src/fonts/SkRandomScalerContext.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/fonts/SkGScalerContext.cpp
diff --git a/src/fonts/SkGScalerContext.cpp b/src/fonts/SkGScalerContext.cpp
index 0a9601bd7e48cd1afb080557a340fcbf3c7136b7..9766e34ff07b33289a0a1c1054d628650d0e1919 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;
@@ -60,6 +29,41 @@
SkScalerContext* fProxy;
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 @@
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 {
« no previous file with comments | « src/fonts/SkGScalerContext.h ('k') | src/fonts/SkRandomScalerContext.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698