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

Unified Diff: tools/sk_tool_utils.h

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 | « tools/PictureRenderer.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/sk_tool_utils.h
diff --git a/tools/sk_tool_utils.h b/tools/sk_tool_utils.h
index 48c71e7e74315fa521110f80ba51bb2f956192ff..8754de69af126fe8c2c72b785c12240a9ac27648 100644
--- a/tools/sk_tool_utils.h
+++ b/tools/sk_tool_utils.h
@@ -9,7 +9,9 @@
#define sk_tool_utils_DEFINED
#include "SkColor.h"
+#include "SkImageEncoder.h"
#include "SkImageInfo.h"
+#include "SkPixelSerializer.h"
#include "SkTypeface.h"
class SkBitmap;
@@ -55,6 +57,18 @@ namespace sk_tool_utils {
sk_tool_utils::draw_checkerboard(canvas, 0xFF999999, 0xFF666666, 8);
}
+ // Encodes to PNG, unless there is already encoded data, in which case that gets
+ // used.
+ 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);
+ }
+ };
+
} // namespace sk_tool_utils
#endif // sk_tool_utils_DEFINED
« no previous file with comments | « tools/PictureRenderer.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698