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/output/delegated_frame_data.h" | 8 #include "cc/output/delegated_frame_data.h" |
9 #include "cc/quads/draw_quad.h" | 9 #include "cc/quads/draw_quad.h" |
10 #include "cc/quads/render_pass_draw_quad.h" | 10 #include "cc/quads/render_pass_draw_quad.h" |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
224 const CompositorFrame* surface_frame = surface->GetEligibleFrame(); | 224 const CompositorFrame* surface_frame = surface->GetEligibleFrame(); |
225 if (!surface_frame) | 225 if (!surface_frame) |
226 return nullptr; | 226 return nullptr; |
227 | 227 |
228 const DelegatedFrameData* frame_data = | 228 const DelegatedFrameData* frame_data = |
229 surface_frame->delegated_frame_data.get(); | 229 surface_frame->delegated_frame_data.get(); |
230 if (frame_data->render_pass_list.empty()) | 230 if (frame_data->render_pass_list.empty()) |
231 return nullptr; | 231 return nullptr; |
232 | 232 |
233 if (!render_pass_id.IsValid()) | 233 if (!render_pass_id.IsValid()) |
234 return frame_data->render_pass_list.back(); | 234 return frame_data->render_pass_list.back().get(); |
235 | 235 |
236 for (const auto* render_pass : frame_data->render_pass_list) { | 236 for (const auto& render_pass : frame_data->render_pass_list) { |
237 if (render_pass->id == render_pass_id) | 237 if (render_pass->id == render_pass_id) |
238 return render_pass; | 238 return render_pass.get(); |
239 } | 239 } |
240 | 240 |
241 return nullptr; | 241 return nullptr; |
242 } | 242 } |
243 | 243 |
244 bool SurfaceHittest::PointInQuad(const DrawQuad* quad, | 244 bool SurfaceHittest::PointInQuad(const DrawQuad* quad, |
245 const gfx::Point& point_in_render_pass_space, | 245 const gfx::Point& point_in_render_pass_space, |
246 gfx::Transform* target_to_quad_transform, | 246 gfx::Transform* target_to_quad_transform, |
247 gfx::Point* point_in_quad_space) { | 247 gfx::Point* point_in_quad_space) { |
248 // First we test against the clip_rect. The clip_rect is in target space, so | 248 // First we test against the clip_rect. The clip_rect is in target space, so |
(...skipping 11 matching lines...) Expand all Loading... |
260 return false; | 260 return false; |
261 } | 261 } |
262 | 262 |
263 *point_in_quad_space = point_in_render_pass_space; | 263 *point_in_quad_space = point_in_render_pass_space; |
264 target_to_quad_transform->TransformPoint(point_in_quad_space); | 264 target_to_quad_transform->TransformPoint(point_in_quad_space); |
265 | 265 |
266 return quad->rect.Contains(*point_in_quad_space); | 266 return quad->rect.Contains(*point_in_quad_space); |
267 } | 267 } |
268 | 268 |
269 } // namespace cc | 269 } // namespace cc |
OLD | NEW |