[refactor] More post-NSS WebCrypto cleanups (utility functions).
[chromium-blink-merge.git] / cc / surfaces / surface_hittest.h
blob094d401619fc5b1dae87a63acba5d082fdcc3127
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
3 // found in the LICENSE file.
5 #ifndef CC_SURFACES_SURFACE_HITTEST_H_
6 #define CC_SURFACES_SURFACE_HITTEST_H_
8 #include <set>
10 #include "cc/surfaces/surface_id.h"
11 #include "cc/surfaces/surfaces_export.h"
13 namespace gfx {
14 class Point;
15 class Transform;
18 namespace cc {
19 class DrawQuad;
20 class QuadList;
21 class RenderPass;
22 class RenderPassId;
23 class SurfaceManager;
25 // Performs a hittest in surface quads.
26 class CC_SURFACES_EXPORT SurfaceHittest {
27 public:
28 explicit SurfaceHittest(SurfaceManager* manager);
29 ~SurfaceHittest();
31 // Hittests against Surface with SurfaceId |surface_id|, return the contained
32 // surface that the point is hitting and the |transformed_point| in the
33 // surface space.
34 SurfaceId GetTargetSurfaceAtPoint(SurfaceId surface_id,
35 const gfx::Point& point,
36 gfx::Point* transformed_point);
38 private:
39 bool GetTargetSurfaceAtPointInternal(
40 SurfaceId surface_id,
41 const RenderPassId& render_pass_id,
42 const gfx::Point& point_in_root_target,
43 std::set<const RenderPass*>* referenced_passes,
44 SurfaceId* out_surface_id,
45 gfx::Point* out_transformed_point);
47 const RenderPass* GetRenderPassForSurfaceById(
48 SurfaceId surface_id,
49 const RenderPassId& render_pass_id);
51 bool PointInQuad(const DrawQuad* quad,
52 const gfx::Point& point_in_render_pass_space,
53 gfx::Point* point_in_quad_space);
55 SurfaceManager* const manager_;
57 } // namespace cc
59 #endif // CC_SURFACES_SURFACE_HITTEST_H_