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

Side by Side Diff: skia/ext/bitmap_platform_device_mac.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_linux.cc ('k') | skia/ext/bitmap_platform_device_mac.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_MAC_H_ 5 #ifndef SKIA_EXT_BITMAP_PLATFORM_DEVICE_MAC_H_
6 #define SKIA_EXT_BITMAP_PLATFORM_DEVICE_MAC_H_ 6 #define SKIA_EXT_BITMAP_PLATFORM_DEVICE_MAC_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 10 matching lines...) Expand all
21 // 21 //
22 // The device owns the pixel data, when the device goes away, the pixel data 22 // The device owns the pixel data, when the device goes away, the pixel data
23 // also becomes invalid. THIS IS DIFFERENT THAN NORMAL SKIA which uses 23 // also becomes invalid. THIS IS DIFFERENT THAN NORMAL SKIA which uses
24 // reference counting for the pixel data. In normal Skia, you could assign 24 // reference counting for the pixel data. In normal Skia, you could assign
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 BitmapPlatformDevice : public PlatformDevice, public SkDevice { 29 class BitmapPlatformDevice : public PlatformDevice, public SkDevice {
30 public: 30 public:
31 // |context| may be NULL. 31 // Creates a BitmapPlatformDevice instance. |is_opaque| should be set if the
32 // caller knows the bitmap will be completely opaque and allows some
33 // optimizations.
34 // |context| may be NULL. If |context| is NULL, then the bitmap backing store
35 // is not initialized.
32 static BitmapPlatformDevice* Create(CGContextRef context, 36 static BitmapPlatformDevice* Create(CGContextRef context,
33 int width, int height, 37 int width, int height,
34 bool is_opaque); 38 bool is_opaque);
35 39
40 // Creates a BitmapPlatformDevice instance. If |is_opaque| is false,
41 // then the bitmap is initialzed to 0.
42 static BitmapPlatformDevice* CreateAndClear(int width, int height,
43 bool is_opaque);
44
36 // Creates a context for |data| and calls Create. 45 // Creates a context for |data| and calls Create.
46 // If |data| is NULL, then the bitmap backing store is not initialized.
37 static BitmapPlatformDevice* CreateWithData(uint8_t* data, 47 static BitmapPlatformDevice* CreateWithData(uint8_t* data,
38 int width, int height, 48 int width, int height,
39 bool is_opaque); 49 bool is_opaque);
40 50
41 virtual ~BitmapPlatformDevice(); 51 virtual ~BitmapPlatformDevice();
42 52
43 // PlatformDevice overrides 53 // PlatformDevice overrides
44 virtual CGContextRef GetBitmapContext() OVERRIDE; 54 virtual CGContextRef GetBitmapContext() OVERRIDE;
45 virtual void DrawToNativeContext(CGContextRef context, int x, int y, 55 virtual void DrawToNativeContext(CGContextRef context, int x, int y,
46 const CGRect* src_rect) OVERRIDE; 56 const CGRect* src_rect) OVERRIDE;
(...skipping 23 matching lines...) Expand all
70 // Data associated with this device, guaranteed non-null. We hold a reference 80 // Data associated with this device, guaranteed non-null. We hold a reference
71 // to this object. 81 // to this object.
72 BitmapPlatformDeviceData* data_; 82 BitmapPlatformDeviceData* data_;
73 83
74 DISALLOW_COPY_AND_ASSIGN(BitmapPlatformDevice); 84 DISALLOW_COPY_AND_ASSIGN(BitmapPlatformDevice);
75 }; 85 };
76 86
77 } // namespace skia 87 } // namespace skia
78 88
79 #endif // SKIA_EXT_BITMAP_PLATFORM_DEVICE_MAC_H_ 89 #endif // SKIA_EXT_BITMAP_PLATFORM_DEVICE_MAC_H_
OLDNEW
« no previous file with comments | « skia/ext/bitmap_platform_device_linux.cc ('k') | skia/ext/bitmap_platform_device_mac.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698