diff options
author | commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-12-19 16:12:25 +0000 |
---|---|---|
committer | commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-12-19 16:12:25 +0000 |
commit | 8128d8c119382279918b90ad8d80ccb3aaebb8a0 (patch) | |
tree | 5b6e0de49787b72a8438a5e487e5483562147382 /include | |
parent | 144cba079cb56229d11a2abf370b43232b5d6cc4 (diff) |
Move distance field font code into GrDistanceFieldTextContext.
This avoids the SkDraw path and renders the distance field glyphs directly from
GrDistanceFieldTextContext. It also disables LCD, subpixel and autohinting, and
removes the supporting code when rendering DF fonts.
R=reed@google.com, bsalomon@google.com, robertphillips@google.com
Author: jvanverth@google.com
Review URL: https://codereview.chromium.org/85653004
git-svn-id: http://skia.googlecode.com/svn/trunk@12770 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'include')
-rw-r--r-- | include/core/SkDevice.h | 16 | ||||
-rw-r--r-- | include/core/SkDraw.h | 13 | ||||
-rw-r--r-- | include/core/SkPaint.h | 1 | ||||
-rwxr-xr-x | include/gpu/GrDistanceFieldTextContext.h | 13 |
4 files changed, 27 insertions, 16 deletions
diff --git a/include/core/SkDevice.h b/include/core/SkDevice.h index d63af0424a..3764ff39ef 100644 --- a/include/core/SkDevice.h +++ b/include/core/SkDevice.h @@ -375,6 +375,15 @@ protected: // either is identical to kNative_Premul_Config8888. Otherwise, -1. static const SkCanvas::Config8888 kPMColorAlias; +protected: + /** + * Leaky properties are those which the device should be applying but it isn't. + * These properties will be applied by the draw, when and as it can. + * If the device does handle a property, that property should be set to the identity value + * for that property, effectively making it non-leaky. + */ + SkDeviceProperties fLeakyProperties; + private: friend class SkCanvas; friend struct DeviceCM; //for setMatrixClip @@ -412,13 +421,6 @@ private: SkIPoint fOrigin; SkMetaData* fMetaData; - /** - * Leaky properties are those which the device should be applying but it isn't. - * These properties will be applied by the draw, when and as it can. - * If the device does handle a property, that property should be set to the identity value - * for that property, effectively making it non-leaky. - */ - SkDeviceProperties fLeakyProperties; #ifdef SK_DEBUG bool fAttachedToCanvas; diff --git a/include/core/SkDraw.h b/include/core/SkDraw.h index 8ccb1c0116..f0759dc3c5 100644 --- a/include/core/SkDraw.h +++ b/include/core/SkDraw.h @@ -107,11 +107,12 @@ public: static RectType ComputeRectType(const SkPaint&, const SkMatrix&, SkPoint* strokeSize); - void drawText_asPaths(const char text[], size_t byteLength, - SkScalar x, SkScalar y, const SkPaint&) const; - void drawPosText_asPaths(const char text[], size_t byteLength, - const SkScalar pos[], SkScalar constY, - int scalarsPerPosition, const SkPaint&) const; + static bool ShouldDrawTextAsPaths(const SkPaint&, const SkMatrix&); + void drawText_asPaths(const char text[], size_t byteLength, + SkScalar x, SkScalar y, const SkPaint&) const; + void drawPosText_asPaths(const char text[], size_t byteLength, + const SkScalar pos[], SkScalar constY, + int scalarsPerPosition, const SkPaint&) const; private: void drawDevMask(const SkMask& mask, const SkPaint&) const; @@ -131,8 +132,6 @@ private: bool SK_WARN_UNUSED_RESULT computeConservativeLocalClipBounds(SkRect* bounds) const; - static bool ShouldDrawTextAsPaths(const SkPaint&, const SkMatrix&); - public: const SkBitmap* fBitmap; // required const SkMatrix* fMatrix; // required diff --git a/include/core/SkPaint.h b/include/core/SkPaint.h index 4930842a2e..7dc3a4e03c 100644 --- a/include/core/SkPaint.h +++ b/include/core/SkPaint.h @@ -1070,6 +1070,7 @@ private: friend class SkDraw; friend class SkGraphics; // So Term() can be called. friend class SkPDFDevice; + friend class GrDistanceFieldTextContext; friend class SkTextToPathIter; friend class SkCanonicalizePaint; diff --git a/include/gpu/GrDistanceFieldTextContext.h b/include/gpu/GrDistanceFieldTextContext.h index 217faf3cb0..3e00ff2477 100755 --- a/include/gpu/GrDistanceFieldTextContext.h +++ b/include/gpu/GrDistanceFieldTextContext.h @@ -17,12 +17,21 @@ class GrTextStrike; */ class GrDistanceFieldTextContext : public GrTextContext { public: - GrDistanceFieldTextContext(GrContext*, const GrPaint&, SkColor, SkScalar textRatio); + GrDistanceFieldTextContext(GrContext*, const GrPaint&, const SkPaint&); virtual ~GrDistanceFieldTextContext(); virtual void drawPackedGlyph(GrGlyph::PackedID, GrFixed left, GrFixed top, GrFontScaler*) SK_OVERRIDE; + void drawText(const char text[], size_t byteLength, + SkScalar x, SkScalar y, SkGlyphCache*, GrFontScaler*); + void drawPosText(const char text[], size_t byteLength, + const SkScalar pos[], SkScalar constY, + int scalarsPerPosition, + SkGlyphCache* cache, GrFontScaler* fontScaler); + + const SkPaint& getSkPaint() { return fSkPaint; } + private: GrTextStrike* fStrike; SkScalar fTextRatio; @@ -36,7 +45,7 @@ private: kDefaultRequestedVerts = kDefaultRequestedGlyphs * 4, }; - SkColor fSkPaintColor; + SkPaint fSkPaint; SkPoint* fVertices; int32_t fMaxVertices; GrTexture* fCurrTexture; |