OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef UI_GFX_IMAGE_IMAGE_PNG_H_ | |
6 #define UI_GFX_IMAGE_IMAGE_PNG_H_ | |
7 | |
8 #include <vector> | |
9 | |
10 #include "base/basictypes.h" | |
11 #include "base/memory/ref_counted_memory.h" | |
12 #include "ui/base/ui_export.h" | |
13 | |
14 namespace gfx { | |
15 | |
16 // ImagePNG is a simple container for png-encoded data. It is cheap to copy | |
17 // and intentionally supports copy semantics. | |
18 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
| |
19 public: | |
20 // Creates an ImagePNG from a copy of the png-encoded input. | |
21 explicit ImagePNG(const std::vector<unsigned char>& input); | |
22 ImagePNG(const unsigned char* input, size_t input_size); | |
23 | |
24 // Copies a reference to |other|'s storage. | |
25 ImagePNG(const ImagePNG& other); | |
26 | |
27 // Copies a reference to |other|'s storage. | |
28 ImagePNG& operator=(const ImagePNG& other); | |
29 | |
30 ~ImagePNG(); | |
31 | |
32 static ImagePNG FromSkBitmap(const SkBitmap* bitmap); | |
33 | |
34 bool empty() const; | |
35 | |
36 const std::vector<unsigned char>& Image() const; | |
37 private: | |
38 // Default constructor only used by FromSkBitmap | |
39 ImagePNG(); | |
40 | |
41 // A refptr so that ImagePNG can be copied cheaply. | |
42 scoped_refptr<base::RefCountedBytes> image_; | |
43 }; | |
44 | |
45 } // namespace gfx | |
46 | |
47 #endif // UI_GFX_IMAGE_IMAGE_SKIA_H_ | |
OLD | NEW |