aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/utils
diff options
context:
space:
mode:
Diffstat (limited to 'src/utils')
-rw-r--r--src/utils/SkDumpCanvas.cpp14
-rw-r--r--src/utils/SkLuaCanvas.cpp6
-rw-r--r--src/utils/SkNWayCanvas.cpp7
-rw-r--r--src/utils/SkPaintFilterCanvas.cpp10
4 files changed, 36 insertions, 1 deletions
diff --git a/src/utils/SkDumpCanvas.cpp b/src/utils/SkDumpCanvas.cpp
index 05cabadefe..c547fa238e 100644
--- a/src/utils/SkDumpCanvas.cpp
+++ b/src/utils/SkDumpCanvas.cpp
@@ -6,6 +6,7 @@
*/
#include "SkData.h"
+#include "SkDrawable.h"
#include "SkDumpCanvas.h"
#include "SkImage.h"
#include "SkPatchUtils.h"
@@ -461,11 +462,22 @@ void SkDumpCanvas::onDrawPicture(const SkPicture* picture, const SkMatrix* matri
fNestLevel += 1;
this->INHERITED::onDrawPicture(picture, matrix, paint);
fNestLevel -= 1;
- this->dump(kDrawPicture_Verb, nullptr, "endPicture(%p) %f:%f:%f:%f", &picture,
+ this->dump(kDrawPicture_Verb, nullptr, "endPicture(%p) %f:%f:%f:%f", picture,
picture->cullRect().fLeft, picture->cullRect().fTop,
picture->cullRect().fRight, picture->cullRect().fBottom);
}
+void SkDumpCanvas::onDrawDrawable(SkDrawable* drawable, const SkMatrix* matrix) {
+ const auto bounds = drawable->getBounds();
+ this->dump(kDrawPicture_Verb, nullptr, "drawDrawable(%p) %f:%f:%f:%f", drawable,
+ bounds.fLeft, bounds.fTop, bounds.fRight, bounds.fBottom);
+ fNestLevel += 1;
+ this->INHERITED::onDrawDrawable(drawable, matrix);
+ fNestLevel -= 1;
+ this->dump(kDrawPicture_Verb, nullptr, "endDrawable(%p) %f:%f:%f:%f", drawable,
+ bounds.fLeft, bounds.fTop, bounds.fRight, bounds.fBottom);
+}
+
void SkDumpCanvas::onDrawVerticesObject(const SkVertices* vertices, SkBlendMode,
const SkPaint& paint) {
this->dump(kDrawVertices_Verb, &paint, "drawVertices(%s [%d] ...)",
diff --git a/src/utils/SkLuaCanvas.cpp b/src/utils/SkLuaCanvas.cpp
index ddf5187baf..9d2e8c9041 100644
--- a/src/utils/SkLuaCanvas.cpp
+++ b/src/utils/SkLuaCanvas.cpp
@@ -307,6 +307,12 @@ void SkLuaCanvas::onDrawPicture(const SkPicture* picture, const SkMatrix* matrix
this->INHERITED::onDrawPicture(picture, matrix, paint);
}
+void SkLuaCanvas::onDrawDrawable(SkDrawable* drawable, const SkMatrix* matrix) {
+ AUTO_LUA("drawDrawable");
+ // call through so we can see the nested ops
+ this->INHERITED::onDrawDrawable(drawable, matrix);
+}
+
void SkLuaCanvas::onDrawVerticesObject(const SkVertices*, SkBlendMode, const SkPaint& paint) {
AUTO_LUA("drawVertices");
lua.pushPaint(paint, "paint");
diff --git a/src/utils/SkNWayCanvas.cpp b/src/utils/SkNWayCanvas.cpp
index 208f3b4719..b1e92fb2be 100644
--- a/src/utils/SkNWayCanvas.cpp
+++ b/src/utils/SkNWayCanvas.cpp
@@ -282,6 +282,13 @@ void SkNWayCanvas::onDrawPicture(const SkPicture* picture, const SkMatrix* matri
}
}
+void SkNWayCanvas::onDrawDrawable(SkDrawable* drawable, const SkMatrix* matrix) {
+ Iter iter(fList);
+ while (iter.next()) {
+ iter->drawDrawable(drawable, matrix);
+ }
+}
+
void SkNWayCanvas::onDrawVerticesObject(const SkVertices* vertices, SkBlendMode bmode,
const SkPaint& paint) {
Iter iter(fList);
diff --git a/src/utils/SkPaintFilterCanvas.cpp b/src/utils/SkPaintFilterCanvas.cpp
index e504c72119..6092058ee1 100644
--- a/src/utils/SkPaintFilterCanvas.cpp
+++ b/src/utils/SkPaintFilterCanvas.cpp
@@ -172,6 +172,16 @@ void SkPaintFilterCanvas::onDrawPicture(const SkPicture* picture, const SkMatrix
}
}
+void SkPaintFilterCanvas::onDrawDrawable(SkDrawable* drawable, const SkMatrix* matrix) {
+ // There is no paint to filter in this case, but we can still filter on type.
+ // Subclasses need to unroll the drawable explicity (by overriding this method) in
+ // order to actually filter nested content.
+ AutoPaintFilter apf(this, kDrawable_Type, nullptr);
+ if (apf.shouldDraw()) {
+ this->INHERITED::onDrawDrawable(drawable, matrix);
+ }
+}
+
void SkPaintFilterCanvas::onDrawText(const void* text, size_t byteLength, SkScalar x, SkScalar y,
const SkPaint& paint) {
AutoPaintFilter apf(this, kText_Type, paint);