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 SKIA_EXT_BITMAP_PLATFORM_DEVICE_WIN_H_ | 5 #ifndef SKIA_EXT_BITMAP_PLATFORM_DEVICE_WIN_H_ |
6 #define SKIA_EXT_BITMAP_PLATFORM_DEVICE_WIN_H_ | 6 #define SKIA_EXT_BITMAP_PLATFORM_DEVICE_WIN_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "skia/ext/platform_device.h" | 10 #include "skia/ext/platform_device.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 public: | 28 public: |
29 // Factory function. is_opaque should be set if the caller knows the bitmap | 29 // Factory function. is_opaque should be set if the caller knows the bitmap |
30 // will be completely opaque and allows some optimizations. | 30 // will be completely opaque and allows some optimizations. |
31 // | 31 // |
32 // The |shared_section| parameter is optional (pass NULL for default | 32 // The |shared_section| parameter is optional (pass NULL for default |
33 // behavior). If |shared_section| is non-null, then it must be a handle to a | 33 // behavior). If |shared_section| is non-null, then it must be a handle to a |
34 // file-mapping object returned by CreateFileMapping. See CreateDIBSection | 34 // file-mapping object returned by CreateFileMapping. See CreateDIBSection |
35 // for details. If |shared_section| is null, the bitmap backing store is not | 35 // for details. If |shared_section| is null, the bitmap backing store is not |
36 // initialized. | 36 // initialized. |
37 static BitmapPlatformDevice* Create(int width, int height, | 37 static BitmapPlatformDevice* Create(int width, int height, |
38 bool is_opaque, HANDLE shared_section); | 38 bool is_opaque, HANDLE shared_section, |
| 39 bool do_clear = false); |
39 | 40 |
40 // Create a BitmapPlatformDevice with no shared section. The bitmap is not | 41 // Create a BitmapPlatformDevice with no shared section. The bitmap is not |
41 // initialized to 0. | 42 // initialized to 0. |
42 static BitmapPlatformDevice* Create(int width, int height, bool is_opaque); | 43 static BitmapPlatformDevice* Create(int width, int height, bool is_opaque); |
43 | 44 |
44 // Creates a BitmapPlatformDevice instance respecting the parameters as above. | |
45 // If |is_opaque| is false, then the bitmap is initialzed to 0. | |
46 static BitmapPlatformDevice* CreateAndClear(int width, int height, | |
47 bool is_opaque); | |
48 | |
49 virtual ~BitmapPlatformDevice(); | 45 virtual ~BitmapPlatformDevice(); |
50 | 46 |
51 // PlatformDevice overrides | 47 // PlatformDevice overrides |
52 // Retrieves the bitmap DC, which is the memory DC for our bitmap data. The | 48 // Retrieves the bitmap DC, which is the memory DC for our bitmap data. The |
53 // bitmap DC is lazy created. | 49 // bitmap DC is lazy created. |
54 virtual PlatformSurface BeginPlatformPaint() override; | 50 virtual PlatformSurface BeginPlatformPaint() override; |
55 virtual void EndPlatformPaint() override; | 51 virtual void EndPlatformPaint() override; |
56 | 52 |
57 virtual void DrawToNativeContext(HDC dc, int x, int y, | 53 virtual void DrawToNativeContext(HDC dc, int x, int y, |
58 const RECT* src_rect) override; | 54 const RECT* src_rect) override; |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 #ifdef SK_DEBUG | 113 #ifdef SK_DEBUG |
118 int begin_paint_count_; | 114 int begin_paint_count_; |
119 #endif | 115 #endif |
120 | 116 |
121 DISALLOW_COPY_AND_ASSIGN(BitmapPlatformDevice); | 117 DISALLOW_COPY_AND_ASSIGN(BitmapPlatformDevice); |
122 }; | 118 }; |
123 | 119 |
124 } // namespace skia | 120 } // namespace skia |
125 | 121 |
126 #endif // SKIA_EXT_BITMAP_PLATFORM_DEVICE_WIN_H_ | 122 #endif // SKIA_EXT_BITMAP_PLATFORM_DEVICE_WIN_H_ |
OLD | NEW |