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

Unified Diff: ui/gfx/image/image.h

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 | « chrome/browser/ui/tests/ui_gfx_image_unittest.mm ('k') | ui/gfx/image/image.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/image/image.h
diff --git a/ui/gfx/image/image.h b/ui/gfx/image/image.h
index b643362fcf06376c34705ca94b12f1593feb9c6f..079014803a850d21a83672d73d4ddc300ea79843 100644
--- a/ui/gfx/image/image.h
+++ b/ui/gfx/image/image.h
@@ -55,6 +55,7 @@ class UI_EXPORT Image {
kImageRepCocoa,
kImageRepCairo,
kImageRepSkia,
+ kImageRepPNG,
};
typedef std::map<RepresentationType, internal::ImageRep*> RepresentationMap;
@@ -62,6 +63,12 @@ class UI_EXPORT Image {
// Creates an empty image with no representations.
Image();
+ // Creates a new image by copying the PNG-encoded input for use as the default
+ // representation. For example (from an std::vector):
+ // std::vector<unsigned char> png = ...;
+ // gfx::Image image(&png.front(), png.size());
+ Image(const unsigned char* png, size_t input_size);
+
// Creates a new image by copying the ImageSkia for use as the default
// representation.
explicit Image(const ImageSkia& image);
@@ -98,6 +105,7 @@ class UI_EXPORT Image {
// Converts the Image to the desired representation and stores it internally.
// The returned result is a weak pointer owned by and scoped to the life of
// the Image. Must only be called if IsEmpty() is false.
+ const std::vector<unsigned char>* ToImagePNG() const;
const SkBitmap* ToSkBitmap() const;
const ImageSkia* ToImageSkia() const;
#if defined(TOOLKIT_GTK)
@@ -125,6 +133,7 @@ class UI_EXPORT Image {
// backing pixels are shared amongst all copies (a fact of each of the
// converted representations, rather than a limitation imposed by Image) and
// so the result should be considered immutable.
+ std::vector<unsigned char>* CopyImagePNG() const;
ImageSkia* CopyImageSkia() const;
SkBitmap* CopySkBitmap() const;
#if defined(TOOLKIT_GTK)
« no previous file with comments | « chrome/browser/ui/tests/ui_gfx_image_unittest.mm ('k') | ui/gfx/image/image.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698