aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/utils
diff options
context:
space:
mode:
authorGravatar Florin Malita <fmalita@chromium.org>2017-10-12 11:08:46 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-10-12 15:32:11 +0000
commit1ba5b6baa8aa9f7803996763dcc9a0d8307c3093 (patch)
treeb3e1e69e042c1c9cd052c52d243925175844af63 /src/utils
parent20d479c088ad6dc06e16b13a3e6b2dfefa845430 (diff)
Plumb more SkPaintFilterCanvas virtuals
SkNWayCanvas cannot support virtuals which imply one-to-one proxying, but SkPaintFilterCanvas can (and should). Change-Id: If966aa4ec3fcc79e6355a82cc299fd1877e4cf53 Reviewed-on: https://skia-review.googlesource.com/58842 Reviewed-by: Mike Reed <reed@google.com> Commit-Queue: Florin Malita <fmalita@chromium.org>
Diffstat (limited to 'src/utils')
-rw-r--r--src/utils/SkNWayCanvas.cpp7
-rw-r--r--src/utils/SkPaintFilterCanvas.cpp32
2 files changed, 39 insertions, 0 deletions
diff --git a/src/utils/SkNWayCanvas.cpp b/src/utils/SkNWayCanvas.cpp
index b1e92fb2be..c612c7d7e1 100644
--- a/src/utils/SkNWayCanvas.cpp
+++ b/src/utils/SkNWayCanvas.cpp
@@ -320,6 +320,13 @@ void SkNWayCanvas::onDrawAnnotation(const SkRect& rect, const char key[], SkData
}
}
+void SkNWayCanvas::onFlush() {
+ Iter iter(fList);
+ while (iter.next()) {
+ iter->flush();
+ }
+}
+
#ifdef SK_SUPPORT_LEGACY_DRAWFILTER
SkDrawFilter* SkNWayCanvas::setDrawFilter(SkDrawFilter* filter) {
Iter iter(fList);
diff --git a/src/utils/SkPaintFilterCanvas.cpp b/src/utils/SkPaintFilterCanvas.cpp
index 6092058ee1..668ebe37a9 100644
--- a/src/utils/SkPaintFilterCanvas.cpp
+++ b/src/utils/SkPaintFilterCanvas.cpp
@@ -8,6 +8,8 @@
#include "SkPaintFilterCanvas.h"
#include "SkPaint.h"
+#include "SkPixmap.h"
+#include "SkSurface.h"
#include "SkTLazy.h"
class SkPaintFilterCanvas::AutoPaintFilter {
@@ -230,3 +232,33 @@ void SkPaintFilterCanvas::onDrawTextBlob(const SkTextBlob* blob, SkScalar x, SkS
this->INHERITED::onDrawTextBlob(blob, x, y, *apf.paint());
}
}
+
+sk_sp<SkSurface> SkPaintFilterCanvas::onNewSurface(const SkImageInfo& info,
+ const SkSurfaceProps& props) {
+ return proxy()->makeSurface(info, &props);
+}
+
+bool SkPaintFilterCanvas::onPeekPixels(SkPixmap* pixmap) {
+ return proxy()->peekPixels(pixmap);
+}
+
+bool SkPaintFilterCanvas::onAccessTopLayerPixels(SkPixmap* pixmap) {
+ SkImageInfo info;
+ size_t rowBytes;
+
+ void* addr = proxy()->accessTopLayerPixels(&info, &rowBytes);
+ if (!addr) {
+ return false;
+ }
+
+ pixmap->reset(info, addr, rowBytes);
+ return true;
+}
+
+SkImageInfo SkPaintFilterCanvas::onImageInfo() const {
+ return proxy()->imageInfo();
+}
+
+bool SkPaintFilterCanvas::onGetProps(SkSurfaceProps* props) const {
+ return proxy()->getProps(props);
+}