| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/renderer/pepper/pepper_graphics_2d_host.h" | 5 #include "content/renderer/pepper/pepper_graphics_2d_host.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/debug/trace_event.h" | 8 #include "base/debug/trace_event.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 214 return false; | 214 return false; |
| 215 } | 215 } |
| 216 is_always_opaque_ = is_always_opaque; | 216 is_always_opaque_ = is_always_opaque; |
| 217 scale_ = 1.0f; | 217 scale_ = 1.0f; |
| 218 return true; | 218 return true; |
| 219 } | 219 } |
| 220 | 220 |
| 221 int32_t PepperGraphics2DHost::OnResourceMessageReceived( | 221 int32_t PepperGraphics2DHost::OnResourceMessageReceived( |
| 222 const IPC::Message& msg, | 222 const IPC::Message& msg, |
| 223 ppapi::host::HostMessageContext* context) { | 223 ppapi::host::HostMessageContext* context) { |
| 224 IPC_BEGIN_MESSAGE_MAP(PepperGraphics2DHost, msg) | 224 PPAPI_BEGIN_MESSAGE_MAP(PepperGraphics2DHost, msg) |
| 225 PPAPI_DISPATCH_HOST_RESOURCE_CALL(PpapiHostMsg_Graphics2D_PaintImageData, | 225 PPAPI_DISPATCH_HOST_RESOURCE_CALL(PpapiHostMsg_Graphics2D_PaintImageData, |
| 226 OnHostMsgPaintImageData) | 226 OnHostMsgPaintImageData) |
| 227 PPAPI_DISPATCH_HOST_RESOURCE_CALL(PpapiHostMsg_Graphics2D_Scroll, | 227 PPAPI_DISPATCH_HOST_RESOURCE_CALL(PpapiHostMsg_Graphics2D_Scroll, |
| 228 OnHostMsgScroll) | 228 OnHostMsgScroll) |
| 229 PPAPI_DISPATCH_HOST_RESOURCE_CALL(PpapiHostMsg_Graphics2D_ReplaceContents, | 229 PPAPI_DISPATCH_HOST_RESOURCE_CALL(PpapiHostMsg_Graphics2D_ReplaceContents, |
| 230 OnHostMsgReplaceContents) | 230 OnHostMsgReplaceContents) |
| 231 PPAPI_DISPATCH_HOST_RESOURCE_CALL_0(PpapiHostMsg_Graphics2D_Flush, | 231 PPAPI_DISPATCH_HOST_RESOURCE_CALL_0(PpapiHostMsg_Graphics2D_Flush, |
| 232 OnHostMsgFlush) | 232 OnHostMsgFlush) |
| 233 PPAPI_DISPATCH_HOST_RESOURCE_CALL(PpapiHostMsg_Graphics2D_SetScale, | 233 PPAPI_DISPATCH_HOST_RESOURCE_CALL(PpapiHostMsg_Graphics2D_SetScale, |
| 234 OnHostMsgSetScale) | 234 OnHostMsgSetScale) |
| 235 PPAPI_DISPATCH_HOST_RESOURCE_CALL(PpapiHostMsg_Graphics2D_ReadImageData, | 235 PPAPI_DISPATCH_HOST_RESOURCE_CALL(PpapiHostMsg_Graphics2D_ReadImageData, |
| 236 OnHostMsgReadImageData) | 236 OnHostMsgReadImageData) |
| 237 IPC_END_MESSAGE_MAP() | 237 PPAPI_END_MESSAGE_MAP() |
| 238 return PP_ERROR_FAILED; | 238 return PP_ERROR_FAILED; |
| 239 } | 239 } |
| 240 | 240 |
| 241 bool PepperGraphics2DHost::IsGraphics2DHost() { return true; } | 241 bool PepperGraphics2DHost::IsGraphics2DHost() { return true; } |
| 242 | 242 |
| 243 bool PepperGraphics2DHost::ReadImageData(PP_Resource image, | 243 bool PepperGraphics2DHost::ReadImageData(PP_Resource image, |
| 244 const PP_Point* top_left) { | 244 const PP_Point* top_left) { |
| 245 // Get and validate the image object to paint into. | 245 // Get and validate the image object to paint into. |
| 246 EnterResourceNoLock<PPB_ImageData_API> enter(image, true); | 246 EnterResourceNoLock<PPB_ImageData_API> enter(image, true); |
| 247 if (enter.failed()) | 247 if (enter.failed()) |
| (...skipping 539 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 787 gfx::Point inverse_scaled_point = | 787 gfx::Point inverse_scaled_point = |
| 788 gfx::ToFlooredPoint(gfx::ScalePoint(*delta, inverse_scale)); | 788 gfx::ToFlooredPoint(gfx::ScalePoint(*delta, inverse_scale)); |
| 789 if (original_delta != inverse_scaled_point) | 789 if (original_delta != inverse_scaled_point) |
| 790 return false; | 790 return false; |
| 791 } | 791 } |
| 792 | 792 |
| 793 return true; | 793 return true; |
| 794 } | 794 } |
| 795 | 795 |
| 796 } // namespace content | 796 } // namespace content |
| OLD | NEW |