switch surface to sk_sp
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1817383002
CQ_EXTRA_TRYBOTS=client.skia.compile:Build-Ubuntu-GCC-x86_64-Release-CMake-Trybot,Build-Mac-Clang-x86_64-Release-CMake-Trybot
Review URL: https://codereview.chromium.org/1817383002
diff --git a/bench/DisplacementBench.cpp b/bench/DisplacementBench.cpp
index c22b8fd..eadafb6 100644
--- a/bench/DisplacementBench.cpp
+++ b/bench/DisplacementBench.cpp
@@ -48,7 +48,7 @@
void makeCheckerboard() {
const int w = this->isSmall() ? FILTER_WIDTH_SMALL : FILTER_WIDTH_LARGE;
const int h = this->isSmall() ? FILTER_HEIGHT_LARGE : FILTER_HEIGHT_LARGE;
- SkAutoTUnref<SkSurface> surface(SkSurface::NewRasterN32Premul(w, h));
+ auto surface(SkSurface::MakeRasterN32Premul(w, h));
SkCanvas* canvas = surface->getCanvas();
canvas->clear(0x00000000);
SkPaint darkPaint;
diff --git a/bench/ImageBench.cpp b/bench/ImageBench.cpp
index b07d267..fbfce05 100644
--- a/bench/ImageBench.cpp
+++ b/bench/ImageBench.cpp
@@ -31,12 +31,12 @@
void onPerCanvasPreDraw(SkCanvas* canvas) override {
// create an Image reflecting the canvas (gpu or cpu)
SkImageInfo info = SkImageInfo::MakeN32Premul(100, 100);
- SkAutoTUnref<SkSurface> surface(canvas->newSurface(info));
+ auto surface(canvas->makeSurface(info));
canvas->drawColor(SK_ColorRED);
fImage = surface->makeImageSnapshot();
// create a cpu-backed Surface
- fRasterSurface.reset(SkSurface::NewRaster(info));
+ fRasterSurface = SkSurface::MakeRaster(info);
}
void onPerCanvasPostDraw(SkCanvas*) override {
@@ -57,7 +57,7 @@
private:
SkString fName;
sk_sp<SkImage> fImage;
- SkAutoTUnref<SkSurface> fRasterSurface;
+ sk_sp<SkSurface> fRasterSurface;
typedef Benchmark INHERITED;
};
diff --git a/bench/MergeBench.cpp b/bench/MergeBench.cpp
index b24f988..e1f7d97 100644
--- a/bench/MergeBench.cpp
+++ b/bench/MergeBench.cpp
@@ -51,7 +51,7 @@
}
void make_bitmap() {
- SkAutoTUnref<SkSurface> surface(SkSurface::NewRasterN32Premul(80, 80));
+ auto surface(SkSurface::MakeRasterN32Premul(80, 80));
surface->getCanvas()->clear(0x00000000);
SkPaint paint;
paint.setAntiAlias(true);
@@ -63,7 +63,7 @@
}
void make_checkerboard() {
- SkAutoTUnref<SkSurface> surface(SkSurface::NewRasterN32Premul(80, 80));
+ auto surface(SkSurface::MakeRasterN32Premul(80, 80));
SkCanvas* canvas = surface->getCanvas();
canvas->clear(0x00000000);
SkPaint darkPaint;
diff --git a/bench/SKPBench.cpp b/bench/SKPBench.cpp
index 1d378b5..add415d 100644
--- a/bench/SKPBench.cpp
+++ b/bench/SKPBench.cpp
@@ -72,7 +72,7 @@
for (int x = bounds.fLeft; x < bounds.fRight; x += tileW) {
const SkIRect tileRect = SkIRect::MakeXYWH(x, y, tileW, tileH);
*fTileRects.append() = tileRect;
- *fSurfaces.push() = canvas->newSurface(ii);
+ *fSurfaces.push() = canvas->makeSurface(ii).release();
// Never want the contents of a tile to include stuff the parent
// canvas clips out
diff --git a/bench/nanobench.cpp b/bench/nanobench.cpp
index 3a3bca6..c0f674f 100644
--- a/bench/nanobench.cpp
+++ b/bench/nanobench.cpp
@@ -132,8 +132,8 @@
bool Target::init(SkImageInfo info, Benchmark* bench) {
if (Benchmark::kRaster_Backend == config.backend) {
- this->surface.reset(SkSurface::NewRaster(info));
- if (!this->surface.get()) {
+ this->surface = SkSurface::MakeRaster(info);
+ if (!this->surface) {
return false;
}
}
@@ -183,10 +183,10 @@
uint32_t flags = this->config.useDFText ? SkSurfaceProps::kUseDeviceIndependentFonts_Flag :
0;
SkSurfaceProps props(flags, SkSurfaceProps::kLegacyFontHost_InitType);
- this->surface.reset(SkSurface::NewRenderTarget(gGrFactory->get(this->config.ctxType,
- this->config.ctxOptions),
+ this->surface = SkSurface::MakeRenderTarget(gGrFactory->get(this->config.ctxType,
+ this->config.ctxOptions),
SkBudgeted::kNo, info,
- this->config.samples, &props));
+ this->config.samples, &props);
this->gl = gGrFactory->getContextInfo(this->config.ctxType,
this->config.ctxOptions).fGLContext;
if (!this->surface.get()) {
diff --git a/bench/nanobench.h b/bench/nanobench.h
index ad538dd..5e4efbf 100644
--- a/bench/nanobench.h
+++ b/bench/nanobench.h
@@ -44,7 +44,7 @@
virtual ~Target() { }
const Config config;
- SkAutoTDelete<SkSurface> surface;
+ sk_sp<SkSurface> surface;
/** Called once per target, immediately before any timing or drawing. */
virtual void setup() { }