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

Unified Diff: debugger/QT/SkDebuggerGUI.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: 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: debugger/QT/SkDebuggerGUI.cpp
diff --git a/debugger/QT/SkDebuggerGUI.cpp b/debugger/QT/SkDebuggerGUI.cpp
index a8d8f14c21715e6a34419ae777543135a7556e77..42df29e83c5e8b6c279d0cf427bd6751d9e70a06 100644
--- a/debugger/QT/SkDebuggerGUI.cpp
+++ b/debugger/QT/SkDebuggerGUI.cpp
@@ -355,11 +355,23 @@ void SkDebuggerGUI::drawComplete() {
fInspectorWidget.setClip(fDebugger.getCurrentClip());
}
+// Encodes to PNG, unless there is already encoded data, in which case that gets
+// used.
+class PngPixelSerializer : public SkPixelSerializer {
scroggo 2015/03/20 17:21:41 I think this is the third instance of this. It may
+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);
+ }
+};
+
void SkDebuggerGUI::saveToFile(const SkString& filename) {
SkFILEWStream file(filename.c_str());
SkAutoTUnref<SkPicture> copy(fDebugger.copyPicture());
- copy->serialize(&file);
+ PngPixelSerializer serializer;
+ copy->serialize(&file, &serializer);
}
void SkDebuggerGUI::loadFile(QListWidgetItem *item) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698