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

Unified Diff: src/image/SkImage.cpp

Issue 1501303002: SkPixelSerializer: support indexed pixels (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 2015-12-07 (Monday) 10:44:44 EST Created 5 years 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
« include/core/SkPixelSerializer.h ('K') | « src/core/SkWriteBuffer.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/image/SkImage.cpp
diff --git a/src/image/SkImage.cpp b/src/image/SkImage.cpp
index be837f28a8fa8782e16afdc5ed0763c8668c6440..f4227856ca5dc0f7227c120f230a7138dfd692dd 100644
--- a/src/image/SkImage.cpp
+++ b/src/image/SkImage.cpp
@@ -185,9 +185,15 @@ protected:
bool onUseEncodedData(const void *data, size_t len) override {
return true;
}
-
- SkData* onEncodePixels(const SkImageInfo& info, const void* pixels, size_t rowBytes) override {
- return SkImageEncoder::EncodeData(info, pixels, rowBytes, SkImageEncoder::kPNG_Type, 100);
+ SkData* onEncode(const SkPixmap& pixmap) override {
+ SkBitmap bm;
+ return bm.installPixels(pixmap.info(),
scroggo 2015/12/07 15:57:07 nit: I think this would be easier to follow if you
hal.canary 2015/12/07 20:25:01 done
+ const_cast<void*>(pixmap.addr()),
+ pixmap.rowBytes(),
+ pixmap.ctable(),
+ nullptr, nullptr)
+ ? SkImageEncoder::EncodeData(bm, SkImageEncoder::kPNG_Type, 100)
+ : nullptr;
}
};
« include/core/SkPixelSerializer.h ('K') | « src/core/SkWriteBuffer.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698