Revert "Fix broken channel icon in chrome://help on CrOS" and try again
[chromium-blink-merge.git] / cc / output / overlay_strategy_common.h
blob6d8c40559eb6afed356c8430ec9d0c73040fb75b
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_OUTPUT_OVERLAY_STRATEGY_COMMON_H_
6 #define CC_OUTPUT_OVERLAY_STRATEGY_COMMON_H_
8 #include "cc/base/cc_export.h"
9 #include "cc/output/overlay_candidate.h"
10 #include "cc/output/overlay_processor.h"
12 namespace cc {
13 class IOSurfaceDrawQuad;
14 class OverlayCandidate;
15 class OverlayCandidateValidator;
16 class StreamVideoDrawQuad;
17 class TextureDrawQuad;
19 class CC_EXPORT OverlayStrategyCommonDelegate {
20 public:
21 virtual ~OverlayStrategyCommonDelegate() {}
22 virtual bool TryOverlay(OverlayCandidateValidator* capability_checker,
23 RenderPassList* render_passes_in_draw_order,
24 OverlayCandidateList* candidate_list,
25 const OverlayCandidate& candidate,
26 QuadList::Iterator iter,
27 float device_scale_factor) = 0;
30 class CC_EXPORT OverlayStrategyCommon : public OverlayProcessor::Strategy {
31 public:
32 explicit OverlayStrategyCommon(OverlayCandidateValidator* capability_checker,
33 OverlayStrategyCommonDelegate* delegate);
34 ~OverlayStrategyCommon() override;
36 bool Attempt(RenderPassList* render_passes_in_draw_order,
37 OverlayCandidateList* candidate_list,
38 float device_scale_factor) override;
40 // Returns true if |draw_quad| will not block quads underneath from becoming
41 // an overlay.
42 static bool IsInvisibleQuad(const DrawQuad* draw_quad);
44 protected:
45 bool GetCandidateQuadInfo(const DrawQuad& draw_quad,
46 OverlayCandidate* quad_info);
48 // Returns true if |draw_quad| is of a known quad type and contains an
49 // overlayable resource.
50 bool IsOverlayQuad(const DrawQuad* draw_quad);
52 bool GetTextureQuadInfo(const TextureDrawQuad& quad,
53 OverlayCandidate* quad_info);
54 bool GetVideoQuadInfo(const StreamVideoDrawQuad& quad,
55 OverlayCandidate* quad_info);
56 bool GetIOSurfaceQuadInfo(const IOSurfaceDrawQuad& quad,
57 OverlayCandidate* quad_info);
59 private:
60 OverlayCandidateValidator* capability_checker_;
61 scoped_ptr<OverlayStrategyCommonDelegate> delegate_;
63 DISALLOW_COPY_AND_ASSIGN(OverlayStrategyCommon);
65 } // namespace cc
67 #endif // CC_OUTPUT_OVERLAY_STRATEGY_COMMON_H_