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

Public Types

enum class  DrawType { kCircle , kRect , kRRect }
 
- Public Types inherited from skiagm::GM
enum  Mode { kGM_Mode , kSample_Mode , kBench_Mode }
 
using DrawResult = skiagm::DrawResult
 
using GraphiteTestContext = skiatest::graphite::GraphiteTestContext
 

Public Member Functions

 BlurIgnoreXformGM (DrawType drawType)
 
- 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
 
void drawOverlay (SkCanvas *canvas)
 
- 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

- Static Public Attributes inherited from skiagm::GM
static constexpr char kErrorMsg_DrawSkippedGpuOnly []
 

Detailed Description

Definition at line 29 of file blurignorexform.cpp.

Member Enumeration Documentation

◆ DrawType

enum class BlurIgnoreXformGM::DrawType
strong
Enumerator
kCircle 
kRect 
kRRect 

Definition at line 31 of file blurignorexform.cpp.

31 {
32 kCircle,
33 kRect,
34 kRRect,
35 };
@ kRRect
constexpr std::array< std::array< float, 2 >, 2 > kRect

Constructor & Destructor Documentation

◆ BlurIgnoreXformGM()

BlurIgnoreXformGM::BlurIgnoreXformGM ( DrawType  drawType)
inline

Definition at line 37 of file blurignorexform.cpp.

37: fDrawType(drawType) { }

Member Function Documentation

◆ drawOverlay()

void BlurIgnoreXformGM::drawOverlay ( SkCanvas canvas)
inlineprotected

Definition at line 105 of file blurignorexform.cpp.

105 {
106 canvas->translate(10, 0);
108 canvas->save();
109 for (int i = 0; i < kNumBlurs; ++i) {
110 canvas->drawString(kBlurFlags[i].fName, 100, 0, font, SkPaint());
111 canvas->translate(SkIntToScalar(130), 0);
112 }
113 canvas->restore();
114 for (auto scale : kMatrixScales) {
115 canvas->drawString(scale.fName, 0, 50, font, SkPaint());
116 canvas->translate(0, SkIntToScalar(150));
117 }
118 }
const char * fName
#define SkIntToScalar(x)
Definition: SkScalar.h:57
void restore()
Definition: SkCanvas.cpp:461
void translate(SkScalar dx, SkScalar dy)
Definition: SkCanvas.cpp:1278
int save()
Definition: SkCanvas.cpp:447
void drawString(const char str[], SkScalar x, SkScalar y, const SkFont &font, const SkPaint &paint)
Definition: SkCanvas.h:1803
Definition: SkFont.h:35
SkFont DefaultPortableFont()
font
Font Metadata and Metrics.
const Scalar scale

◆ getISize()

SkISize BlurIgnoreXformGM::getISize ( )
inlineoverrideprotectedvirtual

Implements skiagm::GM.

Definition at line 50 of file blurignorexform.cpp.

50{ return SkISize::Make(375, 475); }
static constexpr SkISize Make(int32_t w, int32_t h)
Definition: SkSize.h:20

◆ getName()

SkString BlurIgnoreXformGM::getName ( ) const
inlineoverrideprotectedvirtual

Implements skiagm::GM.

Definition at line 42 of file blurignorexform.cpp.

42 {
44 name.printf("blur_ignore_xform_%s",
45 DrawType::kCircle == fDrawType ? "circle"
46 : DrawType::kRect == fDrawType ? "rect" : "rrect");
47 return name;
48 }
DEF_SWITCHES_START aot vmservice shared library name
Definition: switches.h:32

◆ onDraw()

void BlurIgnoreXformGM::onDraw ( SkCanvas canvas)
inlineoverrideprotectedvirtual

Reimplemented from skiagm::GM.

Definition at line 61 of file blurignorexform.cpp.

61 {
63 paint.setColor(SK_ColorBLACK);
64 paint.setAntiAlias(true);
65
66 canvas->translate(10, 25);
67 canvas->save();
68 canvas->translate(80, 0);
69 for (size_t i = 0; i < kNumBlurs; ++i) {
70 SkAutoCanvasRestore autoRestore(canvas, true);
71 canvas->translate(SkIntToScalar(i * 150), 0);
72 for (auto scale : kMatrixScales) {
73 canvas->save();
74 canvas->scale(scale.fScale, scale.fScale);
75 static const SkScalar kRadius = 20.0f;
76 SkScalar coord = 50.0f * 1.0f / scale.fScale;
77 SkRect rect = SkRect::MakeXYWH(coord - kRadius , coord - kRadius,
78 2 * kRadius, 2 * kRadius);
80
81 paint.setMaskFilter(fBlurFilters[i]);
82 for (int j = 0; j < 2; ++j) {
83 canvas->save();
84 canvas->translate(10 * (1 - j), 10 * (1 - j));
85 if (DrawType::kCircle == fDrawType) {
86 canvas->drawCircle(coord, coord, kRadius, paint);
87 } else if (DrawType::kRect == fDrawType) {
88 canvas->drawRect(rect, paint);
89 } else {
90 canvas->drawRRect(rrect, paint);
91 }
92 paint.setMaskFilter(nullptr);
93 canvas->restore();
94 }
95 canvas->restore();
96 canvas->translate(0, SkIntToScalar(150));
97 }
98 }
99 canvas->restore();
100 if (kBench_Mode != this->getMode()) {
101 this->drawOverlay(canvas);
102 }
103 }
constexpr SkColor SK_ColorBLACK
Definition: SkColor.h:103
void drawOverlay(SkCanvas *canvas)
void drawRect(const SkRect &rect, const SkPaint &paint)
Definition: SkCanvas.cpp:1673
void drawRRect(const SkRRect &rrect, const SkPaint &paint)
Definition: SkCanvas.cpp:1705
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
static SkRRect MakeRectXY(const SkRect &rect, SkScalar xRad, SkScalar yRad)
Definition: SkRRect.h:180
@ kBench_Mode
Definition: gm.h:121
Mode getMode() const
Definition: gm.h:125
const Paint & paint
Definition: color_source.cc:38
float SkScalar
Definition: extension.cpp:12
SkRRect rrect
Definition: SkRecords.h:232
sk_sp< SkBlender > blender SkRect rect
Definition: SkRecords.h:350
constexpr int kRadius
static constexpr SkRect MakeXYWH(float x, float y, float w, float h)
Definition: SkRect.h:659

◆ onOnceBeforeDraw()

void BlurIgnoreXformGM::onOnceBeforeDraw ( )
inlineoverrideprotectedvirtual

Reimplemented from skiagm::GM.

Definition at line 52 of file blurignorexform.cpp.

52 {
53 for (int i = 0; i < kNumBlurs; ++i) {
54 fBlurFilters[i] = SkMaskFilter::MakeBlur(
57 kBlurFlags[i].fRespectCTM);
58 }
59 }
@ 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 BlurIgnoreXformGM::runAsBench ( ) const
inlineoverrideprotectedvirtual

Reimplemented from skiagm::GM.

Definition at line 40 of file blurignorexform.cpp.

40{ return true; }

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