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

Public Member Functions

 BigBlursGM ()
 
- 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

SkString getName () const override
 
SkISize getISize () 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 29 of file bigblurs.cpp.

Constructor & Destructor Documentation

◆ BigBlursGM()

skiagm::BigBlursGM::BigBlursGM ( )
inline

Definition at line 31 of file bigblurs.cpp.

31 {
32 this->setBGColor(0xFFDDDDDD);
33 }
void setBGColor(SkColor)
Definition: gm.cpp:159

Member Function Documentation

◆ getISize()

SkISize skiagm::BigBlursGM::getISize ( )
inlineoverrideprotectedvirtual

Implements skiagm::GM.

Definition at line 38 of file bigblurs.cpp.

38{ return SkISize::Make(kWidth, kHeight); }
static constexpr SkISize Make(int32_t w, int32_t h)
Definition: SkSize.h:20

◆ getName()

SkString skiagm::BigBlursGM::getName ( ) const
inlineoverrideprotectedvirtual

Implements skiagm::GM.

Definition at line 36 of file bigblurs.cpp.

36{ return SkString("bigblurs"); }

◆ onDraw()

void skiagm::BigBlursGM::onDraw ( SkCanvas canvas)
inlineoverrideprotectedvirtual

Reimplemented from skiagm::GM.

Definition at line 40 of file bigblurs.cpp.

40 {
41 constexpr int kBig = 65536;
43
44 const SkRect bigRect = SkRect::MakeWH(SkIntToScalar(kBig), SkIntToScalar(kBig));
45 SkRect insetRect = bigRect;
46 insetRect.inset(20, 20);
47
48 SkPath rectori = SkPathBuilder().addRect(bigRect)
50 .detach();
51
52 // The blur extends 3*kSigma out from the big rect.
53 // Offset the close-up windows so we get the entire blur
54 const SkScalar kLeftTopPad = 3*kSigma; // use on left & up of big rect
55 const SkScalar kRightBotPad = kCloseUpSize-3*kSigma; // use on right and bot sides
56
57 // UL hand corners of the rendered closeups
58 const SkPoint origins[] = {
59 { -kLeftTopPad, -kLeftTopPad }, // UL
60 { kBig-kRightBotPad, -kLeftTopPad }, // UR
61 { kBig-kRightBotPad, kBig-kRightBotPad }, // LR
62 { -kLeftTopPad, kBig-kRightBotPad }, // LL
63 { kBig/2-kCloseUpSize/2, kBig/2-kCloseUpSize/2 }, // center
64 };
65
66 SkPaint outlinePaint;
67 outlinePaint.setColor(SK_ColorRED);
68 outlinePaint.setStyle(SkPaint::kStroke_Style);
69
70 SkPaint blurPaint;
71 blurPaint.setAntiAlias(true);
72 blurPaint.setColor(SK_ColorBLACK);
73
74 int desiredX = 0, desiredY = 0;
75
76 for (int i = 0; i < 2; ++i) {
77 for (int j = 0; j <= kLastEnum_SkBlurStyle; ++j) {
79
80 for (int k = 0; k < (int)std::size(origins); ++k) {
81 canvas->save();
82
84 SkIntToScalar(desiredY),
85 SkIntToScalar(kCloseUpSize),
86 SkIntToScalar(kCloseUpSize));
87
88 canvas->clipRect(clipRect);
89
90 canvas->translate(desiredX-origins[k].fX,
91 desiredY-origins[k].fY);
92
93 if (0 == i) {
94 canvas->drawRect(bigRect, blurPaint);
95 } else {
96 canvas->drawPath(rectori, blurPaint);
97 }
98 canvas->restore();
99 canvas->drawRect(clipRect, outlinePaint);
100
101 desiredX += kCloseUpSize;
102 }
103
104 desiredX = 0;
105 desiredY += kCloseUpSize;
106 }
107 }
108 }
SkBlurStyle
Definition: SkBlurTypes.h:11
@ kLastEnum_SkBlurStyle
Definition: SkBlurTypes.h:17
constexpr SkColor SK_ColorRED
Definition: SkColor.h:126
constexpr SkColor SK_ColorBLACK
Definition: SkColor.h:103
#define SkIntToScalar(x)
Definition: SkScalar.h:57
static SkScalar SK_SPI ConvertRadiusToSigma(SkScalar radius)
Definition: SkBlurMask.cpp:39
void drawRect(const SkRect &rect, const SkPaint &paint)
Definition: SkCanvas.cpp:1673
void clipRect(const SkRect &rect, SkClipOp op, bool doAntiAlias)
Definition: SkCanvas.cpp:1361
void restore()
Definition: SkCanvas.cpp:461
void translate(SkScalar dx, SkScalar dy)
Definition: SkCanvas.cpp:1278
int save()
Definition: SkCanvas.cpp:447
void drawPath(const SkPath &path, const SkPaint &paint)
Definition: SkCanvas.cpp:1747
static sk_sp< SkMaskFilter > MakeBlur(SkBlurStyle style, SkScalar sigma, bool respectCTM=true)
void setStyle(Style style)
Definition: SkPaint.cpp:105
void setColor(SkColor color)
Definition: SkPaint.cpp:119
void setAntiAlias(bool aa)
Definition: SkPaint.h:170
@ kStroke_Style
set to stroke geometry
Definition: SkPaint.h:194
void setMaskFilter(sk_sp< SkMaskFilter > maskFilter)
SkPathBuilder & addRect(const SkRect &, SkPathDirection, unsigned startIndex)
Definition: SkPath.h:59
float SkScalar
Definition: extension.cpp:12
clipRect(r.rect, r.opAA.op(), r.opAA.aa())) template<> void Draw
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
void inset(float dx, float dy)
Definition: SkRect.h:1060
static constexpr SkRect MakeXYWH(float x, float y, float w, float h)
Definition: SkRect.h:659
static constexpr SkRect MakeWH(float w, float h)
Definition: SkRect.h:609

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