aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/utils
diff options
context:
space:
mode:
authorGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2014-04-17 15:19:32 +0000
committerGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2014-04-17 15:19:32 +0000
commitcc277b729b16c0d8d042f9ae1db6563fb4538d88 (patch)
tree7d313351dfc1ca16345d8563376505ac2b5335e1 /src/utils
parentefaf53ba2488dec99f96120e5995e000632f31d2 (diff)
Orphan ProcXfermode, with an eye towards removing it
BUG=skia: R=scroggo@google.com, mtklein@google.com Author: reed@google.com Review URL: https://codereview.chromium.org/240533003 git-svn-id: http://skia.googlecode.com/svn/trunk@14238 2bbb7eff-a529-9590-31e7-b0007b416f81
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() {