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

Unified Diff: base/gfx/png_encoder.cc

Issue 18347: Add a PNGEncoder helper function that takes an SkBitmap, (Closed)
Patch Set: Test2 Created 11 years, 11 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 | « base/gfx/png_encoder.h ('k') | chrome/browser/fav_icon_helper.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/gfx/png_encoder.cc
diff --git a/base/gfx/png_encoder.cc b/base/gfx/png_encoder.cc
old mode 100644
new mode 100755
index 7b44a5259867babfd88750acc40f2be593436182..64e46d7c16ee286782f9f3836d5e6391863fd966
--- a/base/gfx/png_encoder.cc
+++ b/base/gfx/png_encoder.cc
@@ -5,6 +5,7 @@
#include "base/basictypes.h"
#include "base/gfx/png_encoder.h"
#include "base/logging.h"
+#include "skia/include/SkBitmap.h"
extern "C" {
#include "png.h"
@@ -191,3 +192,14 @@ bool PNGEncoder::Encode(const unsigned char* input, ColorFormat format,
return true;
}
+// static
+bool PNGEncoder::EncodeBGRASkBitmap(const SkBitmap& input,
+ bool discard_transparency,
+ std::vector<unsigned char>* output) {
+ SkAutoLockPixels input_lock(input);
+ DCHECK_EQ(input.bytesPerPixel(), 4);
+ return Encode(static_cast<unsigned char*>(input.getPixels()),
+ PNGEncoder::FORMAT_BGRA, input.width(), input.height(),
+ input.rowBytes(), discard_transparency, output);
+}
+
« no previous file with comments | « base/gfx/png_encoder.h ('k') | chrome/browser/fav_icon_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698