Index: src/images/SkImageEncoder.cpp |
diff --git a/src/images/SkImageEncoder.cpp b/src/images/SkImageEncoder.cpp |
index 31fdcf96042eaf6c701e000e14307be0f5c92391..a6f109a207102de44368fa74a3271f2072c6c446 100644 |
--- a/src/images/SkImageEncoder.cpp |
+++ b/src/images/SkImageEncoder.cpp |
@@ -50,3 +50,13 @@ SkData* SkImageEncoder::EncodeData(const SkBitmap& bm, Type t, int quality) { |
SkAutoTDelete<SkImageEncoder> enc(SkImageEncoder::Create(t)); |
return enc.get() ? enc.get()->encodeData(bm, quality) : NULL; |
} |
+ |
+SkData* SkImageEncoder::EncodeData(const SkImageInfo& info, const void* pixels, size_t rowBytes, |
+ Type t, int quality) { |
+ SkBitmap bm; |
+ if (!bm.installPixels(info, const_cast<void*>(pixels), rowBytes)) { |
+ return NULL; |
+ } |
+ SkAutoTDelete<SkImageEncoder> enc(SkImageEncoder::Create(t)); |
+ return enc.get() ? enc.get()->encodeData(bm, quality) : NULL; |
+} |