Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Member Functions | List of all members
TestBlend Class Reference

Public Member Functions

 TestBlend (skiatest::Reporter *r, GrRecordingContext *grContext, const GraphiteInfo *graphite)
 
void build (const char *src)
 
SkSurfacesurface ()
 
SkRuntimeBlendBuilder::BuilderUniform uniform (const char *name)
 
SkRuntimeBlendBuilder::BuilderChild child (const char *name)
 
void test (std::array< GrColor, 4 > expected, PreTestFn preTestCallback=nullptr)
 
void test (GrColor expected, PreTestFn preTestCallback=nullptr)
 

Detailed Description

Definition at line 535 of file SkRuntimeEffectTest.cpp.

Constructor & Destructor Documentation

◆ TestBlend()

TestBlend::TestBlend ( skiatest::Reporter r,
GrRecordingContext grContext,
const GraphiteInfo graphite 
)
inline

Definition at line 537 of file SkRuntimeEffectTest.cpp.

538 : fReporter(r), fGrContext(grContext), fGraphite(graphite) {
539 fSurface = make_surface(fGrContext, fGraphite, /*size=*/{2, 2});
540 }
static sk_sp< SkSurface > make_surface(GrRecordingContext *grContext, const GraphiteInfo *graphite, SkISize size)

Member Function Documentation

◆ build()

void TestBlend::build ( const char *  src)
inline

Definition at line 542 of file SkRuntimeEffectTest.cpp.

542 {
543 auto [effect, errorText] = SkRuntimeEffect::MakeForBlender(SkString(src));
544 if (!effect) {
545 ERRORF(fReporter, "Effect didn't compile: %s", errorText.c_str());
546 return;
547 }
548 fBuilder.init(std::move(effect));
549 }
#define ERRORF(r,...)
Definition Test.h:293
static Result MakeForBlender(SkString sksl, const Options &)
T * init(Args &&... args)
Definition SkTLazy.h:45

◆ child()

SkRuntimeBlendBuilder::BuilderChild TestBlend::child ( const char *  name)
inline

Definition at line 559 of file SkRuntimeEffectTest.cpp.

559 {
560 return fBuilder->child(name);
561 }
BuilderChild child(std::string_view name)
const char * name
Definition fuchsia.cc:50

◆ surface()

SkSurface * TestBlend::surface ( )
inline

Definition at line 551 of file SkRuntimeEffectTest.cpp.

551 {
552 return fSurface.get();
553 }
T * get() const
Definition SkRefCnt.h:303

◆ test() [1/2]

void TestBlend::test ( GrColor  expected,
PreTestFn  preTestCallback = nullptr 
)
inline

Definition at line 580 of file SkRuntimeEffectTest.cpp.

580 {
581 this->test({expected, expected, expected, expected}, preTestCallback);
582 }
#define test(name)

◆ test() [2/2]

void TestBlend::test ( std::array< GrColor, 4 >  expected,
PreTestFn  preTestCallback = nullptr 
)
inline

Definition at line 563 of file SkRuntimeEffectTest.cpp.

563 {
564 auto blender = fBuilder->makeBlender();
565 if (!blender) {
566 ERRORF(fReporter, "Effect didn't produce a blender");
567 return;
568 }
569
570 SkCanvas* canvas = fSurface->getCanvas();
572 paint.setBlender(std::move(blender));
573 paint.setColor(SK_ColorGRAY);
574
575 paint_canvas(canvas, &paint, preTestCallback);
576
577 verify_2x2_surface_results(fReporter, fBuilder->effect(), fSurface.get(), expected);
578 }
constexpr SkColor SK_ColorGRAY
Definition SkColor.h:113
static void verify_2x2_surface_results(skiatest::Reporter *r, const SkRuntimeEffect *effect, SkSurface *surface, std::array< GrColor, 4 > expected)
void paint_canvas(SkCanvas *canvas, SkPaint *paint, const PreTestFn &preTestCallback)
sk_sp< SkBlender > makeBlender() const
const SkRuntimeEffect * effect() const
SkCanvas * getCanvas()
Definition SkSurface.cpp:82
const Paint & paint

◆ uniform()

SkRuntimeBlendBuilder::BuilderUniform TestBlend::uniform ( const char *  name)
inline

Definition at line 555 of file SkRuntimeEffectTest.cpp.

555 {
556 return fBuilder->uniform(name);
557 }
BuilderUniform uniform(std::string_view name)

The documentation for this class was generated from the following file: