Chromium Code Reviews| 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_ |