OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/plugins/ppapi/ppb_graphics_2d_impl.h" | 5 #include "webkit/plugins/ppapi/ppb_graphics_2d_impl.h" |
6 | 6 |
7 #include <iterator> | 7 #include <iterator> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
11 #include "base/message_loop.h" | 11 #include "base/message_loop.h" |
12 #include "base/task.h" | 12 #include "base/task.h" |
13 #include "skia/ext/platform_canvas.h" | 13 #include "skia/ext/platform_canvas.h" |
14 #include "ppapi/c/pp_errors.h" | 14 #include "ppapi/c/pp_errors.h" |
15 #include "ppapi/c/pp_rect.h" | 15 #include "ppapi/c/pp_rect.h" |
16 #include "ppapi/c/pp_resource.h" | 16 #include "ppapi/c/pp_resource.h" |
17 #include "ppapi/c/ppb_graphics_2d.h" | 17 #include "ppapi/c/ppb_graphics_2d.h" |
18 #include "ppapi/thunk/enter.h" | 18 #include "ppapi/thunk/enter.h" |
19 #include "ppapi/thunk/thunk.h" | 19 #include "ppapi/thunk/thunk.h" |
20 #include "third_party/skia/include/core/SkBitmap.h" | 20 #include "third_party/skia/include/core/SkBitmap.h" |
21 #include "ui/gfx/blit.h" | 21 #include "ui/gfx/blit.h" |
22 #include "ui/gfx/point.h" | 22 #include "ui/gfx/point.h" |
23 #include "ui/gfx/rect.h" | 23 #include "ui/gfx/rect.h" |
24 #include "webkit/plugins/ppapi/common.h" | 24 #include "webkit/plugins/ppapi/common.h" |
| 25 #include "webkit/plugins/ppapi/gfx_conversion.h" |
25 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" | 26 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" |
26 #include "webkit/plugins/ppapi/ppb_image_data_impl.h" | 27 #include "webkit/plugins/ppapi/ppb_image_data_impl.h" |
27 #include "webkit/plugins/ppapi/resource_helper.h" | 28 #include "webkit/plugins/ppapi/resource_helper.h" |
28 | 29 |
29 #if defined(OS_MACOSX) | 30 #if defined(OS_MACOSX) |
30 #include "base/mac/mac_util.h" | 31 #include "base/mac/mac_util.h" |
31 #include "base/mac/scoped_cftyperef.h" | 32 #include "base/mac/scoped_cftyperef.h" |
32 #endif | 33 #endif |
33 | 34 |
34 using ppapi::thunk::EnterResourceNoLock; | 35 using ppapi::thunk::EnterResourceNoLock; |
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
323 ExecuteReplaceContents(operation.replace_image, &op_rect); | 324 ExecuteReplaceContents(operation.replace_image, &op_rect); |
324 break; | 325 break; |
325 } | 326 } |
326 | 327 |
327 // We need the rect to be in terms of the current clip rect of the plugin | 328 // We need the rect to be in terms of the current clip rect of the plugin |
328 // since that's what will actually be painted. If we issue an invalidate | 329 // since that's what will actually be painted. If we issue an invalidate |
329 // for a clipped-out region, WebKit will do nothing and we won't get any | 330 // for a clipped-out region, WebKit will do nothing and we won't get any |
330 // ViewInitiatedPaint/ViewFlushedPaint calls, leaving our callback stranded. | 331 // ViewInitiatedPaint/ViewFlushedPaint calls, leaving our callback stranded. |
331 gfx::Rect visible_changed_rect; | 332 gfx::Rect visible_changed_rect; |
332 if (bound_instance_ && !op_rect.IsEmpty()) | 333 if (bound_instance_ && !op_rect.IsEmpty()) |
333 visible_changed_rect = bound_instance_->clip().Intersect(op_rect); | 334 visible_changed_rect =PP_ToGfxRect(bound_instance_->view_data().clip_rect)
. |
| 335 Intersect(op_rect); |
334 | 336 |
335 if (bound_instance_ && !visible_changed_rect.IsEmpty()) { | 337 if (bound_instance_ && !visible_changed_rect.IsEmpty()) { |
336 if (operation.type == QueuedOperation::SCROLL) { | 338 if (operation.type == QueuedOperation::SCROLL) { |
337 bound_instance_->ScrollRect(operation.scroll_dx, operation.scroll_dy, | 339 bound_instance_->ScrollRect(operation.scroll_dx, operation.scroll_dy, |
338 visible_changed_rect); | 340 visible_changed_rect); |
339 } else { | 341 } else { |
340 bound_instance_->InvalidateRect(visible_changed_rect); | 342 bound_instance_->InvalidateRect(visible_changed_rect); |
341 } | 343 } |
342 nothing_visible = false; | 344 nothing_visible = false; |
343 } | 345 } |
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
643 } | 645 } |
644 | 646 |
645 bool PPB_Graphics2D_Impl::HasPendingFlush() const { | 647 bool PPB_Graphics2D_Impl::HasPendingFlush() const { |
646 return !unpainted_flush_callback_.is_null() || | 648 return !unpainted_flush_callback_.is_null() || |
647 !painted_flush_callback_.is_null() || | 649 !painted_flush_callback_.is_null() || |
648 offscreen_flush_pending_; | 650 offscreen_flush_pending_; |
649 } | 651 } |
650 | 652 |
651 } // namespace ppapi | 653 } // namespace ppapi |
652 } // namespace webkit | 654 } // namespace webkit |
OLD | NEW |