aboutsummaryrefslogtreecommitdiffhomepage
path: root/dm
diff options
context:
space:
mode:
authorGravatar Mike Reed <reed@google.com>2016-11-09 13:59:58 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2016-11-09 19:40:06 +0000
commit824075071885b6b741c141cbe2134d8345d34589 (patch)
tree828b9fd105e92a6ff21b0dc942da6c015ea8ac73 /dm
parentc78eff97549e8e346394d3e228395ceb8a467b35 (diff)
Change SkCanvas to *not* inherit from SkRefCnt
Definitely tricky for classes like SkNWayCanvas, where the caller (today) need not pay attention to ownership of the canvases it gave the NWay (after this CL, the caller *must* managed ownership) BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=4441 DOCS_PREVIEW= https://skia.org/?cl=4441 Change-Id: Ib1ac07a3cdf0686d78e7aaa4735d45cc90bea081 Reviewed-on: https://skia-review.googlesource.com/4441 Commit-Queue: Mike Reed <reed@google.com> Reviewed-by: Florin Malita <fmalita@chromium.org> Reviewed-by: Robert Phillips <robertphillips@google.com>
Diffstat (limited to 'dm')
-rw-r--r--dm/DMSrcSink.cpp12
1 files changed, 5 insertions, 7 deletions
diff --git a/dm/DMSrcSink.cpp b/dm/DMSrcSink.cpp
index 3bef299d65..b495520287 100644
--- a/dm/DMSrcSink.cpp
+++ b/dm/DMSrcSink.cpp
@@ -1192,8 +1192,7 @@ Name MSKPSrc::name() const { return SkOSPath::Basename(fPath.c_str()); }
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
Error NullSink::draw(const Src& src, SkBitmap*, SkWStream*, SkString*) const {
- std::unique_ptr<SkCanvas> canvas(SkCreateNullCanvas());
- return src.draw(canvas.get());
+ return src.draw(SkMakeNullCanvas().get());
}
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
@@ -1356,7 +1355,7 @@ Error DebugSink::draw(const Src& src, SkBitmap*, SkWStream* dst, SkString*) cons
if (!err.isEmpty()) {
return err;
}
- sk_sp<SkCanvas> nullCanvas(SkCreateNullCanvas());
+ std::unique_ptr<SkCanvas> nullCanvas = SkMakeNullCanvas();
UrlDataManager dataManager(SkString("data"));
Json::Value json = debugCanvas.toJSON(
dataManager, debugCanvas.getSize(), nullCanvas.get());
@@ -1371,10 +1370,9 @@ SVGSink::SVGSink() {}
Error SVGSink::draw(const Src& src, SkBitmap*, SkWStream* dst, SkString*) const {
#if defined(SK_XML)
std::unique_ptr<SkXMLWriter> xmlWriter(new SkXMLStreamWriter(dst));
- sk_sp<SkCanvas> canvas(SkSVGCanvas::Create(
- SkRect::MakeWH(SkIntToScalar(src.size().width()), SkIntToScalar(src.size().height())),
- xmlWriter.get()));
- return src.draw(canvas.get());
+ return src.draw(SkSVGCanvas::Make(SkRect::MakeWH(SkIntToScalar(src.size().width()),
+ SkIntToScalar(src.size().height())),
+ xmlWriter.get()).get());
#else
return Error("SVG sink is disabled.");
#endif // SK_XML