aboutsummaryrefslogtreecommitdiffhomepage
path: root/gm/aaclip.cpp
diff options
context:
space:
mode:
authorGravatar Heather Miller <hcm@google.com>2016-11-10 21:25:30 +0000
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2016-11-10 21:25:44 +0000
commitb613c266df48cf45296ecc23d1bd7098c84bb7ba (patch)
tree50f7d84a4238918bf5869ee760ed78332b2db946 /gm/aaclip.cpp
parentfac8db2df8b5cf6fd62189315bad0726d8e51f6d (diff)
Revert "Change SkCanvas to *not* inherit from SkRefCnt"
This reverts commit 824075071885b6b741c141cbe2134d8345d34589. Reason for revert: Breaking WebView (chromium:663959) Original change's description: > 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> > TBR=djsollen@google.com,mtklein@google.com,halcanary@google.com,robertphillips@google.com,fmalita@chromium.org,fmalita@google.com,reed@google.com,reviews@skia.org NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true Change-Id: I5e3b3e876b7d2c09833cf841801321033b6b968b Reviewed-on: https://skia-review.googlesource.com/4687 Commit-Queue: Heather Miller <hcm@google.com> Reviewed-by: Heather Miller <hcm@google.com>
Diffstat (limited to 'gm/aaclip.cpp')
-rw-r--r--gm/aaclip.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/gm/aaclip.cpp b/gm/aaclip.cpp
index 683f5ff960..dd83b7c730 100644
--- a/gm/aaclip.cpp
+++ b/gm/aaclip.cpp
@@ -8,7 +8,6 @@
#include "gm.h"
#include "SkCanvas.h"
#include "SkPath.h"
-#include "SkMakeUnique.h"
static void do_draw(SkCanvas* canvas, const SkRect& r) {
SkPaint paint;
@@ -167,14 +166,14 @@ DEF_GM(return new AAClipGM;)
#ifdef SK_BUILD_FOR_MAC
-static std::unique_ptr<SkCanvas> make_canvas(const SkBitmap& bm) {
+static SkCanvas* make_canvas(const SkBitmap& bm) {
const SkImageInfo& info = bm.info();
if (info.bytesPerPixel() == 4) {
- return SkCanvas::MakeRasterDirectN32(info.width(), info.height(),
- (SkPMColor*)bm.getPixels(),
- bm.rowBytes());
+ return SkCanvas::NewRasterDirectN32(info.width(), info.height(),
+ (SkPMColor*)bm.getPixels(),
+ bm.rowBytes());
} else {
- return skstd::make_unique<SkCanvas>(bm);
+ return new SkCanvas(bm);
}
}
@@ -183,6 +182,7 @@ static void test_image(SkCanvas* canvas, const SkImageInfo& info) {
SkBitmap bm;
bm.allocPixels(info);
+ sk_sp<SkCanvas> newc(make_canvas(bm));
if (info.isOpaque()) {
bm.eraseColor(SK_ColorGREEN);
} else {
@@ -192,7 +192,7 @@ static void test_image(SkCanvas* canvas, const SkImageInfo& info) {
SkPaint paint;
paint.setAntiAlias(true);
paint.setColor(SK_ColorBLUE);
- make_canvas(bm)->drawCircle(50, 50, 49, paint);
+ newc->drawCircle(50, 50, 49, paint);
canvas->drawBitmap(bm, 10, 10);
CGImageRef image = SkCreateCGImageRefWithColorspace(bm, nullptr);