Flutter Engine
The Flutter Engine
Public Member Functions | Protected Member Functions | List of all members
ImageFiltersTextBaseGM Class Referenceabstract
Inheritance diagram for ImageFiltersTextBaseGM:
skiagm::GM ImageFiltersText_CF ImageFiltersText_IF

Public Member Functions

 ImageFiltersTextBaseGM (const char suffix[])
 
- 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 drawWaterfall (SkCanvas *canvas, const SkPaint &paint)
 
virtual void installFilter (SkPaint *paint)=0
 
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 226 of file imagefiltersbase.cpp.

Constructor & Destructor Documentation

◆ ImageFiltersTextBaseGM()

ImageFiltersTextBaseGM::ImageFiltersTextBaseGM ( const char  suffix[])
inline

Definition at line 229 of file imagefiltersbase.cpp.

229: fSuffix(suffix) {}

Member Function Documentation

◆ drawWaterfall()

void ImageFiltersTextBaseGM::drawWaterfall ( SkCanvas canvas,
const SkPaint paint 
)
inlineprotected

Definition at line 240 of file imagefiltersbase.cpp.

240 {
241 static const SkFont::Edging kEdgings[3] = {
245 };
247
248 SkAutoCanvasRestore acr(canvas, true);
249 for (SkFont::Edging edging : kEdgings) {
250 font.setEdging(edging);
251 canvas->drawString("Hamburgefon", 0, 0, font, paint);
252 canvas->translate(0, 40);
253 }
254 }
void translate(SkScalar dx, SkScalar dy)
Definition: SkCanvas.cpp:1278
void drawString(const char str[], SkScalar x, SkScalar y, const SkFont &font, const SkPaint &paint)
Definition: SkCanvas.h:1803
Definition: SkFont.h:35
Edging
Definition: SkFont.h:39
@ kAntiAlias
may have transparent pixels on glyph edges
@ kAlias
no transparent pixels on glyph edges
@ kSubpixelAntiAlias
glyph positioned in pixel using transparency
const Paint & paint
Definition: color_source.cc:38
sk_sp< SkTypeface > DefaultPortableTypeface()
font
Font Metadata and Metrics.

◆ getISize()

SkISize ImageFiltersTextBaseGM::getISize ( )
inlineoverrideprotectedvirtual

Implements skiagm::GM.

Definition at line 238 of file imagefiltersbase.cpp.

238{ return SkISize::Make(512, 342); }
static constexpr SkISize Make(int32_t w, int32_t h)
Definition: SkSize.h:20

◆ getName()

SkString ImageFiltersTextBaseGM::getName ( ) const
inlineoverrideprotectedvirtual

Implements skiagm::GM.

Definition at line 232 of file imagefiltersbase.cpp.

232 {
234 name.printf("%s_%s", "textfilter", fSuffix.c_str());
235 return name;
236 }
const char * c_str() const
Definition: SkString.h:133
DEF_SWITCHES_START aot vmservice shared library name
Definition: switches.h:32

◆ installFilter()

virtual void ImageFiltersTextBaseGM::installFilter ( SkPaint paint)
protectedpure virtual

◆ onDraw()

void ImageFiltersTextBaseGM::onDraw ( SkCanvas canvas)
inlineoverrideprotectedvirtual

Reimplemented from skiagm::GM.

Definition at line 258 of file imagefiltersbase.cpp.

258 {
259 canvas->translate(20, 40);
260
261 for (int doSaveLayer = 0; doSaveLayer <= 1; ++doSaveLayer) {
262 SkAutoCanvasRestore acr(canvas, true);
263 for (int useFilter = 0; useFilter <= 1; ++useFilter) {
264 SkAutoCanvasRestore acr2(canvas, true);
265
267 if (useFilter) {
268 this->installFilter(&paint);
269 }
270 if (doSaveLayer) {
271 canvas->saveLayer(nullptr, &paint);
272 paint.setImageFilter(nullptr);
273 }
274 this->drawWaterfall(canvas, paint);
275
276 acr2.restore();
277 canvas->translate(250, 0);
278 }
279 acr.restore();
280 canvas->translate(0, 200);
281 }
282 }
virtual void installFilter(SkPaint *paint)=0
void drawWaterfall(SkCanvas *canvas, const SkPaint &paint)
int saveLayer(const SkRect *bounds, const SkPaint *paint)
Definition: SkCanvas.cpp:496

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