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

Public Member Functions

 ImageBlurClampModeGM ()
 
- 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
 
bool runAsBench () const 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 58 of file imageblurclampmode.cpp.

Constructor & Destructor Documentation

◆ ImageBlurClampModeGM()

skiagm::ImageBlurClampModeGM::ImageBlurClampModeGM ( )
inline

Definition at line 60 of file imageblurclampmode.cpp.

60 {
61 this->setBGColor(0xFFCCCCCC);
62 }
void setBGColor(SkColor)
Definition: gm.cpp:159

Member Function Documentation

◆ getISize()

SkISize skiagm::ImageBlurClampModeGM::getISize ( )
inlineoverrideprotectedvirtual

Implements skiagm::GM.

Definition at line 67 of file imageblurclampmode.cpp.

67{ return SkISize::Make(850, 920); }
static constexpr SkISize Make(int32_t w, int32_t h)
Definition: SkSize.h:20

◆ getName()

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

Implements skiagm::GM.

Definition at line 65 of file imageblurclampmode.cpp.

65{ return SkString("imageblurclampmode"); }

◆ onDraw()

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

Reimplemented from skiagm::GM.

Definition at line 71 of file imageblurclampmode.cpp.

71 {
74
75 canvas->translate(0, 30);
76 // Test different kernel size, including the one to launch 2d Gaussian
77 // blur.
78 for (auto sigma: { 0.6f, 3.0f, 8.0f, 20.0f }) {
79 canvas->save();
80
81 // x-only blur
82 filter = SkImageFilters::Blur(
83 sigma, 0.0f, SkTileMode::kClamp, nullptr, image->bounds());
84 draw_image(canvas, image, std::move(filter));
85 canvas->translate(image->width() + 20, 0);
86
87 // y-only blur
88 filter = SkImageFilters::Blur(
89 0.0f, sigma, SkTileMode::kClamp, nullptr, image->bounds());
90 draw_image(canvas, image, std::move(filter));
91 canvas->translate(image->width() + 20, 0);
92
93 // both directions
94 filter = SkImageFilters::Blur(
95 sigma, sigma, SkTileMode::kClamp, nullptr, image->bounds());
96 draw_image(canvas, image, std::move(filter));
97 canvas->translate(image->width() + 20, 0);
98
99 canvas->restore();
100
101 canvas->translate(0, image->height() + 20);
102 }
103 }
void restore()
Definition: SkCanvas.cpp:461
void translate(SkScalar dx, SkScalar dy)
Definition: SkCanvas.cpp:1278
int save()
Definition: SkCanvas.cpp:447
static sk_sp< SkImageFilter > Blur(SkScalar sigmaX, SkScalar sigmaY, SkTileMode tileMode, sk_sp< SkImageFilter > input, const CropRect &cropRect={})
int width() const
Definition: SkImage.h:285
int height() const
Definition: SkImage.h:291
SkIRect bounds() const
Definition: SkImage.h:303
static void draw_image(SkCanvas *canvas, const sk_sp< SkImage > image, sk_sp< SkImageFilter > filter)
sk_sp< const SkImage > image
Definition: SkRecords.h:269
static sk_sp< SkImage > make_image(SkColorType colorType, SkAlphaType alphaType)

◆ runAsBench()

bool skiagm::ImageBlurClampModeGM::runAsBench ( ) const
inlineoverrideprotectedvirtual

Reimplemented from skiagm::GM.

Definition at line 69 of file imageblurclampmode.cpp.

69{ return true; }

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