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

Unified Diff: tests/PictureTest.cpp

Issue 15489004: New API for encoding bitmaps during serialization. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Fix ifdef'd out code Created 7 years, 7 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
Index: tests/PictureTest.cpp
diff --git a/tests/PictureTest.cpp b/tests/PictureTest.cpp
index 20226e7d56a5865c3b7b618168ebbc6f8a7f41ed..23ff6893c0f4d867fb7d1754c5ba6e75d1e2d99f 100644
--- a/tests/PictureTest.cpp
+++ b/tests/PictureTest.cpp
@@ -359,8 +359,9 @@ private:
#include "SkImageEncoder.h"
-static bool PNGEncodeBitmapToStream(SkWStream* wStream, const SkBitmap& bm) {
- return SkImageEncoder::EncodeStream(wStream, bm, SkImageEncoder::kPNG_Type, 100);
+static SkData* encode_bitmap_to_data(size_t* offset, const SkBitmap& bm) {
+ *offset = 0;
+ return SkImageEncoder::EncodeData(bm, SkImageEncoder::kPNG_Type, 100);
}
static SkData* serialized_picture_from_bitmap(const SkBitmap& bitmap) {
@@ -368,7 +369,7 @@ static SkData* serialized_picture_from_bitmap(const SkBitmap& bitmap) {
SkCanvas* canvas = picture.beginRecording(bitmap.width(), bitmap.height());
canvas->drawBitmap(bitmap, 0, 0);
SkDynamicMemoryWStream wStream;
- picture.serialize(&wStream, &PNGEncodeBitmapToStream);
+ picture.serialize(&wStream, &encode_bitmap_to_data);
return wStream.copyToData();
}

Powered by Google App Engine
This is Rietveld 408576698