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

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

Issue 11270042: Add non-member non-mutating methods for common gfx::Rect operations. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 1 month 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 | Annotate | Revision Log
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 1139 matching lines...) Expand 10 before | Expand all | Expand 10 after
1150 return false; 1150 return false;
1151 1151
1152 gfx::Point plugin_origin = PP_ToGfxPoint(view_data_.rect.point); 1152 gfx::Point plugin_origin = PP_ToGfxPoint(view_data_.rect.point);
1153 // Convert |paint_bounds| to be relative to the left-top corner of the plugin. 1153 // Convert |paint_bounds| to be relative to the left-top corner of the plugin.
1154 gfx::Rect relative_paint_bounds(paint_bounds); 1154 gfx::Rect relative_paint_bounds(paint_bounds);
1155 relative_paint_bounds.Offset(-plugin_origin.x(), -plugin_origin.y()); 1155 relative_paint_bounds.Offset(-plugin_origin.x(), -plugin_origin.y());
1156 1156
1157 gfx::Rect pixel_plugin_backing_store_rect( 1157 gfx::Rect pixel_plugin_backing_store_rect(
1158 0, 0, image_data->width(), image_data->height()); 1158 0, 0, image_data->width(), image_data->height());
1159 float scale = GetBoundGraphics2D()->GetScale(); 1159 float scale = GetBoundGraphics2D()->GetScale();
1160 gfx::RectF scaled_backing_store_rect = pixel_plugin_backing_store_rect; 1160 gfx::Rect plugin_backing_store_rect = gfx::ToEnclosedRect(
1161 scaled_backing_store_rect.Scale(scale); 1161 gfx::Scale(pixel_plugin_backing_store_rect, scale));
1162 gfx::Rect plugin_backing_store_rect =
1163 gfx::ToEnclosedRect(scaled_backing_store_rect);
1164 1162
1165 gfx::Rect clip_page = PP_ToGfxRect(view_data_.clip_rect); 1163 gfx::Rect clip_page = PP_ToGfxRect(view_data_.clip_rect);
1166 gfx::Rect plugin_paint_rect = plugin_backing_store_rect; 1164 gfx::Rect plugin_paint_rect =
1167 plugin_paint_rect.Intersect(clip_page); 1165 gfx::Intersection(plugin_backing_store_rect, clip_page);
1168 if (!plugin_paint_rect.Contains(relative_paint_bounds)) 1166 if (!plugin_paint_rect.Contains(relative_paint_bounds))
1169 return false; 1167 return false;
1170 1168
1171 // Don't do optimized painting if the area to paint intersects with the 1169 // Don't do optimized painting if the area to paint intersects with the
1172 // cut-out rects, otherwise we will paint over them. 1170 // cut-out rects, otherwise we will paint over them.
1173 for (std::vector<gfx::Rect>::const_iterator iter = cut_outs_rects_.begin(); 1171 for (std::vector<gfx::Rect>::const_iterator iter = cut_outs_rects_.begin();
1174 iter != cut_outs_rects_.end(); ++iter) { 1172 iter != cut_outs_rects_.end(); ++iter) {
1175 if (relative_paint_bounds.Intersects(*iter)) 1173 if (relative_paint_bounds.Intersects(*iter))
1176 return false; 1174 return false;
1177 } 1175 }
(...skipping 2031 matching lines...) Expand 10 before | Expand all | Expand 10 after
3209 screen_size_for_fullscreen_ = gfx::Size(); 3207 screen_size_for_fullscreen_ = gfx::Size();
3210 WebElement element = container_->element(); 3208 WebElement element = container_->element();
3211 element.setAttribute(WebString::fromUTF8(kWidth), width_before_fullscreen_); 3209 element.setAttribute(WebString::fromUTF8(kWidth), width_before_fullscreen_);
3212 element.setAttribute(WebString::fromUTF8(kHeight), height_before_fullscreen_); 3210 element.setAttribute(WebString::fromUTF8(kHeight), height_before_fullscreen_);
3213 element.setAttribute(WebString::fromUTF8(kBorder), border_before_fullscreen_); 3211 element.setAttribute(WebString::fromUTF8(kBorder), border_before_fullscreen_);
3214 element.setAttribute(WebString::fromUTF8(kStyle), style_before_fullscreen_); 3212 element.setAttribute(WebString::fromUTF8(kStyle), style_before_fullscreen_);
3215 } 3213 }
3216 3214
3217 } // namespace ppapi 3215 } // namespace ppapi
3218 } // namespace webkit 3216 } // namespace webkit
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698