| 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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 *dest = gfx::Rect(rect->point.x, rect->point.y, | 54 *dest = gfx::Rect(rect->point.x, rect->point.y, |
| 55 rect->size.width, rect->size.height); | 55 rect->size.width, rect->size.height); |
| 56 } | 56 } |
| 57 return true; | 57 return true; |
| 58 } | 58 } |
| 59 | 59 |
| 60 PP_Resource Create(PP_Module module_id, int32_t width, int32_t height, | 60 PP_Resource Create(PP_Module module_id, int32_t width, int32_t height, |
| 61 bool is_always_opaque) { | 61 bool is_always_opaque) { |
| 62 PluginModule* module = PluginModule::FromPPModule(module_id); | 62 PluginModule* module = PluginModule::FromPPModule(module_id); |
| 63 if (!module) | 63 if (!module) |
| 64 return NullPPResource(); | 64 return NULL; |
| 65 | 65 |
| 66 scoped_refptr<DeviceContext2D> context(new DeviceContext2D(module)); | 66 scoped_refptr<DeviceContext2D> context(new DeviceContext2D(module)); |
| 67 if (!context->Init(width, height, is_always_opaque)) | 67 if (!context->Init(width, height, is_always_opaque)) |
| 68 return NullPPResource(); | 68 return NULL; |
| 69 context->AddRef(); // AddRef for the caller. | 69 context->AddRef(); // AddRef for the caller. |
| 70 return context->GetResource(); | 70 return context->GetResource(); |
| 71 } | 71 } |
| 72 | 72 |
| 73 bool PaintImageData(PP_Resource device_context, | 73 bool PaintImageData(PP_Resource device_context, |
| 74 PP_Resource image, | 74 PP_Resource image, |
| 75 int32_t x, int32_t y, | 75 int32_t x, int32_t y, |
| 76 const PP_Rect* src_rect) { | 76 const PP_Rect* src_rect) { |
| 77 scoped_refptr<DeviceContext2D> context( | 77 scoped_refptr<DeviceContext2D> context( |
| 78 ResourceTracker::Get()->GetAsDeviceContext2D(device_context)); | 78 ResourceTracker::Get()->GetAsDeviceContext2D(device_context)); |
| (...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 363 | 363 |
| 364 void DeviceContext2D::ExecuteScroll(const gfx::Rect& clip, int dx, int dy) { | 364 void DeviceContext2D::ExecuteScroll(const gfx::Rect& clip, int dx, int dy) { |
| 365 // FIXME(brettw) | 365 // FIXME(brettw) |
| 366 } | 366 } |
| 367 | 367 |
| 368 void DeviceContext2D::ExecuteReplaceContents(ImageData* image) { | 368 void DeviceContext2D::ExecuteReplaceContents(ImageData* image) { |
| 369 image_data_->Swap(image); | 369 image_data_->Swap(image); |
| 370 } | 370 } |
| 371 | 371 |
| 372 } // namespace pepper | 372 } // namespace pepper |
| OLD | NEW |