Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Macros | Functions
GrTest.cpp File Reference
#include "include/core/SkString.h"
#include "include/gpu/GrBackendSurface.h"
#include "include/gpu/GrContextOptions.h"
#include "include/gpu/GrRecordingContext.h"
#include "include/private/base/SkTo.h"
#include "src/base/SkMathPriv.h"
#include "src/base/SkRandom.h"
#include "src/gpu/ganesh/GrClip.h"
#include "src/gpu/ganesh/GrDirectContextPriv.h"
#include "src/gpu/ganesh/GrDrawOpAtlas.h"
#include "src/gpu/ganesh/GrDrawingManager.h"
#include "src/gpu/ganesh/GrGpu.h"
#include "src/gpu/ganesh/GrGpuResourceCacheAccess.h"
#include "src/gpu/ganesh/GrMemoryPool.h"
#include "src/gpu/ganesh/GrRecordingContextPriv.h"
#include "src/gpu/ganesh/GrRenderTargetProxy.h"
#include "src/gpu/ganesh/GrResourceCache.h"
#include "src/gpu/ganesh/GrSemaphore.h"
#include "src/gpu/ganesh/GrTexture.h"
#include "src/gpu/ganesh/SkGr.h"
#include "src/gpu/ganesh/SurfaceDrawContext.h"
#include "src/gpu/ganesh/image/SkImage_Ganesh.h"
#include "src/text/gpu/StrikeCache.h"
#include "src/text/gpu/TextBlobRedrawCoordinator.h"
#include <algorithm>

Go to the source code of this file.

Macros

#define DRAW_OP_TEST_EXTERN(Op)
 
#define DRAW_OP_TEST_ENTRY(Op)   Op##__Test
 

Functions

 DRAW_OP_TEST_EXTERN (AAConvexPathOp)
 
 DRAW_OP_TEST_EXTERN (AAFlatteningConvexPathOp)
 
 DRAW_OP_TEST_EXTERN (AAHairlineOp)
 
 DRAW_OP_TEST_EXTERN (AAStrokeRectOp)
 
 DRAW_OP_TEST_EXTERN (AtlasTextOp)
 
 DRAW_OP_TEST_EXTERN (ButtCapDashedCircleOp)
 
 DRAW_OP_TEST_EXTERN (CircleOp)
 
 DRAW_OP_TEST_EXTERN (DashOpImpl)
 
 DRAW_OP_TEST_EXTERN (DefaultPathOp)
 
 DRAW_OP_TEST_EXTERN (DrawAtlasOp)
 
 DRAW_OP_TEST_EXTERN (DIEllipseOp)
 
 DRAW_OP_TEST_EXTERN (EllipseOp)
 
 DRAW_OP_TEST_EXTERN (FillRectOp)
 
 DRAW_OP_TEST_EXTERN (NonAALatticeOp)
 
 DRAW_OP_TEST_EXTERN (NonAAStrokeRectOp)
 
 DRAW_OP_TEST_EXTERN (RegionOp)
 
 DRAW_OP_TEST_EXTERN (RRectOp)
 
 DRAW_OP_TEST_EXTERN (ShadowRRectOp)
 
 DRAW_OP_TEST_EXTERN (SmallPathOp)
 
 DRAW_OP_TEST_EXTERN (TextureOpImpl)
 
 DRAW_OP_TEST_EXTERN (TriangulatingPathOp)
 
void GrDrawRandomOp (SkRandom *random, skgpu::ganesh::SurfaceDrawContext *sdc, GrPaint &&paint)
 

Macro Definition Documentation

◆ DRAW_OP_TEST_ENTRY

#define DRAW_OP_TEST_ENTRY (   Op)    Op##__Test

Definition at line 40 of file GrTest.cpp.

◆ DRAW_OP_TEST_EXTERN

#define DRAW_OP_TEST_EXTERN (   Op)
Value:

Definition at line 37 of file GrTest.cpp.

