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

Unified Diff: tests/PictureTest.cpp

Issue 783393004: Revert of Replace EncodeBitmap with an interface. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years 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 | « src/core/SkWriteBuffer.cpp ('k') | tools/PictureRenderer.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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();
}
« no previous file with comments | « src/core/SkWriteBuffer.cpp ('k') | tools/PictureRenderer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698