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

Unified Diff: src/utils/debugger/SkDebugCanvas.cpp

Issue 997913002: Fix debugger's overdraw color filter (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: SK_ARRAY_COUNT (again) Created 5 years, 9 months 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/utils/debugger/SkDebugCanvas.cpp
diff --git a/src/utils/debugger/SkDebugCanvas.cpp b/src/utils/debugger/SkDebugCanvas.cpp
index aed87cc22120e4e03f3e6af004ddebe8c9f638b5..1faa015b364a4ca7a4d3f32d20ca941c9f68f34c 100644
--- a/src/utils/debugger/SkDebugCanvas.cpp
+++ b/src/utils/debugger/SkDebugCanvas.cpp
@@ -105,14 +105,22 @@ public:
SkPackARGB32(0xFF, 255, 50, 0),
SkPackARGB32(0xFF, 255, 0, 0)
};
-
- for (size_t i = 0; i < SK_ARRAY_COUNT(gTable)-1; ++i) {
- if (gTable[i] == dst) {
- return gTable[i+1];
- }
- }
-
- return gTable[SK_ARRAY_COUNT(gTable)-1];
+
+
+ int idx;
+ if (SkColorGetR(dst) < 64) { // 0
+ idx = 0;
+ } else if (SkColorGetG(dst) < 25) { // 10
+ idx = 9; // cap at 9 for upcoming increment
+ } else if ((SkColorGetB(dst)+21)/42 > 0) { // 1-6
+ idx = 7 - (SkColorGetB(dst)+21)/42;
+ } else { // 7-9
+ idx = 10 - (SkColorGetG(dst)+22)/45;
+ }
+ ++idx;
+ SkASSERT(idx < (int)SK_ARRAY_COUNT(gTable));
+
+ return gTable[idx];
}
Factory getFactory() const SK_OVERRIDE { return NULL; }
@@ -133,6 +141,7 @@ public:
bool filter(SkPaint* p, Type) SK_OVERRIDE {
p->setXfermode(fXferMode);
+ p->setAntiAlias(false);
return true;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698