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

Unified Diff: src/core/SkScan_AAAPath.cpp

Issue 2482193004: Tighten SkAAClip Bounds by Path Bounds (Closed)
Patch Set: Send in the true SkRegion Created 4 years, 1 month 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
Index: src/core/SkScan_AAAPath.cpp
diff --git a/src/core/SkScan_AAAPath.cpp b/src/core/SkScan_AAAPath.cpp
index 16b5561a9dbe23b9c3303045e6dd5462872f04de..2f33a0fba5fa4301c22293a395f073732f7d65af 100644
--- a/src/core/SkScan_AAAPath.cpp
+++ b/src/core/SkScan_AAAPath.cpp
@@ -961,9 +961,9 @@ static inline void aaa_walk_convex_edges(SkAnalyticEdge* prevHead, AdditiveBlitt
}
local_bot_fixed = SkMin32(local_bot_fixed, SkIntToFixed(stop_y));
- SkFixed left = leftE->fX;
+ SkFixed left = SkTMax(leftBound, leftE->fX);
SkFixed dLeft = leftE->fDX;
- SkFixed rite = riteE->fX;
+ SkFixed rite = SkTMin(riteBound, riteE->fX);
SkFixed dRite = riteE->fDX;
if (0 == (dLeft | dRite)) {
int fullLeft = SkFixedCeilToInt(left);
@@ -1073,6 +1073,8 @@ static inline void aaa_walk_convex_edges(SkAnalyticEdge* prevHead, AdditiveBlitt
SkFixed dY = nextY - y;
SkFixed nextLeft = left + SkFixedMul_lowprec(dLeft, dY);
SkFixed nextRite = rite + SkFixedMul_lowprec(dRite, dY);
+ SkASSERT((left & kSnapMask) >= leftBound && (rite & kSnapMask) <= riteBound &&
+ (nextLeft & kSnapMask) >= leftBound && (nextRite & kSnapMask) <= riteBound);
blit_trapezoid_row(blitter, y >> 16, left & kSnapMask, rite & kSnapMask,
nextLeft & kSnapMask, nextRite & kSnapMask, leftE->fDY, riteE->fDY,
getPartialAlpha(0xFF, dY), maskRow, isUsingMask);
@@ -1088,6 +1090,8 @@ static inline void aaa_walk_convex_edges(SkAnalyticEdge* prevHead, AdditiveBlitt
maskRow = static_cast<MaskAdditiveBlitter*>(blitter)->getRow(y >> 16);
}
SkFixed nextY = y + SK_Fixed1, nextLeft = left + dLeft, nextRite = rite + dRite;
+ SkASSERT((left & kSnapMask) >= leftBound && (rite & kSnapMask) <= riteBound &&
+ (nextLeft & kSnapMask) >= leftBound && (nextRite & kSnapMask) <= riteBound);
blit_trapezoid_row(blitter, y >> 16, left & kSnapMask, rite & kSnapMask,
nextLeft & kSnapMask, nextRite & kSnapMask,
leftE->fDY, riteE->fDY, 0xFF, maskRow, isUsingMask);
@@ -1109,6 +1113,8 @@ static inline void aaa_walk_convex_edges(SkAnalyticEdge* prevHead, AdditiveBlitt
// Note that we substract kSnapHalf later so we have to add them to leftBound/riteBound
SkFixed nextLeft = SkTMax(left + SkFixedMul_lowprec(dLeft, dY), leftBound + kSnapHalf);
SkFixed nextRite = SkTMin(rite + SkFixedMul_lowprec(dRite, dY), riteBound + kSnapHalf);
+ SkASSERT((left & kSnapMask) >= leftBound && (rite & kSnapMask) <= riteBound &&
+ (nextLeft & kSnapMask) >= leftBound && (nextRite & kSnapMask) <= riteBound);
blit_trapezoid_row(blitter, y >> 16, left & kSnapMask, rite & kSnapMask,
nextLeft & kSnapMask, nextRite & kSnapMask, leftE->fDY, riteE->fDY,
getPartialAlpha(0xFF, dY), maskRow, isUsingMask);
« src/core/SkAAClip.cpp ('K') | « src/core/SkAAClip.cpp ('k') | tests/PathTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698