Flutter Engine
The Flutter Engine
Public Member Functions | List of all members
CanvasLinePathStage Class Reference
Inheritance diagram for CanvasLinePathStage:
Stage

Public Member Functions

 CanvasLinePathStage (SkSize size)
 
 ~CanvasLinePathStage () override=default
 
void draw (SkCanvas *canvas) override
 
bool animate (double) override
 
std::unique_ptr< MMObjectcreateObject () override
 
- Public Member Functions inherited from Stage
 Stage (SkSize size, int startingObjectCount, int objectIncrement)
 
virtual ~Stage ()=default
 
virtual void draw (SkCanvas *canvas)
 
virtual bool animate (double nanos)
 
virtual bool onChar (SkUnichar uni)
 

Additional Inherited Members

- Protected Member Functions inherited from Stage
virtual std::unique_ptr< MMObjectcreateObject ()=0
 
void initializeObjects ()
 
- Protected Attributes inherited from Stage
SkSize fSize
 
int fStartingObjectCount
 
int fObjectIncrement
 
std::vector< std::unique_ptr< MMObject > > fObjects
 
SkRandom fRandom
 

Detailed Description

Definition at line 562 of file MotionMarkSlide.cpp.

Constructor & Destructor Documentation

◆ CanvasLinePathStage()

CanvasLinePathStage::CanvasLinePathStage ( SkSize  size)
inline

Definition at line 564 of file MotionMarkSlide.cpp.

565 : Stage(size, /*startingObjectCount=*/5000, /*objectIncrement=*/1000) {
566 this->initializeObjects();
567 }
void initializeObjects()
Stage(SkSize size, int startingObjectCount, int objectIncrement)
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
Definition: switches.h:259

◆ ~CanvasLinePathStage()

CanvasLinePathStage::~CanvasLinePathStage ( )
overridedefault

Member Function Documentation

◆ animate()

bool CanvasLinePathStage::animate ( double  )
inlineoverridevirtual

Reimplemented from Stage.

Definition at line 604 of file MotionMarkSlide.cpp.

604 {
605 // Nothing to do, but return true so we redraw.
606 return true;
607 }

◆ createObject()

std::unique_ptr< MMObject > CanvasLinePathStage::createObject ( )
inlineoverridevirtual

Implements Stage.

Definition at line 609 of file MotionMarkSlide.cpp.

609 {
610 if (fObjects.empty()) {
611 return make_line_path(&fRandom, fSize, nullptr);
612 } else {
613 CanvasLinePoint* prevObject = reinterpret_cast<CanvasLinePoint*>(fObjects.back().get());
614 SkPoint coord = prevObject->getCoord();
615 return make_line_path(&fRandom, fSize, &coord);
616 }
617 }
std::unique_ptr< CanvasLinePoint > make_line_path(SkRandom *random, SkSize size, SkPoint *prev)
SkSize fSize
SkRandom fRandom
std::vector< std::unique_ptr< MMObject > > fObjects

◆ draw()

void CanvasLinePathStage::draw ( SkCanvas canvas)
inlineoverridevirtual

Reimplemented from Stage.

Definition at line 571 of file MotionMarkSlide.cpp.

571 {
572 canvas->clear(SK_ColorWHITE);
573
574 SkPath currentPath;
576 paint.setAntiAlias(true);
578 for (size_t i = 0; i < fObjects.size(); ++i) {
579 CanvasLinePoint* object = reinterpret_cast<CanvasLinePoint*>(fObjects[i].get());
580 if (i == 0) {
581 paint.setStrokeWidth(object->getWidth());
582 paint.setColor(object->getColor());
583 currentPath.moveTo(object->getPoint());
584 } else {
585 object->append(&currentPath);
586
587 if (object->isSplit()) {
588 canvas->drawPath(currentPath, paint);
589
590 paint.setStrokeWidth(object->getWidth());
591 paint.setColor(object->getColor());
592 currentPath.reset();
593 currentPath.moveTo(object->getPoint());
594 }
595
596 if (fRandom.nextF() > 0.995) {
597 object->toggleIsSplit();
598 }
599 }
600 }
601 canvas->drawPath(currentPath, paint);
602 }
constexpr SkColor SK_ColorWHITE
Definition: SkColor.h:122
void clear(SkColor color)
Definition: SkCanvas.h:1199
void drawPath(const SkPath &path, const SkPaint &paint)
Definition: SkCanvas.cpp:1747
@ kStroke_Style
set to stroke geometry
Definition: SkPaint.h:194
Definition: SkPath.h:59
SkPath & moveTo(SkScalar x, SkScalar y)
Definition: SkPath.cpp:688
SkPath & reset()
Definition: SkPath.cpp:370
float nextF()
Definition: SkRandom.h:55
const Paint & paint
Definition: color_source.cc:38

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