aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/utils/debugger
diff options
context:
space:
mode:
authorGravatar robertphillips@google.com <robertphillips@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2014-02-28 18:19:39 +0000
committerGravatar robertphillips@google.com <robertphillips@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2014-02-28 18:19:39 +0000
commit8f90a892c5130d4d26b5588e1ff151d01a40688a (patch)
treec21277731de84a5059659df199659fee9352842c /src/utils/debugger
parent069c2a46ba2dc419dcd7dbcb9bf3b83c49b45b41 (diff)
add new onClip* methods to SkCanvas
Diffstat (limited to 'src/utils/debugger')
-rw-r--r--src/utils/debugger/SkDebugCanvas.cpp23
-rw-r--r--src/utils/debugger/SkDebugCanvas.h34
2 files changed, 34 insertions, 23 deletions
diff --git a/src/utils/debugger/SkDebugCanvas.cpp b/src/utils/debugger/SkDebugCanvas.cpp
index 15165c27e2..fedef697aa 100644
--- a/src/utils/debugger/SkDebugCanvas.cpp
+++ b/src/utils/debugger/SkDebugCanvas.cpp
@@ -43,7 +43,8 @@ SkDebugCanvas::SkDebugCanvas(int width, int height)
large.roundOut(&largeIRect);
SkASSERT(!largeIRect.isEmpty());
#endif
- INHERITED::clipRect(large, SkRegion::kReplace_Op, false);
+ // call the base class' version to avoid adding a draw command
+ this->INHERITED::onClipRect(large, SkRegion::kReplace_Op, kHard_ClipEdgeStyle);
}
SkDebugCanvas::~SkDebugCanvas() {
@@ -297,24 +298,20 @@ void SkDebugCanvas::clear(SkColor color) {
addDrawCommand(new SkClearCommand(color));
}
-bool SkDebugCanvas::clipPath(const SkPath& path, SkRegion::Op op, bool doAA) {
- addDrawCommand(new SkClipPathCommand(path, op, doAA));
- return true;
+void SkDebugCanvas::onClipPath(const SkPath& path, SkRegion::Op op, ClipEdgeStyle edgeStyle) {
+ this->addDrawCommand(new SkClipPathCommand(path, op, kSoft_ClipEdgeStyle == edgeStyle));
}
-bool SkDebugCanvas::clipRect(const SkRect& rect, SkRegion::Op op, bool doAA) {
- addDrawCommand(new SkClipRectCommand(rect, op, doAA));
- return true;
+void SkDebugCanvas::onClipRect(const SkRect& rect, SkRegion::Op op, ClipEdgeStyle edgeStyle) {
+ this->addDrawCommand(new SkClipRectCommand(rect, op, kSoft_ClipEdgeStyle == edgeStyle));
}
-bool SkDebugCanvas::clipRRect(const SkRRect& rrect, SkRegion::Op op, bool doAA) {
- addDrawCommand(new SkClipRRectCommand(rrect, op, doAA));
- return true;
+void SkDebugCanvas::onClipRRect(const SkRRect& rrect, SkRegion::Op op, ClipEdgeStyle edgeStyle) {
+ this->addDrawCommand(new SkClipRRectCommand(rrect, op, kSoft_ClipEdgeStyle == edgeStyle));
}
-bool SkDebugCanvas::clipRegion(const SkRegion& region, SkRegion::Op op) {
- addDrawCommand(new SkClipRegionCommand(region, op));
- return true;
+void SkDebugCanvas::onClipRegion(const SkRegion& region, SkRegion::Op op) {
+ this->addDrawCommand(new SkClipRegionCommand(region, op));
}
bool SkDebugCanvas::concat(const SkMatrix& matrix) {
diff --git a/src/utils/debugger/SkDebugCanvas.h b/src/utils/debugger/SkDebugCanvas.h
index 7d496274ac..ebce6c9131 100644
--- a/src/utils/debugger/SkDebugCanvas.h
+++ b/src/utils/debugger/SkDebugCanvas.h
@@ -143,16 +143,6 @@ public:
virtual void clear(SkColor) SK_OVERRIDE;
- virtual bool clipPath(const SkPath&, SkRegion::Op, bool) SK_OVERRIDE;
-
- virtual bool clipRect(const SkRect&, SkRegion::Op, bool) SK_OVERRIDE;
-
- virtual bool clipRRect(const SkRRect& rrect,
- SkRegion::Op op = SkRegion::kIntersect_Op,
- bool doAntiAlias = false) SK_OVERRIDE;
-
- virtual bool clipRegion(const SkRegion& region, SkRegion::Op op) SK_OVERRIDE;
-
virtual bool concat(const SkMatrix& matrix) SK_OVERRIDE;
virtual void drawBitmap(const SkBitmap&, SkScalar left, SkScalar top,
@@ -233,11 +223,35 @@ public:
static const int kVizImageHeight = 256;
static const int kVizImageWidth = 256;
+ virtual bool isClipEmpty() const SK_OVERRIDE { return false; }
+ virtual ClipType getClipType() const SK_OVERRIDE {
+ return kRect_ClipType;
+ }
+ virtual bool getClipBounds(SkRect* bounds) const SK_OVERRIDE {
+ if (NULL != bounds) {
+ bounds->setXYWH(0, 0,
+ SkIntToScalar(this->imageInfo().fWidth),
+ SkIntToScalar(this->imageInfo().fHeight));
+ }
+ return true;
+ }
+ virtual bool getClipDeviceBounds(SkIRect* bounds) const SK_OVERRIDE {
+ if (NULL != bounds) {
+ bounds->setLargest();
+ }
+ return true;
+ }
+
protected:
virtual void onDrawDRRect(const SkRRect&, const SkRRect&, const SkPaint&) SK_OVERRIDE;
virtual void onPushCull(const SkRect& cullRect) SK_OVERRIDE;
virtual void onPopCull() SK_OVERRIDE;
+ virtual void onClipRect(const SkRect&, SkRegion::Op, ClipEdgeStyle) SK_OVERRIDE;
+ virtual void onClipRRect(const SkRRect&, SkRegion::Op, ClipEdgeStyle) SK_OVERRIDE;
+ virtual void onClipPath(const SkPath&, SkRegion::Op, ClipEdgeStyle) SK_OVERRIDE;
+ virtual void onClipRegion(const SkRegion& region, SkRegion::Op) SK_OVERRIDE;
+
private:
SkTDArray<SkDrawCommand*> fCommandVector;
int fWidth;