Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(47)

Unified Diff: src/images/SkImageEncoder.cpp

Issue 656503003: Move SkImage::encode to SkImageEncoder (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/images/SkImageDecoder_ktx.cpp ('k') | tests/CachedDecodingPixelRefTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/images/SkImageEncoder.cpp
diff --git a/src/images/SkImageEncoder.cpp b/src/images/SkImageEncoder.cpp
index 31fdcf96042eaf6c701e000e14307be0f5c92391..6886009257f18f8501f41f30f7c9125286ea63a9 100644
--- a/src/images/SkImageEncoder.cpp
+++ b/src/images/SkImageEncoder.cpp
@@ -7,6 +7,7 @@
#include "SkImageEncoder.h"
#include "SkBitmap.h"
+#include "SkImage.h"
#include "SkStream.h"
#include "SkTemplates.h"
@@ -40,6 +41,8 @@ bool SkImageEncoder::EncodeFile(const char file[], const SkBitmap& bm, Type t,
return enc.get() && enc.get()->encodeFile(file, bm, quality);
}
+
+
bool SkImageEncoder::EncodeStream(SkWStream* stream, const SkBitmap& bm, Type t,
int quality) {
SkAutoTDelete<SkImageEncoder> enc(SkImageEncoder::Create(t));
@@ -50,3 +53,12 @@ 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 SkImage& image, Type type, int quality) {
+ SkBitmap bm;
+ if (image.getBitmapForEncoding(&bm)) {
+ return SkImageEncoder::EncodeData(bm, type, quality);
+ }
+ return NULL;
+}
+
« no previous file with comments | « src/images/SkImageDecoder_ktx.cpp ('k') | tests/CachedDecodingPixelRefTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698