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

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

Issue 1607253002: Add gpu implementation of OverdrawXfermode (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Update FP & XP Factory counts Created 4 years, 11 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/gpu/glsl/GrGLSLXferProcessor.h ('k') | src/utils/debugger/SkOverdrawMode.h » ('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 63739aee814a41a1a4b338d6009590f20eec56d8..c2dd8f8a1915376cffcd47e6ccd64d935a14dc27 100644
--- a/src/utils/debugger/SkDebugCanvas.cpp
+++ b/src/utils/debugger/SkDebugCanvas.cpp
@@ -6,55 +6,11 @@
*/
#include "SkClipStack.h"
-#include "SkColorPriv.h"
#include "SkDebugCanvas.h"
#include "SkDrawCommand.h"
#include "SkDevice.h"
#include "SkPaintFilterCanvas.h"
-#include "SkXfermode.h"
-
-namespace {
-
-class OverdrawXfermode : public SkXfermode {
-public:
- SkPMColor xferColor(SkPMColor src, SkPMColor dst) const 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)
- };
-
-
- 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 override { return nullptr; }
-#ifndef SK_IGNORE_TO_STRING
- void toString(SkString* str) const override { str->set("OverdrawXfermode"); }
-#endif
-};
+#include "SkOverdrawMode.h"
class DebugPaintFilterCanvas : public SkPaintFilterCanvas {
public:
@@ -64,7 +20,7 @@ public:
bool overrideFilterQuality,
SkFilterQuality quality)
: INHERITED(width, height)
- , fOverdrawXfermode(overdrawViz ? new OverdrawXfermode : nullptr)
+ , fOverdrawXfermode(overdrawViz ? SkOverdrawMode::Create() : nullptr)
, fOverrideFilterQuality(overrideFilterQuality)
, fFilterQuality(quality) {}
@@ -99,8 +55,6 @@ private:
typedef SkPaintFilterCanvas INHERITED;
};
-}
-
SkDebugCanvas::SkDebugCanvas(int width, int height)
: INHERITED(width, height)
, fPicture(nullptr)
« no previous file with comments | « src/gpu/glsl/GrGLSLXferProcessor.h ('k') | src/utils/debugger/SkOverdrawMode.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698