| OLD | NEW |
| 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 Loading... |
| 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::Transform transform; |
| 233 gfx::Point transformed_point = point; |
| 235 cc::SurfaceHittest hittest(nullptr, GetSurfaceManager()); | 234 cc::SurfaceHittest hittest(nullptr, GetSurfaceManager()); |
| 236 if (hittest.GetTransformToTargetSurface(surface_id_, original_surface, | 235 if (hittest.GetTransformToTargetSurface(surface_id_, original_surface, |
| 237 &transform) && | 236 &transform) && |
| 238 transform.GetInverse(&transform)) { | 237 transform.GetInverse(&transform)) { |
| 239 transform.TransformPoint(transformed_point); | 238 transform.TransformPoint(&transformed_point); |
| 240 } | 239 } |
| 240 return transformed_point; |
| 241 } |
| 242 |
| 243 gfx::Point DelegatedFrameHost::TransformPointToCoordSpaceForView( |
| 244 const gfx::Point& point, |
| 245 RenderWidgetHostViewBase* target_view) { |
| 246 if (surface_id_.is_null()) |
| 247 return point; |
| 248 |
| 249 return target_view->TransformPointToLocalCoordSpace(point, surface_id_); |
| 241 } | 250 } |
| 242 | 251 |
| 243 bool DelegatedFrameHost::ShouldSkipFrame(gfx::Size size_in_dip) const { | 252 bool DelegatedFrameHost::ShouldSkipFrame(gfx::Size size_in_dip) const { |
| 244 // Should skip a frame only when another frame from the renderer is guaranteed | 253 // 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 | 254 // 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.) | 255 // the completion of latency infos (such as when taking a Snapshot.) |
| 247 if (can_lock_compositor_ == NO_PENDING_RENDERER_FRAME || | 256 if (can_lock_compositor_ == NO_PENDING_RENDERER_FRAME || |
| 248 can_lock_compositor_ == NO_PENDING_COMMIT || !resize_lock_.get()) | 257 can_lock_compositor_ == NO_PENDING_COMMIT || !resize_lock_.get()) |
| 249 return false; | 258 return false; |
| 250 | 259 |
| (...skipping 649 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 900 cc::SurfaceManager* manager = factory->GetSurfaceManager(); | 909 cc::SurfaceManager* manager = factory->GetSurfaceManager(); |
| 901 new_layer->SetShowSurface( | 910 new_layer->SetShowSurface( |
| 902 surface_id_, base::Bind(&SatisfyCallback, base::Unretained(manager)), | 911 surface_id_, base::Bind(&SatisfyCallback, base::Unretained(manager)), |
| 903 base::Bind(&RequireCallback, base::Unretained(manager)), | 912 base::Bind(&RequireCallback, base::Unretained(manager)), |
| 904 current_surface_size_, current_scale_factor_, | 913 current_surface_size_, current_scale_factor_, |
| 905 current_frame_size_in_dip_); | 914 current_frame_size_in_dip_); |
| 906 } | 915 } |
| 907 } | 916 } |
| 908 | 917 |
| 909 } // namespace content | 918 } // namespace content |
| OLD | NEW |