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

Unified Diff: src/core/SkScan_AAAPath.cpp

Issue 2471133002: Set analytic AA as default. (Closed)
Patch Set: One more catch 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 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);
reed1 2016/11/07 15:31:42 why do we have a cast on delta?
liyuqian 2016/11/07 16:08:00 I think that we can also cast alpha to int? If we
+ 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;
reed1 2016/11/07 15:31:42 return SkToU8(SkFixedRoundToInt(alpha * partialHei
liyuqian 2016/11/07 16:08:00 Done.
}
static inline SkAlpha getPartialAlpha(SkAlpha alpha, SkAlpha fullAlpha) {
« src/core/SkPath.cpp ('K') | « src/core/SkScan.cpp ('k') | src/core/SkXfermode.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698