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

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 & add BitmapPlatformDevice::CreateAndClear. 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
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 17 matching lines...) Expand all
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 behavior).
36 // If shared_section is non-null, then it must be a handle to a file-mapping 36 // If shared_section is non-null, then it must be a handle to a file-mapping
37 // object returned by CreateFileMapping. See CreateDIBSection for details. 37 // object returned by CreateFileMapping. See CreateDIBSection for details.
38 static BitmapPlatformDevice* create(HDC screen_dc, int width, int height, 38 // If shared_section is null, the bitmap backing store is not initialized.
msw 2012/03/16 07:13:22 nit: vertical bars around |shared_section|.
Jeff Timanus 2012/03/16 15:52:42 Done.
39 static BitmapPlatformDevice* Create(HDC screen_dc, int width, int height,
39 bool is_opaque, HANDLE shared_section); 40 bool is_opaque, HANDLE shared_section);
40 41
41 // This version is the same as above but will get the screen DC itself. 42 // 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, 43 static BitmapPlatformDevice* Create(int width, int height, bool is_opaque,
43 HANDLE shared_section); 44 HANDLE shared_section);
44 45
46 // Create a BitmapPlatformDevice wit no shared section. The bitmap is not
msw 2012/03/16 07:13:22 spelling nit: with
Jeff Timanus 2012/03/16 15:52:42 Done.
47 // initialized to 0.
48 static BitmapPlatformDevice* Create(int width, int height, bool is_opaque);
49
50 // Creates a BitmapPlatformDevice instance respecting the parameters as above.
51 // If |is_opaque| is false, then the bitmap is initialzed to 0.
52 static BitmapPlatformDevice* CreateAndClear(int width, int height,
53 bool is_opaque);
54
45 virtual ~BitmapPlatformDevice(); 55 virtual ~BitmapPlatformDevice();
46 56
47 // PlatformDevice overrides 57 // PlatformDevice overrides
48 // Retrieves the bitmap DC, which is the memory DC for our bitmap data. The 58 // Retrieves the bitmap DC, which is the memory DC for our bitmap data. The
49 // bitmap DC is lazy created. 59 // bitmap DC is lazy created.
50 virtual PlatformSurface BeginPlatformPaint() OVERRIDE; 60 virtual PlatformSurface BeginPlatformPaint() OVERRIDE;
51 virtual void EndPlatformPaint() OVERRIDE; 61 virtual void EndPlatformPaint() OVERRIDE;
52 62
53 virtual void DrawToNativeContext(HDC dc, int x, int y, 63 virtual void DrawToNativeContext(HDC dc, int x, int y,
54 const RECT* src_rect) OVERRIDE; 64 const RECT* src_rect) OVERRIDE;
(...skipping 30 matching lines...) Expand all
85 #ifdef SK_DEBUG 95 #ifdef SK_DEBUG
86 int begin_paint_count_; 96 int begin_paint_count_;
87 #endif 97 #endif
88 98
89 DISALLOW_COPY_AND_ASSIGN(BitmapPlatformDevice); 99 DISALLOW_COPY_AND_ASSIGN(BitmapPlatformDevice);
90 }; 100 };
91 101
92 } // namespace skia 102 } // namespace skia
93 103
94 #endif // SKIA_EXT_BITMAP_PLATFORM_DEVICE_WIN_H_ 104 #endif // SKIA_EXT_BITMAP_PLATFORM_DEVICE_WIN_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698