Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 "skia/ext/platform_device.h" | 10 #include "skia/ext/platform_device.h" |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 144 PlatformSurface GetPlatformSurface() { return platform_surface_; } | 144 PlatformSurface GetPlatformSurface() { return platform_surface_; } |
| 145 private: | 145 private: |
| 146 SkCanvas* canvas_; | 146 SkCanvas* canvas_; |
| 147 PlatformSurface platform_surface_; | 147 PlatformSurface platform_surface_; |
| 148 | 148 |
| 149 // Disallow copy and assign | 149 // Disallow copy and assign |
| 150 ScopedPlatformPaint(const ScopedPlatformPaint&); | 150 ScopedPlatformPaint(const ScopedPlatformPaint&); |
| 151 ScopedPlatformPaint& operator=(const ScopedPlatformPaint&); | 151 ScopedPlatformPaint& operator=(const ScopedPlatformPaint&); |
| 152 }; | 152 }; |
| 153 | 153 |
| 154 class SK_API PlatformBitmap { | |
| 155 public: | |
|
brettw
2012/10/09 20:40:12
nit: indenting for these two classes (2 space inde
reed1
2012/10/09 21:06:43
Done.
| |
| 156 PlatformBitmap() : surface_(0) {} | |
|
brettw
2012/10/09 20:40:12
Can you put this in the .cc file? (Background: Chr
reed1
2012/10/09 21:06:43
Done.
| |
| 157 ~PlatformBitmap(); | |
| 158 | |
| 159 bool Allocate(int width, int height, bool isOpaque); | |
|
brettw
2012/10/09 20:40:12
style: is_opaque.
| |
| 160 | |
| 161 PlatformSurface LockSurface(); | |
|
brettw
2012/10/09 20:40:12
Can these have documentation? Be sure to mention w
reed1
2012/10/09 21:06:43
Done.
| |
| 162 void UnlockSurface(); | |
| 163 | |
| 164 const SkBitmap& GetBitmap() { return bitmap_; } | |
| 165 | |
| 166 private: | |
| 167 SkBitmap bitmap_; | |
|
brettw
2012/10/09 20:40:12
Normally we don't try to horizontally align these
reed1
2012/10/09 21:06:43
Done.
| |
| 168 PlatformSurface surface_; | |
| 169 }; | |
|
brettw
2012/10/09 20:40:12
Should these classes be DISALLOW_COPY_AND_ASSIGN?
reed1
2012/10/09 21:06:43
That is waht SkNoncopyable does. I have updated Pl
brettw
2012/10/09 21:08:23
If you're doing Chrome code I'd prefer the Chrome
| |
| 170 | |
| 171 class SK_API ScopedPlatformBitmap : SkNoncopyable { | |
| 172 public: | |
| 173 explicit ScopedPlatformBitmap(PlatformBitmap* bitmap) : bitmap_(bitmap) { | |
|
brettw
2012/10/09 20:40:12
Can you also put this constructor & destructor in
| |
| 174 surface_ = bitmap->LockSurface(); | |
| 175 } | |
| 176 ~ScopedPlatformBitmap() { bitmap_->UnlockSurface(); } | |
| 177 | |
| 178 // Returns the PlatformSurface to use for native platform drawing calls. | |
| 179 PlatformSurface GetPlatformSurface() { return surface_; } | |
| 180 private: | |
| 181 PlatformBitmap* bitmap_; | |
| 182 PlatformSurface surface_; | |
| 183 }; | |
|
brettw
2012/10/09 20:40:12
Probably also DISALLOW_COPY_AND_ASSIGN here.
| |
| 184 | |
| 154 } // namespace skia | 185 } // namespace skia |
| 155 | 186 |
| 156 #endif // SKIA_EXT_PLATFORM_CANVAS_H_ | 187 #endif // SKIA_EXT_PLATFORM_CANVAS_H_ |
| OLD | NEW |