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

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

Issue 126150: Rename CreateWithContext to Create (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 11 years, 6 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 | « no previous file | 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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 7
8 #include "skia/ext/platform_device_mac.h" 8 #include "skia/ext/platform_device_mac.h"
9 9
10 namespace skia { 10 namespace skia {
11 11
12 // A device is basically a wrapper around SkBitmap that provides a surface for 12 // A device is basically a wrapper around SkBitmap that provides a surface for
13 // SkCanvas to draw into. Our device provides a surface CoreGraphics can also 13 // SkCanvas to draw into. Our device provides a surface CoreGraphics can also
14 // write to. BitmapPlatformDevice creates a bitmap using 14 // write to. BitmapPlatformDevice creates a bitmap using
15 // CGCreateBitmapContext() in a format that Skia supports and can then use this 15 // CGCreateBitmapContext() in a format that Skia supports and can then use this
16 // to draw text into, etc. This pixel data is provided to the bitmap that the 16 // to draw text into, etc. This pixel data is provided to the bitmap that the
17 // device contains so that it can be shared. 17 // device contains so that it can be shared.
18 // 18 //
19 // The device owns the pixel data, when the device goes away, the pixel data 19 // The device owns the pixel data, when the device goes away, the pixel data
20 // also becomes invalid. THIS IS DIFFERENT THAN NORMAL SKIA which uses 20 // also becomes invalid. THIS IS DIFFERENT THAN NORMAL SKIA which uses
21 // reference counting for the pixel data. In normal Skia, you could assign 21 // reference counting for the pixel data. In normal Skia, you could assign
22 // another bitmap to this device's bitmap and everything will work properly. 22 // another bitmap to this device's bitmap and everything will work properly.
23 // For us, that other bitmap will become invalid as soon as the device becomes 23 // For us, that other bitmap will become invalid as soon as the device becomes
24 // invalid, which may lead to subtle bugs. Therefore, DO NOT ASSIGN THE 24 // invalid, which may lead to subtle bugs. Therefore, DO NOT ASSIGN THE
25 // DEVICE'S PIXEL DATA TO ANOTHER BITMAP, make sure you copy instead. 25 // DEVICE'S PIXEL DATA TO ANOTHER BITMAP, make sure you copy instead.
26 class BitmapPlatformDevice : public PlatformDevice { 26 class BitmapPlatformDevice : public PlatformDevice {
27 public: 27 public:
28 // |context| may be NULL. 28 // |context| may be NULL.
29 static BitmapPlatformDevice* CreateWithContext(CGContextRef context, 29 static BitmapPlatformDevice* Create(CGContextRef context,
30 int width, int height, 30 int width, int height,
31 bool is_opaque); 31 bool is_opaque);
32 32
33 // Creates a context for |data| and calls CreateWithContext. 33 // Creates a context for |data| and calls Create.
34 static BitmapPlatformDevice* CreateWithData(uint8_t* data, 34 static BitmapPlatformDevice* CreateWithData(uint8_t* data,
35 int width, int height, 35 int width, int height,
36 bool is_opaque); 36 bool is_opaque);
37 37
38 // Copy constructor. When copied, devices duplicate their internal data, so 38 // Copy constructor. When copied, devices duplicate their internal data, so
39 // stay linked. This is because their implementation is very heavyweight 39 // stay linked. This is because their implementation is very heavyweight
40 // (lots of memory and CoreGraphics state). If a device has been copied, both 40 // (lots of memory and CoreGraphics state). If a device has been copied, both
41 // clip rects and other state will stay in sync. 41 // clip rects and other state will stay in sync.
42 // 42 //
43 // This means it will NOT work to duplicate a device and assign it to a 43 // This means it will NOT work to duplicate a device and assign it to a
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 adjustAlpha adjustor); 82 adjustAlpha adjustor);
83 83
84 // Data associated with this device, guaranteed non-null. We hold a reference 84 // Data associated with this device, guaranteed non-null. We hold a reference
85 // to this object. 85 // to this object.
86 BitmapPlatformDeviceData* data_; 86 BitmapPlatformDeviceData* data_;
87 }; 87 };
88 88
89 } // namespace skia 89 } // namespace skia
90 90
91 #endif // SKIA_EXT_BITMAP_PLATFORM_DEVICE_MAC_H_ 91 #endif // SKIA_EXT_BITMAP_PLATFORM_DEVICE_MAC_H_
OLDNEW
« no previous file with comments | « no previous file | skia/ext/bitmap_platform_device_mac.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698