aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--gyp/utils.gypi2
-rw-r--r--include/utils/SkPaintFilterCanvas.h93
-rw-r--r--src/utils/SkPaintFilterCanvas.cpp157
-rw-r--r--src/utils/debugger/SkDebugCanvas.cpp237
-rw-r--r--src/utils/debugger/SkDebugCanvas.h12
5 files changed, 377 insertions, 124 deletions
diff --git a/gyp/utils.gypi b/gyp/utils.gypi
index ad9721001e..68876cbdfe 100644
--- a/gyp/utils.gypi
+++ b/gyp/utils.gypi
@@ -34,6 +34,7 @@
'<(skia_include_path)/utils/SkNoSaveLayerCanvas.h',
'<(skia_include_path)/utils/SkNWayCanvas.h',
'<(skia_include_path)/utils/SkNullCanvas.h',
+ '<(skia_include_path)/utils/SkPaintFilterCanvas.h',
'<(skia_include_path)/utils/SkParse.h',
'<(skia_include_path)/utils/SkParsePaint.h',
'<(skia_include_path)/utils/SkParsePath.h',
@@ -74,6 +75,7 @@
'<(skia_src_path)/utils/SkNWayCanvas.cpp',
'<(skia_src_path)/utils/SkNullCanvas.cpp',
'<(skia_src_path)/utils/SkOSFile.cpp',
+ '<(skia_src_path)/utils/SkPaintFilterCanvas.cpp',
'<(skia_src_path)/utils/SkParse.cpp',
'<(skia_src_path)/utils/SkParseColor.cpp',
'<(skia_src_path)/utils/SkParsePath.cpp',
diff --git a/include/utils/SkPaintFilterCanvas.h b/include/utils/SkPaintFilterCanvas.h
new file mode 100644
index 0000000000..942fbda876
--- /dev/null
+++ b/include/utils/SkPaintFilterCanvas.h
@@ -0,0 +1,93 @@
+/*
+ * Copyright 2015 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef SkPaintFilterCanvas_DEFINED
+#define SkPaintFilterCanvas_DEFINED
+
+#include "SkNWayCanvas.h"
+
+/** \class SkPaintFilterCanvas
+
+ A utility proxy base class for implementing paint filters.
+*/
+class SK_API SkPaintFilterCanvas : public SkNWayCanvas {
+public:
+ SkPaintFilterCanvas(int width, int height);
+
+ enum Type {
+ kPaint_Type,
+ kPoint_Type,
+ kBitmap_Type,
+ kRect_Type,
+ kRRect_Type,
+ kDRRect_Type,
+ kOval_Type,
+ kPath_Type,
+ kPicture_Type,
+ kText_Type,
+ kTextBlob_Type,
+ kVertices_Type,
+ kPatch_Type,
+
+ kTypeCount
+ };
+
+protected:
+ /**
+ * Called with the paint that will be used to draw the specified type.
+ * The implementation may modify the paint as they wish.
+ *
+ * Note: The base implementation calls onFilterPaint() for top-level/explicit paints only.
+ * To also filter encapsulated paints (e.g. SkPicture, SkTextBlob), clients may need to
+ * override the relevant methods (i.e. drawPicture, drawTextBlob).
+ */
+ virtual void onFilterPaint(SkPaint* paint, Type type) const = 0;
+
+ void onDrawPaint(const SkPaint&) override;
+ void onDrawPoints(PointMode, size_t count, const SkPoint pts[], const SkPaint&) override;
+ void onDrawRect(const SkRect&, const SkPaint&) override;
+ void onDrawRRect(const SkRRect&, const SkPaint&) override;
+ void onDrawDRRect(const SkRRect&, const SkRRect&, const SkPaint&) override;
+ void onDrawOval(const SkRect&, const SkPaint&) override;
+ void onDrawPath(const SkPath&, const SkPaint&) override;
+ void onDrawBitmap(const SkBitmap&, SkScalar left, SkScalar top, const SkPaint*) override;
+ void onDrawBitmapRect(const SkBitmap&, const SkRect* src, const SkRect& dst, const SkPaint*,
+ DrawBitmapRectFlags flags) override;
+ void onDrawImage(const SkImage*, SkScalar left, SkScalar top, const SkPaint*) override;
+ void onDrawImageRect(const SkImage*, const SkRect* src, const SkRect& dst,
+ const SkPaint*) override;
+ void onDrawBitmapNine(const SkBitmap&, const SkIRect& center, const SkRect& dst,
+ const SkPaint*) override;
+ void onDrawSprite(const SkBitmap&, int left, int top, const SkPaint*) override;
+ void onDrawVertices(VertexMode vmode, int vertexCount,
+ const SkPoint vertices[], const SkPoint texs[],
+ const SkColor colors[], SkXfermode* xmode,
+ const uint16_t indices[], int indexCount,
+ const SkPaint&) override;
+ void onDrawPatch(const SkPoint cubics[12], const SkColor colors[4],
+ const SkPoint texCoords[4], SkXfermode* xmode,
+ const SkPaint& paint) override;
+ void onDrawPicture(const SkPicture*, const SkMatrix*, const SkPaint*) override;
+
+ void onDrawText(const void* text, size_t byteLength, SkScalar x, SkScalar y,
+ const SkPaint&) override;
+ void onDrawPosText(const void* text, size_t byteLength, const SkPoint pos[],
+ const SkPaint&) override;
+ void onDrawPosTextH(const void* text, size_t byteLength, const SkScalar xpos[],
+ SkScalar constY, const SkPaint&) override;
+ void onDrawTextOnPath(const void* text, size_t byteLength, const SkPath& path,
+ const SkMatrix* matrix, const SkPaint&) override;
+ void onDrawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y,
+ const SkPaint& paint) override;
+
+private:
+ class AutoPaintFilter;
+
+ typedef SkNWayCanvas INHERITED;
+};
+
+#endif
diff --git a/src/utils/SkPaintFilterCanvas.cpp b/src/utils/SkPaintFilterCanvas.cpp
new file mode 100644
index 0000000000..1abebef8ca
--- /dev/null
+++ b/src/utils/SkPaintFilterCanvas.cpp
@@ -0,0 +1,157 @@
+/*
+ * Copyright 2015 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include "SkPaintFilterCanvas.h"
+
+#include "SkPaint.h"
+#include "SkTLazy.h"
+
+class SkPaintFilterCanvas::AutoPaintFilter {
+public:
+ AutoPaintFilter(const SkPaintFilterCanvas* canvas, Type type, const SkPaint* paint) {
+ if (paint) {
+ canvas->onFilterPaint(fLazyPaint.set(*paint), type);
+ }
+ }
+
+ AutoPaintFilter(const SkPaintFilterCanvas* canvas, Type type, const SkPaint& paint) {
+ canvas->onFilterPaint(fLazyPaint.set(paint), type);
+ }
+
+ const SkPaint* paint() const { return fLazyPaint.getMaybeNull(); }
+
+private:
+ SkTLazy<SkPaint> fLazyPaint;
+};
+
+SkPaintFilterCanvas::SkPaintFilterCanvas(int width, int height) : INHERITED(width, height) { }
+
+void SkPaintFilterCanvas::onDrawPaint(const SkPaint& paint) {
+ AutoPaintFilter apf(this, kPaint_Type, paint);
+ this->INHERITED::onDrawPaint(*apf.paint());
+}
+
+void SkPaintFilterCanvas::onDrawPoints(PointMode mode, size_t count, const SkPoint pts[],
+ const SkPaint& paint) {
+ AutoPaintFilter apf(this, kPoint_Type, paint);
+ this->INHERITED::onDrawPoints(mode, count, pts, *apf.paint());
+}
+
+void SkPaintFilterCanvas::onDrawRect(const SkRect& rect, const SkPaint& paint) {
+ AutoPaintFilter apf(this, kRect_Type, paint);
+ this->INHERITED::onDrawRect(rect, *apf.paint());
+}
+
+void SkPaintFilterCanvas::onDrawRRect(const SkRRect& rrect, const SkPaint& paint) {
+ AutoPaintFilter apf(this, kRRect_Type, paint);
+ this->INHERITED::onDrawRRect(rrect, *apf.paint());
+}
+
+void SkPaintFilterCanvas::onDrawDRRect(const SkRRect& outer, const SkRRect& inner,
+ const SkPaint& paint) {
+ AutoPaintFilter apf(this, kDRRect_Type, paint);
+ this->INHERITED::onDrawDRRect(outer, inner, *apf.paint());
+}
+
+void SkPaintFilterCanvas::onDrawOval(const SkRect& rect, const SkPaint& paint) {
+ AutoPaintFilter apf(this, kOval_Type, paint);
+ this->INHERITED::onDrawOval(rect, *apf.paint());
+}
+
+void SkPaintFilterCanvas::onDrawPath(const SkPath& path, const SkPaint& paint) {
+ AutoPaintFilter apf(this, kPath_Type, paint);
+ this->INHERITED::onDrawPath(path, *apf.paint());
+}
+
+void SkPaintFilterCanvas::onDrawBitmap(const SkBitmap& bm, SkScalar left, SkScalar top,
+ const SkPaint* paint) {
+ AutoPaintFilter apf(this, kBitmap_Type, paint);
+ this->INHERITED::onDrawBitmap(bm, left, top, apf.paint());
+}
+
+void SkPaintFilterCanvas::onDrawBitmapRect(const SkBitmap& bm, const SkRect* src, const SkRect& dst,
+ const SkPaint* paint, DrawBitmapRectFlags flags) {
+ AutoPaintFilter apf(this, kBitmap_Type, paint);
+ this->INHERITED::onDrawBitmapRect(bm, src, dst, apf.paint(), flags);
+}
+
+void SkPaintFilterCanvas::onDrawImage(const SkImage* image, SkScalar left, SkScalar top,
+ const SkPaint* paint) {
+ AutoPaintFilter apf(this, kBitmap_Type, paint);
+ this->INHERITED::onDrawImage(image, left, top, apf.paint());
+}
+
+void SkPaintFilterCanvas::onDrawImageRect(const SkImage* image, const SkRect* src,
+ const SkRect& dst, const SkPaint* paint) {
+ AutoPaintFilter apf(this, kBitmap_Type, paint);
+ this->INHERITED::onDrawImageRect(image, src, dst, apf.paint());
+}
+
+void SkPaintFilterCanvas::onDrawBitmapNine(const SkBitmap& bm, const SkIRect& center,
+ const SkRect& dst, const SkPaint* paint) {
+ AutoPaintFilter apf(this, kBitmap_Type, paint);
+ this->INHERITED::onDrawBitmapNine(bm, center, dst, apf.paint());
+}
+
+void SkPaintFilterCanvas::onDrawSprite(const SkBitmap& bm, int left, int top,
+ const SkPaint* paint) {
+ AutoPaintFilter apf(this, kBitmap_Type, paint);
+ this->INHERITED::onDrawSprite(bm, left, top, apf.paint());
+}
+
+void SkPaintFilterCanvas::onDrawVertices(VertexMode vmode, int vertexCount,
+ const SkPoint vertices[], const SkPoint texs[],
+ const SkColor colors[], SkXfermode* xmode,
+ const uint16_t indices[], int indexCount,
+ const SkPaint& paint) {
+ AutoPaintFilter apf(this, kVertices_Type, paint);
+ this->INHERITED::onDrawVertices(vmode, vertexCount, vertices, texs, colors, xmode, indices,
+ indexCount, *apf.paint());
+}
+
+void SkPaintFilterCanvas::onDrawPatch(const SkPoint cubics[], const SkColor colors[],
+ const SkPoint texCoords[], SkXfermode* xmode,
+ const SkPaint& paint) {
+ AutoPaintFilter apf(this, kPatch_Type, paint);
+ this->INHERITED::onDrawPatch(cubics, colors, texCoords, xmode, *apf.paint());
+}
+
+void SkPaintFilterCanvas::onDrawPicture(const SkPicture* picture, const SkMatrix* m,
+ const SkPaint* paint) {
+ AutoPaintFilter apf(this, kPicture_Type, paint);
+ this->INHERITED::onDrawPicture(picture, m, apf.paint());
+}
+
+void SkPaintFilterCanvas::onDrawText(const void* text, size_t byteLength, SkScalar x, SkScalar y,
+ const SkPaint& paint) {
+ AutoPaintFilter apf(this, kText_Type, paint);
+ this->INHERITED::onDrawText(text, byteLength, x, y, *apf.paint());
+}
+
+void SkPaintFilterCanvas::onDrawPosText(const void* text, size_t byteLength, const SkPoint pos[],
+ const SkPaint& paint) {
+ AutoPaintFilter apf(this, kText_Type, paint);
+ this->INHERITED::onDrawPosText(text, byteLength, pos, *apf.paint());
+}
+
+void SkPaintFilterCanvas::onDrawPosTextH(const void* text, size_t byteLength, const SkScalar xpos[],
+ SkScalar constY, const SkPaint& paint) {
+ AutoPaintFilter apf(this, kText_Type, paint);
+ this->INHERITED::onDrawPosTextH(text, byteLength, xpos, constY, *apf.paint());
+}
+
+void SkPaintFilterCanvas::onDrawTextOnPath(const void* text, size_t byteLength, const SkPath& path,
+ const SkMatrix* matrix, const SkPaint& paint) {
+ AutoPaintFilter apf(this, kText_Type, paint);
+ this->INHERITED::onDrawTextOnPath(text, byteLength, path, matrix, *apf.paint());
+}
+
+void SkPaintFilterCanvas::onDrawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y,
+ const SkPaint& paint) {
+ AutoPaintFilter apf(this, kTextBlob_Type, paint);
+ this->INHERITED::onDrawTextBlob(blob, x, y, *apf.paint());
+}
diff --git a/src/utils/debugger/SkDebugCanvas.cpp b/src/utils/debugger/SkDebugCanvas.cpp
index 6d186a7ee8..4b5e03bf1f 100644
--- a/src/utils/debugger/SkDebugCanvas.cpp
+++ b/src/utils/debugger/SkDebugCanvas.cpp
@@ -10,19 +10,98 @@
#include "SkColorPriv.h"
#include "SkDebugCanvas.h"
#include "SkDrawCommand.h"
-#include "SkDrawFilter.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 NULL; }
+#ifndef SK_IGNORE_TO_STRING
+ virtual void toString(SkString* str) const override { str->set("OverdrawXfermode"); }
+#endif
+};
+
+class DebugPaintFilterCanvas : public SkPaintFilterCanvas {
+public:
+ DebugPaintFilterCanvas(int width, int height, bool overdrawViz, bool overrideFilterQuality,
+ SkFilterQuality quality)
+ : INHERITED(width, height)
+ , fOverdrawXfermode(overdrawViz ? SkNEW(OverdrawXfermode) : NULL)
+ , fOverrideFilterQuality(overrideFilterQuality)
+ , fFilterQuality(quality) { }
+
+protected:
+ void onFilterPaint(SkPaint* paint, Type) const override {
+ if (NULL != fOverdrawXfermode.get()) {
+ paint->setAntiAlias(false);
+ paint->setXfermode(fOverdrawXfermode.get());
+ }
+
+ if (fOverrideFilterQuality) {
+ paint->setFilterQuality(fFilterQuality);
+ }
+ }
+
+ void onDrawPicture(const SkPicture* picture, const SkMatrix* matrix, const SkPaint* paint) {
+ // We need to replay the picture onto this canvas in order to filter its internal paints.
+ this->SkCanvas::onDrawPicture(picture, matrix, paint);
+ }
+
+private:
+ SkAutoTUnref<SkXfermode> fOverdrawXfermode;
+
+ bool fOverrideFilterQuality;
+ SkFilterQuality fFilterQuality;
+
+ typedef SkPaintFilterCanvas INHERITED;
+};
+
+}
+
SkDebugCanvas::SkDebugCanvas(int width, int height)
: INHERITED(width, height)
, fPicture(NULL)
, fFilter(false)
, fMegaVizMode(false)
, fOverdrawViz(false)
- , fOverdrawFilter(NULL)
- , fOverrideTexFiltering(false)
- , fTexOverrideFilter(NULL) {
+ , fOverrideFilterQuality(false)
+ , fFilterQuality(kNone_SkFilterQuality) {
fUserMatrix.reset();
// SkPicturePlayback uses the base-class' quickReject calls to cull clipped
@@ -46,8 +125,6 @@ SkDebugCanvas::SkDebugCanvas(int width, int height)
SkDebugCanvas::~SkDebugCanvas() {
fCommandVector.deleteAll();
- SkSafeUnref(fOverdrawFilter);
- SkSafeUnref(fTexOverrideFilter);
}
void SkDebugCanvas::addDrawCommand(SkDrawCommand* command) {
@@ -88,93 +165,6 @@ int SkDebugCanvas::getCommandAtPoint(int x, int y, int index) {
return layer;
}
-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 NULL; }
-#ifndef SK_IGNORE_TO_STRING
- virtual void toString(SkString* str) const override { str->set("OverdrawXfermode"); }
-#endif
-};
-
-class SkOverdrawFilter : public SkDrawFilter {
-public:
- SkOverdrawFilter() {
- fXferMode = SkNEW(OverdrawXfermode);
- }
-
- virtual ~SkOverdrawFilter() {
- delete fXferMode;
- }
-
- bool filter(SkPaint* p, Type) override {
- p->setXfermode(fXferMode);
- p->setAntiAlias(false);
- return true;
- }
-
-protected:
- SkXfermode* fXferMode;
-
-private:
- typedef SkDrawFilter INHERITED;
-};
-
-// SkTexOverrideFilter modifies every paint to use the specified
-// texture filtering mode
-class SkTexOverrideFilter : public SkDrawFilter {
-public:
- SkTexOverrideFilter() : fFilterQuality(kNone_SkFilterQuality) {
- }
-
- void setFilterQuality(SkFilterQuality filterQuality) {
- fFilterQuality = filterQuality;
- }
-
- bool filter(SkPaint* p, Type) override {
- p->setFilterQuality(fFilterQuality);
- return true;
- }
-
-protected:
- SkFilterQuality fFilterQuality;
-
-private:
- typedef SkDrawFilter INHERITED;
-};
-
class SkDebugClipVisitor : public SkCanvas::ClipVisitor {
public:
SkDebugClipVisitor(SkCanvas* canvas) : fCanvas(canvas) {}
@@ -250,28 +240,9 @@ void SkDebugCanvas::drawTo(SkCanvas* canvas, int index) {
}
this->applyUserTransform(canvas);
- // The setting of the draw filter has to go here (rather than in
- // SkRasterWidget) due to the canvas restores this class performs.
- // Since the draw filter is stored in the layer stack if we
- // call setDrawFilter on anything but the root layer odd things happen.
- if (fOverdrawViz) {
- if (NULL == fOverdrawFilter) {
- fOverdrawFilter = new SkOverdrawFilter;
- }
-
- if (fOverdrawFilter != canvas->getDrawFilter()) {
- canvas->setDrawFilter(fOverdrawFilter);
- }
- } else if (fOverrideTexFiltering) {
- if (NULL == fTexOverrideFilter) {
- fTexOverrideFilter = new SkTexOverrideFilter;
- }
-
- if (fTexOverrideFilter != canvas->getDrawFilter()) {
- canvas->setDrawFilter(fTexOverrideFilter);
- }
- } else {
- canvas->setDrawFilter(NULL);
+ if (fPaintFilterCanvas) {
+ fPaintFilterCanvas->addCanvas(canvas);
+ canvas = fPaintFilterCanvas.get();
}
if (fMegaVizMode) {
@@ -342,6 +313,10 @@ void SkDebugCanvas::drawTo(SkCanvas* canvas, int index) {
}
canvas->restoreToCount(saveCount);
+
+ if (fPaintFilterCanvas) {
+ fPaintFilterCanvas->removeAll();
+ }
}
void SkDebugCanvas::deleteDrawCommandAt(int index) {
@@ -379,13 +354,37 @@ SkTDArray <SkDrawCommand*>& SkDebugCanvas::getDrawCommands() {
return fCommandVector;
}
+void SkDebugCanvas::updatePaintFilterCanvas() {
+ if (!fOverdrawViz && !fOverrideFilterQuality) {
+ fPaintFilterCanvas.reset(NULL);
+ return;
+ }
+
+ const SkImageInfo info = this->imageInfo();
+ fPaintFilterCanvas.reset(SkNEW_ARGS(DebugPaintFilterCanvas, (info.width(),
+ info.height(),
+ fOverdrawViz,
+ fOverrideFilterQuality,
+ fFilterQuality)));
+}
+
+void SkDebugCanvas::setOverdrawViz(bool overdrawViz) {
+ if (fOverdrawViz == overdrawViz) {
+ return;
+ }
+
+ fOverdrawViz = overdrawViz;
+ this->updatePaintFilterCanvas();
+}
+
void SkDebugCanvas::overrideTexFiltering(bool overrideTexFiltering, SkFilterQuality quality) {
- if (NULL == fTexOverrideFilter) {
- fTexOverrideFilter = new SkTexOverrideFilter;
+ if (fOverrideFilterQuality == overrideTexFiltering && fFilterQuality == quality) {
+ return;
}
- fOverrideTexFiltering = overrideTexFiltering;
- fTexOverrideFilter->setFilterQuality(quality);
+ fOverrideFilterQuality = overrideTexFiltering;
+ fFilterQuality = quality;
+ this->updatePaintFilterCanvas();
}
void SkDebugCanvas::onClipPath(const SkPath& path, SkRegion::Op op, ClipEdgeStyle edgeStyle) {
diff --git a/src/utils/debugger/SkDebugCanvas.h b/src/utils/debugger/SkDebugCanvas.h
index 66b85fc38f..35dd6fb92d 100644
--- a/src/utils/debugger/SkDebugCanvas.h
+++ b/src/utils/debugger/SkDebugCanvas.h
@@ -17,7 +17,7 @@
#include "SkTArray.h"
#include "SkString.h"
-class SkTexOverrideFilter;
+class SkNWayCanvas;
class SK_API SkDebugCanvas : public SkCanvas {
public:
@@ -32,7 +32,7 @@ public:
/**
* Enable or disable overdraw visualization
*/
- void setOverdrawViz(bool overdrawViz) { fOverdrawViz = overdrawViz; }
+ void setOverdrawViz(bool overdrawViz);
bool getOverdrawViz() const { return fOverdrawViz; }
bool getAllowSimplifyClip() const { return fAllowSimplifyClip; }
@@ -232,10 +232,10 @@ private:
SkPath fSaveDevPath;
bool fOverdrawViz;
- SkDrawFilter* fOverdrawFilter;
+ bool fOverrideFilterQuality;
+ SkFilterQuality fFilterQuality;
- bool fOverrideTexFiltering;
- SkTexOverrideFilter* fTexOverrideFilter;
+ SkAutoTUnref<SkNWayCanvas> fPaintFilterCanvas;
/**
The active saveLayer commands at a given point in the renderering.
@@ -274,6 +274,8 @@ private:
void outputPointsCommon(const SkPoint* pts, int count);
void outputScalar(SkScalar num);
+ void updatePaintFilterCanvas();
+
typedef SkCanvas INHERITED;
};