| 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 {
|
|
|