Index: tests/PictureTest.cpp |
diff --git a/tests/PictureTest.cpp b/tests/PictureTest.cpp |
index ad1459ea8a151b8e659106ead921701aa9ace9f3..7a8c8fa9e3e097fe681fba4964a530f848ab007c 100644 |
--- a/tests/PictureTest.cpp |
+++ b/tests/PictureTest.cpp |
@@ -22,7 +22,6 @@ |
#include "SkPictureRecorder.h" |
#include "SkPictureUtils.h" |
#include "SkPixelRef.h" |
-#include "SkPixelSerializer.h" |
#include "SkRRect.h" |
#include "SkRandom.h" |
#include "SkRecord.h" |
@@ -1443,21 +1442,9 @@ |
} |
#endif |
-// Encodes to PNG, unless there is already encoded data, in which case that gets |
-// used. |
-// FIXME: Share with PictureRenderer.cpp? |
-class PngPixelSerializer : public SkPixelSerializer { |
-public: |
- virtual bool onUseEncodedData(const void*, size_t) SK_OVERRIDE { return true; } |
- virtual SkData* onEncodePixels(const SkImageInfo& info, void* pixels, |
- size_t rowBytes) SK_OVERRIDE { |
- SkBitmap bm; |
- if (!bm.installPixels(info, pixels, rowBytes)) { |
- return NULL; |
- } |
- return SkImageEncoder::EncodeData(bm, SkImageEncoder::kPNG_Type, 100); |
- } |
-}; |
+static SkData* encode_bitmap_to_data(size_t*, const SkBitmap& bm) { |
+ return SkImageEncoder::EncodeData(bm, SkImageEncoder::kPNG_Type, 100); |
+} |
static SkData* serialized_picture_from_bitmap(const SkBitmap& bitmap) { |
SkPictureRecorder recorder; |
@@ -1467,8 +1454,7 @@ |
SkAutoTUnref<SkPicture> picture(recorder.endRecording()); |
SkDynamicMemoryWStream wStream; |
- PngPixelSerializer serializer; |
- picture->serialize(&wStream, &serializer); |
+ picture->serialize(&wStream, &encode_bitmap_to_data); |
return wStream.copyToData(); |
} |