aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/utils
diff options
context:
space:
mode:
Diffstat (limited to 'src/utils')
-rw-r--r--src/utils/debugger/SkDebugCanvas.cpp52
1 files changed, 30 insertions, 22 deletions
diff --git a/src/utils/debugger/SkDebugCanvas.cpp b/src/utils/debugger/SkDebugCanvas.cpp
index 0f2b9e0f05..22eef6f9a5 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() {