summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbsalomon@google.com <bsalomon@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-08-27 21:45:39 +0000
committerbsalomon@google.com <bsalomon@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-08-27 21:45:39 +0000
commit3bbbfc90113d7ea025eb48be8b5fbe1ce86c2b96 (patch)
tree74dccd9cffc4fcfc0b9ce0d16851e850e163df41
parent4efae63cf70024bfef88b8fb82e830776af32cb6 (diff)
downloadsrc-3bbbfc90113d7ea025eb48be8b5fbe1ce86c2b96.tar.gz
Merge r10804 from trunk to branches/chrome/m30_1599
git-svn-id: http://skia.googlecode.com/svn/branches/chrome/m30_1599/src@10962 2bbb7eff-a529-9590-31e7-b0007b416f81
-rw-r--r--gpu/GrContext.cpp25
1 files changed, 17 insertions, 8 deletions
diff --git a/gpu/GrContext.cpp b/gpu/GrContext.cpp
index 20c633dc..7631c8ac 100644
--- a/gpu/GrContext.cpp
+++ b/gpu/GrContext.cpp
@@ -994,8 +994,6 @@ void GrContext::drawOval(const GrPaint& paint,
}
}
-namespace {
-
// Can 'path' be drawn as a pair of filled nested rectangles?
static bool is_nested_rects(GrDrawTarget* target,
const SkPath& path,
@@ -1030,15 +1028,26 @@ static bool is_nested_rects(GrDrawTarget* target,
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) {