Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
third_party
skia
src
gpu
graphite
DrawList.cpp
Go to the documentation of this file.
1
/*
2
* Copyright 2021 Google LLC
3
*
4
* Use of this source code is governed by a BSD-style license that can be
5
* found in the LICENSE file.
6
*/
7
8
#include "
src/gpu/graphite/DrawList.h
"
9
10
#include "
src/gpu/BufferWriter.h
"
11
#include "
src/gpu/graphite/Renderer.h
"
12
#include "
src/gpu/graphite/geom/Shape.h
"
13
14
namespace
skgpu::graphite
{
15
16
const
Transform
&
DrawList::deduplicateTransform
(
const
Transform
& localToDevice) {
17
// TODO: This is a pretty simple deduplication strategy and doesn't take advantage of the stack
18
// knowledge that Device has.
19
if
(
fTransforms
.empty() ||
fTransforms
.back() != localToDevice) {
20
fTransforms
.push_back(localToDevice);
21
}
22
return
fTransforms
.back();
23
}
24
25
void
DrawList::recordDraw
(
const
Renderer
* renderer,
26
const
Transform
& localToDevice,
27
const
Geometry
& geometry,
28
const
Clip
&
clip
,
29
DrawOrder
ordering,
30
const
PaintParams
*
paint
,
31
const
StrokeStyle
* stroke) {
32
SkASSERT
(localToDevice.
valid
());
33
SkASSERT
(!geometry.
isEmpty
() && !
clip
.drawBounds().isEmptyNegativeOrNaN());
34
SkASSERT
(!(renderer->depthStencilFlags() &
DepthStencilFlags::kStencil
) ||
35
ordering.
stencilIndex
() !=
DrawOrder::kUnassigned
);
36
37
// TODO: Add validation that the renderer's expected shape type and stroke params match provided
38
39
fDraws
.emplace_back(renderer, this->
deduplicateTransform
(localToDevice),
40
geometry,
clip
, ordering,
paint
, stroke);
41
fRenderStepCount
+= renderer->numRenderSteps();
42
43
#if defined(SK_DEBUG)
44
if
(geometry.
isCoverageMaskShape
()) {
45
fCoverageMaskShapeDrawCount++;
46
}
47
#endif
48
49
if
(
paint
&&
paint
->dstReadRequirement() ==
DstReadRequirement::kTextureCopy
) {
50
fDstCopyBounds
.
join
(
clip
.drawBounds());
51
}
52
}
53
54
}
// namespace skgpu::graphite
BufferWriter.h
DrawList.h
Renderer.h
Shape.h
SkASSERT
#define SkASSERT(cond)
Definition
SkAssert.h:116
clip
static SkPath clip(const SkPath &path, const SkHalfPlane &plane)
Definition
SkPath.cpp:3824
skgpu::graphite::Clip
Definition
DrawParams.h:64
skgpu::graphite::DrawList::deduplicateTransform
const Transform & deduplicateTransform(const Transform &)
Definition
DrawList.cpp:16
skgpu::graphite::DrawList::fTransforms
SkTBlockList< Transform, 16 > fTransforms
Definition
DrawList.h:110
skgpu::graphite::DrawList::fRenderStepCount
int fRenderStepCount
Definition
DrawList.h:114
skgpu::graphite::DrawList::fDraws
SkTBlockList< Draw, 16 > fDraws
Definition
DrawList.h:111
skgpu::graphite::DrawList::fDstCopyBounds
Rect fDstCopyBounds
Definition
DrawList.h:121
skgpu::graphite::DrawList::recordDraw
void recordDraw(const Renderer *renderer, const Transform &localToDevice, const Geometry &geometry, const Clip &clip, DrawOrder ordering, const PaintParams *paint, const StrokeStyle *stroke)
Definition
DrawList.cpp:25
skgpu::graphite::DrawOrder
Definition
DrawOrder.h:105
skgpu::graphite::DrawOrder::kUnassigned
static constexpr DisjointStencilIndex kUnassigned
Definition
DrawOrder.h:115
skgpu::graphite::DrawOrder::stencilIndex
DisjointStencilIndex stencilIndex() const
Definition
DrawOrder.h:128
skgpu::graphite::Geometry
Definition
Geometry.h:26
skgpu::graphite::Geometry::isCoverageMaskShape
bool isCoverageMaskShape() const
Definition
Geometry.h:100
skgpu::graphite::Geometry::isEmpty
bool isEmpty() const
Definition
Geometry.h:102
skgpu::graphite::PaintParams
Definition
PaintParams.h:34
skgpu::graphite::Rect::join
AI Rect & join(Rect rect)
Definition
Rect.h:150
skgpu::graphite::Renderer
Definition
Renderer.h:223
skgpu::graphite::StrokeStyle
Definition
DrawParams.h:24
skgpu::graphite::Transform
Definition
Transform_graphite.h:19
skgpu::graphite::Transform::valid
bool valid() const
Definition
Transform_graphite.h:85
paint
const Paint & paint
Definition
color_source.cc:38
skgpu::graphite
Definition
BoundsManagerBench.cpp:27
skgpu::graphite::DepthStencilFlags::kStencil
@ kStencil
skgpu::graphite::DstReadRequirement::kTextureCopy
@ kTextureCopy
Generated on Fri Apr 26 2024 06:17:17 for Flutter Engine by
1.9.8