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

Side by Side Diff: content/browser/renderer_host/delegated_frame_host.cc

Issue 2184033003: Refactor browser process coordinate transformation methods (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removed problematic DCHECK Created 4 years, 4 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "content/browser/renderer_host/delegated_frame_host.h" 5 #include "content/browser/renderer_host/delegated_frame_host.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 cc::SurfaceHittest hittest(delegate, GetSurfaceManager()); 216 cc::SurfaceHittest hittest(delegate, GetSurfaceManager());
217 gfx::Transform target_transform; 217 gfx::Transform target_transform;
218 cc::SurfaceId target_surface_id = 218 cc::SurfaceId target_surface_id =
219 hittest.GetTargetSurfaceAtPoint(surface_id_, point, &target_transform); 219 hittest.GetTargetSurfaceAtPoint(surface_id_, point, &target_transform);
220 *transformed_point = point; 220 *transformed_point = point;
221 if (!target_surface_id.is_null()) 221 if (!target_surface_id.is_null())
222 target_transform.TransformPoint(transformed_point); 222 target_transform.TransformPoint(transformed_point);
223 return target_surface_id; 223 return target_surface_id;
224 } 224 }
225 225
226 void DelegatedFrameHost::TransformPointToLocalCoordSpace( 226 gfx::Point DelegatedFrameHost::TransformPointToLocalCoordSpace(
227 const gfx::Point& point, 227 const gfx::Point& point,
228 const cc::SurfaceId& original_surface, 228 const cc::SurfaceId& original_surface) {
229 gfx::Point* transformed_point) {
230 *transformed_point = point;
231 if (surface_id_.is_null() || original_surface == surface_id_) 229 if (surface_id_.is_null() || original_surface == surface_id_)
232 return; 230 return point;
233 231
234 gfx::Transform transform; 232 gfx::Point transformed_point = point;
235 cc::SurfaceHittest hittest(nullptr, GetSurfaceManager()); 233 cc::SurfaceHittest hittest(nullptr, GetSurfaceManager());
236 if (hittest.GetTransformToTargetSurface(surface_id_, original_surface, 234 hittest.TransformPointToTargetSurface(original_surface, surface_id_,
237 &transform) && 235 &transformed_point);
238 transform.GetInverse(&transform)) { 236 return transformed_point;
239 transform.TransformPoint(transformed_point); 237 }
240 } 238
239 gfx::Point DelegatedFrameHost::TransformPointToCoordSpaceForView(
240 const gfx::Point& point,
241 RenderWidgetHostViewBase* target_view) {
242 if (surface_id_.is_null())
243 return point;
244
245 return target_view->TransformPointToLocalCoordSpace(point, surface_id_);
241 } 246 }
242 247
243 bool DelegatedFrameHost::ShouldSkipFrame(gfx::Size size_in_dip) const { 248 bool DelegatedFrameHost::ShouldSkipFrame(gfx::Size size_in_dip) const {
244 // Should skip a frame only when another frame from the renderer is guaranteed 249 // Should skip a frame only when another frame from the renderer is guaranteed
245 // to replace it. Otherwise may cause hangs when the renderer is waiting for 250 // to replace it. Otherwise may cause hangs when the renderer is waiting for
246 // the completion of latency infos (such as when taking a Snapshot.) 251 // the completion of latency infos (such as when taking a Snapshot.)
247 if (can_lock_compositor_ == NO_PENDING_RENDERER_FRAME || 252 if (can_lock_compositor_ == NO_PENDING_RENDERER_FRAME ||
248 can_lock_compositor_ == NO_PENDING_COMMIT || !resize_lock_.get()) 253 can_lock_compositor_ == NO_PENDING_COMMIT || !resize_lock_.get())
249 return false; 254 return false;
250 255
(...skipping 649 matching lines...) Expand 10 before | Expand all | Expand 10 after
900 cc::SurfaceManager* manager = factory->GetSurfaceManager(); 905 cc::SurfaceManager* manager = factory->GetSurfaceManager();
901 new_layer->SetShowSurface( 906 new_layer->SetShowSurface(
902 surface_id_, base::Bind(&SatisfyCallback, base::Unretained(manager)), 907 surface_id_, base::Bind(&SatisfyCallback, base::Unretained(manager)),
903 base::Bind(&RequireCallback, base::Unretained(manager)), 908 base::Bind(&RequireCallback, base::Unretained(manager)),
904 current_surface_size_, current_scale_factor_, 909 current_surface_size_, current_scale_factor_,
905 current_frame_size_in_dip_); 910 current_frame_size_in_dip_);
906 } 911 }
907 } 912 }
908 913
909 } // namespace content 914 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/delegated_frame_host.h ('k') | content/browser/renderer_host/render_widget_host_view_aura.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698