aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools
diff options
context:
space:
mode:
authorGravatar halcanary <halcanary@google.com>2015-12-10 12:40:23 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2015-12-10 12:40:23 -0800
commitf2848b60358deb23eca38a4587247c1d2e335d30 (patch)
tree0e2d57d7e4c4b2bdf728da293de3a5844f487509 /tools
parent1812fa225dc7d0d8bc6166d903ea13df88d3eeab (diff)
default SkPixelSerializer
Add SkImageEncoder::EncodeData(const SkPixmap&, ...) function. Add SkImageEncoder::CreatePixelSerializer() to return a PixelSerializer that calls into SkImageEncoder::EncodeData. SkImage::encode() make use of SkImageEncoder::CreatePixelSerializer. Committed: https://skia.googlesource.com/skia/+/b0bd1516bff3f5afcbfd615e805867531657811b Committed: https://skia.googlesource.com/skia/+/808ce2886d732b1055f89c8fb0f1b11b47fcb0ce Review URL: https://codereview.chromium.org/1507123002
Diffstat (limited to 'tools')
-rw-r--r--tools/sk_tool_utils.cpp13
-rw-r--r--tools/sk_tool_utils.h8
2 files changed, 0 insertions, 21 deletions
diff --git a/tools/sk_tool_utils.cpp b/tools/sk_tool_utils.cpp
index 8c3097602c..e2bc0fc42c 100644
--- a/tools/sk_tool_utils.cpp
+++ b/tools/sk_tool_utils.cpp
@@ -222,19 +222,6 @@ 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);
diff --git a/tools/sk_tool_utils.h b/tools/sk_tool_utils.h
index 3eabcdcd0f..dab42e31fd 100644
--- a/tools/sk_tool_utils.h
+++ b/tools/sk_tool_utils.h
@@ -114,14 +114,6 @@ namespace sk_tool_utils {
SkBitmap create_string_bitmap(int w, int h, SkColor c, int x, int y,
int textSize, const char* str);
- // 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) override;
- SkData* onEncode(const SkPixmap&) override;
- };
-
// A helper for inserting a drawtext call into a SkTextBlobBuilder
void add_to_text_blob(SkTextBlobBuilder* builder, const char* text, const SkPaint& origPaint,
SkScalar x, SkScalar y);