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) { |