OLD | NEW |
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_DEVICE_CONTEXT_2D_H_ |
6 #define WEBKIT_GLUE_PLUGINS_PEPPER_DEVICE_CONTEXT_2D_H_ | 6 #define WEBKIT_GLUE_PLUGINS_PEPPER_DEVICE_CONTEXT_2D_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 20 matching lines...) Loading... |
31 // Returns a pointer to the interface implementing PPB_ImageData that is | 31 // Returns a pointer to the interface implementing PPB_ImageData that is |
32 // exposed to the plugin. | 32 // exposed to the plugin. |
33 static const PPB_DeviceContext2D* GetInterface(); | 33 static const PPB_DeviceContext2D* GetInterface(); |
34 | 34 |
35 bool Init(int width, int height, bool is_always_opaque); | 35 bool Init(int width, int height, bool is_always_opaque); |
36 | 36 |
37 // Resource override. | 37 // Resource override. |
38 virtual DeviceContext2D* AsDeviceContext2D() { return this; } | 38 virtual DeviceContext2D* AsDeviceContext2D() { return this; } |
39 | 39 |
40 // PPB_DeviceContext2D functions. | 40 // PPB_DeviceContext2D functions. |
| 41 bool Describe(int32_t* width, int32_t* height, bool* is_always_opaque); |
41 bool PaintImageData(PP_Resource image, | 42 bool PaintImageData(PP_Resource image, |
42 int32_t x, int32_t y, | 43 int32_t x, int32_t y, |
43 const PP_Rect* src_rect); | 44 const PP_Rect* src_rect); |
44 bool Scroll(const PP_Rect* clip_rect, int32_t dx, int32_t dy); | 45 bool Scroll(const PP_Rect* clip_rect, int32_t dx, int32_t dy); |
45 bool ReplaceContents(PP_Resource image); | 46 bool ReplaceContents(PP_Resource image); |
46 bool Flush(PPB_DeviceContext2D_FlushCallback callback, | 47 bool Flush(PPB_DeviceContext2D_FlushCallback callback, |
47 void* callback_data); | 48 void* callback_data); |
| 49 bool ReadImageData(PP_Resource image, int32_t x, int32_t y); |
48 | 50 |
49 void Paint(WebKit::WebCanvas* canvas, | 51 void Paint(WebKit::WebCanvas* canvas, |
50 const gfx::Rect& plugin_rect, | 52 const gfx::Rect& plugin_rect, |
51 const gfx::Rect& paint_rect); | 53 const gfx::Rect& paint_rect); |
52 | 54 |
53 private: | 55 private: |
54 // Called internally to execute the different queued commands. The | 56 // Called internally to execute the different queued commands. The |
55 // parameters to these functions will have already been validated. | 57 // parameters to these functions will have already been validated. |
56 void ExecutePaintImageData(const ImageData* image, | 58 void ExecutePaintImageData(ImageData* image, |
57 int x, int y, | 59 int x, int y, |
58 const gfx::Rect& src_rect); | 60 const gfx::Rect& src_rect); |
59 void ExecuteScroll(const gfx::Rect& clip, int dx, int dy); | 61 void ExecuteScroll(const gfx::Rect& clip, int dx, int dy); |
60 void ExecuteReplaceContents(ImageData* image); | 62 void ExecuteReplaceContents(ImageData* image); |
61 | 63 |
62 scoped_refptr<ImageData> image_data_; | 64 scoped_refptr<ImageData> image_data_; |
63 | 65 |
64 // Keeps track of all drawing commands queued before a Flush call. | 66 // Keeps track of all drawing commands queued before a Flush call. |
65 struct QueuedOperation; | 67 struct QueuedOperation; |
66 typedef std::vector<QueuedOperation> OperationQueue; | 68 typedef std::vector<QueuedOperation> OperationQueue; |
67 OperationQueue queued_operations_; | 69 OperationQueue queued_operations_; |
68 | 70 |
69 DISALLOW_COPY_AND_ASSIGN(DeviceContext2D); | 71 DISALLOW_COPY_AND_ASSIGN(DeviceContext2D); |
70 }; | 72 }; |
71 | 73 |
72 } // namespace pepper | 74 } // namespace pepper |
73 | 75 |
74 #endif // WEBKIT_GLUE_PLUGINS_PEPPER_DEVICE_CONTEXT_2D_H_ | 76 #endif // WEBKIT_GLUE_PLUGINS_PEPPER_DEVICE_CONTEXT_2D_H_ |
OLD | NEW |