aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkScan_Path.cpp
diff options
context:
space:
mode:
authorGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-05-01 14:49:28 +0000
committerGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-05-01 14:49:28 +0000
commit9d5f76a250502620952d4aaa2926ff5bfeffc980 (patch)
tree59bb4b59ad1764d199e3a486686d68ec59165d88 /src/core/SkScan_Path.cpp
parentaf7e6943b74260ff9038bfbe0f8c50cf66657e83 (diff)
fix bug (and add test) for drawing an inverse-path whose bounds do intersect
the clip, but whose edges do not (e.g. a curve). We used to overdraw a section (and assert). git-svn-id: http://skia.googlecode.com/svn/trunk@3809 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/core/SkScan_Path.cpp')
-rw-r--r--src/core/SkScan_Path.cpp24
1 files changed, 19 insertions, 5 deletions
diff --git a/src/core/SkScan_Path.cpp b/src/core/SkScan_Path.cpp
index 5b92ff92fb..8a3d718f03 100644
--- a/src/core/SkScan_Path.cpp
+++ b/src/core/SkScan_Path.cpp
@@ -424,11 +424,25 @@ void sk_fill_path(const SkPath& path, const SkIRect* clipRect, SkBlitter* blitte
if (count < 2) {
if (path.isInverseFillType()) {
- const SkIRect& clipRect = clipRgn.getBounds();
- blitter->blitRect(clipRect.fLeft << shiftEdgesUp,
- clipRect.fTop << shiftEdgesUp,
- clipRect.width() << shiftEdgesUp,
- clipRect.height() << shiftEdgesUp);
+ /*
+ * Since we are in inverse-fill, our caller has already drawn above
+ * our top (start_y) and will draw below our bottom (stop_y). Thus
+ * we need to restrict our drawing to the intersection of the clip
+ * and those two limits.
+ */
+ SkIRect rect = clipRgn.getBounds();
+ if (rect.fTop < start_y) {
+ rect.fTop = start_y;
+ }
+ if (rect.fBottom > stop_y) {
+ rect.fBottom = stop_y;
+ }
+ if (!rect.isEmpty()) {
+ blitter->blitRect(rect.fLeft << shiftEdgesUp,
+ rect.fTop << shiftEdgesUp,
+ rect.width() << shiftEdgesUp,
+ rect.height() << shiftEdgesUp);
+ }
}
return;