Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Member Functions | List of all members
flutter::testing::SkRenderResult Class Referencefinal
Inheritance diagram for flutter::testing::SkRenderResult:
flutter::testing::RenderResult

Public Member Functions

 SkRenderResult (const sk_sp< SkSurface > &surface, bool take_snapshot=false)
 
 ~SkRenderResult () override
 
sk_sp< SkImageimage () const override
 
int width () const override
 
int height () const override
 
const uint32_t * addr32 (int x, int y) const override
 
void write (const std::string &path) const
 
- Public Member Functions inherited from flutter::testing::RenderResult
virtual ~RenderResult ()=default
 

Detailed Description

Definition at line 378 of file dl_rendering_unittests.cc.

Constructor & Destructor Documentation

◆ SkRenderResult()

flutter::testing::SkRenderResult::SkRenderResult ( const sk_sp< SkSurface > &  surface,
bool  take_snapshot = false 
)
inlineexplicit

Definition at line 380 of file dl_rendering_unittests.cc.

381 {
382 SkImageInfo info = surface->imageInfo();
383 info = SkImageInfo::MakeN32Premul(info.dimensions());
384 addr_ = malloc(info.computeMinByteSize() * info.height());
385 pixmap_.reset(info, addr_, info.minRowBytes());
386 surface->readPixels(pixmap_, 0, 0);
387 if (take_snapshot) {
388 image_ = surface->makeImageSnapshot();
389 }
390 }
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
Definition DM.cpp:213
void reset()
Definition SkPixmap.cpp:32
VkSurfaceKHR surface
Definition main.cc:49
void * malloc(size_t size)
Definition allocation.cc:19
static SkImageInfo MakeN32Premul(int width, int height)

◆ ~SkRenderResult()

flutter::testing::SkRenderResult::~SkRenderResult ( )
inlineoverride

Definition at line 391 of file dl_rendering_unittests.cc.

391{ free(addr_); }

Member Function Documentation

◆ addr32()

const uint32_t * flutter::testing::SkRenderResult::addr32 ( int  x,
int  y 
) const
inlineoverridevirtual

Implements flutter::testing::RenderResult.

Definition at line 396 of file dl_rendering_unittests.cc.

396 {
397 return pixmap_.addr32(x, y);
398 }
const uint32_t * addr32() const
Definition SkPixmap.h:352
double y
double x

◆ height()

int flutter::testing::SkRenderResult::height ( ) const
inlineoverridevirtual

Implements flutter::testing::RenderResult.

Definition at line 395 of file dl_rendering_unittests.cc.

395{ return pixmap_.height(); }
int height() const
Definition SkPixmap.h:166

◆ image()

sk_sp< SkImage > flutter::testing::SkRenderResult::image ( ) const
inlineoverridevirtual

Implements flutter::testing::RenderResult.

Definition at line 393 of file dl_rendering_unittests.cc.

393{ return image_; }

◆ width()

int flutter::testing::SkRenderResult::width ( ) const
inlineoverridevirtual

Implements flutter::testing::RenderResult.

Definition at line 394 of file dl_rendering_unittests.cc.

394{ return pixmap_.width(); }
int width() const
Definition SkPixmap.h:160

◆ write()

void flutter::testing::SkRenderResult::write ( const std::string &  path) const
inlinevirtual

Implements flutter::testing::RenderResult.

Definition at line 399 of file dl_rendering_unittests.cc.

399 {
400 auto stream = SkFILEWStream(path.c_str());
402 SkPngEncoder::Encode(&stream, pixmap_, options);
403 stream.flush();
404 }
const char * options
SK_API bool Encode(SkWStream *dst, const SkPixmap &src, const Options &options)
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

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