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 #include "webkit/glue/plugins/pepper_device_context_2d.h" | 5 #include "webkit/glue/plugins/pepper_device_context_2d.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "gfx/point.h" | 8 #include "gfx/point.h" |
9 #include "gfx/rect.h" | 9 #include "gfx/rect.h" |
10 #include "skia/ext/platform_canvas.h" | 10 #include "skia/ext/platform_canvas.h" |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 bool Flush(PP_Resource device_context, | 111 bool Flush(PP_Resource device_context, |
112 PPB_DeviceContext2D_FlushCallback callback, | 112 PPB_DeviceContext2D_FlushCallback callback, |
113 void* callback_data) { | 113 void* callback_data) { |
114 scoped_refptr<DeviceContext2D> context( | 114 scoped_refptr<DeviceContext2D> context( |
115 ResourceTracker::Get()->GetAsDeviceContext2D(device_context)); | 115 ResourceTracker::Get()->GetAsDeviceContext2D(device_context)); |
116 if (!context.get()) | 116 if (!context.get()) |
117 return false; | 117 return false; |
118 return context->Flush(callback, callback_data); | 118 return context->Flush(callback, callback_data); |
119 } | 119 } |
120 | 120 |
121 bool ReadImageData(PP_Resource device_context, | |
122 PP_Resource image, | |
123 int32_t x, int32_t y) { | |
124 scoped_refptr<DeviceContext2D> context( | |
125 ResourceTracker::Get()->GetAsDeviceContext2D(device_context)); | |
126 if (!context.get()) | |
127 return false; | |
128 return context->ReadImageData(image, x, y); | |
129 } | |
130 | |
131 const PPB_DeviceContext2D ppb_devicecontext2d = { | 121 const PPB_DeviceContext2D ppb_devicecontext2d = { |
132 &Create, | 122 &Create, |
133 &Describe, | 123 &Describe, |
134 &PaintImageData, | 124 &PaintImageData, |
135 &Scroll, | 125 &Scroll, |
136 &ReplaceContents, | 126 &ReplaceContents, |
137 &Flush, | 127 &Flush |
138 &ReadImageData | |
139 }; | 128 }; |
140 | 129 |
141 } // namespace | 130 } // namespace |
142 | 131 |
143 struct DeviceContext2D::QueuedOperation { | 132 struct DeviceContext2D::QueuedOperation { |
144 enum Type { | 133 enum Type { |
145 PAINT, | 134 PAINT, |
146 SCROLL, | 135 SCROLL, |
147 REPLACE | 136 REPLACE |
148 }; | 137 }; |
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
430 | 419 |
431 void DeviceContext2D::ExecuteScroll(const gfx::Rect& clip, int dx, int dy) { | 420 void DeviceContext2D::ExecuteScroll(const gfx::Rect& clip, int dx, int dy) { |
432 // FIXME(brettw) | 421 // FIXME(brettw) |
433 } | 422 } |
434 | 423 |
435 void DeviceContext2D::ExecuteReplaceContents(ImageData* image) { | 424 void DeviceContext2D::ExecuteReplaceContents(ImageData* image) { |
436 image_data_->Swap(image); | 425 image_data_->Swap(image); |
437 } | 426 } |
438 | 427 |
439 } // namespace pepper | 428 } // namespace pepper |
OLD | NEW |