Flutter Engine
The Flutter Engine
Public Member Functions | Protected Member Functions | List of all members
ColorSpaceTransformBench Class Reference
Inheritance diagram for ColorSpaceTransformBench:
Benchmark SkRefCnt SkRefCntBase

Public Member Functions

 ColorSpaceTransformBench (Mode mode)
 
- Public Member Functions inherited from Benchmark
 Benchmark ()
 
const char * getName ()
 
const char * getUniqueName ()
 
SkISize getSize ()
 
virtual bool isSuitableFor (Backend backend)
 
virtual void modifyGrContextOptions (GrContextOptions *)
 
virtual bool shouldLoop () const
 
void delayedSetup ()
 
void perCanvasPreDraw (SkCanvas *)
 
void perCanvasPostDraw (SkCanvas *)
 
void preDraw (SkCanvas *)
 
void postDraw (SkCanvas *)
 
void draw (int loops, SkCanvas *)
 
virtual void getGpuStats (SkCanvas *, skia_private::TArray< SkString > *keys, skia_private::TArray< double > *values)
 
virtual bool getDMSAAStats (GrRecordingContext *)
 
int getUnits () const
 
- Public Member Functions inherited from SkRefCntBase
 SkRefCntBase ()
 
virtual ~SkRefCntBase ()
 
bool unique () const
 
void ref () const
 
void unref () const
 

Protected Member Functions

const char * onGetName () override
 
bool isSuitableFor (Backend backend) override
 
void onDelayedSetup () override
 
void onDraw (int loops, SkCanvas *canvas) override
 
- Protected Member Functions inherited from Benchmark
void setUnits (int units)
 
virtual void setupPaint (SkPaint *paint)
 
virtual const char * onGetName ()=0
 
virtual const char * onGetUniqueName ()
 
virtual void onDelayedSetup ()
 
virtual void onPerCanvasPreDraw (SkCanvas *)
 
virtual void onPerCanvasPostDraw (SkCanvas *)
 
virtual void onPreDraw (SkCanvas *)
 
virtual void onPostDraw (SkCanvas *)
 
virtual void onDraw (int loops, SkCanvas *)=0
 
virtual SkISize onGetSize ()
 

Additional Inherited Members

- Public Types inherited from Benchmark
enum class  Backend {
  kNonRendering , kRaster , kGanesh , kGraphite ,
  kPDF , kHWUI
}
 

Detailed Description

Definition at line 33 of file ColorSpaceBench.cpp.

Constructor & Destructor Documentation

◆ ColorSpaceTransformBench()

ColorSpaceTransformBench::ColorSpaceTransformBench ( Mode  mode)
inline

Definition at line 35 of file ColorSpaceBench.cpp.

35 : fMode(mode) {
36 fName = std::string("ColorSpace") + mode_name(fMode) + "Transform";
37 }
static const char * mode_name(Mode m)
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive mode
Definition: switches.h:228

Member Function Documentation

◆ isSuitableFor()

bool ColorSpaceTransformBench::isSuitableFor ( Backend  backend)
inlineoverrideprotectedvirtual

Reimplemented from Benchmark.

Definition at line 44 of file ColorSpaceBench.cpp.

44 {
46 }
const char * backend

◆ onDelayedSetup()

void ColorSpaceTransformBench::onDelayedSetup ( )
inlineoverrideprotectedvirtual

Reimplemented from Benchmark.

Definition at line 51 of file ColorSpaceBench.cpp.

51 {
52 // Set the image buffer to solid white.
53 std::fill(std::begin(fSrcPixels), std::end(fSrcPixels), 0xFF);
54
55 // Create a conversion from sRGB to Adobe.
56 fSRGBCS = SkColorSpace::MakeSRGB();
58
59 fXformSteps = SkColorSpaceXformSteps(fSRGBCS.get(), kPremul_SkAlphaType,
60 fAdobeCS.get(), kPremul_SkAlphaType);
61
62 // Build up a pipeline.
63 fSrcCtx = SkRasterPipeline_MemoryCtx{fSrcPixels, kWidth};
64 fDstCtx = SkRasterPipeline_MemoryCtx{fDstPixels, kWidth};
65
66 fPipeline.append(SkRasterPipelineOp::load_8888, &fSrcCtx);
67 fXformSteps.apply(&fPipeline);
68 fPipeline.append(SkRasterPipelineOp::store_8888, &fDstCtx);
69
70 fConversionPipeline = fPipeline.compile();
71 }
@ kPremul_SkAlphaType
pixel components are premultiplied by alpha
Definition: SkAlphaType.h:29
static sk_sp< SkColorSpace > MakeSRGB()
static sk_sp< SkColorSpace > MakeRGB(const skcms_TransferFunction &transferFn, const skcms_Matrix3x3 &toXYZ)
void append(SkRasterPipelineOp, void *=nullptr)
std::function< void(size_t, size_t, size_t, size_t)> compile() const
T * get() const
Definition: SkRefCnt.h:303
static const char * begin(const StringSlice &s)
Definition: editor.cpp:252
static constexpr skcms_Matrix3x3 kAdobeRGB
Definition: SkColorSpace.h:77
static constexpr skcms_TransferFunction k2Dot2
Definition: SkColorSpace.h:48
void apply(float rgba[4]) const

◆ onDraw()

void ColorSpaceTransformBench::onDraw ( int  loops,
SkCanvas canvas 
)
inlineoverrideprotectedvirtual

Implements Benchmark.

Definition at line 73 of file ColorSpaceBench.cpp.

73 {
74 switch (fMode) {
76 for (int i = 0; i < loops; i++) {
77 fConversionPipeline(0, 0, kWidth, kHeight);
78 }
79 break;
80
82 for (int i = 0; i < loops; i++) {
83 fPipeline.run(0, 0, kWidth, kHeight);
84 }
85 break;
86
88 for (int i = 0; i < loops; i++) {
89 for (int y = 0; y < kHeight; ++y) {
90 fPipeline.run(0, y, kWidth, 1);
91 }
92 }
93 break;
94 }
95 }
@ kMultipleImage
@ kSingleImage
@ kSingleScanline
void run(size_t x, size_t y, size_t w, size_t h) const
double y

◆ onGetName()

const char * ColorSpaceTransformBench::onGetName ( )
inlineoverrideprotectedvirtual

Implements Benchmark.

Definition at line 40 of file ColorSpaceBench.cpp.

40 {
41 return fName.c_str();
42 }

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