Flutter Engine
The Flutter Engine
Public Member Functions | List of all members
DM::MSKPSrc Class Reference

#include <DMSrcSink.h>

Inheritance diagram for DM::MSKPSrc:
DM::Src

Public Member Functions

 MSKPSrc (Path path)
 
int pageCount () const override
 
Result draw (SkCanvas *c, GraphiteTestContext *) const override
 
Result draw (int, SkCanvas *, GraphiteTestContext *) const override
 
SkISize size () const override
 
SkISize size (int) const override
 
Name name () const override
 
- Public Member Functions inherited from DM::Src
virtual ~Src ()
 
virtual Result draw (SkCanvas *canvas, GraphiteTestContext *) const =0
 
virtual SkISize size () const =0
 
virtual Name name () const =0
 
virtual void modifyGrContextOptions (GrContextOptions *) const
 
virtual void modifyGraphiteContextOptions (skgpu::graphite::ContextOptions *) const
 
virtual bool veto (SinkFlags) const
 
virtual int pageCount () const
 
virtual Result draw (int page, SkCanvas *canvas, GraphiteTestContext *graphiteTestContext) const
 
virtual SkISize size (int page) const
 
virtual bool serial () const
 

Additional Inherited Members

- Public Types inherited from DM::Src
using GraphiteTestContext = skiatest::graphite::GraphiteTestContext
 

Detailed Description

Definition at line 340 of file DMSrcSink.h.

Constructor & Destructor Documentation

◆ MSKPSrc()

DM::MSKPSrc::MSKPSrc ( Path  path)
explicit

Definition at line 1428 of file DMSrcSink.cpp.

1428 : fPath(path) {
1429 std::unique_ptr<SkStreamAsset> stream = SkStream::MakeFromFile(fPath.c_str());
1431 if (count > 0) {
1432 fPages.reset(count);
1434 fPages.size()));
1435 }
1436}
int count
Definition: FontMgrTest.cpp:50
#define SkASSERT_RELEASE(cond)
Definition: SkAssert.h:100
static std::unique_ptr< SkStreamAsset > MakeFromFile(const char path[])
Definition: SkStream.cpp:922
const char * c_str() const
Definition: SkString.h:133
void reset(int n)
Definition: SkTArray.h:144
int size() const
Definition: SkTArray.h:421
SK_API int ReadPageCount(SkStreamSeekable *src)
bool ReadPageSizes(SkStreamSeekable *stream, SkDocumentPage *dstArray, int dstArrayCount)
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

Member Function Documentation

◆ draw() [1/2]

Result DM::MSKPSrc::draw ( int  i,
SkCanvas canvas,
GraphiteTestContext  
) const
overridevirtual

Reimplemented from DM::Src.

Definition at line 1448 of file DMSrcSink.cpp.

1448 {
1449 if (this->pageCount() == 0) {
1450 return Result::Fatal("Unable to parse MultiPictureDocument file: %s", fPath.c_str());
1451 }
1452 if (i >= fPages.size() || i < 0) {
1453 return Result::Fatal("MultiPictureDocument page number out of range: %d", i);
1454 }
1455 SkPicture* page = fPages[i].fPicture.get();
1456 if (!page) {
1457 std::unique_ptr<SkStreamAsset> stream = SkStream::MakeFromFile(fPath.c_str());
1458 if (!stream) {
1459 return Result::Fatal("Unable to open file: %s", fPath.c_str());
1460 }
1461 if (!SkMultiPictureDocument::Read(stream.get(), &fPages[0], fPages.size())) {
1462 return Result::Fatal("SkMultiPictureDocument reader failed on page %d: %s", i,
1463 fPath.c_str());
1464 }
1465 page = fPages[i].fPicture.get();
1466 }
1467 canvas->drawPicture(page);
1468 return Result::Ok();
1469}
int pageCount() const override
Definition: DMSrcSink.cpp:1438
static Result Ok()
Definition: DMSrcSink.h:50
static Result Fatal(const char *fmt,...) SK_PRINTF_LIKE(1
void drawPicture(const SkPicture *picture)
Definition: SkCanvas.h:1961
SK_API bool Read(SkStreamSeekable *src, SkDocumentPage *dstArray, int dstArrayCount, const SkDeserialProcs *=nullptr)

◆ draw() [2/2]

Result DM::MSKPSrc::draw ( SkCanvas c,
GraphiteTestContext testContext 
) const
overridevirtual

Implements DM::Src.

Definition at line 1445 of file DMSrcSink.cpp.

1445 {
1446 return this->draw(FLAGS_mskpFrame, c, testContext);
1447}
Result draw(SkCanvas *c, GraphiteTestContext *) const override
Definition: DMSrcSink.cpp:1445

◆ name()

Name DM::MSKPSrc::name ( ) const
overridevirtual

Implements DM::Src.

Definition at line 1471 of file DMSrcSink.cpp.

1471{ return SkOSPath::Basename(fPath.c_str()); }
static SkString Basename(const char *fullPath)
Definition: SkOSPath.cpp:23

◆ pageCount()

int DM::MSKPSrc::pageCount ( ) const
overridevirtual

Reimplemented from DM::Src.

Definition at line 1438 of file DMSrcSink.cpp.

1438{ return fPages.size(); }

◆ size() [1/2]

SkISize DM::MSKPSrc::size ( ) const
overridevirtual

Implements DM::Src.

Definition at line 1440 of file DMSrcSink.cpp.

1440{ return this->size(FLAGS_mskpFrame); }
SkISize size() const override
Definition: DMSrcSink.cpp:1440

◆ size() [2/2]

SkISize DM::MSKPSrc::size ( int  i) const
overridevirtual

Reimplemented from DM::Src.

Definition at line 1441 of file DMSrcSink.cpp.

1441 {
1442 return i >= 0 && i < fPages.size() ? fPages[i].fSize.toCeil() : SkISize{0, 0};
1443}
Definition: SkSize.h:16

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