File: aggregated_render_pass_draw_quad.cc

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 (132 lines) | stat: -rw-r--r-- 5,003 bytes parent folder | download | duplicates (6)
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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
// Copyright 2011 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "components/viz/common/quads/aggregated_render_pass_draw_quad.h"

#include "base/trace_event/traced_value.h"
#include "base/values.h"
#include "cc/base/math_util.h"
#include "components/viz/common/traced_value.h"
#include "third_party/skia/include/core/SkImageFilter.h"

namespace viz {

AggregatedRenderPassDrawQuad::AggregatedRenderPassDrawQuad() = default;

AggregatedRenderPassDrawQuad::AggregatedRenderPassDrawQuad(
    const AggregatedRenderPassDrawQuad& other) = default;

AggregatedRenderPassDrawQuad::~AggregatedRenderPassDrawQuad() = default;

bool AggregatedRenderPassDrawQuad::Equals(
    const AggregatedRenderPassDrawQuad& other) const {
  DCHECK(shared_quad_state);

  return render_pass_id == other.render_pass_id &&
         // RenderPassDrawQuadInternal
         mask_uv_rect == other.mask_uv_rect &&
         mask_texture_size == other.mask_texture_size &&
         filters_scale == other.filters_scale &&
         filters_origin == other.filters_origin &&
         tex_coord_rect == other.tex_coord_rect &&
         backdrop_filter_quality == other.backdrop_filter_quality &&
         force_anti_aliasing_off == other.force_anti_aliasing_off &&
         intersects_damage_under == other.intersects_damage_under &&
         // DrawQuad. Skip `resource_id`.
         material == other.material && rect == other.rect &&
         visible_rect == other.visible_rect &&
         needs_blending == other.needs_blending &&
         shared_quad_state->Equals(*other.shared_quad_state);
}

void AggregatedRenderPassDrawQuad::SetNew(
    const SharedQuadState* shared_quad_state,
    const gfx::Rect& rect,
    const gfx::Rect& visible_rect,
    AggregatedRenderPassId render_pass,
    ResourceId mask_resource_id,
    const gfx::RectF& mask_uv_rect,
    const gfx::Size& mask_texture_size,
    const gfx::Vector2dF& filters_scale,
    const gfx::PointF& filters_origin,
    const gfx::RectF& tex_coord_rect,
    bool force_anti_aliasing_off,
    float backdrop_filter_quality) {
  DCHECK(render_pass);

  bool needs_blending = true;
  bool intersects_damage_under = true;
  SetAll(shared_quad_state, rect, visible_rect, needs_blending, render_pass,
         mask_resource_id, mask_uv_rect, mask_texture_size, filters_scale,
         filters_origin, tex_coord_rect, force_anti_aliasing_off,
         backdrop_filter_quality, intersects_damage_under);
}

void AggregatedRenderPassDrawQuad::SetAll(
    const AggregatedRenderPassDrawQuad& other) {
  render_pass_id = other.render_pass_id;

  // DrawQuad
  DrawQuad::SetAll(other.shared_quad_state,
                   DrawQuad::Material::kAggregatedRenderPass, other.rect,
                   other.visible_rect, other.needs_blending);
  resource_id = other.resource_id;

  // RenderPassDrawQuadInternal
  mask_uv_rect = other.mask_uv_rect;
  mask_texture_size = other.mask_texture_size;
  filters_scale = other.filters_scale;
  filters_origin = other.filters_origin;
  tex_coord_rect = other.tex_coord_rect;
  force_anti_aliasing_off = other.force_anti_aliasing_off;
  backdrop_filter_quality = other.backdrop_filter_quality;
  intersects_damage_under = other.intersects_damage_under;
}

void AggregatedRenderPassDrawQuad::SetAll(
    const SharedQuadState* shared_quad_state,
    const gfx::Rect& rect,
    const gfx::Rect& visible_rect,
    bool needs_blending,
    AggregatedRenderPassId render_pass,
    ResourceId mask_resource_id,
    const gfx::RectF& mask_uv_rect,
    const gfx::Size& mask_texture_size,
    const gfx::Vector2dF& filters_scale,
    const gfx::PointF& filters_origin,
    const gfx::RectF& tex_coord_rect,
    bool force_anti_aliasing_off,
    float backdrop_filter_quality,
    bool intersects_damage_under) {
  DCHECK(render_pass);

  DrawQuad::SetAll(shared_quad_state, DrawQuad::Material::kAggregatedRenderPass,
                   rect, visible_rect, needs_blending);
  render_pass_id = render_pass;
  resource_id = mask_resource_id;
  this->mask_uv_rect = mask_uv_rect;
  this->mask_texture_size = mask_texture_size;
  this->filters_scale = filters_scale;
  this->filters_origin = filters_origin;
  this->tex_coord_rect = tex_coord_rect;
  this->force_anti_aliasing_off = force_anti_aliasing_off;
  this->backdrop_filter_quality = backdrop_filter_quality;
  this->intersects_damage_under = intersects_damage_under;
}

const AggregatedRenderPassDrawQuad* AggregatedRenderPassDrawQuad::MaterialCast(
    const DrawQuad* quad) {
  CHECK_EQ(quad->material, DrawQuad::Material::kAggregatedRenderPass);
  return static_cast<const AggregatedRenderPassDrawQuad*>(quad);
}

void AggregatedRenderPassDrawQuad::ExtendValue(
    base::trace_event::TracedValue* value) const {
  TracedValue::SetIDRef(
      reinterpret_cast<void*>(static_cast<uint64_t>(render_pass_id)), value,
      "render_pass_id");
  RenderPassDrawQuadInternal::ExtendValue(value);
}

}  // namespace viz