override new virtual onDrawDRRect in util canvas subclasses
BUG=skia:
R=robertphillips@google.com, reed@google.com
Author: reed@chromium.org
Review URL: https://codereview.chromium.org/174593003
git-svn-id: http://skia.googlecode.com/svn/trunk@13529 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/include/utils/SkDeferredCanvas.h b/include/utils/SkDeferredCanvas.h
index b0435de..d028282 100644
--- a/include/utils/SkDeferredCanvas.h
+++ b/include/utils/SkDeferredCanvas.h
@@ -200,6 +200,10 @@
virtual SkBounder* setBounder(SkBounder* bounder) SK_OVERRIDE;
virtual SkDrawFilter* setDrawFilter(SkDrawFilter* filter) SK_OVERRIDE;
+protected:
+ virtual void onDrawDRRect(const SkRRect&, const SkRRect&,
+ const SkPaint&) SK_OVERRIDE;
+
public:
class NotificationClient {
public:
diff --git a/include/utils/SkDumpCanvas.h b/include/utils/SkDumpCanvas.h
index 96b45e7..7b65f43 100644
--- a/include/utils/SkDumpCanvas.h
+++ b/include/utils/SkDumpCanvas.h
@@ -40,6 +40,7 @@
kDrawOval_Verb,
kDrawRect_Verb,
kDrawRRect_Verb,
+ kDrawDRRect_Verb,
kDrawPath_Verb,
kDrawBitmap_Verb,
kDrawText_Verb,
@@ -126,6 +127,9 @@
virtual void addComment(const char* kywd, const char* value) SK_OVERRIDE;
virtual void endCommentGroup() SK_OVERRIDE;
+protected:
+ virtual void onDrawDRRect(const SkRRect&, const SkRRect&, const SkPaint&) SK_OVERRIDE;
+
private:
Dumper* fDumper;
int fNestLevel; // for nesting recursive elements like pictures
diff --git a/include/utils/SkLuaCanvas.h b/include/utils/SkLuaCanvas.h
index c34d134..be1cf4d 100644
--- a/include/utils/SkLuaCanvas.h
+++ b/include/utils/SkLuaCanvas.h
@@ -72,6 +72,9 @@
const SkPaint& paint) SK_OVERRIDE;
virtual void drawData(const void* data, size_t length) SK_OVERRIDE;
+protected:
+ virtual void onDrawDRRect(const SkRRect&, const SkRRect&, const SkPaint&) SK_OVERRIDE;
+
private:
lua_State* fL;
SkString fFunc;
diff --git a/include/utils/SkNWayCanvas.h b/include/utils/SkNWayCanvas.h
index eae3bfc..d83dd6e 100644
--- a/include/utils/SkNWayCanvas.h
+++ b/include/utils/SkNWayCanvas.h
@@ -86,6 +86,8 @@
protected:
SkTDArray<SkCanvas*> fList;
+ virtual void onDrawDRRect(const SkRRect&, const SkRRect&, const SkPaint&) SK_OVERRIDE;
+
class Iter;
private:
diff --git a/include/utils/SkProxyCanvas.h b/include/utils/SkProxyCanvas.h
index 383e532..f192e54 100644
--- a/include/utils/SkProxyCanvas.h
+++ b/include/utils/SkProxyCanvas.h
@@ -85,6 +85,9 @@
virtual SkBounder* setBounder(SkBounder* bounder) SK_OVERRIDE;
virtual SkDrawFilter* setDrawFilter(SkDrawFilter* filter) SK_OVERRIDE;
+protected:
+ virtual void onDrawDRRect(const SkRRect&, const SkRRect&, const SkPaint&) SK_OVERRIDE;
+
private:
SkCanvas* fProxy;
diff --git a/src/utils/SkDeferredCanvas.cpp b/src/utils/SkDeferredCanvas.cpp
index fc85711..3911fd0 100644
--- a/src/utils/SkDeferredCanvas.cpp
+++ b/src/utils/SkDeferredCanvas.cpp
@@ -880,6 +880,13 @@
}
}
+void SkDeferredCanvas::onDrawDRRect(const SkRRect& outer, const SkRRect& inner,
+ const SkPaint& paint) {
+ AutoImmediateDrawIfNeeded autoDraw(*this, &paint);
+ this->drawingCanvas()->drawDRRect(outer, inner, paint);
+ this->recordedDrawCommand();
+}
+
void SkDeferredCanvas::drawPath(const SkPath& path, const SkPaint& paint) {
AutoImmediateDrawIfNeeded autoDraw(*this, &paint);
this->drawingCanvas()->drawPath(path, paint);
diff --git a/src/utils/SkDumpCanvas.cpp b/src/utils/SkDumpCanvas.cpp
index 5f3a572..c8a94f4 100644
--- a/src/utils/SkDumpCanvas.cpp
+++ b/src/utils/SkDumpCanvas.cpp
@@ -324,7 +324,16 @@
void SkDumpCanvas::drawRRect(const SkRRect& rrect, const SkPaint& paint) {
SkString str;
toString(rrect, &str);
- this->dump(kDrawRRect_Verb, &paint, "drawRRect(%s)", str.c_str());
+ this->dump(kDrawDRRect_Verb, &paint, "drawRRect(%s)", str.c_str());
+}
+
+void SkDumpCanvas::onDrawDRRect(const SkRRect& outer, const SkRRect& inner,
+ const SkPaint& paint) {
+ SkString str0, str1;
+ toString(outer, &str0);
+ toString(inner, &str0);
+ this->dump(kDrawRRect_Verb, &paint, "drawDRRect(%s,%s)",
+ str0.c_str(), str1.c_str());
}
void SkDumpCanvas::drawPath(const SkPath& path, const SkPaint& paint) {
diff --git a/src/utils/SkLuaCanvas.cpp b/src/utils/SkLuaCanvas.cpp
index 7f12740..8c25dc0 100644
--- a/src/utils/SkLuaCanvas.cpp
+++ b/src/utils/SkLuaCanvas.cpp
@@ -194,6 +194,14 @@
lua.pushPaint(paint, "paint");
}
+void SkLuaCanvas::onDrawDRRect(const SkRRect& outer, const SkRRect& inner,
+ const SkPaint& paint) {
+ AUTO_LUA("drawDRRect");
+ lua.pushRRect(outer, "outer");
+ lua.pushRRect(inner, "inner");
+ lua.pushPaint(paint, "paint");
+}
+
void SkLuaCanvas::drawPath(const SkPath& path, const SkPaint& paint) {
AUTO_LUA("drawPath");
lua.pushPath(path, "path");
diff --git a/src/utils/SkNWayCanvas.cpp b/src/utils/SkNWayCanvas.cpp
index 831d7bf..27adc6d 100644
--- a/src/utils/SkNWayCanvas.cpp
+++ b/src/utils/SkNWayCanvas.cpp
@@ -205,6 +205,14 @@
}
}
+void SkNWayCanvas::onDrawDRRect(const SkRRect& outer, const SkRRect& inner,
+ const SkPaint& paint) {
+ Iter iter(fList);
+ while (iter.next()) {
+ iter->drawDRRect(outer, inner, paint);
+ }
+}
+
void SkNWayCanvas::drawPath(const SkPath& path, const SkPaint& paint) {
Iter iter(fList);
while (iter.next()) {
diff --git a/src/utils/SkProxyCanvas.cpp b/src/utils/SkProxyCanvas.cpp
index f530313..245e0a6 100644
--- a/src/utils/SkProxyCanvas.cpp
+++ b/src/utils/SkProxyCanvas.cpp
@@ -95,6 +95,11 @@
fProxy->drawRRect(rrect, paint);
}
+void SkProxyCanvas::onDrawDRRect(const SkRRect& outer, const SkRRect& inner,
+ const SkPaint& paint) {
+ fProxy->drawDRRect(outer, inner, paint);
+}
+
void SkProxyCanvas::drawPath(const SkPath& path, const SkPaint& paint) {
fProxy->drawPath(path, paint);
}
diff --git a/src/utils/debugger/SkDebugCanvas.cpp b/src/utils/debugger/SkDebugCanvas.cpp
index 07cb09f..8808854 100644
--- a/src/utils/debugger/SkDebugCanvas.cpp
+++ b/src/utils/debugger/SkDebugCanvas.cpp
@@ -401,6 +401,11 @@
addDrawCommand(new SkDrawRRectCommand(rrect, paint));
}
+void SkDebugCanvas::onDrawDRRect(const SkRRect& outer, const SkRRect& inner,
+ const SkPaint& paint) {
+ // TODO: add DRRect to debugger
+}
+
void SkDebugCanvas::drawSprite(const SkBitmap& bitmap, int left, int top,
const SkPaint* paint = NULL) {
addDrawCommand(new SkDrawSpriteCommand(bitmap, left, top, paint));
diff --git a/src/utils/debugger/SkDebugCanvas.h b/src/utils/debugger/SkDebugCanvas.h
index 262619e..94316d5 100644
--- a/src/utils/debugger/SkDebugCanvas.h
+++ b/src/utils/debugger/SkDebugCanvas.h
@@ -233,6 +233,9 @@
static const int kVizImageHeight = 256;
static const int kVizImageWidth = 256;
+protected:
+ virtual void onDrawDRRect(const SkRRect&, const SkRRect&, const SkPaint&) SK_OVERRIDE;
+
private:
SkTDArray<SkDrawCommand*> fCommandVector;
int fWidth;