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

Public Member Functions

 ArbRoundRectBench (bool zeroRad)
 
- 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
 
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 ()
 

Static Protected Member Functions

static void add_corner_arc (SkPath *path, const SkRect &rect, SkScalar xIn, SkScalar yIn, int startAngle)
 
static void make_arb_round_rect (SkPath *path, const SkRect &r, SkScalar xCorner, SkScalar yCorner)
 

Protected Attributes

SkString fName
 

Additional Inherited Members

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

Detailed Description

Definition at line 720 of file PathBench.cpp.

Constructor & Destructor Documentation

◆ ArbRoundRectBench()

ArbRoundRectBench::ArbRoundRectBench ( bool  zeroRad)
inline

Definition at line 725 of file PathBench.cpp.

725 : fZeroRad(zeroRad) {
726 if (zeroRad) {
727 fName.printf("zeroradroundrect");
728 } else {
729 fName.printf("arbroundrect");
730 }
731 }
void printf(const char format[],...) SK_PRINTF_LIKE(2
Definition: SkString.cpp:534

Member Function Documentation

◆ add_corner_arc()

static void ArbRoundRectBench::add_corner_arc ( SkPath path,
const SkRect rect,
SkScalar  xIn,
SkScalar  yIn,
int  startAngle 
)
inlinestaticprotected

Definition at line 738 of file PathBench.cpp.

741 {
742
743 SkScalar rx = std::min(rect.width(), xIn);
744 SkScalar ry = std::min(rect.height(), yIn);
745
746 SkRect arcRect;
747 arcRect.setLTRB(-rx, -ry, rx, ry);
748 switch (startAngle) {
749 case 0:
750 arcRect.offset(rect.fRight - arcRect.fRight, rect.fBottom - arcRect.fBottom);
751 break;
752 case 90:
753 arcRect.offset(rect.fLeft - arcRect.fLeft, rect.fBottom - arcRect.fBottom);
754 break;
755 case 180:
756 arcRect.offset(rect.fLeft - arcRect.fLeft, rect.fTop - arcRect.fTop);
757 break;
758 case 270:
759 arcRect.offset(rect.fRight - arcRect.fRight, rect.fTop - arcRect.fTop);
760 break;
761 default:
762 break;
763 }
764
765 path->arcTo(arcRect, SkIntToScalar(startAngle), SkIntToScalar(90), false);
766 }
#define SkIntToScalar(x)
Definition: SkScalar.h:57
float SkScalar
Definition: extension.cpp:12
static float min(float r, float g, float b)
Definition: hsl.cpp:48
sk_sp< SkBlender > blender SkRect rect
Definition: SkRecords.h:350
SkScalar startAngle
Definition: SkRecords.h:250
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir path
Definition: switches.h:57
SkScalar fBottom
larger y-axis bounds
Definition: extension.cpp:17
SkScalar fLeft
smaller x-axis bounds
Definition: extension.cpp:14
SkScalar fRight
larger x-axis bounds
Definition: extension.cpp:16
void offset(float dx, float dy)
Definition: SkRect.h:1016
void setLTRB(float left, float top, float right, float bottom)
Definition: SkRect.h:865
SkScalar fTop
smaller y-axis bounds
Definition: extension.cpp:15

◆ make_arb_round_rect()

static void ArbRoundRectBench::make_arb_round_rect ( SkPath path,
const SkRect r,
SkScalar  xCorner,
SkScalar  yCorner 
)
inlinestaticprotected

Definition at line 768 of file PathBench.cpp.

769 {
770 // we are lazy here and use the same x & y for each corner
771 add_corner_arc(path, r, xCorner, yCorner, 270);
772 add_corner_arc(path, r, xCorner, yCorner, 0);
773 add_corner_arc(path, r, xCorner, yCorner, 90);
774 add_corner_arc(path, r, xCorner, yCorner, 180);
775 path->close();
776
777 SkASSERT(path->isConvex());
778 }
#define SkASSERT(cond)
Definition: SkAssert.h:116
static void add_corner_arc(SkPath *path, const SkRect &rect, SkScalar xIn, SkScalar yIn, int startAngle)
Definition: PathBench.cpp:738

◆ onDraw()

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

Implements Benchmark.

Definition at line 780 of file PathBench.cpp.

780 {
781 SkRandom rand;
782 SkRect r;
783
784 for (int i = 0; i < loops; ++i) {
786 paint.setColor(0xff000000 | rand.nextU());
787 paint.setAntiAlias(true);
788
789 SkScalar size = rand.nextUScalar1() * 30;
790 if (size < SK_Scalar1) {
791 continue;
792 }
793 r.fLeft = rand.nextUScalar1() * 300;
794 r.fTop = rand.nextUScalar1() * 300;
795 r.fRight = r.fLeft + 2 * size;
796 r.fBottom = r.fTop + 2 * size;
797
798 SkPath temp;
799
800 if (fZeroRad) {
801 make_arb_round_rect(&temp, r, 0, 0);
802
803 SkASSERT(temp.isRect(nullptr));
804 } else {
805 make_arb_round_rect(&temp, r, r.width() / 10, r.height() / 15);
806 }
807
808 canvas->drawPath(temp, paint);
809 }
810 }
#define SK_Scalar1
Definition: SkScalar.h:18
static void make_arb_round_rect(SkPath *path, const SkRect &r, SkScalar xCorner, SkScalar yCorner)
Definition: PathBench.cpp:768
void drawPath(const SkPath &path, const SkPaint &paint)
Definition: SkCanvas.cpp:1747
Definition: SkPath.h:59
bool isRect(SkRect *rect, bool *isClosed=nullptr, SkPathDirection *direction=nullptr) const
Definition: SkPath.cpp:516
uint32_t nextU()
Definition: SkRandom.h:42
SkScalar nextUScalar1()
Definition: SkRandom.h:101
const Paint & paint
Definition: color_source.cc:38
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 keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
Definition: switches.h:259
constexpr float height() const
Definition: SkRect.h:769
constexpr float width() const
Definition: SkRect.h:762

◆ onGetName()

const char * ArbRoundRectBench::onGetName ( )
inlineoverrideprotectedvirtual

Implements Benchmark.

Definition at line 734 of file PathBench.cpp.

734 {
735 return fName.c_str();
736 }
const char * c_str() const
Definition: SkString.h:133

Member Data Documentation

◆ fName

SkString ArbRoundRectBench::fName
protected

Definition at line 722 of file PathBench.cpp.


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