74 {
75 auto rContext = sdc->recordingContext();
76 using MakeDrawOpFn = GrOp::Owner(GrPaint&&,
77 SkRandom*,
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)
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)
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}
#define DRAW_OP_TEST_ENTRY(Op)
Definition GrTest.cpp:40
const Paint & paint

Function Documentation

◆ DRAW_OP_TEST_EXTERN() [1/21]

DRAW_OP_TEST_EXTERN ( AAConvexPathOp  )

◆ DRAW_OP_TEST_EXTERN() [2/21]

DRAW_OP_TEST_EXTERN ( AAFlatteningConvexPathOp  )

◆ DRAW_OP_TEST_EXTERN() [3/21]

DRAW_OP_TEST_EXTERN ( AAHairlineOp  )

◆ DRAW_OP_TEST_EXTERN() [4/21]

DRAW_OP_TEST_EXTERN ( AAStrokeRectOp  )

◆ DRAW_OP_TEST_EXTERN() [5/21]

DRAW_OP_TEST_EXTERN ( AtlasTextOp  )

◆ DRAW_OP_TEST_EXTERN() [6/21]

DRAW_OP_TEST_EXTERN ( ButtCapDashedCircleOp  )

◆ DRAW_OP_TEST_EXTERN() [7/21]

DRAW_OP_TEST_EXTERN ( CircleOp  )

◆ DRAW_OP_TEST_EXTERN() [8/21]

DRAW_OP_TEST_EXTERN ( DashOpImpl  )

◆ DRAW_OP_TEST_EXTERN() [9/21]

DRAW_OP_TEST_EXTERN ( DefaultPathOp  )

◆ DRAW_OP_TEST_EXTERN() [10/21]

DRAW_OP_TEST_EXTERN ( DIEllipseOp  )

◆ DRAW_OP_TEST_EXTERN() [11/21]

DRAW_OP_TEST_EXTERN ( DrawAtlasOp  )

◆ DRAW_OP_TEST_EXTERN() [12/21]

DRAW_OP_TEST_EXTERN ( EllipseOp  )

◆ DRAW_OP_TEST_EXTERN() [13/21]

DRAW_OP_TEST_EXTERN ( FillRectOp  )

◆ DRAW_OP_TEST_EXTERN() [14/21]

DRAW_OP_TEST_EXTERN ( NonAALatticeOp  )

◆ DRAW_OP_TEST_EXTERN() [15/21]

DRAW_OP_TEST_EXTERN ( NonAAStrokeRectOp  )

◆ DRAW_OP_TEST_EXTERN() [16/21]

DRAW_OP_TEST_EXTERN ( RegionOp  )

◆ DRAW_OP_TEST_EXTERN() [17/21]

DRAW_OP_TEST_EXTERN ( RRectOp  )

◆ DRAW_OP_TEST_EXTERN() [18/21]

DRAW_OP_TEST_EXTERN ( ShadowRRectOp  )

◆ DRAW_OP_TEST_EXTERN() [19/21]

DRAW_OP_TEST_EXTERN ( SmallPathOp  )

◆ DRAW_OP_TEST_EXTERN() [20/21]

DRAW_OP_TEST_EXTERN ( TextureOpImpl  )

◆ DRAW_OP_TEST_EXTERN() [21/21]

DRAW_OP_TEST_EXTERN ( TriangulatingPathOp  )

◆ GrDrawRandomOp()

void GrDrawRandomOp ( SkRandom random,
skgpu::ganesh::SurfaceDrawContext sdc,
GrPaint &&  paint 
)

Definition at line 74 of file GrTest.cpp.

74 {
75 auto rContext = sdc->recordingContext();
76 using MakeDrawOpFn = GrOp::Owner(GrPaint&&,
77 SkRandom*,
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)
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)
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}
uint32_t nextULessThan(uint32_t count)
Definition SkRandom.h:93
GrRecordingContext * recordingContext() const