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

Public Member Functions

 SkcmsTransformBench (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 120 of file ColorSpaceBench.cpp.

Constructor & Destructor Documentation

◆ SkcmsTransformBench()

SkcmsTransformBench::SkcmsTransformBench ( Mode  mode)
inline

Definition at line 122 of file ColorSpaceBench.cpp.

122 : fMode(mode) {
123 fName = std::string("Skcms") + mode_name(fMode) + "Transform";
124 }
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 SkcmsTransformBench::isSuitableFor ( Backend  backend)
inlineoverrideprotectedvirtual

Reimplemented from Benchmark.

Definition at line 131 of file ColorSpaceBench.cpp.

131 {
133 }
const char * backend

◆ onDelayedSetup()

void SkcmsTransformBench::onDelayedSetup ( )
inlineoverrideprotectedvirtual

Reimplemented from Benchmark.

Definition at line 138 of file ColorSpaceBench.cpp.

138 {
139 // Set the image buffer to solid white. NANs/denorms might affect timing, but otherwise it
140 // doesn't really matter.
141 std::fill(std::begin(fSrcPixels), std::end(fSrcPixels), 0xFF);
142
143 // Create profiles for sRGB to Adobe.
144 SkColorSpace::MakeSRGB()->toProfile(&fSRGBProfile);
146 SkNamedGamut::kAdobeRGB)->toProfile(&fAdobeProfile);
147 }
void toProfile(skcms_ICCProfile *) const
static sk_sp< SkColorSpace > MakeSRGB()
static sk_sp< SkColorSpace > MakeRGB(const skcms_TransferFunction &transferFn, const skcms_Matrix3x3 &toXYZ)
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

◆ onDraw()

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

Implements Benchmark.

Definition at line 149 of file ColorSpaceBench.cpp.

149 {
150 switch (fMode) {
153
155 for (int i = 0; i < loops; i++) {
156 skcms_Transform(fSrcPixels,
159 &fSRGBProfile,
160 fDstPixels,
163 &fAdobeProfile,
164 kWidth * kHeight);
165 }
166 break;
167
169 for (int i = 0; i < loops; i++) {
170 uint8_t* src = fSrcPixels;
171 uint8_t* dst = fDstPixels;
172 for (int y = 0; y < kHeight; ++y) {
176 &fSRGBProfile,
177 dst,
180 &fAdobeProfile,
181 kWidth);
182 src += kWidth * kBytesPerPixel;
183 dst += kWidth * kBytesPerPixel;
184 }
185 }
186 break;
187 }
188 }
@ kMultipleImage
@ kSingleImage
@ kSingleScanline
#define SkUNREACHABLE
Definition: SkAssert.h:135
double y
dst
Definition: cp.py:12
bool skcms_Transform(const void *src, skcms_PixelFormat srcFmt, skcms_AlphaFormat srcAlpha, const skcms_ICCProfile *srcProfile, void *dst, skcms_PixelFormat dstFmt, skcms_AlphaFormat dstAlpha, const skcms_ICCProfile *dstProfile, size_t nz)
Definition: skcms.cc:2495
@ skcms_PixelFormat_RGBA_8888
Definition: skcms_public.h:287
@ skcms_AlphaFormat_PremulAsEncoded
Definition: skcms_public.h:341

◆ onGetName()

const char * SkcmsTransformBench::onGetName ( )
inlineoverrideprotectedvirtual

Implements Benchmark.

Definition at line 127 of file ColorSpaceBench.cpp.

127 {
128 return fName.c_str();
129 }

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