Flutter Engine
The Flutter Engine
Public Member Functions | Protected Member Functions | List of all members
BlurCirclesGM Class Reference
Inheritance diagram for BlurCirclesGM:
skiagm::GM

Public Member Functions

 BlurCirclesGM ()
 
- Public Member Functions inherited from skiagm::GM
 GM (SkColor backgroundColor=SK_ColorWHITE)
 
virtual ~GM ()
 
void setMode (Mode mode)
 
Mode getMode () const
 
DrawResult gpuSetup (SkCanvas *, SkString *errorMsg, GraphiteTestContext *=nullptr)
 
void gpuTeardown ()
 
void onceBeforeDraw ()
 
DrawResult draw (SkCanvas *canvas)
 
DrawResult draw (SkCanvas *, SkString *errorMsg)
 
void drawBackground (SkCanvas *)
 
DrawResult drawContent (SkCanvas *canvas)
 
DrawResult drawContent (SkCanvas *, SkString *errorMsg)
 
virtual SkISize getISize ()=0
 
virtual SkString getName () const =0
 
virtual bool runAsBench () const
 
SkScalar width ()
 
SkScalar height ()
 
SkColor getBGColor () const
 
void setBGColor (SkColor)
 
void drawSizeBounds (SkCanvas *, SkColor)
 
bool animate (double)
 
virtual bool onChar (SkUnichar)
 
bool getControls (SkMetaData *controls)
 
void setControls (const SkMetaData &controls)
 
virtual void modifyGrContextOptions (GrContextOptions *)
 
virtual void modifyGraphiteContextOptions (skgpu::graphite::ContextOptions *) const
 
virtual bool isBazelOnly () const
 
virtual std::map< std::string, std::string > getGoldKeys () const
 

Protected Member Functions

bool runAsBench () const override
 
SkString getName () const override
 
SkISize getISize () override
 
void onOnceBeforeDraw () override
 
void onDraw (SkCanvas *canvas) override
 
- Protected Member Functions inherited from skiagm::GM
virtual DrawResult onGpuSetup (SkCanvas *, SkString *, GraphiteTestContext *)
 
virtual void onGpuTeardown ()
 
virtual void onOnceBeforeDraw ()
 
virtual DrawResult onDraw (SkCanvas *, SkString *errorMsg)
 
virtual void onDraw (SkCanvas *)
 
virtual bool onAnimate (double)
 
virtual bool onGetControls (SkMetaData *)
 
virtual void onSetControls (const SkMetaData &)
 
GraphiteTestContextgraphiteTestContext () const
 

Additional Inherited Members

- Public Types inherited from skiagm::GM
enum  Mode { kGM_Mode , kSample_Mode , kBench_Mode }
 
using DrawResult = skiagm::DrawResult
 
using GraphiteTestContext = skiatest::graphite::GraphiteTestContext
 
- Static Public Attributes inherited from skiagm::GM
static constexpr char kErrorMsg_DrawSkippedGpuOnly []
 

Detailed Description

Definition at line 21 of file blurcircles.cpp.

Constructor & Destructor Documentation

◆ BlurCirclesGM()

BlurCirclesGM::BlurCirclesGM ( )
inline

Definition at line 23 of file blurcircles.cpp.

23{ }

Member Function Documentation

◆ getISize()

SkISize BlurCirclesGM::getISize ( )
inlineoverrideprotectedvirtual

Implements skiagm::GM.

Definition at line 30 of file blurcircles.cpp.

30{ return SkISize::Make(950, 950); }
static constexpr SkISize Make(int32_t w, int32_t h)
Definition: SkSize.h:20

◆ getName()

SkString BlurCirclesGM::getName ( ) const
inlineoverrideprotectedvirtual

Implements skiagm::GM.

Definition at line 28 of file blurcircles.cpp.

28{ return SkString("blurcircles"); }

◆ onDraw()

void BlurCirclesGM::onDraw ( SkCanvas canvas)
inlineoverrideprotectedvirtual

Reimplemented from skiagm::GM.

Definition at line 42 of file blurcircles.cpp.

42 {
43 canvas->scale(1.5f, 1.5f);
44 canvas->translate(50,50);
45
46 const float circleRadii[] = {5.f, 10.f, 25.f, 50.f};
47
48 for (size_t i = 0; i < kNumBlurs; ++i) {
49 SkAutoCanvasRestore autoRestore(canvas, true);
50 canvas->translate(0, 150.f*i);
51 for (size_t j = 0; j < std::size(circleRadii); ++j) {
53 paint.setColor(SK_ColorBLACK);
54 paint.setMaskFilter(fBlurFilters[i]);
55
56 static constexpr SkPoint kCenter = {50.f, 50.f};
57 // Throw a rotation in the mix to make sure GPU fast path handles it correctly.
58 canvas->save();
59 canvas->rotate(j*22.f, kCenter.fX, kCenter.fY);
60 canvas->drawCircle(kCenter, circleRadii[j], paint);
61 canvas->restore();
62 canvas->translate(150.f, 0.f);
63 }
64 }
65 }
constexpr SkColor SK_ColorBLACK
Definition: SkColor.h:103
void restore()
Definition: SkCanvas.cpp:461
void translate(SkScalar dx, SkScalar dy)
Definition: SkCanvas.cpp:1278
void rotate(SkScalar degrees)
Definition: SkCanvas.cpp:1300
int save()
Definition: SkCanvas.cpp:447
void scale(SkScalar sx, SkScalar sy)
Definition: SkCanvas.cpp:1289
void drawCircle(SkScalar cx, SkScalar cy, SkScalar radius, const SkPaint &paint)
Definition: SkCanvas.cpp:2707
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

◆ onOnceBeforeDraw()

void BlurCirclesGM::onOnceBeforeDraw ( )
inlineoverrideprotectedvirtual

Reimplemented from skiagm::GM.

Definition at line 32 of file blurcircles.cpp.

32 {
33 const float blurRadii[kNumBlurs] = {1.f, 5.f, 10.f, 20.f};
34
35 for (int i = 0; i < kNumBlurs; ++i) {
36 fBlurFilters[i] = SkMaskFilter::MakeBlur(
39 }
40 }
@ kNormal_SkBlurStyle
fuzzy inside and outside
Definition: SkBlurTypes.h:12
static SkScalar SK_SPI ConvertRadiusToSigma(SkScalar radius)
Definition: SkBlurMask.cpp:39
static sk_sp< SkMaskFilter > MakeBlur(SkBlurStyle style, SkScalar sigma, bool respectCTM=true)

◆ runAsBench()

bool BlurCirclesGM::runAsBench ( ) const
inlineoverrideprotectedvirtual

Reimplemented from skiagm::GM.

Definition at line 26 of file blurcircles.cpp.

26{ return true; }

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