diff options
author | 2014-09-18 13:51:53 -0700 | |
---|---|---|
committer | 2014-09-18 13:51:53 -0700 | |
commit | 855d83ff79c6c822b2ad653f2f890178ad0f637b (patch) | |
tree | 8b48ca606e25d3a02ce9de8018ae33ad86c58b53 /src/gpu/GrStencilAndCoverTextContext.h | |
parent | abfaf63bd0331fb8f20b7ef47b384fcb39418669 (diff) |
Uses a single pre-baked set of paths for drawing nvpr text of a given
typeface. Loads the paths using the driver's glyph loading routines.
Refactors GrPathRange to accept a PathGenerator class that it uses to
lazily initialize its paths. The client code is no longer expected to
initialize the paths in a GrPathRange; instead it must provide a
PathGenerator* instance to createPathRange().
Adds a new createGlyphs() method to GrPathRendering that creates a
range of glyph paths, indexed by glyph id. GrPathRendering implements
createGlyphs() with a PathGenerator that loads glyph paths using the
skia frameworks. GrGLPathRendering uses glMemoryGlyphIndexArrayNV()
instead, when possible, to load the glyph paths.
Removes all GlyphPathRange logic from GrStencilAndCoverTextContext.
It instead uses createGlyphs().
BUG=skia:2939
R=bsalomon@google.com, jvanverth@google.com
Author: cdalton@nvidia.com
Review URL: https://codereview.chromium.org/563283004
Diffstat (limited to 'src/gpu/GrStencilAndCoverTextContext.h')
-rw-r--r-- | src/gpu/GrStencilAndCoverTextContext.h | 30 |
1 files changed, 23 insertions, 7 deletions
diff --git a/src/gpu/GrStencilAndCoverTextContext.h b/src/gpu/GrStencilAndCoverTextContext.h index 08d7526b7e..5ba4a7027b 100644 --- a/src/gpu/GrStencilAndCoverTextContext.h +++ b/src/gpu/GrStencilAndCoverTextContext.h @@ -15,6 +15,7 @@ class GrTextStrike; class GrPath; +class GrPathRange; /* * This class implements text rendering using stencil and cover path rendering @@ -37,15 +38,31 @@ public: virtual bool canDraw(const SkPaint& paint) SK_OVERRIDE; private: - class GlyphPathRange; static const int kGlyphBufferSize = 1024; - enum DeviceSpaceGlyphsBehavior { - kUseIfNeeded_DeviceSpaceGlyphsBehavior, - kDoNotUse_DeviceSpaceGlyphsBehavior, + enum RenderMode { + /** + * This is the render mode used by drawText(), which is mainly used by + * the Skia unit tests. It tries match the other text backends exactly, + * with the exception of not implementing LCD text, and doing anti- + * aliasing with the built-in MSAA. + */ + kMaxAccuracy_RenderMode, + + /** + * This is the render mode used by drawPosText(). It ignores hinting and + * LCD text, even if the client provided positions for hinted glyphs, + * and renders from a canonically-sized, generic set of paths for the + * given typeface. In the future we should work out a system for the + * client to know it should not provide hinted glyph positions. This + * render mode also tries to use GPU stroking for fake bold, even when + * SK_USE_FREETYPE_EMBOLDEN is set. + */ + kMaxPerformance_RenderMode, }; + void init(const GrPaint&, const SkPaint&, size_t textByteLength, - DeviceSpaceGlyphsBehavior, SkScalar textTranslateY = 0); + RenderMode, SkScalar textTranslateY = 0); void initGlyphs(SkGlyphCache* cache); void appendGlyph(uint16_t glyphID, float x); void appendGlyph(uint16_t glyphID, float x, float y); @@ -55,9 +72,8 @@ private: GrDrawState::AutoRestoreEffects fStateRestore; SkScalar fTextRatio; float fTextInverseRatio; - SkStrokeRec fStroke; SkGlyphCache* fGlyphCache; - GlyphPathRange* fGlyphs; + GrPathRange* fGlyphs; uint32_t fIndexBuffer[kGlyphBufferSize]; float fTransformBuffer[2 * kGlyphBufferSize]; GrDrawTarget::PathTransformType fTransformType; |