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

Unified Diff: ui/gfx/image/image_util.cc

Issue 10799014: Add support for PNG representation in gfx::Image (Closed) Base URL: http://git.chromium.org/chromium/src.git@bookmark-sync
Patch Set: Created 8 years, 4 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 | « ui/gfx/image/image_unittest_util_mac.mm ('k') | ui/ui.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/image/image_util.cc
diff --git a/ui/gfx/image/image_util.cc b/ui/gfx/image/image_util.cc
index 04cffca50865c186a81d05f0c025128d2b4c9164..6403419ed4610cbf771e47ea4f5d25ede8648834 100644
--- a/ui/gfx/image/image_util.cc
+++ b/ui/gfx/image/image_util.cc
@@ -7,17 +7,14 @@
#include "base/memory/scoped_ptr.h"
#include "third_party/skia/include/core/SkBitmap.h"
#include "ui/gfx/codec/jpeg_codec.h"
-#include "ui/gfx/codec/png_codec.h"
#include "ui/gfx/image/image.h"
+#include "ui/gfx/image/image_skia.h"
namespace gfx {
Image* ImageFromPNGEncodedData(const unsigned char* input, size_t input_size) {
- SkBitmap bitmap;
- if (gfx::PNGCodec::Decode(input, input_size, &bitmap))
- return new Image(bitmap);
-
- return NULL;
+ Image* image = new Image(input, input_size);
+ return image;
}
Image ImageFromJPEGEncodedData(const unsigned char* input, size_t input_size) {
@@ -30,8 +27,8 @@ Image ImageFromJPEGEncodedData(const unsigned char* input, size_t input_size) {
bool PNGEncodedDataFromImage(const Image& image,
std::vector<unsigned char>* dst) {
- const SkBitmap& bitmap = *image.ToSkBitmap();
- return gfx::PNGCodec::EncodeBGRASkBitmap(bitmap, false, dst);
+ *dst = *image.ToImagePNG();
+ return !dst->empty();
}
bool JPEGEncodedDataFromImage(const Image& image, int quality,
« no previous file with comments | « ui/gfx/image/image_unittest_util_mac.mm ('k') | ui/ui.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698