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

Side by Side Diff: ui/gfx/image/image_skia.h

Issue 10860004: image-skia: Remove implicit conversion to SkBitmap on linux and chromeos. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « content/browser/web_contents/web_contents_drag_win.cc ('k') | ui/gfx/image/image_skia.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 // Copies a reference to |other|'s storage. 53 // Copies a reference to |other|'s storage.
54 ImageSkia& operator=(const ImageSkia& other); 54 ImageSkia& operator=(const ImageSkia& other);
55 55
56 // Converts from SkBitmap. 56 // Converts from SkBitmap.
57 // Adds ref to passed in bitmap. 57 // Adds ref to passed in bitmap.
58 // DIP width and height are set based on scale factor of 1x. 58 // DIP width and height are set based on scale factor of 1x.
59 // TODO(pkotwicz): This is temporary till conversion to gfx::ImageSkia is 59 // TODO(pkotwicz): This is temporary till conversion to gfx::ImageSkia is
60 // done. 60 // done.
61 ImageSkia& operator=(const SkBitmap& other); 61 ImageSkia& operator=(const SkBitmap& other);
62 62
63 #if defined(OS_MACOSX) || defined(OS_WIN)
63 // Converts to gfx::ImageSkiaRep and SkBitmap. 64 // Converts to gfx::ImageSkiaRep and SkBitmap.
64 // TODO(pkotwicz): This is temporary till conversion to gfx::ImageSkia is 65 // TODO(pkotwicz): This is temporary till conversion to gfx::ImageSkia is
65 // done. 66 // done.
66 operator SkBitmap&() const; 67 operator SkBitmap&() const { return GetBitmap(); }
68 #endif
67 69
68 ~ImageSkia(); 70 ~ImageSkia();
69 71
70 // Returns true if this object is backed by the same ImageSkiaStorage as 72 // Returns true if this object is backed by the same ImageSkiaStorage as
71 // |other|. Will also return true if both images are isNull(). 73 // |other|. Will also return true if both images are isNull().
72 bool BackedBySameObjectAs(const gfx::ImageSkia& other) const; 74 bool BackedBySameObjectAs(const gfx::ImageSkia& other) const;
73 75
74 // Adds |image_rep| to the image reps contained by this object. 76 // Adds |image_rep| to the image reps contained by this object.
75 void AddRepresentation(const gfx::ImageSkiaRep& image_rep); 77 void AddRepresentation(const gfx::ImageSkiaRep& image_rep);
76 78
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 // Wrapper function for SkBitmap::extractBitmap. 112 // Wrapper function for SkBitmap::extractBitmap.
111 // Deprecated, use ImageSkiaOperations::ExtractSubset instead. 113 // Deprecated, use ImageSkiaOperations::ExtractSubset instead.
112 // TODO(pkotwicz): Remove this function. 114 // TODO(pkotwicz): Remove this function.
113 bool extractSubset(ImageSkia* dst, const SkIRect& subset) const; 115 bool extractSubset(ImageSkia* dst, const SkIRect& subset) const;
114 116
115 // Returns pointer to 1x bitmap contained by this object. If there is no 1x 117 // Returns pointer to 1x bitmap contained by this object. If there is no 1x
116 // bitmap, the bitmap whose scale factor is closest to 1x is returned. 118 // bitmap, the bitmap whose scale factor is closest to 1x is returned.
117 // This function should only be used in unittests and on platforms which do 119 // This function should only be used in unittests and on platforms which do
118 // not support scale factors other than 1x. 120 // not support scale factors other than 1x.
119 // TODO(pkotwicz): Return null SkBitmap when the object has no 1x bitmap. 121 // TODO(pkotwicz): Return null SkBitmap when the object has no 1x bitmap.
120 const SkBitmap* bitmap() const { return &operator SkBitmap&(); } 122 const SkBitmap* bitmap() const { return &GetBitmap(); }
121 123
122 // Returns a vector with the image reps contained in this object. 124 // Returns a vector with the image reps contained in this object.
123 // There is no guarantee that this will return all images rep for 125 // There is no guarantee that this will return all images rep for
124 // supported scale factors. 126 // supported scale factors.
125 // TODO(oshima): Update all use of this API and make this to fail 127 // TODO(oshima): Update all use of this API and make this to fail
126 // when source is used. 128 // when source is used.
127 std::vector<gfx::ImageSkiaRep> image_reps() const; 129 std::vector<gfx::ImageSkiaRep> image_reps() const;
128 130
129 private: 131 private:
130 // Initialize ImageSkiaStorage with passed in parameters. 132 // Initialize ImageSkiaStorage with passed in parameters.
131 // If the image rep's bitmap is empty, ImageStorage is set to NULL. 133 // If the image rep's bitmap is empty, ImageStorage is set to NULL.
132 void Init(const gfx::ImageSkiaRep& image_rep); 134 void Init(const gfx::ImageSkiaRep& image_rep);
133 135
136 SkBitmap& GetBitmap() const;
137
134 // A refptr so that ImageRepSkia can be copied cheaply. 138 // A refptr so that ImageRepSkia can be copied cheaply.
135 scoped_refptr<internal::ImageSkiaStorage> storage_; 139 scoped_refptr<internal::ImageSkiaStorage> storage_;
136 }; 140 };
137 141
138 } // namespace gfx 142 } // namespace gfx
139 143
140 #endif // UI_GFX_IMAGE_IMAGE_SKIA_H_ 144 #endif // UI_GFX_IMAGE_IMAGE_SKIA_H_
OLDNEW
« no previous file with comments | « content/browser/web_contents/web_contents_drag_win.cc ('k') | ui/gfx/image/image_skia.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698