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

Unified Diff: ui/gfx/image/image_png.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, 5 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.cc ('k') | ui/gfx/image/image_png.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/image/image_png.h
diff --git a/ui/gfx/image/image_png.h b/ui/gfx/image/image_png.h
new file mode 100644
index 0000000000000000000000000000000000000000..cdada201ee7fe8b554e23b305b4f6cdc2a29fe86
--- /dev/null
+++ b/ui/gfx/image/image_png.h
@@ -0,0 +1,47 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef UI_GFX_IMAGE_IMAGE_PNG_H_
+#define UI_GFX_IMAGE_IMAGE_PNG_H_
+
+#include <vector>
+
+#include "base/basictypes.h"
+#include "base/memory/ref_counted_memory.h"
+#include "ui/base/ui_export.h"
+
+namespace gfx {
+
+// ImagePNG is a simple container for png-encoded data. It is cheap to copy
+// and intentionally supports copy semantics.
+class UI_EXPORT ImagePNG {
Robert Sesek 2012/07/19 23:45:07 Why do we need ImagePNG? I think everything can be
cjhopman 2012/07/20 17:28:24 Done. Yeah, that works for me, we don't need Image
+ public:
+ // Creates an ImagePNG from a copy of the png-encoded input.
+ explicit ImagePNG(const std::vector<unsigned char>& input);
+ ImagePNG(const unsigned char* input, size_t input_size);
+
+ // Copies a reference to |other|'s storage.
+ ImagePNG(const ImagePNG& other);
+
+ // Copies a reference to |other|'s storage.
+ ImagePNG& operator=(const ImagePNG& other);
+
+ ~ImagePNG();
+
+ static ImagePNG FromSkBitmap(const SkBitmap* bitmap);
+
+ bool empty() const;
+
+ const std::vector<unsigned char>& Image() const;
+ private:
+ // Default constructor only used by FromSkBitmap
+ ImagePNG();
+
+ // A refptr so that ImagePNG can be copied cheaply.
+ scoped_refptr<base::RefCountedBytes> image_;
+};
+
+} // namespace gfx
+
+#endif // UI_GFX_IMAGE_IMAGE_SKIA_H_
« no previous file with comments | « ui/gfx/image/image.cc ('k') | ui/gfx/image/image_png.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698