Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(295)

Side by Side Diff: webkit/plugins/ppapi/ppapi_plugin_instance.cc

Issue 11110004: Make gfx::Rect class operations consistently mutate the class they are called on. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: cc/ fixes Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/callback_helpers.h" 8 #include "base/callback_helpers.h"
9 #include "base/debug/trace_event.h" 9 #include "base/debug/trace_event.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 1047 matching lines...) Expand 10 before | Expand all | Expand 10 after
1058 return false; 1058 return false;
1059 1059
1060 gfx::Point plugin_origin = PP_ToGfxPoint(view_data_.rect.point); 1060 gfx::Point plugin_origin = PP_ToGfxPoint(view_data_.rect.point);
1061 // Convert |paint_bounds| to be relative to the left-top corner of the plugin. 1061 // Convert |paint_bounds| to be relative to the left-top corner of the plugin.
1062 gfx::Rect relative_paint_bounds(paint_bounds); 1062 gfx::Rect relative_paint_bounds(paint_bounds);
1063 relative_paint_bounds.Offset(-plugin_origin.x(), -plugin_origin.y()); 1063 relative_paint_bounds.Offset(-plugin_origin.x(), -plugin_origin.y());
1064 1064
1065 gfx::Rect pixel_plugin_backing_store_rect( 1065 gfx::Rect pixel_plugin_backing_store_rect(
1066 0, 0, image_data->width(), image_data->height()); 1066 0, 0, image_data->width(), image_data->height());
1067 float scale = GetBoundGraphics2D()->GetScale(); 1067 float scale = GetBoundGraphics2D()->GetScale();
1068 gfx::RectF scaled_backing_store_rect = pixel_plugin_backing_store_rect;
1069 scaled_backing_store_rect.Scale(scale);
1068 gfx::Rect plugin_backing_store_rect = 1070 gfx::Rect plugin_backing_store_rect =
1069 gfx::ToEnclosedRect(pixel_plugin_backing_store_rect.Scale(scale)); 1071 gfx::ToEnclosedRect(scaled_backing_store_rect);
1070 1072
1071 gfx::Rect clip_page = PP_ToGfxRect(view_data_.clip_rect); 1073 gfx::Rect clip_page = PP_ToGfxRect(view_data_.clip_rect);
1072 gfx::Rect plugin_paint_rect = plugin_backing_store_rect.Intersect(clip_page); 1074 gfx::Rect plugin_paint_rect = plugin_backing_store_rect;
1075 plugin_paint_rect.Intersect(clip_page);
1073 if (!plugin_paint_rect.Contains(relative_paint_bounds)) 1076 if (!plugin_paint_rect.Contains(relative_paint_bounds))
1074 return false; 1077 return false;
1075 1078
1076 // Don't do optimized painting if the area to paint intersects with the 1079 // Don't do optimized painting if the area to paint intersects with the
1077 // cut-out rects, otherwise we will paint over them. 1080 // cut-out rects, otherwise we will paint over them.
1078 for (std::vector<gfx::Rect>::const_iterator iter = cut_outs_rects_.begin(); 1081 for (std::vector<gfx::Rect>::const_iterator iter = cut_outs_rects_.begin();
1079 iter != cut_outs_rects_.end(); ++iter) { 1082 iter != cut_outs_rects_.end(); ++iter) {
1080 if (relative_paint_bounds.Intersects(*iter)) 1083 if (relative_paint_bounds.Intersects(*iter))
1081 return false; 1084 return false;
1082 } 1085 }
(...skipping 1888 matching lines...) Expand 10 before | Expand all | Expand 10 after
2971 screen_size_for_fullscreen_ = gfx::Size(); 2974 screen_size_for_fullscreen_ = gfx::Size();
2972 WebElement element = container_->element(); 2975 WebElement element = container_->element();
2973 element.setAttribute(WebString::fromUTF8(kWidth), width_before_fullscreen_); 2976 element.setAttribute(WebString::fromUTF8(kWidth), width_before_fullscreen_);
2974 element.setAttribute(WebString::fromUTF8(kHeight), height_before_fullscreen_); 2977 element.setAttribute(WebString::fromUTF8(kHeight), height_before_fullscreen_);
2975 element.setAttribute(WebString::fromUTF8(kBorder), border_before_fullscreen_); 2978 element.setAttribute(WebString::fromUTF8(kBorder), border_before_fullscreen_);
2976 element.setAttribute(WebString::fromUTF8(kStyle), style_before_fullscreen_); 2979 element.setAttribute(WebString::fromUTF8(kStyle), style_before_fullscreen_);
2977 } 2980 }
2978 2981
2979 } // namespace ppapi 2982 } // namespace ppapi
2980 } // namespace webkit 2983 } // namespace webkit
OLDNEW
« no previous file with comments | « webkit/plugins/npapi/webplugin_delegate_impl_mac.mm ('k') | webkit/plugins/ppapi/ppb_graphics_2d_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698