Flutter Engine
The Flutter Engine
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
Protected Member Functions | List of all members
CTMPathEffectGM Class Reference
Inheritance diagram for CTMPathEffectGM:
skiagm::GM

Protected Member Functions

SkString getName () const override
 
SkISize getISize () override
 
DrawResult onGpuSetup (SkCanvas *canvas, SkString *, GraphiteTestContext *) 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
 
- 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
 
- Static Public Attributes inherited from skiagm::GM
static constexpr char kErrorMsg_DrawSkippedGpuOnly []
 

Detailed Description

Definition at line 245 of file patheffects.cpp.

Member Function Documentation

◆ getISize()

SkISize CTMPathEffectGM::getISize ( )
inlineoverrideprotectedvirtual

Implements skiagm::GM.

Definition at line 249 of file patheffects.cpp.

249{ return SkISize::Make(800, 600); }
static constexpr SkISize Make(int32_t w, int32_t h)
Definition: SkSize.h:20

◆ getName()

SkString CTMPathEffectGM::getName ( ) const
inlineoverrideprotectedvirtual

Implements skiagm::GM.

Definition at line 247 of file patheffects.cpp.

247{ return SkString("ctmpatheffect"); }

◆ onDraw()

void CTMPathEffectGM::onDraw ( SkCanvas canvas)
inlineoverrideprotectedvirtual

Reimplemented from skiagm::GM.

Definition at line 257 of file patheffects.cpp.

257 {
258 const float strokeWidth = 16;
259 const float pxInflate = 0.5f;
260 sk_sp<SkPathEffect> pathEffect(new StrokeLineInflated(strokeWidth, pxInflate));
261
262 SkPath path;
263 path.moveTo(100, 100);
264 path.lineTo(200, 200);
265
266 // Draw the inflated path, and a scaled version, in blue.
268 paint.setAntiAlias(true);
269 paint.setColor(SkColorSetA(SK_ColorBLUE, 0xff));
270 paint.setPathEffect(pathEffect);
271 canvas->drawPath(path, paint);
272 canvas->save();
273 canvas->translate(150, 0);
274 canvas->scale(2.5, 0.5f);
275 canvas->drawPath(path, paint);
276 canvas->restore();
277
278 // Draw the regular stroked version on top in green.
279 // The inflated version should be visible underneath as a blue "border".
280 paint.setPathEffect(nullptr);
282 paint.setStrokeWidth(strokeWidth);
283 paint.setColor(SkColorSetA(SK_ColorGREEN, 0xff));
284 canvas->drawPath(path, paint);
285 canvas->save();
286 canvas->translate(150, 0);
287 canvas->scale(2.5, 0.5f);
288 canvas->drawPath(path, paint);
289 canvas->restore();
290 }
static const int strokeWidth
Definition: BlurTest.cpp:60
constexpr SkColor SK_ColorBLUE
Definition: SkColor.h:135
static constexpr SkColor SkColorSetA(SkColor c, U8CPU a)
Definition: SkColor.h:82
constexpr SkColor SK_ColorGREEN
Definition: SkColor.h:131
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
void scale(SkScalar sx, SkScalar sy)
Definition: SkCanvas.cpp:1289
@ kStroke_Style
set to stroke geometry
Definition: SkPaint.h:194
Definition: SkPath.h:59
const Paint & paint
Definition: color_source.cc:38
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir path
Definition: switches.h:57

◆ onGpuSetup()

DrawResult CTMPathEffectGM::onGpuSetup ( SkCanvas canvas,
SkString ,
GraphiteTestContext  
)
inlineoverrideprotectedvirtual

Reimplemented from skiagm::GM.

Definition at line 252 of file patheffects.cpp.

252 {
253 auto dctx = GrAsDirectContext(canvas->recordingContext());
254 return dctx == nullptr ? DrawResult::kOk : DrawResult::kSkip;
255 }
static GrDirectContext * GrAsDirectContext(GrContext_Base *base)
virtual GrRecordingContext * recordingContext() const
Definition: SkCanvas.cpp:1637

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