aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrTessellator.h
diff options
context:
space:
mode:
authorGravatar senorblanco <senorblanco@chromium.org>2016-08-31 10:36:19 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-08-31 10:36:19 -0700
commitf57372daf0562a187c24d427366ac6d0cb980c9b (patch)
treec3e0009b1a5d4efff26b990b005984dddd6ac42e /src/gpu/GrTessellator.h
parent19ff1035d3334ffa513c93edce04662bb5ead5bd (diff)
Screenspace AA tessellated GPU path rendering.
This is an approach to antialiased concave path rendering on the GPU without using MSAA. It uses GrTessellator to extract boundary contours from the given path, then inflates by half a pixel in screen space each direction, then renders the result with zero alpha on the outer contour and one alpha on in the inner contour. This requires two passes through the tessellation code: one to extract the boundaries, then one to tessellate the result. This gives approximately a 3X improvement on the IE chalkboard demo in non-MSAA mode, a 30-40% improvement on MotionMark's "Fill Paths", and a ~3X improvement on MotionMark's "canvas arcTo segments". It works best for large, simple paths, so there's currently a limit of 10 verbs in the onCanDrawPath() check. This dovetails nicely with the distance field path renderer's support for small, detailed (and cached) paths. BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1152733009 NOTRY=true Review-Url: https://codereview.chromium.org/1152733009
Diffstat (limited to 'src/gpu/GrTessellator.h')
-rw-r--r--src/gpu/GrTessellator.h12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/gpu/GrTessellator.h b/src/gpu/GrTessellator.h
index 7cc4311aa5..dd92015cc2 100644
--- a/src/gpu/GrTessellator.h
+++ b/src/gpu/GrTessellator.h
@@ -8,6 +8,7 @@
#ifndef GrTessellator_DEFINED
#define GrTessellator_DEFINED
+#include "GrColor.h"
#include "SkPoint.h"
class SkPath;
@@ -23,9 +24,13 @@ namespace GrTessellator {
class VertexAllocator {
public:
+ VertexAllocator(size_t stride) : fStride(stride) {}
virtual ~VertexAllocator() {}
- virtual SkPoint* lock(int vertexCount) = 0;
+ virtual void* lock(int vertexCount) = 0;
virtual void unlock(int actualCount) = 0;
+ size_t stride() const { return fStride; }
+private:
+ size_t fStride;
};
struct WindingVertex {
@@ -40,8 +45,9 @@ struct WindingVertex {
int PathToVertices(const SkPath& path, SkScalar tolerance, const SkRect& clipBounds,
WindingVertex** verts);
-int PathToTriangles(const SkPath& path, SkScalar tolerance, const SkRect& clipBounds,
- VertexAllocator*, bool *isLinear);
+int PathToTriangles(const SkPath& path, SkScalar tolerance, const SkRect& clipBounds,
+ VertexAllocator*, bool antialias, const GrColor& color,
+ bool canTweakAlphaForCoverage, bool *isLinear);
}
#endif