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

Public Member Functions

 BouncingTaggedImagesStage (SkSize size)
 
 ~BouncingTaggedImagesStage () override=default
 
void initImages (SkCanvas *canvas)
 
void draw (SkCanvas *canvas) override
 
std::unique_ptr< MMObjectcreateObject () override
 
void reset ()
 
- Public Member Functions inherited from BouncingParticlesStage
 BouncingParticlesStage (SkSize size)
 
bool animate (double nanos) 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 BouncingParticlesStage
SkSize fParticleSize
 
float fMaxVelocity
 
double fLastTime = -1
 
- 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 795 of file MotionMarkSlide.cpp.

Constructor & Destructor Documentation

◆ BouncingTaggedImagesStage()

BouncingTaggedImagesStage::BouncingTaggedImagesStage ( SkSize  size)
inline

Definition at line 797 of file MotionMarkSlide.cpp.

798
799 this->initializeObjects();
800 }
BouncingParticlesStage(SkSize size)
void initializeObjects()
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

◆ ~BouncingTaggedImagesStage()

BouncingTaggedImagesStage::~BouncingTaggedImagesStage ( )
overridedefault

Member Function Documentation

◆ createObject()

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

Implements Stage.

Definition at line 857 of file MotionMarkSlide.cpp.

857 {
858 return std::make_unique<BouncingTaggedImage>(&fRandom, fSize, fParticleSize, fMaxVelocity);
859 }
SkSize fSize
SkRandom fRandom

◆ draw()

void BouncingTaggedImagesStage::draw ( SkCanvas canvas)
inlineoverridevirtual

Reimplemented from Stage.

Definition at line 835 of file MotionMarkSlide.cpp.

835 {
836 if (fNeedToInitImages) {
837 this->initImages(canvas);
838 fNeedToInitImages = false;
839 }
840
841 canvas->clear(SK_ColorWHITE);
842
846 for (size_t i = 0; i < fObjects.size(); ++i) {
847 BouncingTaggedImage* object = reinterpret_cast<BouncingTaggedImage*>(fObjects[i].get());
848
849 canvas->save();
850 canvas->concat(object->transform());
851 canvas->drawImageRect(fImages[i % kImageCount], object->rect(), sampling, nullptr);
852
853 canvas->restore();
854 }
855 }
constexpr SkColor SK_ColorWHITE
Definition: SkColor.h:122
const SkMatrix & transform()
void initImages(SkCanvas *canvas)
void restore()
Definition: SkCanvas.cpp:461
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
int save()
Definition: SkCanvas.cpp:447
void concat(const SkMatrix &matrix)
Definition: SkCanvas.cpp:1318
std::vector< std::unique_ptr< MMObject > > fObjects
const Paint & paint
Definition: color_source.cc:38
SkSamplingOptions sampling
Definition: SkRecords.h:337

◆ initImages()

void BouncingTaggedImagesStage::initImages ( SkCanvas canvas)
inline

Definition at line 804 of file MotionMarkSlide.cpp.

804 {
805 const char* kImageSrcs[kImageCount] = {
806 "images/ducky.jpg",
807 "images/dog.jpg",
808 "images/color_wheel.jpg",
809 "images/mandrill_512_q075.jpg",
810 "images/gainmap_iso21496_1.jpg",
811 };
812
813 auto rContext = canvas->recordingContext();
814#if defined(SK_GRAPHITE)
815 skgpu::graphite::Recorder* recorder = nullptr;
816 recorder = canvas->recorder();
817#endif
818 for (int i = 0; i < kImageCount; ++i) {
819 auto lazyYUV = sk_gpu_test::LazyYUVImage::Make(GetResourceAsData(kImageSrcs[i]),
821 SkASSERT(lazyYUV);
822#if defined(SK_GRAPHITE)
823 if (recorder) {
824 fImages[i] = lazyYUV->refImage(recorder,
826 } else
827#endif
828 {
829 fImages[i] = lazyYUV->refImage(rContext,
831 }
832 }
833 }
sk_sp< SkData > GetResourceAsData(const char *resource)
Definition: Resources.cpp:42
#define SkASSERT(cond)
Definition: SkAssert.h:116
virtual GrRecordingContext * recordingContext() const
Definition: SkCanvas.cpp:1637
virtual skgpu::graphite::Recorder * recorder() const
Definition: SkCanvas.cpp:1641
static std::unique_ptr< LazyYUVImage > Make(sk_sp< SkData > data, skgpu::Mipmapped=skgpu::Mipmapped::kNo, sk_sp< SkColorSpace >=nullptr)
Definition: YUVUtils.cpp:200

◆ reset()

void BouncingTaggedImagesStage::reset ( )
inline

Definition at line 861 of file MotionMarkSlide.cpp.

861 {
862 fNeedToInitImages = true;
863 }

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