Index: tools/sk_tool_utils.cpp |
diff --git a/tools/sk_tool_utils.cpp b/tools/sk_tool_utils.cpp |
index e2bc0fc42cfb17e284335972234d0c41a043eb18..8c3097602c98af55b38295639be525864321fa54 100644 |
--- a/tools/sk_tool_utils.cpp |
+++ b/tools/sk_tool_utils.cpp |
@@ -222,6 +222,19 @@ SkBitmap create_string_bitmap(int w, int h, SkColor c, int x, int y, |
return bitmap; |
} |
+bool PngPixelSerializer::onUseEncodedData(const void*, size_t) { return true; } |
+SkData* PngPixelSerializer::onEncode(const SkPixmap& pixmap) { |
+ SkBitmap bm; |
+ if (!bm.installPixels(pixmap.info(), |
+ const_cast<void*>(pixmap.addr()), |
+ pixmap.rowBytes(), |
+ pixmap.ctable(), |
+ nullptr, nullptr)) { |
+ return nullptr; |
+ } |
+ return SkImageEncoder::EncodeData(bm, SkImageEncoder::kPNG_Type, 100); |
+} |
+ |
void add_to_text_blob(SkTextBlobBuilder* builder, const char* text, const SkPaint& origPaint, |
SkScalar x, SkScalar y) { |
SkPaint paint(origPaint); |