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

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

Issue 6064007: Allow the creation of a skia::PlatformCanvas from a CGContextRef. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Created 9 years, 11 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/platform_canvas_mac.cc » ('j') | webkit/glue/webmediaplayer_impl.cc » ('J')
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_PLATFORM_CANVAS_H_ 5 #ifndef SKIA_EXT_PLATFORM_CANVAS_H_
6 #define SKIA_EXT_PLATFORM_CANVAS_H_ 6 #define SKIA_EXT_PLATFORM_CANVAS_H_
7 #pragma once 7 #pragma once
8 8
9 // The platform-specific device will include the necessary platform headers 9 // The platform-specific device will include the necessary platform headers
10 // to get the surface type. 10 // to get the surface type.
(...skipping 30 matching lines...) Expand all
41 41
42 #elif defined(__APPLE__) 42 #elif defined(__APPLE__)
43 // Mac ----------------------------------------------------------------------- 43 // Mac -----------------------------------------------------------------------
44 44
45 PlatformCanvas(int width, int height, bool is_opaque, 45 PlatformCanvas(int width, int height, bool is_opaque,
46 CGContextRef context); 46 CGContextRef context);
47 PlatformCanvas(int width, int height, bool is_opaque, uint8_t* context); 47 PlatformCanvas(int width, int height, bool is_opaque, uint8_t* context);
48 48
49 // For two-part init, call if you use the no-argument constructor above 49 // For two-part init, call if you use the no-argument constructor above
50 bool initialize(int width, int height, bool is_opaque, uint8_t* data = NULL); 50 bool initialize(int width, int height, bool is_opaque, uint8_t* data = NULL);
51 bool initialize(CGContextRef context, int width, int height, bool is_opaque);
brettw 2010/12/29 21:03:52 Can you move this before the other one to match th
sjl 2010/12/31 05:55:49 Done.
51 52
52 #elif defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__) || \ 53 #elif defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__) || \
53 defined(__Solaris__) 54 defined(__Solaris__)
54 // Linux --------------------------------------------------------------------- 55 // Linux ---------------------------------------------------------------------
55 56
56 // Construct a canvas from the given memory region. The memory is not cleared 57 // Construct a canvas from the given memory region. The memory is not cleared
57 // first. @data must be, at least, @height * StrideForWidth(@width) bytes. 58 // first. @data must be, at least, @height * StrideForWidth(@width) bytes.
58 PlatformCanvas(int width, int height, bool is_opaque, uint8_t* data); 59 PlatformCanvas(int width, int height, bool is_opaque, uint8_t* data);
59 60
60 // For two-part init, call if you use the no-argument constructor above 61 // For two-part init, call if you use the no-argument constructor above
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 100
100 private: 101 private:
101 // Unimplemented. This is to try to prevent people from calling this function 102 // Unimplemented. This is to try to prevent people from calling this function
102 // on SkCanvas. SkCanvas' version is not virtual, so we can't prevent this 103 // on SkCanvas. SkCanvas' version is not virtual, so we can't prevent this
103 // 100%, but hopefully this will make people notice and not use the function. 104 // 100%, but hopefully this will make people notice and not use the function.
104 // Calling SkCanvas' version will create a new device which is not compatible 105 // Calling SkCanvas' version will create a new device which is not compatible
105 // with us and we will crash if somebody tries to draw into it with 106 // with us and we will crash if somebody tries to draw into it with
106 // CoreGraphics. 107 // CoreGraphics.
107 virtual SkDevice* setBitmapDevice(const SkBitmap& bitmap); 108 virtual SkDevice* setBitmapDevice(const SkBitmap& bitmap);
108 109
110 // Internal helper.
111 bool initialize(SkDevice* device);
brettw 2010/12/29 21:03:52 We should avoid overloading the initialize functio
sjl 2010/12/31 05:55:49 Done.
112
109 // Disallow copy and assign. 113 // Disallow copy and assign.
110 PlatformCanvas(const PlatformCanvas&); 114 PlatformCanvas(const PlatformCanvas&);
111 PlatformCanvas& operator=(const PlatformCanvas&); 115 PlatformCanvas& operator=(const PlatformCanvas&);
112 }; 116 };
113 117
114 } // namespace skia 118 } // namespace skia
115 119
116 #endif // SKIA_EXT_PLATFORM_CANVAS_H_ 120 #endif // SKIA_EXT_PLATFORM_CANVAS_H_
OLDNEW
« no previous file with comments | « no previous file | skia/ext/platform_canvas_mac.cc » ('j') | webkit/glue/webmediaplayer_impl.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698