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

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: 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..8d721db48db7bc647aab654eae9cbb30d555ff94 100644
--- a/src/utils/debugger/SkDebugCanvas.cpp
+++ b/src/utils/debugger/SkDebugCanvas.cpp
@@ -91,7 +91,7 @@ int SkDebugCanvas::getCommandAtPoint(int x, int y, int index) {
class OverdrawXfermode : public SkXfermode {
public:
SkPMColor xferColor(SkPMColor src, SkPMColor dst) const SK_OVERRIDE {
- // This table encodes the color progression of the overdraw visualization
+ // This table encodes the color progression of the 8overdraw visualization
f(malita) 2015/03/11 13:53:13 Rogue keystroke?
robertphillips 2015/03/11 14:10:20 Haha - yep. Done.
static const SkPMColor gTable[] = {
SkPackARGB32(0x00, 0x00, 0x00, 0x00),
SkPackARGB32(0xFF, 128, 158, 255),
@@ -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 < 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