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

Public Types

enum  Flag {
  kScale_Flag = 0x01 , kTranslate_Flag = 0x02 , kRotate_Flag = 0x04 , kPerspective_Flag = 0x08 ,
  kUncachedTypeMask_Flag = 0x10
}
 
- Public Types inherited from Benchmark
enum class  Backend {
  kNonRendering , kRaster , kGanesh , kGraphite ,
  kPDF , kHWUI
}
 

Public Member Functions

 InvertMapRectMatrixBench (const char *name, int flags)
 
- Public Member Functions inherited from MatrixBench
 MatrixBench (const char name[])
 
bool isSuitableFor (Backend backend) override
 
virtual void performTest ()=0
 
- 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

void performTest () override
 
- Protected Member Functions inherited from MatrixBench
virtual int mulLoopCount () const
 
const char * onGetName () override
 
void onDraw (int loops, SkCanvas *) 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 ()
 

Detailed Description

Definition at line 102 of file MatrixBench.cpp.

Member Enumeration Documentation

◆ Flag

Enumerator
kScale_Flag 
kTranslate_Flag 
kRotate_Flag 
kPerspective_Flag 
kUncachedTypeMask_Flag 

Definition at line 126 of file MatrixBench.cpp.

Constructor & Destructor Documentation

◆ InvertMapRectMatrixBench()

InvertMapRectMatrixBench::InvertMapRectMatrixBench ( const char *  name,
int  flags 
)
inline

Definition at line 104 of file MatrixBench.cpp.

105 : INHERITED(name)
106 , fFlags(flags) {
107 fMatrix.reset();
108 fIteration = 0;
109 if (flags & kScale_Flag) {
110 fMatrix.postScale(1.5f, 2.5f);
111 }
112 if (flags & kTranslate_Flag) {
113 fMatrix.postTranslate(1.5f, 2.5f);
114 }
115 if (flags & kRotate_Flag) {
116 fMatrix.postRotate(45.0f);
117 }
118 if (flags & kPerspective_Flag) {
119 fMatrix.setPerspX(1.5f);
120 fMatrix.setPerspY(2.5f);
121 }
122 if (0 == (flags & kUncachedTypeMask_Flag)) {
123 fMatrix.getType();
124 }
125 }
SkMatrix & postTranslate(SkScalar dx, SkScalar dy)
Definition: SkMatrix.cpp:281
SkMatrix & postRotate(SkScalar degrees, SkScalar px, SkScalar py)
Definition: SkMatrix.cpp:474
SkMatrix & postScale(SkScalar sx, SkScalar sy, SkScalar px, SkScalar py)
Definition: SkMatrix.cpp:360
SkMatrix & setPerspX(SkScalar v)
Definition: SkMatrix.h:537
SkMatrix & setPerspY(SkScalar v)
Definition: SkMatrix.h:544
SkMatrix & reset()
Definition: SkMatrix.cpp:49
TypeMask getType() const
Definition: SkMatrix.h:207
FlutterSemanticsFlag flags
DEF_SWITCHES_START aot vmservice shared library name
Definition: switches.h:32

Member Function Documentation

◆ performTest()

void InvertMapRectMatrixBench::performTest ( )
inlineoverrideprotectedvirtual

Implements MatrixBench.

Definition at line 134 of file MatrixBench.cpp.

134 {
135 if (fFlags & kUncachedTypeMask_Flag) {
136 // This will invalidate the typemask without
137 // changing the matrix.
138 fMatrix.setPerspX(fMatrix.getPerspX());
139 }
141 bool invertible = fMatrix.invert(&inv);
142 SkASSERT(invertible);
143 SkRect transformedRect;
144 // an arbitrary, small, non-zero rect to transform
146 if (invertible) {
147 inv.mapRect(&transformedRect, srcRect);
148 }
149 }
static SkM44 inv(const SkM44 &m)
Definition: 3d.cpp:26
#define SkASSERT(cond)
Definition: SkAssert.h:116
#define SkIntToScalar(x)
Definition: SkScalar.h:57
bool invert(SkMatrix *inverse) const
Definition: SkMatrix.h:1206
SkScalar getPerspX() const
Definition: SkMatrix.h:458
static constexpr SkRect MakeWH(float w, float h)
Definition: SkRect.h:609

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