File: overlay_processor_strategy.h

package info (click to toggle)
chromium 139.0.7258.127-1
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 6,122,068 kB
  • sloc: cpp: 35,100,771; ansic: 7,163,530; javascript: 4,103,002; python: 1,436,920; asm: 946,517; xml: 746,709; pascal: 187,653; perl: 88,691; sh: 88,436; objc: 79,953; sql: 51,488; cs: 44,583; fortran: 24,137; makefile: 22,147; tcl: 15,277; php: 13,980; yacc: 8,984; ruby: 7,485; awk: 3,720; lisp: 3,096; lex: 1,327; ada: 727; jsp: 228; sed: 36
file content (89 lines) | stat: -rw-r--r-- 4,051 bytes parent folder | download | duplicates (8)
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef COMPONENTS_VIZ_SERVICE_DISPLAY_OVERLAY_PROCESSOR_STRATEGY_H_
#define COMPONENTS_VIZ_SERVICE_DISPLAY_OVERLAY_PROCESSOR_STRATEGY_H_

#include <memory>
#include <vector>

#include "components/viz/common/display/overlay_strategy.h"
#include "components/viz/common/quads/aggregated_render_pass.h"
#include "components/viz/service/display/overlay_candidate.h"
#include "components/viz/service/display/overlay_processor_interface.h"
#include "components/viz/service/display/overlay_proposed_candidate.h"
#include "components/viz/service/viz_service_export.h"

namespace viz {

// A strategy for promoting a DrawQuad(s) to overlays. Used by
// `OverlayProcessorUsingStrategy` for proposing and attempting candidates quads
// in different ways.
class VIZ_SERVICE_EXPORT OverlayProcessorStrategy {
 public:
  virtual ~OverlayProcessorStrategy() = default;
  using PrimaryPlane = OverlayProcessorInterface::OutputSurfaceOverlayPlane;

  // Appends all legitimate overlay candidates to the list |candidates|
  // for this strategy.  It is very important to note that this function
  // should not attempt a specific candidate it should merely identify them
  // and save the necessary data required to for a later attempt.
  virtual void Propose(
      const SkM44& output_color_matrix,
      const OverlayProcessorInterface::FilterOperationsMap& render_pass_filters,
      const OverlayProcessorInterface::FilterOperationsMap&
          render_pass_backdrop_filters,
      const DisplayResourceProvider* resource_provider,
      AggregatedRenderPassList* render_pass_list,
      SurfaceDamageRectList* surface_damage_rect_list,
      const PrimaryPlane* primary_plane,
      std::vector<OverlayProposedCandidate>* candidates,
      std::vector<gfx::Rect>* content_bounds) = 0;

  // Returns false if the specific |proposed_candidate| cannot be made to work
  // for this strategy with the current set of render passes. Returns true if
  // the strategy was successful and adds any additional passes necessary to
  // represent overlays to |render_pass_list|. Most strategies should look at
  // the primary RenderPass, the last element.
  virtual bool Attempt(
      const SkM44& output_color_matrix,
      const OverlayProcessorInterface::FilterOperationsMap& render_pass_filters,
      const OverlayProcessorInterface::FilterOperationsMap&
          render_pass_backdrop_filters,
      const DisplayResourceProvider* resource_provider,
      AggregatedRenderPassList* render_pass_list,
      SurfaceDamageRectList* surface_damage_rect_list,
      const PrimaryPlane* primary_plane,
      OverlayCandidateList* candidates,
      std::vector<gfx::Rect>* content_bounds,
      const OverlayProposedCandidate& proposed_candidate) = 0;

  // Commits to using the proposed candidate by updating |render_pass| as
  // appropriate when this candidate is presented in an overlay plane.
  virtual void CommitCandidate(
      const OverlayProposedCandidate& proposed_candidate,
      AggregatedRenderPass* render_pass) = 0;

  // Currently this is only overridden by the Underlay strategy: the underlay
  // strategy needs to enable blending for the primary plane in order to show
  // content underneath.
  virtual void AdjustOutputSurfaceOverlay(
      OverlayProcessorInterface::OutputSurfaceOverlayPlane*
          output_surface_plane) {}

  // Currently this is only overridden by the Fullscreen strategy: the
  // fullscreen strategy covers the entire screen and there is no need to use
  // the primary plane.
  virtual bool RemoveOutputSurfaceAsOverlay();

  virtual OverlayStrategy GetUMAEnum() const;

  // Does a null-check on |primary_plane| and returns it's |display_rect|
  // member if non-null and an empty gfx::RectF otherwise.
  gfx::RectF GetPrimaryPlaneDisplayRect(const PrimaryPlane* primary_plane);
};

}  // namespace viz

#endif  // COMPONENTS_VIZ_SERVICE_DISPLAY_OVERLAY_PROCESSOR_STRATEGY_H_