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

Unified Diff: src/core/SkScan_AAAPath.cpp

Issue 2483523002: Fix the issue of alpha = 254 instead of 255 (Closed)
Patch Set: Rounding 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
« no previous file with comments | « src/core/SkAntiRun.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkScan_AAAPath.cpp
diff --git a/src/core/SkScan_AAAPath.cpp b/src/core/SkScan_AAAPath.cpp
index 3325249833bb9282cf285b67e74750a0dbebead6..91b6e397ae260a2e158c8314a5406fd1bde30c35 100644
--- a/src/core/SkScan_AAAPath.cpp
+++ b/src/core/SkScan_AAAPath.cpp
@@ -83,9 +83,9 @@ number of scan lines in our algorithm is only about 3 + H while the
///////////////////////////////////////////////////////////////////////////////
-inline void addAlpha(SkAlpha& alpha, SkAlpha delta) {
- SkASSERT(alpha + (int)delta <= 0xFF);
- alpha += delta;
+static inline void addAlpha(SkAlpha& alpha, SkAlpha delta) {
+ SkASSERT(alpha + (int)delta <= 256);
+ alpha = SkAlphaRuns::CatchOverflow(alpha + (int)delta);
}
class AdditiveBlitter : public SkBlitter {
@@ -481,7 +481,7 @@ static inline SkAlpha partialTriangleToAlpha(SkFixed a, SkFixed b) {
}
static inline SkAlpha getPartialAlpha(SkAlpha alpha, SkFixed partialHeight) {
- return (alpha * partialHeight) >> 16;
+ return (alpha * partialHeight + SK_FixedHalf) >> 16;
}
static inline SkAlpha getPartialAlpha(SkAlpha alpha, SkAlpha fullAlpha) {
« no previous file with comments | « src/core/SkAntiRun.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698