OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef UI_GFX_IMAGE_IMAGE_SKIA_H_ | 5 #ifndef UI_GFX_IMAGE_IMAGE_SKIA_H_ |
6 #define UI_GFX_IMAGE_IMAGE_SKIA_H_ | 6 #define UI_GFX_IMAGE_IMAGE_SKIA_H_ |
7 | 7 |
| 8 #include <memory> |
8 #include <vector> | 9 #include <vector> |
9 | 10 |
10 #include "base/gtest_prod_util.h" | 11 #include "base/gtest_prod_util.h" |
11 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
12 #include "base/memory/scoped_ptr.h" | |
13 #include "ui/gfx/gfx_export.h" | 13 #include "ui/gfx/gfx_export.h" |
14 #include "ui/gfx/image/image_skia_rep.h" | 14 #include "ui/gfx/image/image_skia_rep.h" |
15 | 15 |
16 namespace gfx { | 16 namespace gfx { |
17 class ImageSkiaSource; | 17 class ImageSkiaSource; |
18 class Size; | 18 class Size; |
19 | 19 |
20 namespace internal { | 20 namespace internal { |
21 class ImageSkiaStorage; | 21 class ImageSkiaStorage; |
22 } // namespace internal | 22 } // namespace internal |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 // density display. | 82 // density display. |
83 static ImageSkia CreateFrom1xBitmap(const SkBitmap& bitmap); | 83 static ImageSkia CreateFrom1xBitmap(const SkBitmap& bitmap); |
84 | 84 |
85 // Returns a deep copy of this ImageSkia which has its own storage with | 85 // Returns a deep copy of this ImageSkia which has its own storage with |
86 // the ImageSkiaRep instances that this ImageSkia currently has. | 86 // the ImageSkiaRep instances that this ImageSkia currently has. |
87 // This can be safely passed to and manipulated by another thread. | 87 // This can be safely passed to and manipulated by another thread. |
88 // Note that this does NOT generate ImageSkiaReps from its source. | 88 // Note that this does NOT generate ImageSkiaReps from its source. |
89 // If you want to create a deep copy with ImageSkiaReps for supported | 89 // If you want to create a deep copy with ImageSkiaReps for supported |
90 // scale factors, you need to explicitly call | 90 // scale factors, you need to explicitly call |
91 // |EnsureRepsForSupportedScales()| first. | 91 // |EnsureRepsForSupportedScales()| first. |
92 scoped_ptr<ImageSkia> DeepCopy() const; | 92 std::unique_ptr<ImageSkia> DeepCopy() const; |
93 | 93 |
94 // Returns true if this object is backed by the same ImageSkiaStorage as | 94 // Returns true if this object is backed by the same ImageSkiaStorage as |
95 // |other|. Will also return true if both images are isNull(). | 95 // |other|. Will also return true if both images are isNull(). |
96 bool BackedBySameObjectAs(const gfx::ImageSkia& other) const; | 96 bool BackedBySameObjectAs(const gfx::ImageSkia& other) const; |
97 | 97 |
98 // Adds |image_rep| to the image reps contained by this object. | 98 // Adds |image_rep| to the image reps contained by this object. |
99 void AddRepresentation(const gfx::ImageSkiaRep& image_rep); | 99 void AddRepresentation(const gfx::ImageSkiaRep& image_rep); |
100 | 100 |
101 // Removes the image rep of |scale| if present. | 101 // Removes the image rep of |scale| if present. |
102 void RemoveRepresentation(float scale); | 102 void RemoveRepresentation(float scale); |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 // so that other thread can access the storage. | 170 // so that other thread can access the storage. |
171 void DetachStorageFromThread(); | 171 void DetachStorageFromThread(); |
172 | 172 |
173 // A refptr so that ImageRepSkia can be copied cheaply. | 173 // A refptr so that ImageRepSkia can be copied cheaply. |
174 scoped_refptr<internal::ImageSkiaStorage> storage_; | 174 scoped_refptr<internal::ImageSkiaStorage> storage_; |
175 }; | 175 }; |
176 | 176 |
177 } // namespace gfx | 177 } // namespace gfx |
178 | 178 |
179 #endif // UI_GFX_IMAGE_IMAGE_SKIA_H_ | 179 #endif // UI_GFX_IMAGE_IMAGE_SKIA_H_ |
OLD | NEW |