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

Side by Side Diff: cc/surfaces/surface_hittest.cc

Issue 2503203002: Revert "Getting rid of DelegatedFrameData" (Closed)
Patch Set: Created 4 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
« no previous file with comments | « cc/surfaces/surface_factory_unittest.cc ('k') | cc/surfaces/surface_hittest_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "cc/surfaces/surface_hittest.h" 5 #include "cc/surfaces/surface_hittest.h"
6 6
7 #include "cc/output/compositor_frame.h" 7 #include "cc/output/compositor_frame.h"
8 #include "cc/output/delegated_frame_data.h"
8 #include "cc/quads/draw_quad.h" 9 #include "cc/quads/draw_quad.h"
9 #include "cc/quads/render_pass_draw_quad.h" 10 #include "cc/quads/render_pass_draw_quad.h"
10 #include "cc/quads/surface_draw_quad.h" 11 #include "cc/quads/surface_draw_quad.h"
11 #include "cc/surfaces/surface.h" 12 #include "cc/surfaces/surface.h"
12 #include "cc/surfaces/surface_hittest_delegate.h" 13 #include "cc/surfaces/surface_hittest_delegate.h"
13 #include "cc/surfaces/surface_manager.h" 14 #include "cc/surfaces/surface_manager.h"
14 #include "ui/gfx/geometry/point.h" 15 #include "ui/gfx/geometry/point.h"
15 #include "ui/gfx/transform.h" 16 #include "ui/gfx/transform.h"
16 17
17 namespace cc { 18 namespace cc {
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 // The target surface was not found. 252 // The target surface was not found.
252 return false; 253 return false;
253 } 254 }
254 255
255 const RenderPass* SurfaceHittest::GetRenderPassForSurfaceById( 256 const RenderPass* SurfaceHittest::GetRenderPassForSurfaceById(
256 const SurfaceId& surface_id, 257 const SurfaceId& surface_id,
257 const RenderPassId& render_pass_id) { 258 const RenderPassId& render_pass_id) {
258 Surface* surface = manager_->GetSurfaceForId(surface_id); 259 Surface* surface = manager_->GetSurfaceForId(surface_id);
259 if (!surface) 260 if (!surface)
260 return nullptr; 261 return nullptr;
261 if (!surface->HasFrame()) 262
263 const CompositorFrame& surface_frame = surface->GetEligibleFrame();
264 if (!surface_frame.delegated_frame_data)
262 return nullptr; 265 return nullptr;
263 const CompositorFrame& surface_frame = surface->GetEligibleFrame();
264 266
265 if (surface_frame.render_pass_list.empty()) 267 const DelegatedFrameData* frame_data =
268 surface_frame.delegated_frame_data.get();
269 if (frame_data->render_pass_list.empty())
266 return nullptr; 270 return nullptr;
267 271
268 if (!render_pass_id.IsValid()) 272 if (!render_pass_id.IsValid())
269 return surface_frame.render_pass_list.back().get(); 273 return frame_data->render_pass_list.back().get();
270 274
271 for (const auto& render_pass : surface_frame.render_pass_list) { 275 for (const auto& render_pass : frame_data->render_pass_list) {
272 if (render_pass->id == render_pass_id) 276 if (render_pass->id == render_pass_id)
273 return render_pass.get(); 277 return render_pass.get();
274 } 278 }
275 279
276 return nullptr; 280 return nullptr;
277 } 281 }
278 282
279 bool SurfaceHittest::PointInQuad(const DrawQuad* quad, 283 bool SurfaceHittest::PointInQuad(const DrawQuad* quad,
280 const gfx::Point& point_in_render_pass_space, 284 const gfx::Point& point_in_render_pass_space,
281 gfx::Transform* target_to_quad_transform, 285 gfx::Transform* target_to_quad_transform,
(...skipping 13 matching lines...) Expand all
295 return false; 299 return false;
296 } 300 }
297 301
298 *point_in_quad_space = point_in_render_pass_space; 302 *point_in_quad_space = point_in_render_pass_space;
299 target_to_quad_transform->TransformPoint(point_in_quad_space); 303 target_to_quad_transform->TransformPoint(point_in_quad_space);
300 304
301 return quad->rect.Contains(*point_in_quad_space); 305 return quad->rect.Contains(*point_in_quad_space);
302 } 306 }
303 307
304 } // namespace cc 308 } // namespace cc
OLDNEW
« no previous file with comments | « cc/surfaces/surface_factory_unittest.cc ('k') | cc/surfaces/surface_hittest_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698