Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(203)

Unified Diff: dm/DMSrcSink.cpp

Issue 1817383002: switch surface to sk_sp (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « dm/DMGpuSupport.h ('k') | example/HelloWorld.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dm/DMSrcSink.cpp
diff --git a/dm/DMSrcSink.cpp b/dm/DMSrcSink.cpp
index 6fd46c80ed99a3b299ad139b0b6bfe5192a5e0fa..78782a086629ce6f33477ec8ceeee3a54f841543 100644
--- a/dm/DMSrcSink.cpp
+++ b/dm/DMSrcSink.cpp
@@ -990,7 +990,7 @@ Error GPUSink::draw(const Src& src, SkBitmap* dst, SkWStream*, SkString* log) co
}
#endif
- SkAutoTUnref<SkSurface> surface(
+ auto surface(
NewGpuSurface(&factory, fContextType, fContextOptions, info, fSampleCount, fUseDIText));
if (!surface) {
return "Could not create a surface.";
@@ -1309,19 +1309,19 @@ Error ViaTiles::draw(const Src& src, SkBitmap* bitmap, SkWStream* stream, SkStri
const int xTiles = (size.width() + fW - 1) / fW,
yTiles = (size.height() + fH - 1) / fH;
SkMultiPictureDraw mpd(xTiles*yTiles);
- SkTDArray<SkSurface*> surfaces;
- surfaces.setReserve(xTiles*yTiles);
+ SkTArray<sk_sp<SkSurface>> surfaces;
+// surfaces.setReserve(xTiles*yTiles);
SkImageInfo info = canvas->imageInfo().makeWH(fW, fH);
for (int j = 0; j < yTiles; j++) {
for (int i = 0; i < xTiles; i++) {
// This lets our ultimate Sink determine the best kind of surface.
// E.g., if it's a GpuSink, the surfaces and images are textures.
- SkSurface* s = canvas->newSurface(info);
+ auto s = canvas->makeSurface(info);
if (!s) {
- s = SkSurface::NewRaster(info); // Some canvases can't create surfaces.
+ s = SkSurface::MakeRaster(info); // Some canvases can't create surfaces.
}
- surfaces.push(s);
+ surfaces.push_back(s);
SkCanvas* c = s->getCanvas();
c->translate(SkIntToScalar(-i * fW),
SkIntToScalar(-j * fH)); // Line up the canvas with this tile.
@@ -1335,7 +1335,6 @@ Error ViaTiles::draw(const Src& src, SkBitmap* bitmap, SkWStream* stream, SkStri
canvas->drawImage(image, SkIntToScalar(i*fW), SkIntToScalar(j*fH));
}
}
- surfaces.unrefAll();
return "";
});
}
« no previous file with comments | « dm/DMGpuSupport.h ('k') | example/HelloWorld.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698