Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | List of all members
MultiFrameSkp Class Reference
Inheritance diagram for MultiFrameSkp:
SkpProducer

Public Member Functions

 MultiFrameSkp (const std::vector< SkDocumentPage > &frames)
 
int drawAndFlushAndSync (GrDirectContext *context, SkSurface *surface, GpuSync &gpuSync) override
 
sk_sp< SkPictureframe (int n) const
 
int count () const
 
- Public Member Functions inherited from SkpProducer
virtual ~SkpProducer ()
 

Static Public Member Functions

static std::unique_ptr< MultiFrameSkpMakeFromFile (const SkString &path)
 

Detailed Description

Definition at line 169 of file skpbench.cpp.

Constructor & Destructor Documentation

◆ MultiFrameSkp()

MultiFrameSkp::MultiFrameSkp ( const std::vector< SkDocumentPage > &  frames)
inline

Definition at line 171 of file skpbench.cpp.

171: fFrames(frames){}

Member Function Documentation

◆ count()

int MultiFrameSkp::count ( ) const
inline

Definition at line 210 of file skpbench.cpp.

210{ return fFrames.size(); }

◆ drawAndFlushAndSync()

int MultiFrameSkp::drawAndFlushAndSync ( GrDirectContext context,
SkSurface surface,
GpuSync gpuSync 
)
inlineoverridevirtual

Implements SkpProducer.

Definition at line 199 of file skpbench.cpp.

201 {
202 for (int i=0; i<this->count(); i++){
203 draw_skp_and_flush_with_sync(context, surface, this->frame(i).get(), gpuSync);
204 }
205 return this->count();
206 }
int count() const
Definition skpbench.cpp:210
VkSurfaceKHR surface
Definition main.cc:49
double frame
Definition examples.cpp:31
const myers::Point & get(const myers::Segment &)
static void draw_skp_and_flush_with_sync(GrDirectContext *, SkSurface *, const SkPicture *, GpuSync &)
Definition skpbench.cpp:680

◆ frame()

sk_sp< SkPicture > MultiFrameSkp::frame ( int  n) const
inline

Definition at line 208 of file skpbench.cpp.

208{ return fFrames[n].fPicture; }

◆ MakeFromFile()

static std::unique_ptr< MultiFrameSkp > MultiFrameSkp::MakeFromFile ( const SkString path)
inlinestatic

Definition at line 173 of file skpbench.cpp.

173 {
174 // Load the multi frame skp at the given filename.
175 std::unique_ptr<SkStreamAsset> stream = SkStream::MakeFromFile(path.c_str());
176 if (!stream) { return nullptr; }
177
178 // Attempt to deserialize with an image sharing serial proc.
179 auto deserialContext = std::make_unique<SkSharingDeserialContext>();
180 SkDeserialProcs procs;
182 procs.fImageCtx = deserialContext.get();
183
184 // The outer format of multi-frame skps is the multi-picture document, which is a
185 // skp file containing subpictures separated by annotations.
187 if (!page_count) {
188 return nullptr;
189 }
190 std::vector<SkDocumentPage> frames(page_count); // can't call reserve, why?
191 if (!SkMultiPictureDocument::Read(stream.get(), frames.data(), page_count, &procs)) {
192 return nullptr;
193 }
194
195 return std::make_unique<MultiFrameSkp>(frames);
196 }
static std::unique_ptr< SkStreamAsset > MakeFromFile(const char path[])
Definition SkStream.cpp:922
SK_API bool Read(SkStreamSeekable *src, SkDocumentPage *dstArray, int dstArrayCount, const SkDeserialProcs *=nullptr)
SK_API int ReadPageCount(SkStreamSeekable *src)
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
SkDeserialImageProc fImageProc
static sk_sp< SkImage > deserializeImage(const void *data, size_t length, void *ctx)

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