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 "webkit/plugins/ppapi/ppapi_plugin_instance.h" | 5 #include "webkit/plugins/ppapi/ppapi_plugin_instance.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/memory/linked_ptr.h" | 10 #include "base/memory/linked_ptr.h" |
(...skipping 1029 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1040 | 1040 |
1041 gfx::Point plugin_origin = PP_ToGfxPoint(view_data_.rect.point); | 1041 gfx::Point plugin_origin = PP_ToGfxPoint(view_data_.rect.point); |
1042 // Convert |paint_bounds| to be relative to the left-top corner of the plugin. | 1042 // Convert |paint_bounds| to be relative to the left-top corner of the plugin. |
1043 gfx::Rect relative_paint_bounds(paint_bounds); | 1043 gfx::Rect relative_paint_bounds(paint_bounds); |
1044 relative_paint_bounds.Offset(-plugin_origin.x(), -plugin_origin.y()); | 1044 relative_paint_bounds.Offset(-plugin_origin.x(), -plugin_origin.y()); |
1045 | 1045 |
1046 gfx::Rect pixel_plugin_backing_store_rect( | 1046 gfx::Rect pixel_plugin_backing_store_rect( |
1047 0, 0, image_data->width(), image_data->height()); | 1047 0, 0, image_data->width(), image_data->height()); |
1048 float scale = GetBoundGraphics2D()->GetScale(); | 1048 float scale = GetBoundGraphics2D()->GetScale(); |
1049 gfx::Rect plugin_backing_store_rect = | 1049 gfx::Rect plugin_backing_store_rect = |
1050 gfx::ToEnclosingRect(pixel_plugin_backing_store_rect.Scale(scale)); | 1050 gfx::ToEnclosedRect(pixel_plugin_backing_store_rect.Scale(scale)); |
1051 | 1051 |
1052 gfx::Rect clip_page = PP_ToGfxRect(view_data_.clip_rect); | 1052 gfx::Rect clip_page = PP_ToGfxRect(view_data_.clip_rect); |
1053 gfx::Rect plugin_paint_rect = plugin_backing_store_rect.Intersect(clip_page); | 1053 gfx::Rect plugin_paint_rect = plugin_backing_store_rect.Intersect(clip_page); |
1054 if (!plugin_paint_rect.Contains(relative_paint_bounds)) | 1054 if (!plugin_paint_rect.Contains(relative_paint_bounds)) |
1055 return false; | 1055 return false; |
1056 | 1056 |
1057 // Don't do optimized painting if the area to paint intersects with the | 1057 // Don't do optimized painting if the area to paint intersects with the |
1058 // cut-out rects, otherwise we will paint over them. | 1058 // cut-out rects, otherwise we will paint over them. |
1059 for (std::vector<gfx::Rect>::const_iterator iter = cut_outs_rects_.begin(); | 1059 for (std::vector<gfx::Rect>::const_iterator iter = cut_outs_rects_.begin(); |
1060 iter != cut_outs_rects_.end(); ++iter) { | 1060 iter != cut_outs_rects_.end(); ++iter) { |
(...skipping 1770 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2831 screen_size_for_fullscreen_ = gfx::Size(); | 2831 screen_size_for_fullscreen_ = gfx::Size(); |
2832 WebElement element = container_->element(); | 2832 WebElement element = container_->element(); |
2833 element.setAttribute(WebString::fromUTF8(kWidth), width_before_fullscreen_); | 2833 element.setAttribute(WebString::fromUTF8(kWidth), width_before_fullscreen_); |
2834 element.setAttribute(WebString::fromUTF8(kHeight), height_before_fullscreen_); | 2834 element.setAttribute(WebString::fromUTF8(kHeight), height_before_fullscreen_); |
2835 element.setAttribute(WebString::fromUTF8(kBorder), border_before_fullscreen_); | 2835 element.setAttribute(WebString::fromUTF8(kBorder), border_before_fullscreen_); |
2836 element.setAttribute(WebString::fromUTF8(kStyle), style_before_fullscreen_); | 2836 element.setAttribute(WebString::fromUTF8(kStyle), style_before_fullscreen_); |
2837 } | 2837 } |
2838 | 2838 |
2839 } // namespace ppapi | 2839 } // namespace ppapi |
2840 } // namespace webkit | 2840 } // namespace webkit |
OLD | NEW |