aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrPathRendering.h
diff options
context:
space:
mode:
authorGravatar cdalton <cdalton@nvidia.com>2014-09-18 13:51:53 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2014-09-18 13:51:53 -0700
commit855d83ff79c6c822b2ad653f2f890178ad0f637b (patch)
tree8b48ca606e25d3a02ce9de8018ae33ad86c58b53 /src/gpu/GrPathRendering.h
parentabfaf63bd0331fb8f20b7ef47b384fcb39418669 (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/GrPathRendering.h')
-rw-r--r--src/gpu/GrPathRendering.h36
1 files changed, 34 insertions, 2 deletions
diff --git a/src/gpu/GrPathRendering.h b/src/gpu/GrPathRendering.h
index 70fa61c27e..26cfa110ce 100644
--- a/src/gpu/GrPathRendering.h
+++ b/src/gpu/GrPathRendering.h
@@ -9,10 +9,12 @@
#define GrPathRendering_DEFINED
#include "SkPath.h"
+#include "GrPathRange.h"
class SkStrokeRec;
+class SkDescriptor;
+class SkTypeface;
class GrPath;
-class GrPathRange;
class GrGpu;
/**
@@ -77,7 +79,37 @@ public:
* @param SkStrokeRec the common stroke applied to each path in the range.
* @return a new path range.
*/
- virtual GrPathRange* createPathRange(size_t size, const SkStrokeRec&) = 0;
+ virtual GrPathRange* createPathRange(GrPathRange::PathGenerator*, const SkStrokeRec&) = 0;
+
+ /**
+ * Creates a range of glyph paths, indexed by glyph id. The glyphs will have an
+ * inverted y-direction in order to match the raw font path data. The caller owns
+ * a ref on the returned path range which must be balanced by a call to unref.
+ *
+ * @param SkTypeface Typeface that defines the glyphs.
+ * If null, the default typeface will be used.
+ *
+ * @param SkDescriptor Additional font configuration that specifies the font's size,
+ * stroke, and other flags. This will generally come from an
+ * SkGlyphCache.
+ *
+ * It is recommended to leave this value null when possible, in
+ * which case the glyphs will be loaded directly from the font's
+ * raw path data and sized at SkPaint::kCanonicalTextSizeForPaths.
+ * This will result in less memory usage and more efficient paths.
+ *
+ * If non-null, the glyph paths will match the font descriptor,
+ * including with the stroke information baked directly into
+ * the outlines.
+ *
+ * @param SkStrokeRec Common stroke that the GPU will apply to every path. Note that
+ * if the glyph outlines contain baked-in strokes from the font
+ * descriptor, the GPU stroke will be applied on top of those
+ * outlines.
+ *
+ * @return a new path range populated with glyphs.
+ */
+ virtual GrPathRange* createGlyphs(const SkTypeface*, const SkDescriptor*, const SkStrokeRec&) = 0;
virtual void stencilPath(const GrPath*, SkPath::FillType) = 0;
virtual void drawPath(const GrPath*, SkPath::FillType) = 0;