OLD | NEW |
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/quads/draw_quad.h" | 8 #include "cc/quads/draw_quad.h" |
9 #include "cc/quads/render_pass_draw_quad.h" | 9 #include "cc/quads/render_pass_draw_quad.h" |
10 #include "cc/quads/surface_draw_quad.h" | 10 #include "cc/quads/surface_draw_quad.h" |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 const RenderPass* SurfaceHittest::GetRenderPassForSurfaceById( | 253 const RenderPass* SurfaceHittest::GetRenderPassForSurfaceById( |
254 const SurfaceId& surface_id, | 254 const SurfaceId& surface_id, |
255 int render_pass_id) { | 255 int render_pass_id) { |
256 Surface* surface = manager_->GetSurfaceForId(surface_id); | 256 Surface* surface = manager_->GetSurfaceForId(surface_id); |
257 if (!surface) | 257 if (!surface) |
258 return nullptr; | 258 return nullptr; |
259 if (!surface->HasActiveFrame()) | 259 if (!surface->HasActiveFrame()) |
260 return nullptr; | 260 return nullptr; |
261 const CompositorFrame& surface_frame = surface->GetActiveFrame(); | 261 const CompositorFrame& surface_frame = surface->GetActiveFrame(); |
262 | 262 |
263 if (surface_frame.render_pass_list.empty()) | |
264 return nullptr; | |
265 | |
266 if (!render_pass_id) | 263 if (!render_pass_id) |
267 return surface_frame.render_pass_list.back().get(); | 264 return surface_frame.render_pass_list.back().get(); |
268 | 265 |
269 for (const auto& render_pass : surface_frame.render_pass_list) { | 266 for (const auto& render_pass : surface_frame.render_pass_list) { |
270 if (render_pass->id == render_pass_id) | 267 if (render_pass->id == render_pass_id) |
271 return render_pass.get(); | 268 return render_pass.get(); |
272 } | 269 } |
273 | 270 |
274 return nullptr; | 271 return nullptr; |
275 } | 272 } |
(...skipping 17 matching lines...) Expand all Loading... |
293 return false; | 290 return false; |
294 } | 291 } |
295 | 292 |
296 *point_in_quad_space = point_in_render_pass_space; | 293 *point_in_quad_space = point_in_render_pass_space; |
297 target_to_quad_transform->TransformPoint(point_in_quad_space); | 294 target_to_quad_transform->TransformPoint(point_in_quad_space); |
298 | 295 |
299 return quad->rect.Contains(*point_in_quad_space); | 296 return quad->rect.Contains(*point_in_quad_space); |
300 } | 297 } |
301 | 298 |
302 } // namespace cc | 299 } // namespace cc |
OLD | NEW |