Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1272)

Unified Diff: src/gpu/effects/GrConvexPolyEffect.cpp

Issue 148283017: Make GMs aware of what tool they're being run in. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: w to this->getMode() Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/effects/GrConvexPolyEffect.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/effects/GrConvexPolyEffect.cpp
diff --git a/src/gpu/effects/GrConvexPolyEffect.cpp b/src/gpu/effects/GrConvexPolyEffect.cpp
index e47ed0f86606b93d42913c8ad298023fefa4e276..98af6948eadc60da09fa32cd8a70934b8e24bf3f 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;
}
}
« no previous file with comments | « src/gpu/effects/GrConvexPolyEffect.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698