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

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

Issue 240533003: Orphan ProcXfermode, with an eye towards removing it (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: guard toString Created 6 years, 8 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 | « src/core/SkXfermode_proccoeff.h ('k') | tests/PaintTest.cpp » ('j') | 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 0f2b9e0f05bf3cda5d883dab6c43a56efb4b8b7f..22eef6f9a5530c78b3ad2e909d9a0c8c56251a80 100644
--- a/src/utils/debugger/SkDebugCanvas.cpp
+++ b/src/utils/debugger/SkDebugCanvas.cpp
@@ -92,37 +92,45 @@ int SkDebugCanvas::getCommandAtPoint(int x, int y, int index) {
return layer;
}
-static SkPMColor OverdrawXferModeProc(SkPMColor src, SkPMColor dst) {
- // This table encodes the color progression of the overdraw visualization
- static const SkPMColor gTable[] = {
- SkPackARGB32(0x00, 0x00, 0x00, 0x00),
- SkPackARGB32(0xFF, 128, 158, 255),
- SkPackARGB32(0xFF, 170, 185, 212),
- SkPackARGB32(0xFF, 213, 195, 170),
- SkPackARGB32(0xFF, 255, 192, 127),
- SkPackARGB32(0xFF, 255, 185, 85),
- SkPackARGB32(0xFF, 255, 165, 42),
- SkPackARGB32(0xFF, 255, 135, 0),
- SkPackARGB32(0xFF, 255, 95, 0),
- 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];
+class OverdrawXfermode : public SkXfermode {
+public:
+ virtual SkPMColor xferColor(SkPMColor src, SkPMColor dst) const SK_OVERRIDE {
+ // This table encodes the color progression of the overdraw visualization
+ static const SkPMColor gTable[] = {
+ SkPackARGB32(0x00, 0x00, 0x00, 0x00),
+ SkPackARGB32(0xFF, 128, 158, 255),
+ SkPackARGB32(0xFF, 170, 185, 212),
+ SkPackARGB32(0xFF, 213, 195, 170),
+ SkPackARGB32(0xFF, 255, 192, 127),
+ SkPackARGB32(0xFF, 255, 185, 85),
+ SkPackARGB32(0xFF, 255, 165, 42),
+ SkPackARGB32(0xFF, 255, 135, 0),
+ SkPackARGB32(0xFF, 255, 95, 0),
+ 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];
}
- return gTable[SK_ARRAY_COUNT(gTable)-1];
-}
+ virtual Factory getFactory() const SK_OVERRIDE { return NULL; }
+#ifndef SK_IGNORE_TO_STRING
+ virtual void toString(SkString* str) const { str->set("OverdrawXfermode"); }
+#endif
+};
// The OverdrawFilter modifies every paint to use an SkProcXfermode which
// in turn invokes OverdrawXferModeProc
class SkOverdrawFilter : public SkDrawFilter {
public:
SkOverdrawFilter() {
- fXferMode = SkProcXfermode::Create(OverdrawXferModeProc);
+ fXferMode = SkNEW(OverdrawXfermode);
}
virtual ~SkOverdrawFilter() {
« no previous file with comments | « src/core/SkXfermode_proccoeff.h ('k') | tests/PaintTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698