Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
third_party
skia
tools
gpu
GrTest.cpp
Go to the documentation of this file.
1
/*
2
* Copyright 2013 Google Inc.
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 "
include/core/SkString.h
"
9
#include "
include/gpu/GrBackendSurface.h
"
10
#include "
include/gpu/GrContextOptions.h
"
11
#include "
include/gpu/GrRecordingContext.h
"
12
#include "
include/private/base/SkTo.h
"
13
#include "
src/base/SkMathPriv.h
"
14
#include "
src/base/SkRandom.h
"
15
#include "
src/gpu/ganesh/GrClip.h
"
16
#include "
src/gpu/ganesh/GrDirectContextPriv.h
"
17
#include "
src/gpu/ganesh/GrDrawOpAtlas.h
"
18
#include "
src/gpu/ganesh/GrDrawingManager.h
"
19
#include "
src/gpu/ganesh/GrGpu.h
"
20
#include "
src/gpu/ganesh/GrGpuResourceCacheAccess.h
"
21
#include "
src/gpu/ganesh/GrMemoryPool.h
"
22
#include "
src/gpu/ganesh/GrRecordingContextPriv.h
"
23
#include "
src/gpu/ganesh/GrRenderTargetProxy.h
"
24
#include "
src/gpu/ganesh/GrResourceCache.h
"
25
#include "
src/gpu/ganesh/GrSemaphore.h
"
26
#include "
src/gpu/ganesh/GrTexture.h
"
27
#include "
src/gpu/ganesh/SkGr.h
"
28
#include "
src/gpu/ganesh/SurfaceDrawContext.h
"
29
#include "
src/gpu/ganesh/image/SkImage_Ganesh.h
"
30
#include "
src/text/gpu/StrikeCache.h
"
31
#include "
src/text/gpu/TextBlobRedrawCoordinator.h
"
32
33
#include <algorithm>
34
35
//////////////////////////////////////////////////////////////////////////////
36
37
#define DRAW_OP_TEST_EXTERN(Op) \
38
extern GrOp::Owner Op##__Test( \
39
GrPaint&&, SkRandom*, GrRecordingContext*, skgpu::ganesh::SurfaceDrawContext*, int)
40
#define DRAW_OP_TEST_ENTRY(Op) Op##__Test
41
42
DRAW_OP_TEST_EXTERN
(AAConvexPathOp);
43
DRAW_OP_TEST_EXTERN
(AAFlatteningConvexPathOp);
44
DRAW_OP_TEST_EXTERN
(AAHairlineOp);
45
DRAW_OP_TEST_EXTERN
(AAStrokeRectOp);
46
DRAW_OP_TEST_EXTERN
(AtlasTextOp);
47
#if !defined(SK_ENABLE_OPTIMIZE_SIZE)
48
DRAW_OP_TEST_EXTERN
(
ButtCapDashedCircleOp
);
49
DRAW_OP_TEST_EXTERN
(
CircleOp
);
50
#endif
51
DRAW_OP_TEST_EXTERN
(DashOpImpl);
52
DRAW_OP_TEST_EXTERN
(DefaultPathOp);
53
DRAW_OP_TEST_EXTERN
(DrawAtlasOp);
54
#if !defined(SK_ENABLE_OPTIMIZE_SIZE)
55
DRAW_OP_TEST_EXTERN
(
DIEllipseOp
);
56
DRAW_OP_TEST_EXTERN
(
EllipseOp
);
57
#endif
58
DRAW_OP_TEST_EXTERN
(FillRectOp);
59
DRAW_OP_TEST_EXTERN
(NonAALatticeOp);
60
DRAW_OP_TEST_EXTERN
(NonAAStrokeRectOp);
61
DRAW_OP_TEST_EXTERN
(RegionOp);
62
#if !defined(SK_ENABLE_OPTIMIZE_SIZE)
63
DRAW_OP_TEST_EXTERN
(RRectOp);
64
#endif
65
DRAW_OP_TEST_EXTERN
(ShadowRRectOp);
66
#if !defined(SK_ENABLE_OPTIMIZE_SIZE)
67
DRAW_OP_TEST_EXTERN
(SmallPathOp);
68
#endif
69
DRAW_OP_TEST_EXTERN
(TextureOpImpl);
70
#if !defined(SK_ENABLE_OPTIMIZE_SIZE)
71
DRAW_OP_TEST_EXTERN
(TriangulatingPathOp);
72
#endif
73
74
void
GrDrawRandomOp
(
SkRandom
* random,
skgpu::ganesh::SurfaceDrawContext
* sdc,
GrPaint
&&
paint
) {
75
auto
rContext = sdc->
recordingContext
();
76
using
MakeDrawOpFn =
GrOp::Owner
(
GrPaint
&&,
77
SkRandom
*,
78
GrRecordingContext
*,
79
skgpu::ganesh::SurfaceDrawContext
*,
80
int
numSamples);
81
static
constexpr
MakeDrawOpFn* gFactories[] = {
82
DRAW_OP_TEST_ENTRY
(AAConvexPathOp),
83
DRAW_OP_TEST_ENTRY
(AAFlatteningConvexPathOp),
84
DRAW_OP_TEST_ENTRY
(AAHairlineOp),
85
DRAW_OP_TEST_ENTRY
(AAStrokeRectOp),
86
DRAW_OP_TEST_ENTRY
(AtlasTextOp),
87
#if !defined(SK_ENABLE_OPTIMIZE_SIZE)
88
DRAW_OP_TEST_ENTRY
(
ButtCapDashedCircleOp
),
89
DRAW_OP_TEST_ENTRY
(
CircleOp
),
90
#endif
91
DRAW_OP_TEST_ENTRY
(DashOpImpl),
92
DRAW_OP_TEST_ENTRY
(DefaultPathOp),
93
DRAW_OP_TEST_ENTRY
(DrawAtlasOp),
94
#if !defined(SK_ENABLE_OPTIMIZE_SIZE)
95
DRAW_OP_TEST_ENTRY
(
DIEllipseOp
),
96
DRAW_OP_TEST_ENTRY
(
EllipseOp
),
97
#endif
98
DRAW_OP_TEST_ENTRY
(FillRectOp),
99
DRAW_OP_TEST_ENTRY
(NonAALatticeOp),
100
DRAW_OP_TEST_ENTRY
(NonAAStrokeRectOp),
101
DRAW_OP_TEST_ENTRY
(RegionOp),
102
#if !defined(SK_ENABLE_OPTIMIZE_SIZE)
103
DRAW_OP_TEST_ENTRY
(RRectOp),
104
#endif
105
DRAW_OP_TEST_ENTRY
(ShadowRRectOp),
106
#if !defined(SK_ENABLE_OPTIMIZE_SIZE)
107
DRAW_OP_TEST_ENTRY
(SmallPathOp),
108
#endif
109
DRAW_OP_TEST_ENTRY
(TextureOpImpl),
110
#if !defined(SK_ENABLE_OPTIMIZE_SIZE)
111
DRAW_OP_TEST_ENTRY
(TriangulatingPathOp),
112
#endif
113
};
114
115
static
constexpr
size_t
kTotal = std::size(gFactories);
116
uint32_t index = random->
nextULessThan
(
static_cast<
uint32_t
>
(kTotal));
117
auto
op = gFactories[index](std::move(
paint
),
118
random,
119
rContext,
120
sdc,
121
sdc->
numSamples
());
122
123
// Creating a GrAtlasTextOp my not produce an op if for example, it is totally outside the
124
// render target context.
125
if
(op) {
126
sdc->
addDrawOp
(std::move(op));
127
}
128
}
GrBackendSurface.h
GrClip.h
GrContextOptions.h
GrDirectContextPriv.h
GrDrawOpAtlas.h
GrDrawingManager.h
GrGpuResourceCacheAccess.h
GrGpu.h
GrMemoryPool.h
GrRecordingContextPriv.h
GrRecordingContext.h
GrRenderTargetProxy.h
GrResourceCache.h
GrSemaphore.h
DRAW_OP_TEST_EXTERN
#define DRAW_OP_TEST_EXTERN(Op)
Definition
GrTest.cpp:37
DRAW_OP_TEST_ENTRY
#define DRAW_OP_TEST_ENTRY(Op)
Definition
GrTest.cpp:40
GrDrawRandomOp
void GrDrawRandomOp(SkRandom *random, skgpu::ganesh::SurfaceDrawContext *sdc, GrPaint &&paint)
Definition
GrTest.cpp:74
GrTexture.h
SkGr.h
SkImage_Ganesh.h
SkMathPriv.h
SkRandom.h
SkString.h
SkTo.h
StrikeCache.h
SurfaceDrawContext.h
TextBlobRedrawCoordinator.h
ButtCapDashedCircleOp
Definition
GrOvalOpFactory.cpp:1500
CircleOp
Definition
GrOvalOpFactory.cpp:985
DIEllipseOp
Definition
GrOvalOpFactory.cpp:2113
EllipseOp
Definition
GrOvalOpFactory.cpp:1821
GrOp::Owner
std::unique_ptr< GrOp > Owner
Definition
GrOp.h:72
GrPaint
Definition
GrPaint.h:40
GrRecordingContext
Definition
GrRecordingContext.h:42
SkRandom
Definition
SkRandom.h:27
SkRandom::nextULessThan
uint32_t nextULessThan(uint32_t count)
Definition
SkRandom.h:93
skgpu::ganesh::SurfaceContext::recordingContext
GrRecordingContext * recordingContext() const
Definition
SurfaceContext.h:50
skgpu::ganesh::SurfaceDrawContext
Definition
SurfaceDrawContext.h:65
skgpu::ganesh::SurfaceDrawContext::addDrawOp
void addDrawOp(const GrClip *, GrOp::Owner, const std::function< WillAddOpFn > &=std::function< WillAddOpFn >())
Definition
SurfaceDrawContext.cpp:1922
skgpu::ganesh::SurfaceDrawContext::numSamples
int numSamples() const
Definition
SurfaceDrawContext.h:591
paint
const Paint & paint
Definition
color_source.cc:38
Generated on Fri Apr 26 2024 06:18:10 for Flutter Engine by
1.9.8