aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools/skiaserve
diff options
context:
space:
mode:
authorGravatar reed <reed@google.com>2016-09-12 12:01:44 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-09-12 12:01:44 -0700
commit42943c8aa9c611c18ad0f1a30a27669f3d82239c (patch)
treedeff0bbc59dd92559191c188d73f97b4f9c580aa /tools/skiaserve
parent09524ae42998ece3a8e7973064ab286646511b31 (diff)
change SkStreams to work with sk_sp<SkData> instead of SkData*
Diffstat (limited to 'tools/skiaserve')
-rw-r--r--tools/skiaserve/Request.cpp10
-rw-r--r--tools/skiaserve/urlhandlers/BreakHandler.cpp3
2 files changed, 6 insertions, 7 deletions
diff --git a/tools/skiaserve/Request.cpp b/tools/skiaserve/Request.cpp
index 22fa211abc..ea2d17afb9 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]);
diff --git a/tools/skiaserve/urlhandlers/BreakHandler.cpp b/tools/skiaserve/urlhandlers/BreakHandler.cpp
index 7766adb021..f4f741fe34 100644
--- a/tools/skiaserve/urlhandlers/BreakHandler.cpp
+++ b/tools/skiaserve/urlhandlers/BreakHandler.cpp
@@ -80,6 +80,5 @@ int BreakHandler::handle(Request* request, MHD_Connection* connection,
canvas->restoreToCount(saveCount);
SkDynamicMemoryWStream stream;
stream.writeText(Json::FastWriter().write(response).c_str());
- sk_sp<SkData> data(stream.copyToData());
- return SendData(connection, data.get(), "application/json");
+ return SendData(connection, stream.detachAsData().get(), "application/json");
}