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

Unified Diff: src/gpu/GrContext.cpp

Issue 22824016: Fix for nested rect drawing bug (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Gussied up a bit Created 7 years, 4 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 | « gyp/gmslides.gypi ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrContext.cpp
===================================================================
--- src/gpu/GrContext.cpp (revision 10773)
+++ src/gpu/GrContext.cpp (working copy)
@@ -1011,8 +1011,6 @@
}
}
-namespace {
-
// Can 'path' be drawn as a pair of filled nested rectangles?
static bool is_nested_rects(GrDrawTarget* target,
const SkPath& path,
@@ -1047,16 +1045,27 @@
return false;
}
- if (SkPath::kWinding_FillType == path.getFillType()) {
+ if (SkPath::kWinding_FillType == path.getFillType() && dirs[0] == dirs[1]) {
// The two rects need to be wound opposite to each other
- return dirs[0] != dirs[1];
- } else {
- return true;
+ return false;
}
+
+ // Right now, nested rects where the margin is not the same width
+ // all around do not render correctly
+ const SkScalar* outer = rects[0].asScalars();
+ const SkScalar* inner = rects[1].asScalars();
+
+ SkScalar margin = SkScalarAbs(outer[0] - inner[0]);
+ for (int i = 1; i < 4; ++i) {
+ SkScalar temp = SkScalarAbs(outer[i] - inner[i]);
+ if (!SkScalarNearlyEqual(margin, temp)) {
+ return false;
+ }
+ }
+
+ return true;
}
-};
-
void GrContext::drawPath(const GrPaint& paint, const SkPath& path, const SkStrokeRec& stroke) {
if (path.isEmpty()) {
« no previous file with comments | « gyp/gmslides.gypi ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698