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

Public Member Functions

 BigTileImageFilterGM ()
 
- 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 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 42 of file bigtileimagefilter.cpp.

Constructor & Destructor Documentation

◆ BigTileImageFilterGM()

skiagm::BigTileImageFilterGM::BigTileImageFilterGM ( )
inline

Definition at line 44 of file bigtileimagefilter.cpp.

44 {
45 this->setBGColor(0xFF000000);
46 }
void setBGColor(SkColor)
Definition: gm.cpp:159

Member Function Documentation

◆ getISize()

SkISize skiagm::BigTileImageFilterGM::getISize ( )
inlineoverrideprotectedvirtual

Implements skiagm::GM.

Definition at line 51 of file bigtileimagefilter.cpp.

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

◆ getName()

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

Implements skiagm::GM.

Definition at line 49 of file bigtileimagefilter.cpp.

49{ return SkString("bigtileimagefilter"); }

◆ onDraw()

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

Reimplemented from skiagm::GM.

Definition at line 58 of file bigtileimagefilter.cpp.

58 {
59 canvas->clear(SK_ColorBLACK);
60
61 {
62 SkPaint p;
63
64 const SkRect bound = SkRect::MakeIWH(kWidth, kHeight);
65 sk_sp<SkImageFilter> imageSource(SkImageFilters::Image(fRedImage,
67
69 SkRect::MakeIWH(kBitmapSize, kBitmapSize), SkRect::MakeIWH(kWidth, kHeight),
70 std::move(imageSource)));
71
72 p.setImageFilter(std::move(tif));
73
74 canvas->saveLayer(&bound, &p);
75 canvas->restore();
76 }
77
78 {
79 SkPaint p2;
80
81 const SkRect bound2 = SkRect::MakeIWH(kBitmapSize, kBitmapSize);
82
84 SkRect::MakeIWH(kBitmapSize, kBitmapSize),
85 SkRect::MakeIWH(kBitmapSize, kBitmapSize),
86 nullptr));
87
88 p2.setImageFilter(std::move(tif));
89
90 canvas->translate(320, 320);
91 canvas->saveLayer(&bound2, &p2);
92 canvas->setMatrix(SkMatrix::I());
93
94 SkRect bound3 = SkRect::MakeXYWH(320, 320,
95 SkIntToScalar(kBitmapSize),
96 SkIntToScalar(kBitmapSize));
97 canvas->drawImageRect(fGreenImage.get(), bound2, bound3, SkSamplingOptions(), nullptr,
99 canvas->restore();
100 }
101 }
constexpr SkColor SK_ColorBLACK
Definition: SkColor.h:103
#define SkIntToScalar(x)
Definition: SkScalar.h:57
int saveLayer(const SkRect *bounds, const SkPaint *paint)
Definition: SkCanvas.cpp:496
void restore()
Definition: SkCanvas.cpp:461
void translate(SkScalar dx, SkScalar dy)
Definition: SkCanvas.cpp:1278
@ kStrict_SrcRectConstraint
sample only inside bounds; slower
Definition: SkCanvas.h:1542
void clear(SkColor color)
Definition: SkCanvas.h:1199
void drawImageRect(const SkImage *, const SkRect &src, const SkRect &dst, const SkSamplingOptions &, const SkPaint *, SrcRectConstraint)
Definition: SkCanvas.cpp:2333
void setMatrix(const SkM44 &matrix)
Definition: SkCanvas.cpp:1349
static sk_sp< SkImageFilter > Image(sk_sp< SkImage > image, const SkRect &srcRect, const SkRect &dstRect, const SkSamplingOptions &sampling)
static sk_sp< SkImageFilter > Tile(const SkRect &src, const SkRect &dst, sk_sp< SkImageFilter > input)
static const SkMatrix & I()
Definition: SkMatrix.cpp:1544
void setImageFilter(sk_sp< SkImageFilter > imageFilter)
T * get() const
Definition: SkRefCnt.h:303
static SkRect MakeIWH(int w, int h)
Definition: SkRect.h:623
static constexpr SkRect MakeXYWH(float x, float y, float w, float h)
Definition: SkRect.h:659

◆ onOnceBeforeDraw()

void skiagm::BigTileImageFilterGM::onOnceBeforeDraw ( )
inlineoverrideprotectedvirtual

Reimplemented from skiagm::GM.

Definition at line 53 of file bigtileimagefilter.cpp.

53 {
54 fRedImage = create_circle_texture(kBitmapSize, SK_ColorRED);
55 fGreenImage = create_circle_texture(kBitmapSize, SK_ColorGREEN);
56 }
constexpr SkColor SK_ColorRED
Definition: SkColor.h:126
constexpr SkColor SK_ColorGREEN
Definition: SkColor.h:131
static sk_sp< SkImage > create_circle_texture(int size, SkColor color)

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