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

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

Issue 9416017: Optionally clear PlatformCanvas instances. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Address comments. Created 8 years, 9 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_mac.cc ('k') | skia/ext/bitmap_platform_device_win.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_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 #pragma once 7 #pragma once
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
(...skipping 14 matching lines...) Expand all
25 // another bitmap to this device's bitmap and everything will work properly. 25 // another bitmap to this device's bitmap and everything will work properly.
26 // For us, that other bitmap will become invalid as soon as the device becomes 26 // For us, that other bitmap will become invalid as soon as the device becomes
27 // invalid, which may lead to subtle bugs. Therefore, DO NOT ASSIGN THE 27 // invalid, which may lead to subtle bugs. Therefore, DO NOT ASSIGN THE
28 // DEVICE'S PIXEL DATA TO ANOTHER BITMAP, make sure you copy instead. 28 // DEVICE'S PIXEL DATA TO ANOTHER BITMAP, make sure you copy instead.
29 class SK_API BitmapPlatformDevice : public PlatformDevice, public SkDevice { 29 class SK_API BitmapPlatformDevice : public PlatformDevice, public SkDevice {
30 public: 30 public:
31 // Factory function. The screen DC is used to create the bitmap, and will not 31 // Factory function. The screen DC is used to create the bitmap, and will not
32 // be stored beyond this function. is_opaque should be set if the caller 32 // be stored beyond this function. is_opaque should be set if the caller
33 // knows the bitmap will be completely opaque and allows some optimizations. 33 // knows the bitmap will be completely opaque and allows some optimizations.
34 // 34 //
35 // The shared_section parameter is optional (pass NULL for default behavior). 35 // The |shared_section| parameter is optional (pass NULL for default
36 // If shared_section is non-null, then it must be a handle to a file-mapping 36 // behavior). If |shared_section| is non-null, then it must be a handle to a
37 // object returned by CreateFileMapping. See CreateDIBSection for details. 37 // file-mapping object returned by CreateFileMapping. See CreateDIBSection
38 static BitmapPlatformDevice* create(HDC screen_dc, int width, int height, 38 // for details. If |shared_section| is null, the bitmap backing store is not
39 // initialized.
40 static BitmapPlatformDevice* Create(HDC screen_dc, int width, int height,
39 bool is_opaque, HANDLE shared_section); 41 bool is_opaque, HANDLE shared_section);
40 42
41 // This version is the same as above but will get the screen DC itself. 43 // This version is the same as above but will get the screen DC itself.
42 static BitmapPlatformDevice* create(int width, int height, bool is_opaque, 44 static BitmapPlatformDevice* Create(int width, int height, bool is_opaque,
43 HANDLE shared_section); 45 HANDLE shared_section);
44 46
47 // Create a BitmapPlatformDevice with no shared section. The bitmap is not
48 // initialized to 0.
49 static BitmapPlatformDevice* Create(int width, int height, bool is_opaque);
50
51 // Creates a BitmapPlatformDevice instance respecting the parameters as above.
52 // If |is_opaque| is false, then the bitmap is initialzed to 0.
53 static BitmapPlatformDevice* CreateAndClear(int width, int height,
54 bool is_opaque);
55
45 virtual ~BitmapPlatformDevice(); 56 virtual ~BitmapPlatformDevice();
46 57
47 // PlatformDevice overrides 58 // PlatformDevice overrides
48 // Retrieves the bitmap DC, which is the memory DC for our bitmap data. The 59 // Retrieves the bitmap DC, which is the memory DC for our bitmap data. The
49 // bitmap DC is lazy created. 60 // bitmap DC is lazy created.
50 virtual PlatformSurface BeginPlatformPaint() OVERRIDE; 61 virtual PlatformSurface BeginPlatformPaint() OVERRIDE;
51 virtual void EndPlatformPaint() OVERRIDE; 62 virtual void EndPlatformPaint() OVERRIDE;
52 63
53 virtual void DrawToNativeContext(HDC dc, int x, int y, 64 virtual void DrawToNativeContext(HDC dc, int x, int y,
54 const RECT* src_rect) OVERRIDE; 65 const RECT* src_rect) OVERRIDE;
(...skipping 30 matching lines...) Expand all
85 #ifdef SK_DEBUG 96 #ifdef SK_DEBUG
86 int begin_paint_count_; 97 int begin_paint_count_;
87 #endif 98 #endif
88 99
89 DISALLOW_COPY_AND_ASSIGN(BitmapPlatformDevice); 100 DISALLOW_COPY_AND_ASSIGN(BitmapPlatformDevice);
90 }; 101 };
91 102
92 } // namespace skia 103 } // namespace skia
93 104
94 #endif // SKIA_EXT_BITMAP_PLATFORM_DEVICE_WIN_H_ 105 #endif // SKIA_EXT_BITMAP_PLATFORM_DEVICE_WIN_H_
OLDNEW
« no previous file with comments | « skia/ext/bitmap_platform_device_mac.cc ('k') | skia/ext/bitmap_platform_device_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698