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

Unified Diff: src/core/SkAntiRun.h

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
« no previous file with comments | « no previous file | src/core/SkPath.cpp » ('j') | src/core/SkPath.cpp » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkAntiRun.h
diff --git a/src/core/SkAntiRun.h b/src/core/SkAntiRun.h
index 8214e28d5b7ee8d8575c082d31b77e9f49388d5a..5ac0e62a6ce99129f356c43709b14c45c5fb2712 100644
--- a/src/core/SkAntiRun.h
+++ b/src/core/SkAntiRun.h
@@ -21,6 +21,11 @@ public:
int16_t* fRuns;
uint8_t* fAlpha;
+ // Return 0-255 given 0-256
+ static inline SkAlpha CatchOverflow(int alpha) {
reed1 2016/11/07 15:31:42 nit: SkASSERT(alpha >= 0 && alpha <= 256);
liyuqian 2016/11/07 16:08:00 Done.
+ return alpha - (alpha >> 8);
+ }
+
/// Returns true if the scanline contains only a single run,
/// of alpha value 0.
bool empty() const {
@@ -79,7 +84,7 @@ public:
runs += x;
x = 0;
do {
- alpha[0] = SkToU8(alpha[0] + maxValue);
+ alpha[0] = SkToU8(CatchOverflow(alpha[0] + maxValue));
int n = runs[0];
SkASSERT(n <= middleCount);
alpha += n;
« no previous file with comments | « no previous file | src/core/SkPath.cpp » ('j') | src/core/SkPath.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698