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

Unified Diff: tools/skiaserve/Request.cpp

Issue 2333713002: change SkStreams to work with sk_sp<SkData> instead of SkData* (Closed)
Patch Set: fix xpsdevice Created 4 years, 3 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 | « tools/skdiff_utils.cpp ('k') | tools/skiaserve/urlhandlers/BreakHandler.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/skiaserve/Request.cpp
diff --git a/tools/skiaserve/Request.cpp b/tools/skiaserve/Request.cpp
index 22fa211abceb854f2ff303072110c64b8fc481ce..ea2d17afb94229015f3c9ae32fc9bb3617809743 100644
--- a/tools/skiaserve/Request.cpp
+++ b/tools/skiaserve/Request.cpp
@@ -65,7 +65,7 @@ sk_sp<SkData> Request::writeCanvasToPng(SkCanvas* canvas) {
SkDynamicMemoryWStream buffer;
SkDrawCommand::WritePNG((const png_bytep) encodedBitmap->bytes(), bmp->width(), bmp->height(),
buffer, true);
- return sk_sp<SkData>(buffer.copyToData());
+ return buffer.detachAsData();
}
SkCanvas* Request::getCanvas() {
@@ -117,7 +117,7 @@ sk_sp<SkData> Request::writeOutSkp() {
SkAutoTUnref<SkPixelSerializer> serializer(SkImageEncoder::CreatePixelSerializer());
picture->serialize(&outStream, serializer);
- return sk_sp<SkData>(outStream.copyToData());
+ return outStream.detachAsData();
}
GrContext* Request::getContext() {
@@ -257,7 +257,7 @@ sk_sp<SkData> Request::getJsonOps(int n) {
SkDynamicMemoryWStream stream;
stream.writeText(Json::FastWriter().write(root).c_str());
- return sk_sp<SkData>(stream.copyToData());
+ return stream.detachAsData();
}
sk_sp<SkData> Request::getJsonBatchList(int n) {
@@ -269,7 +269,7 @@ sk_sp<SkData> Request::getJsonBatchList(int n) {
SkDynamicMemoryWStream stream;
stream.writeText(Json::FastWriter().write(result).c_str());
- return sk_sp<SkData>(stream.copyToData());
+ return stream.detachAsData();
}
sk_sp<SkData> Request::getJsonInfo(int n) {
@@ -301,7 +301,7 @@ SkColor Request::getPixel(int x, int y) {
// Convert to format suitable for inspection
sk_sp<SkData> encodedBitmap = sk_tools::encode_bitmap_for_png(*bitmap);
- SkASSERT(encodedBitmap.get());
+ SkASSERT(encodedBitmap);
const uint8_t* start = encodedBitmap->bytes() + ((y * bitmap->width() + x) * 4);
SkColor result = SkColorSetARGB(start[3], start[0], start[1], start[2]);
« no previous file with comments | « tools/skdiff_utils.cpp ('k') | tools/skiaserve/urlhandlers/BreakHandler.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698