aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/effects
diff options
context:
space:
mode:
authorGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2014-02-07 21:13:11 +0000
committerGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2014-02-07 21:13:11 +0000
commitb21fac156d9287d6c0cfd446d707c4c7be6fae6e (patch)
treec23de31a7d04eb6e53dfaa64c715f72e3b67e510 /src/gpu/effects
parent5bc7339aab03b71d503a48a0f75cf23b62a4d6cc (diff)
Make GMs aware of what tool they're being run in.
Add a saveLayer set of draws to convex_poly_clip and fix GPU bug where polygon clips don't account for the translation between clip and device space. BUG=skia:2051 R=robertphillips@google.com, reed@google.com Author: bsalomon@google.com Review URL: https://codereview.chromium.org/148283017 git-svn-id: http://skia.googlecode.com/svn/trunk@13371 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/gpu/effects')
-rw-r--r--src/gpu/effects/GrConvexPolyEffect.cpp12
-rw-r--r--src/gpu/effects/GrConvexPolyEffect.h5
2 files changed, 13 insertions, 4 deletions
diff --git a/src/gpu/effects/GrConvexPolyEffect.cpp b/src/gpu/effects/GrConvexPolyEffect.cpp
index e47ed0f866..98af6948ea 100644
--- a/src/gpu/effects/GrConvexPolyEffect.cpp
+++ b/src/gpu/effects/GrConvexPolyEffect.cpp
@@ -97,7 +97,7 @@ GrGLEffect::EffectKey GrGLConvexPolyEffect::GenKey(const GrDrawEffect& drawEffec
//////////////////////////////////////////////////////////////////////////////
-GrEffectRef* GrConvexPolyEffect::Create(EdgeType type, const SkPath& path) {
+GrEffectRef* GrConvexPolyEffect::Create(EdgeType type, const SkPath& path, const SkVector* offset) {
if (path.getSegmentMasks() != SkPath::kLine_SegmentMask ||
!path.isConvex() ||
path.isInverseFillType()) {
@@ -114,6 +114,13 @@ GrEffectRef* GrConvexPolyEffect::Create(EdgeType type, const SkPath& path) {
SkPath::Direction dir;
SkAssertResult(path.cheapComputeDirection(&dir));
+ SkVector t;
+ if (NULL == offset) {
+ t.set(0, 0);
+ } else {
+ t = *offset;
+ }
+
int count = path.getPoints(pts, kMaxEdges);
int n = 0;
for (int lastPt = count - 1, i = 0; i < count; lastPt = i++) {
@@ -127,7 +134,8 @@ GrEffectRef* GrConvexPolyEffect::Create(EdgeType type, const SkPath& path) {
edges[3 * n] = -v.fY;
edges[3 * n + 1] = v.fX;
}
- edges[3 * n + 2] = -(edges[3 * n] * pts[i].fX + edges[3 * n + 1] * pts[i].fY);
+ SkPoint p = pts[i] + t;
+ edges[3 * n + 2] = -(edges[3 * n] * p.fX + edges[3 * n + 1] * p.fY);
++n;
}
}
diff --git a/src/gpu/effects/GrConvexPolyEffect.h b/src/gpu/effects/GrConvexPolyEffect.h
index 035d9e95dd..225e729242 100644
--- a/src/gpu/effects/GrConvexPolyEffect.h
+++ b/src/gpu/effects/GrConvexPolyEffect.h
@@ -57,9 +57,10 @@ public:
/**
* Creates an effect that clips against the path. If the path is not a convex polygon, is
- * inverse filled, or has too many edges, this will return NULL.
+ * inverse filled, or has too many edges, this will return NULL. If offset is non-NULL, then
+ * the path is translated by the vector.
*/
- static GrEffectRef* Create(EdgeType, const SkPath&);
+ static GrEffectRef* Create(EdgeType, const SkPath&, const SkVector* offset= NULL);
virtual ~GrConvexPolyEffect();