aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrPathRendering.cpp
diff options
context:
space:
mode:
authorGravatar kkinnunen <kkinnunen@nvidia.com>2015-05-18 23:02:07 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2015-05-18 23:02:07 -0700
commit50b58e6fbcc50785ceffacb2c51b22c6e67a7ab7 (patch)
tree90e4c1dbf12534523f1f7e8a1cece158bd58cb45 /src/gpu/GrPathRendering.cpp
parent54b8511189bb5da6bfd248fa63f5c4156e9e2bd6 (diff)
Improve caching of dashed paths in GrStencilAndCoverPathRenderer
Improve caching of dashed paths in GrStencilAndCoverPathRenderer. Look up the (NVPR specific) GrGLPath based on GrStrokeInfo and the original path. Use unique keys for all GrPaths. Dash the path with Skia dash stroker and use that path geometry for NVPR path. NVPR internal dashing stroke is not used, because the dashing implementation of NVPR does not match Skia implementation. Review URL: https://codereview.chromium.org/1116123003
Diffstat (limited to 'src/gpu/GrPathRendering.cpp')
-rw-r--r--src/gpu/GrPathRendering.cpp19
1 files changed, 13 insertions, 6 deletions
diff --git a/src/gpu/GrPathRendering.cpp b/src/gpu/GrPathRendering.cpp
index fba55d5e1e..e97d754a46 100644
--- a/src/gpu/GrPathRendering.cpp
+++ b/src/gpu/GrPathRendering.cpp
@@ -15,13 +15,18 @@
class GlyphGenerator : public GrPathRange::PathGenerator {
public:
GlyphGenerator(const SkTypeface& typeface, const SkDescriptor& desc)
- : fDesc(desc.copy()),
- fScalerContext(typeface.createScalerContext(fDesc)) {
+ : fScalerContext(typeface.createScalerContext(&desc))
+#ifdef SK_DEBUG
+ , fDesc(desc.copy())
+#endif
+ {
fFlipMatrix.setScale(1, -1);
}
virtual ~GlyphGenerator() {
+#ifdef SK_DEBUG
SkDescriptor::Free(fDesc);
+#endif
}
int getNumPaths() override {
@@ -36,20 +41,22 @@ public:
fScalerContext->getPath(skGlyph, out);
out->transform(fFlipMatrix); // Load glyphs with the inverted y-direction.
}
-
+#ifdef SK_DEBUG
bool isEqualTo(const SkDescriptor& desc) const override {
return fDesc->equals(desc);
}
-
+#endif
private:
- SkDescriptor* const fDesc;
const SkAutoTDelete<SkScalerContext> fScalerContext;
SkMatrix fFlipMatrix;
+#ifdef SK_DEBUG
+ SkDescriptor* const fDesc;
+#endif
};
GrPathRange* GrPathRendering::createGlyphs(const SkTypeface* typeface,
const SkDescriptor* desc,
- const SkStrokeRec& stroke) {
+ const GrStrokeInfo& stroke) {
if (NULL == typeface) {
typeface = SkTypeface::GetDefaultTypeface();
SkASSERT(NULL != typeface);