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

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: 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/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 999 matching lines...) Expand 10 before | Expand all | Expand 10 after
1010 return false; 1010 return false;
1011 1011
1012 gfx::Point plugin_origin = PP_ToGfxPoint(view_data_.rect.point); 1012 gfx::Point plugin_origin = PP_ToGfxPoint(view_data_.rect.point);
1013 // Convert |paint_bounds| to be relative to the left-top corner of the plugin. 1013 // Convert |paint_bounds| to be relative to the left-top corner of the plugin.
1014 gfx::Rect relative_paint_bounds(paint_bounds); 1014 gfx::Rect relative_paint_bounds(paint_bounds);
1015 relative_paint_bounds.Offset(-plugin_origin.x(), -plugin_origin.y()); 1015 relative_paint_bounds.Offset(-plugin_origin.x(), -plugin_origin.y());
1016 1016
1017 gfx::Rect pixel_plugin_backing_store_rect( 1017 gfx::Rect pixel_plugin_backing_store_rect(
1018 0, 0, image_data->width(), image_data->height()); 1018 0, 0, image_data->width(), image_data->height());
1019 float scale = GetBoundGraphics2D()->GetScale(); 1019 float scale = GetBoundGraphics2D()->GetScale();
1020 gfx::RectF scaled_backing_store_rect = pixel_plugin_backing_store_rect;
1021 scaled_backing_store_rect.Scale(scale);
1020 gfx::Rect plugin_backing_store_rect = 1022 gfx::Rect plugin_backing_store_rect =
1021 gfx::ToEnclosingRect(pixel_plugin_backing_store_rect.Scale(scale)); 1023 gfx::ToEnclosingRect(scaled_backing_store_rect);
1022 1024
1023 gfx::Rect clip_page = PP_ToGfxRect(view_data_.clip_rect); 1025 gfx::Rect clip_page = PP_ToGfxRect(view_data_.clip_rect);
1024 gfx::Rect plugin_paint_rect = plugin_backing_store_rect.Intersect(clip_page); 1026 gfx::Rect plugin_paint_rect = plugin_backing_store_rect;
1027 plugin_paint_rect.Intersect(clip_page);
1025 if (!plugin_paint_rect.Contains(relative_paint_bounds)) 1028 if (!plugin_paint_rect.Contains(relative_paint_bounds))
1026 return false; 1029 return false;
1027 1030
1028 // Don't do optimized painting if the area to paint intersects with the 1031 // Don't do optimized painting if the area to paint intersects with the
1029 // cut-out rects, otherwise we will paint over them. 1032 // cut-out rects, otherwise we will paint over them.
1030 for (std::vector<gfx::Rect>::const_iterator iter = cut_outs_rects_.begin(); 1033 for (std::vector<gfx::Rect>::const_iterator iter = cut_outs_rects_.begin();
1031 iter != cut_outs_rects_.end(); ++iter) { 1034 iter != cut_outs_rects_.end(); ++iter) {
1032 if (relative_paint_bounds.Intersects(*iter)) 1035 if (relative_paint_bounds.Intersects(*iter))
1033 return false; 1036 return false;
1034 } 1037 }
(...skipping 1679 matching lines...) Expand 10 before | Expand all | Expand 10 after
2714 screen_size_for_fullscreen_ = gfx::Size(); 2717 screen_size_for_fullscreen_ = gfx::Size();
2715 WebElement element = container_->element(); 2718 WebElement element = container_->element();
2716 element.setAttribute(WebString::fromUTF8(kWidth), width_before_fullscreen_); 2719 element.setAttribute(WebString::fromUTF8(kWidth), width_before_fullscreen_);
2717 element.setAttribute(WebString::fromUTF8(kHeight), height_before_fullscreen_); 2720 element.setAttribute(WebString::fromUTF8(kHeight), height_before_fullscreen_);
2718 element.setAttribute(WebString::fromUTF8(kBorder), border_before_fullscreen_); 2721 element.setAttribute(WebString::fromUTF8(kBorder), border_before_fullscreen_);
2719 element.setAttribute(WebString::fromUTF8(kStyle), style_before_fullscreen_); 2722 element.setAttribute(WebString::fromUTF8(kStyle), style_before_fullscreen_);
2720 } 2723 }
2721 2724
2722 } // namespace ppapi 2725 } // namespace ppapi
2723 } // namespace webkit 2726 } // namespace webkit
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698