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

Unified Diff: tools/PictureRenderer.cpp

Issue 1020103005: Preserve texture compression when saving a revised skp from debugger (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: clean up Created 5 years, 9 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 | « tests/PictureTest.cpp ('k') | tools/sk_tool_utils.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/PictureRenderer.cpp
diff --git a/tools/PictureRenderer.cpp b/tools/PictureRenderer.cpp
index 6acd13ca0ffe9f71da28ed56f121f7d010d09512..aec153d953fe7c74b71e5a6e60cbb9098b26e6c3 100644
--- a/tools/PictureRenderer.cpp
+++ b/tools/PictureRenderer.cpp
@@ -37,6 +37,7 @@
#include "SkTDArray.h"
#include "SkThreadUtils.h"
#include "SkTypes.h"
+#include "sk_tool_utils.h"
static inline SkScalar scalar_log2(SkScalar x) {
static const SkScalar log2_conversion_factor = SkScalarDiv(1, SkScalarLog(2));
@@ -358,19 +359,6 @@ SkCanvas* RecordPictureRenderer::setupCanvas(int width, int height) {
return NULL;
}
-// Encodes to PNG, unless there is already encoded data, in which case that gets
-// used.
-// FIXME: Share with PictureTest.cpp?
-
-class PngPixelSerializer : public SkPixelSerializer {
-public:
- bool onUseEncodedData(const void*, size_t) SK_OVERRIDE { return true; }
- SkData* onEncodePixels(const SkImageInfo& info, const void* pixels,
- size_t rowBytes) SK_OVERRIDE {
- return SkImageEncoder::EncodeData(info, pixels, rowBytes, SkImageEncoder::kPNG_Type, 100);
- }
-};
-
bool RecordPictureRenderer::render(SkBitmap** out) {
SkAutoTDelete<SkBBHFactory> factory(this->getFactory());
SkPictureRecorder recorder;
@@ -385,7 +373,7 @@ bool RecordPictureRenderer::render(SkBitmap** out) {
// Record the new picture as a new SKP with PNG encoded bitmaps.
SkString skpPath = SkOSPath::Join(fWritePath.c_str(), fInputFilename.c_str());
SkFILEWStream stream(skpPath.c_str());
- PngPixelSerializer serializer;
+ sk_tool_utils::PngPixelSerializer serializer;
picture->serialize(&stream, &serializer);
return true;
}
« no previous file with comments | « tests/PictureTest.cpp ('k') | tools/sk_tool_utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698