| 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 <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "base/gtest_prod_util.h" | 11 #include "base/gtest_prod_util.h" |
| 12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
| 13 #include "base/memory/scoped_ptr.h" |
| 13 #include "ui/base/ui_export.h" | 14 #include "ui/base/ui_export.h" |
| 14 #include "ui/gfx/image/image_skia_rep.h" | 15 #include "ui/gfx/image/image_skia_rep.h" |
| 15 | 16 |
| 16 namespace gfx { | 17 namespace gfx { |
| 17 class ImageSkiaSource; | 18 class ImageSkiaSource; |
| 18 class Size; | 19 class Size; |
| 19 | 20 |
| 20 namespace internal { | 21 namespace internal { |
| 21 class ImageSkiaStorage; | 22 class ImageSkiaStorage; |
| 22 } // namespace internal | 23 } // namespace internal |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 | 72 |
| 72 ~ImageSkia(); | 73 ~ImageSkia(); |
| 73 | 74 |
| 74 // Returns a deep copy of this ImageSkia which has its own storage with | 75 // Returns a deep copy of this ImageSkia which has its own storage with |
| 75 // the ImageSkiaRep instances that this ImageSkia currently has. | 76 // the ImageSkiaRep instances that this ImageSkia currently has. |
| 76 // This can be safely passed to and manipulated by another thread. | 77 // This can be safely passed to and manipulated by another thread. |
| 77 // Note that this does NOT generate ImageSkiaReps from its source. | 78 // Note that this does NOT generate ImageSkiaReps from its source. |
| 78 // If you want to create a deep copy with ImageSkiaReps for supported | 79 // If you want to create a deep copy with ImageSkiaReps for supported |
| 79 // scale factors, you need to explicitly call | 80 // scale factors, you need to explicitly call |
| 80 // |EnsureRepsForSupportedScaleFactors()| first. | 81 // |EnsureRepsForSupportedScaleFactors()| first. |
| 81 ImageSkia DeepCopy() const; | 82 scoped_ptr<ImageSkia> DeepCopy() const; |
| 82 | 83 |
| 83 // Returns true if this object is backed by the same ImageSkiaStorage as | 84 // Returns true if this object is backed by the same ImageSkiaStorage as |
| 84 // |other|. Will also return true if both images are isNull(). | 85 // |other|. Will also return true if both images are isNull(). |
| 85 bool BackedBySameObjectAs(const gfx::ImageSkia& other) const; | 86 bool BackedBySameObjectAs(const gfx::ImageSkia& other) const; |
| 86 | 87 |
| 87 // Adds |image_rep| to the image reps contained by this object. | 88 // Adds |image_rep| to the image reps contained by this object. |
| 88 void AddRepresentation(const gfx::ImageSkiaRep& image_rep); | 89 void AddRepresentation(const gfx::ImageSkiaRep& image_rep); |
| 89 | 90 |
| 90 // Removes the image rep of |scale_factor| if present. | 91 // Removes the image rep of |scale_factor| if present. |
| 91 void RemoveRepresentation(ui::ScaleFactor scale_factor); | 92 void RemoveRepresentation(ui::ScaleFactor scale_factor); |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 // so that other thread can access the storage. | 162 // so that other thread can access the storage. |
| 162 void DetachStorageFromThread(); | 163 void DetachStorageFromThread(); |
| 163 | 164 |
| 164 // A refptr so that ImageRepSkia can be copied cheaply. | 165 // A refptr so that ImageRepSkia can be copied cheaply. |
| 165 scoped_refptr<internal::ImageSkiaStorage> storage_; | 166 scoped_refptr<internal::ImageSkiaStorage> storage_; |
| 166 }; | 167 }; |
| 167 | 168 |
| 168 } // namespace gfx | 169 } // namespace gfx |
| 169 | 170 |
| 170 #endif // UI_GFX_IMAGE_IMAGE_SKIA_H_ | 171 #endif // UI_GFX_IMAGE_IMAGE_SKIA_H_ |
| OLD | NEW |