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

Side by Side Diff: webkit/glue/plugins/pepper_graphics_2d.h

Issue 3255003: Pull new PPAPI, rename non-P0 interfaces to Dev, rename DeviceContext2D to Gr... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 10 years, 3 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 | « webkit/glue/plugins/pepper_font.cc ('k') | webkit/glue/plugins/pepper_graphics_2d.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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 WEBKIT_GLUE_PLUGINS_PEPPER_DEVICE_CONTEXT_2D_H_ 5 #ifndef WEBKIT_GLUE_PLUGINS_PEPPER_GRAPHICS_2D_H_
6 #define WEBKIT_GLUE_PLUGINS_PEPPER_DEVICE_CONTEXT_2D_H_ 6 #define WEBKIT_GLUE_PLUGINS_PEPPER_GRAPHICS_2D_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "third_party/ppapi/c/pp_completion_callback.h" 11 #include "third_party/ppapi/c/pp_completion_callback.h"
12 #include "third_party/ppapi/c/ppb_device_context_2d.h" 12 #include "third_party/ppapi/c/ppb_graphics_2d.h"
13 #include "third_party/WebKit/WebKit/chromium/public/WebCanvas.h" 13 #include "third_party/WebKit/WebKit/chromium/public/WebCanvas.h"
14 #include "webkit/glue/plugins/pepper_resource.h" 14 #include "webkit/glue/plugins/pepper_resource.h"
15 15
16 typedef struct _ppb_DeviceContext2D PPB_DeviceContext2D; 16 struct PPB_Graphics2D;
17 17
18 namespace gfx { 18 namespace gfx {
19 class Rect; 19 class Rect;
20 } 20 }
21 21
22 namespace pepper { 22 namespace pepper {
23 23
24 class ImageData; 24 class ImageData;
25 class PluginInstance; 25 class PluginInstance;
26 class PluginModule; 26 class PluginModule;
27 27
28 class DeviceContext2D : public Resource { 28 class Graphics2D : public Resource {
29 public: 29 public:
30 DeviceContext2D(PluginModule* module); 30 Graphics2D(PluginModule* module);
31 virtual ~DeviceContext2D(); 31 virtual ~Graphics2D();
32 32
33 // Returns a pointer to the interface implementing PPB_ImageData that is 33 // Returns a pointer to the interface implementing PPB_ImageData that is
34 // exposed to the plugin. 34 // exposed to the plugin.
35 static const PPB_DeviceContext2D* GetInterface(); 35 static const PPB_Graphics2D* GetInterface();
36 36
37 bool Init(int width, int height, bool is_always_opaque); 37 bool Init(int width, int height, bool is_always_opaque);
38 38
39 // Resource override. 39 // Resource override.
40 virtual DeviceContext2D* AsDeviceContext2D() { return this; } 40 virtual Graphics2D* AsGraphics2D() { return this; }
41 41
42 // PPB_DeviceContext2D functions. 42 // PPB_Graphics2D functions.
43 bool Describe(PP_Size* size, bool* is_always_opaque); 43 bool Describe(PP_Size* size, bool* is_always_opaque);
44 bool PaintImageData(PP_Resource image, 44 bool PaintImageData(PP_Resource image,
45 const PP_Point* top_left, 45 const PP_Point* top_left,
46 const PP_Rect* src_rect); 46 const PP_Rect* src_rect);
47 bool Scroll(const PP_Rect* clip_rect, const PP_Point* amount); 47 bool Scroll(const PP_Rect* clip_rect, const PP_Point* amount);
48 bool ReplaceContents(PP_Resource image); 48 bool ReplaceContents(PP_Resource image);
49 int32_t Flush(const PP_CompletionCallback& callback); 49 int32_t Flush(const PP_CompletionCallback& callback);
50 50
51 bool ReadImageData(PP_Resource image, const PP_Point* top_left); 51 bool ReadImageData(PP_Resource image, const PP_Point* top_left);
52 52
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 119
120 // Function scheduled to execute by ScheduleOffscreenCallback that actually 120 // Function scheduled to execute by ScheduleOffscreenCallback that actually
121 // issues the offscreen callbacks. 121 // issues the offscreen callbacks.
122 void ExecuteOffscreenCallback(FlushCallbackData data); 122 void ExecuteOffscreenCallback(FlushCallbackData data);
123 123
124 // Returns true if there is any type of flush callback pending. 124 // Returns true if there is any type of flush callback pending.
125 bool HasPendingFlush() const; 125 bool HasPendingFlush() const;
126 126
127 scoped_refptr<ImageData> image_data_; 127 scoped_refptr<ImageData> image_data_;
128 128
129 // Non-owning pointer to the plugin instance this device context is currently 129 // Non-owning pointer to the plugin instance this context is currently bound
130 // bound to, if any. If the device context is currently unbound, this will 130 // to, if any. If the context is currently unbound, this will be NULL.
131 // be NULL.
132 PluginInstance* bound_instance_; 131 PluginInstance* bound_instance_;
133 132
134 // Keeps track of all drawing commands queued before a Flush call. 133 // Keeps track of all drawing commands queued before a Flush call.
135 struct QueuedOperation; 134 struct QueuedOperation;
136 typedef std::vector<QueuedOperation> OperationQueue; 135 typedef std::vector<QueuedOperation> OperationQueue;
137 OperationQueue queued_operations_; 136 OperationQueue queued_operations_;
138 137
139 // Indicates whether any changes have been flushed to the backing store. 138 // Indicates whether any changes have been flushed to the backing store.
140 // This is initially false and is set to true at the first Flush() call. 139 // This is initially false and is set to true at the first Flush() call.
141 bool flushed_any_data_; 140 bool flushed_any_data_;
(...skipping 18 matching lines...) Expand all
160 // move it to the painted callbacks list. When the renderer receives a flush, 159 // move it to the painted callbacks list. When the renderer receives a flush,
161 // we'll execute the callback and remove it from the list. 160 // we'll execute the callback and remove it from the list.
162 FlushCallbackData unpainted_flush_callback_; 161 FlushCallbackData unpainted_flush_callback_;
163 FlushCallbackData painted_flush_callback_; 162 FlushCallbackData painted_flush_callback_;
164 163
165 // When doing offscreen flushes, we issue a task that issues the callback 164 // When doing offscreen flushes, we issue a task that issues the callback
166 // later. This is set when one of those tasks is pending so that we can 165 // later. This is set when one of those tasks is pending so that we can
167 // enforce the "only one pending flush at a time" constraint in the API. 166 // enforce the "only one pending flush at a time" constraint in the API.
168 bool offscreen_flush_pending_; 167 bool offscreen_flush_pending_;
169 168
170 DISALLOW_COPY_AND_ASSIGN(DeviceContext2D); 169 DISALLOW_COPY_AND_ASSIGN(Graphics2D);
171 }; 170 };
172 171
173 } // namespace pepper 172 } // namespace pepper
174 173
175 #endif // WEBKIT_GLUE_PLUGINS_PEPPER_DEVICE_CONTEXT_2D_H_ 174 #endif // WEBKIT_GLUE_PLUGINS_PEPPER_GRAPHICS_2D_H_
OLDNEW
« no previous file with comments | « webkit/glue/plugins/pepper_font.cc ('k') | webkit/glue/plugins/pepper_graphics_2d.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698