Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
third_party
skia
src
gpu
ganesh
tessellate
StrokeTessellator.h
Go to the documentation of this file.
1
/*
2
* Copyright 2022 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
#ifndef StrokeTessellator_DEFINED
9
#define StrokeTessellator_DEFINED
10
11
#include "
include/core/SkPath.h
"
12
#include "
include/core/SkRefCnt.h
"
13
#include "
include/core/SkStrokeRec.h
"
14
#include "
include/private/SkColorData.h
"
15
#include "
src/gpu/ganesh/GrGpuBuffer.h
"
16
#include "
src/gpu/ganesh/GrVertexChunkArray.h
"
17
#include "
src/gpu/tessellate/Tessellation.h
"
18
19
class
GrMeshDrawTarget
;
20
class
GrOpFlushState
;
21
class
SkMatrix
;
22
23
namespace
skgpu::ganesh
{
24
25
// Prepares GPU data for, and then draws a stroke's tessellated geometry. Renders strokes as
26
// fixed-count triangle strip instances. Any extra triangles not needed by the instance are emitted
27
// as degenerate triangles.
28
class
StrokeTessellator
{
29
public
:
30
using
PatchAttribs
=
tess::PatchAttribs
;
31
32
struct
PathStrokeList
{
33
PathStrokeList
(
const
SkPath
& path,
const
SkStrokeRec
& stroke,
const
SkPMColor4f
&
color
)
34
:
fPath
(path),
fStroke
(stroke),
fColor
(
color
) {}
35
SkPath
fPath
;
36
SkStrokeRec
fStroke
;
37
SkPMColor4f
fColor
;
38
PathStrokeList
*
fNext
=
nullptr
;
39
};
40
41
StrokeTessellator
(
PatchAttribs
attribs) :
fAttribs
(attribs |
PatchAttribs
::
kJoinControlPoint
) {}
42
43
// Called before draw(). Prepares GPU buffers containing the geometry to tessellate.
44
//
45
// Returns the fixed number of edges the tessellator will draw per patch.
46
void
prepare
(
GrMeshDrawTarget
*,
47
const
SkMatrix
& shaderMatrix,
48
PathStrokeList
*,
49
int
totalCombinedStrokeVerbCnt);
50
51
// Issues draw calls for the tessellated stroke. The caller is responsible for creating and
52
// binding a pipeline that uses this class's shader() before calling draw().
53
void
draw
(
GrOpFlushState
*)
const
;
54
55
protected
:
56
const
PatchAttribs
fAttribs
;
57
58
GrVertexChunkArray
fVertexChunkArray
;
59
60
int
fVertexCount
= 0;
61
62
// Only used if sk_VertexID is not supported.
63
sk_sp<const GrGpuBuffer>
fVertexBufferIfNoIDSupport
;
64
};
65
66
}
// namespace skgpu::ganesh
67
68
#endif
// StrokeTessellator_DEFINED
GrGpuBuffer.h
GrVertexChunkArray.h
color
SkColor4f color
Definition
ImageShaderTest.cpp:28
SkColorData.h
SkPath.h
SkRefCnt.h
SkStrokeRec.h
Tessellation.h
GrMeshDrawTarget
Definition
GrMeshDrawTarget.h:53
GrOpFlushState
Definition
GrOpFlushState.h:58
SkMatrix
Definition
SkMatrix.h:54
SkPath
Definition
SkPath.h:59
SkStrokeRec
Definition
SkStrokeRec.h:22
sk_sp
Definition
SkRefCnt.h:220
skgpu::ganesh::StrokeTessellator
Definition
StrokeTessellator.h:28
skgpu::ganesh::StrokeTessellator::fVertexChunkArray
GrVertexChunkArray fVertexChunkArray
Definition
StrokeTessellator.h:58
skgpu::ganesh::StrokeTessellator::StrokeTessellator
StrokeTessellator(PatchAttribs attribs)
Definition
StrokeTessellator.h:41
skgpu::ganesh::StrokeTessellator::fVertexCount
int fVertexCount
Definition
StrokeTessellator.h:60
skgpu::ganesh::StrokeTessellator::draw
void draw(GrOpFlushState *) const
Definition
StrokeTessellator.cpp:191
skgpu::ganesh::StrokeTessellator::prepare
void prepare(GrMeshDrawTarget *, const SkMatrix &shaderMatrix, PathStrokeList *, int totalCombinedStrokeVerbCnt)
Definition
StrokeTessellator.cpp:165
skgpu::ganesh::StrokeTessellator::fVertexBufferIfNoIDSupport
sk_sp< const GrGpuBuffer > fVertexBufferIfNoIDSupport
Definition
StrokeTessellator.h:63
skgpu::ganesh::StrokeTessellator::fAttribs
const PatchAttribs fAttribs
Definition
StrokeTessellator.h:56
skia_private::STArray< 1, GrVertexChunk >
skgpu::ganesh
Definition
TessellateBench.cpp:24
skgpu::tess::PatchAttribs
PatchAttribs
Definition
Tessellation.h:77
skgpu::tess::PatchAttribs::kJoinControlPoint
@ kJoinControlPoint
SkRGBA4f< kPremul_SkAlphaType >
skgpu::ganesh::StrokeTessellator::PathStrokeList
Definition
StrokeTessellator.h:32
skgpu::ganesh::StrokeTessellator::PathStrokeList::PathStrokeList
PathStrokeList(const SkPath &path, const SkStrokeRec &stroke, const SkPMColor4f &color)
Definition
StrokeTessellator.h:33
skgpu::ganesh::StrokeTessellator::PathStrokeList::fColor
SkPMColor4f fColor
Definition
StrokeTessellator.h:37
skgpu::ganesh::StrokeTessellator::PathStrokeList::fNext
PathStrokeList * fNext
Definition
StrokeTessellator.h:38
skgpu::ganesh::StrokeTessellator::PathStrokeList::fStroke
SkStrokeRec fStroke
Definition
StrokeTessellator.h:36
skgpu::ganesh::StrokeTessellator::PathStrokeList::fPath
SkPath fPath
Definition
StrokeTessellator.h:35
Generated on Fri Apr 26 2024 06:17:13 for Flutter Engine by
1.9.8