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

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

Issue 11031055: Introduce PlatformBitmap, which is a minimal helper class that wraps an SkBitmap (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 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 | Annotate | Revision Log
« 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 "skia/ext/platform_device.h" 11 #include "skia/ext/platform_device.h"
11 #include "third_party/skia/include/core/SkCanvas.h" 12 #include "third_party/skia/include/core/SkCanvas.h"
12 13
13 namespace skia { 14 namespace skia {
14 15
15 // This class is a specialization of the regular SkCanvas that is designed to 16 // This class is a specialization of the regular SkCanvas that is designed to
16 // work with a PlatformDevice to manage platform-specific drawing. It allows 17 // work with a PlatformDevice to manage platform-specific drawing. It allows
17 // using both Skia operations and platform-specific operations. 18 // using both Skia operations and platform-specific operations.
18 class SK_API PlatformCanvas : public SkCanvas { 19 class SK_API PlatformCanvas : public SkCanvas {
19 public: 20 public:
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 PlatformSurface GetPlatformSurface() { return platform_surface_; } 145 PlatformSurface GetPlatformSurface() { return platform_surface_; }
145 private: 146 private:
146 SkCanvas* canvas_; 147 SkCanvas* canvas_;
147 PlatformSurface platform_surface_; 148 PlatformSurface platform_surface_;
148 149
149 // Disallow copy and assign 150 // Disallow copy and assign
150 ScopedPlatformPaint(const ScopedPlatformPaint&); 151 ScopedPlatformPaint(const ScopedPlatformPaint&);
151 ScopedPlatformPaint& operator=(const ScopedPlatformPaint&); 152 ScopedPlatformPaint& operator=(const ScopedPlatformPaint&);
152 }; 153 };
153 154
155 class SK_API PlatformBitmap {
156 public:
157 PlatformBitmap();
158 ~PlatformBitmap();
159
160 // Returns true if the bitmap was able to allocate its surface.
161 bool Allocate(int width, int height, bool is_opaque);
162
163 // Returns the platform surface, or 0 if Allocate() did not return true.
164 PlatformSurface GetSurface() { return surface_; }
165
166 // Return the skia bitmap, which will be empty if Allocate() did not
167 // return true.
168 const SkBitmap& GetBitmap() { return bitmap_; }
169
170 private:
171 SkBitmap bitmap_;
172 PlatformSurface surface_;
173
174 DISALLOW_COPY_AND_ASSIGN(PlatformBitmap);
175 };
176
154 } // namespace skia 177 } // namespace skia
155 178
156 #endif // SKIA_EXT_PLATFORM_CANVAS_H_ 179 #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