summaryrefslogtreecommitdiffstats
path: root/cc/output/overlay_strategy_common.h
blob: 515a106e78201199660a22f3ac40fd04dc80027c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CC_OUTPUT_OVERLAY_STRATEGY_COMMON_H_
#define CC_OUTPUT_OVERLAY_STRATEGY_COMMON_H_

#include "cc/base/cc_export.h"
#include "cc/output/overlay_candidate.h"
#include "cc/output/overlay_processor.h"

namespace cc {
class OverlayCandidateValidator;
class StreamVideoDrawQuad;
class TextureDrawQuad;
class OverlayCandidate;

class CC_EXPORT OverlayStrategyCommon : public OverlayProcessor::Strategy {
 public:
  OverlayStrategyCommon(OverlayCandidateValidator* capability_checker,
                        ResourceProvider* resource_provider);
  ~OverlayStrategyCommon() override;

 protected:
  bool GetCandidateQuadInfo(const DrawQuad& draw_quad,
                            OverlayCandidate* quad_info);

  // Returns true if |draw_quad| will not block quads underneath from becoming
  // an overlay.
  bool IsInvisibleQuad(const DrawQuad* draw_quad);

  // Returns true if |draw_quad| is of a known quad type and contains an
  // overlayable resource.
  bool IsOverlayQuad(const DrawQuad* draw_quad);

  bool GetTextureQuadInfo(const TextureDrawQuad& quad,
                          OverlayCandidate* quad_info);
  bool GetVideoQuadInfo(const StreamVideoDrawQuad& quad,
                        OverlayCandidate* quad_info);

  OverlayCandidateValidator* capability_checker_;
  ResourceProvider* resource_provider_;

 private:
  DISALLOW_COPY_AND_ASSIGN(OverlayStrategyCommon);
};
}  // namespace cc

#endif  // CC_OUTPUT_OVERLAY_STRATEGY_COMMON_H_