From 1ba5b6baa8aa9f7803996763dcc9a0d8307c3093 Mon Sep 17 00:00:00 2001 From: Florin Malita Date: Thu, 12 Oct 2017 11:08:46 -0400 Subject: 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 Commit-Queue: Florin Malita --- src/utils/SkNWayCanvas.cpp | 7 +++++++ src/utils/SkPaintFilterCanvas.cpp | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+) (limited to 'src/utils') 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 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); +} -- cgit v1.2.3