aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkScan_AAAPath.cpp
diff options
context:
space:
mode:
authorGravatar Yuqian Li <liyuqian@google.com>2016-11-16 13:07:57 -0500
committerGravatar Yuqian Li <liyuqian@google.com>2016-11-16 18:43:52 +0000
commit20079a94e82fd7345dfb119a8777e5ba482a041c (patch)
tree379ad97f7cb40878d03c1a7ee08531bf0e842482 /src/core/SkScan_AAAPath.cpp
parent721625b25e3e99d23b7765c75ba0b2ae5a351f7e (diff)
Fix mask overflow caused by edge drift
BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=4797 Change-Id: Ica1568b67c1e1ce4aae2bdaba2c5b1f2155d1382 Reviewed-on: https://skia-review.googlesource.com/4797 Reviewed-by: Cary Clark <caryclark@google.com>
Diffstat (limited to 'src/core/SkScan_AAAPath.cpp')
-rw-r--r--src/core/SkScan_AAAPath.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/core/SkScan_AAAPath.cpp b/src/core/SkScan_AAAPath.cpp
index 8bfe7bbb1b..47d2dcc1bf 100644
--- a/src/core/SkScan_AAAPath.cpp
+++ b/src/core/SkScan_AAAPath.cpp
@@ -1204,8 +1204,18 @@ void aaa_fill_path(const SkPath& path, const SkIRect& clipRect, AdditiveBlitter*
if (!path.isInverseFillType() && path.isConvex()) {
SkASSERT(count >= 2); // convex walker does not handle missing right edges
+ SkFixed leftBound = SkIntToFixed(rect.fLeft);
+ SkFixed rightBound = SkIntToFixed(rect.fRight);
+ if (isUsingMask) {
+ // If we're using mask, then we have to limit the bound within the path bounds.
+ // Otherwise, the edge drift may access an invalid address inside the mask.
+ SkIRect ir;
+ path.getBounds().roundOut(&ir);
+ leftBound = SkTMax(leftBound, SkIntToFixed(ir.fLeft));
+ rightBound = SkTMin(rightBound, SkIntToFixed(ir.fRight));
+ }
aaa_walk_convex_edges(&headEdge, blitter, start_y, stop_y,
- rect.fLeft << 16, rect.fRight << 16, isUsingMask);
+ leftBound, rightBound, isUsingMask);
} else {
SkFAIL("Concave AAA is not yet implemented!");
}