Index: src/images/SkImageEncoder.cpp |
diff --git a/src/images/SkImageEncoder.cpp b/src/images/SkImageEncoder.cpp |
index cea567816bad7d74c95147490d17307bd4b99e99..cc1b73baa52150de72f20c1543634503d83770f9 100644 |
--- a/src/images/SkImageEncoder.cpp |
+++ b/src/images/SkImageEncoder.cpp |
@@ -7,8 +7,6 @@ |
#include "SkImageEncoder.h" |
#include "SkBitmap.h" |
-#include "SkPixelSerializer.h" |
-#include "SkPixmap.h" |
#include "SkStream.h" |
#include "SkTemplates.h" |
@@ -59,33 +57,6 @@ |
if (!bm.installPixels(info, const_cast<void*>(pixels), rowBytes)) { |
return nullptr; |
} |
- bm.setImmutable(); |
- return SkImageEncoder::EncodeData(bm, t, quality); |
+ SkAutoTDelete<SkImageEncoder> enc(SkImageEncoder::Create(t)); |
+ return enc.get() ? enc.get()->encodeData(bm, quality) : nullptr; |
} |
- |
-SkData* SkImageEncoder::EncodeData(const SkPixmap& pixmap, |
- Type t, int quality) { |
- SkBitmap bm; |
- if (!bm.installPixels(pixmap.info(), |
- const_cast<void*>(pixmap.addr()), |
- pixmap.rowBytes(), |
- pixmap.ctable(), nullptr, nullptr)) { |
- return nullptr; |
- } |
- bm.setImmutable(); |
- return SkImageEncoder::EncodeData(bm, t, quality); |
-} |
- |
-namespace { |
-class ImageEncoderPixelSerializer final : public SkPixelSerializer { |
-protected: |
- bool onUseEncodedData(const void*, size_t) override { return true; } |
- SkData* onEncode(const SkPixmap& pmap) override { |
- return SkImageEncoder::EncodeData(pmap, SkImageEncoder::kPNG_Type, 100); |
- } |
-}; |
-} // namespace |
- |
-SkPixelSerializer* SkImageEncoder::CreatePixelSerializer() { |
- return new ImageEncoderPixelSerializer; |
-} |