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

Side by Side Diff: skia/ext/platform_canvas.h

Issue 1396613006: Remove skia::PlatformBitmap. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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
« no previous file with comments | « skia/ext/bitmap_platform_device_win.cc ('k') | skia/ext/platform_canvas.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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 SKIA_EXT_PLATFORM_CANVAS_H_ 5 #ifndef SKIA_EXT_PLATFORM_CANVAS_H_
6 #define SKIA_EXT_PLATFORM_CANVAS_H_ 6 #define SKIA_EXT_PLATFORM_CANVAS_H_
7 7
8 // The platform-specific device will include the necessary platform headers 8 // The platform-specific device will include the necessary platform headers
9 // to get the surface type. 9 // to get the surface type.
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 PlatformSurface GetPlatformSurface() { return platform_surface_; } 147 PlatformSurface GetPlatformSurface() { return platform_surface_; }
148 private: 148 private:
149 SkCanvas* canvas_; 149 SkCanvas* canvas_;
150 PlatformSurface platform_surface_; 150 PlatformSurface platform_surface_;
151 151
152 // Disallow copy and assign 152 // Disallow copy and assign
153 ScopedPlatformPaint(const ScopedPlatformPaint&); 153 ScopedPlatformPaint(const ScopedPlatformPaint&);
154 ScopedPlatformPaint& operator=(const ScopedPlatformPaint&); 154 ScopedPlatformPaint& operator=(const ScopedPlatformPaint&);
155 }; 155 };
156 156
157 // PlatformBitmap holds a PlatformSurface that can also be used as an SkBitmap.
158 class SK_API PlatformBitmap {
159 public:
160 PlatformBitmap();
161 ~PlatformBitmap();
162
163 // Returns true if the bitmap was able to allocate its surface.
164 bool Allocate(int width, int height, bool is_opaque);
165
166 // Returns the platform surface, or 0 if Allocate() did not return true.
167 PlatformSurface GetSurface() { return surface_; }
168
169 // Return the skia bitmap, which will be empty if Allocate() did not
170 // return true.
171 //
172 // The resulting SkBitmap holds a refcount on the underlying platform surface,
173 // so the surface will remain allocated so long as the SkBitmap or its copies
174 // stay around.
175 const SkBitmap& GetBitmap() { return bitmap_; }
176
177 private:
178 SkBitmap bitmap_;
179 PlatformSurface surface_; // initialized to 0
180 intptr_t platform_extra_; // platform specific, initialized to 0
181
182 DISALLOW_COPY_AND_ASSIGN(PlatformBitmap);
183 };
184
185 } // namespace skia 157 } // namespace skia
186 158
187 #endif // SKIA_EXT_PLATFORM_CANVAS_H_ 159 #endif // SKIA_EXT_PLATFORM_CANVAS_H_
OLDNEW
« no previous file with comments | « skia/ext/bitmap_platform_device_win.cc ('k') | skia/ext/platform_canvas.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698