| 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 12 matching lines...) Expand all Loading... |
| 23 #include "ui/gfx/blit.h" | 23 #include "ui/gfx/blit.h" |
| 24 #include "ui/gfx/point.h" | 24 #include "ui/gfx/point.h" |
| 25 #include "ui/gfx/point_conversions.h" | 25 #include "ui/gfx/point_conversions.h" |
| 26 #include "ui/gfx/rect.h" | 26 #include "ui/gfx/rect.h" |
| 27 #include "ui/gfx/rect_conversions.h" | 27 #include "ui/gfx/rect_conversions.h" |
| 28 #include "ui/gfx/scoped_ns_graphics_context_save_gstate_mac.h" | 28 #include "ui/gfx/scoped_ns_graphics_context_save_gstate_mac.h" |
| 29 #include "ui/gfx/size_conversions.h" | 29 #include "ui/gfx/size_conversions.h" |
| 30 #include "ui/gfx/skia_util.h" | 30 #include "ui/gfx/skia_util.h" |
| 31 #include "webkit/plugins/ppapi/common.h" | 31 #include "webkit/plugins/ppapi/common.h" |
| 32 #include "webkit/plugins/ppapi/gfx_conversion.h" | 32 #include "webkit/plugins/ppapi/gfx_conversion.h" |
| 33 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" | 33 #include "webkit/plugins/ppapi/ppapi_plugin_instance_impl.h" |
| 34 #include "webkit/plugins/ppapi/ppb_image_data_impl.h" | 34 #include "webkit/plugins/ppapi/ppb_image_data_impl.h" |
| 35 #include "webkit/plugins/ppapi/resource_helper.h" | 35 #include "webkit/plugins/ppapi/resource_helper.h" |
| 36 | 36 |
| 37 #if defined(OS_MACOSX) | 37 #if defined(OS_MACOSX) |
| 38 #include "base/mac/mac_util.h" | 38 #include "base/mac/mac_util.h" |
| 39 #include "base/mac/scoped_cftyperef.h" | 39 #include "base/mac/scoped_cftyperef.h" |
| 40 #endif | 40 #endif |
| 41 | 41 |
| 42 using ppapi::thunk::EnterResourceNoLock; | 42 using ppapi::thunk::EnterResourceNoLock; |
| 43 using ppapi::thunk::PPB_ImageData_API; | 43 using ppapi::thunk::PPB_ImageData_API; |
| (...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 289 // We want to replace the contents of the bitmap rather than blend. | 289 // We want to replace the contents of the bitmap rather than blend. |
| 290 SkPaint paint; | 290 SkPaint paint; |
| 291 paint.setXfermodeMode(SkXfermode::kSrc_Mode); | 291 paint.setXfermodeMode(SkXfermode::kSrc_Mode); |
| 292 dest_canvas->drawBitmapRect(*image_data_->GetMappedBitmap(), | 292 dest_canvas->drawBitmapRect(*image_data_->GetMappedBitmap(), |
| 293 &src_irect, dest_rect, &paint); | 293 &src_irect, dest_rect, &paint); |
| 294 } | 294 } |
| 295 return true; | 295 return true; |
| 296 } | 296 } |
| 297 | 297 |
| 298 bool PepperGraphics2DHost::BindToInstance( | 298 bool PepperGraphics2DHost::BindToInstance( |
| 299 webkit::ppapi::PluginInstance* new_instance) { | 299 webkit::ppapi::PluginInstanceImpl* new_instance) { |
| 300 if (new_instance && new_instance->pp_instance() != pp_instance()) | 300 if (new_instance && new_instance->pp_instance() != pp_instance()) |
| 301 return false; // Can't bind other instance's contexts. | 301 return false; // Can't bind other instance's contexts. |
| 302 if (bound_instance_ == new_instance) | 302 if (bound_instance_ == new_instance) |
| 303 return true; // Rebinding the same device, nothing to do. | 303 return true; // Rebinding the same device, nothing to do. |
| 304 if (bound_instance_ && new_instance) | 304 if (bound_instance_ && new_instance) |
| 305 return false; // Can't change a bound device. | 305 return false; // Can't change a bound device. |
| 306 | 306 |
| 307 if (!new_instance) { | 307 if (!new_instance) { |
| 308 // When the device is detached, we'll not get any more paint callbacks so | 308 // When the device is detached, we'll not get any more paint callbacks so |
| 309 // we need to clear the list, but we still want to issue any pending | 309 // we need to clear the list, but we still want to issue any pending |
| (...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 762 gfx::Point inverse_scaled_point = | 762 gfx::Point inverse_scaled_point = |
| 763 gfx::ToFlooredPoint(gfx::ScalePoint(*delta, inverse_scale)); | 763 gfx::ToFlooredPoint(gfx::ScalePoint(*delta, inverse_scale)); |
| 764 if (original_delta != inverse_scaled_point) | 764 if (original_delta != inverse_scaled_point) |
| 765 return false; | 765 return false; |
| 766 } | 766 } |
| 767 | 767 |
| 768 return true; | 768 return true; |
| 769 } | 769 } |
| 770 | 770 |
| 771 } // namespace content | 771 } // namespace content |
| OLD | NEW |