Flutter Engine
 
Loading...
Searching...
No Matches
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< SkImage > image () 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 392 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 394 of file dl_rendering_unittests.cc.

395 {
396 SkImageInfo info = surface->imageInfo();
397 info = SkImageInfo::MakeN32Premul(info.dimensions());
398 addr_ = malloc(info.computeMinByteSize() * info.height());
399 pixmap_.reset(info, addr_, info.minRowBytes());
400 surface->readPixels(pixmap_, 0, 0);
401 if (take_snapshot) {
402 image_ = surface->makeImageSnapshot();
403 }
404 }
VkSurfaceKHR surface
Definition main.cc:65

References surface.

◆ ~SkRenderResult()

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

Definition at line 405 of file dl_rendering_unittests.cc.

405{ 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 410 of file dl_rendering_unittests.cc.

410 {
411 return pixmap_.addr32(x, y);
412 }
int32_t x
double y

References x, and y.

◆ height()

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

Implements flutter::testing::RenderResult.

Definition at line 409 of file dl_rendering_unittests.cc.

409{ return pixmap_.height(); }

◆ image()

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

Implements flutter::testing::RenderResult.

Definition at line 407 of file dl_rendering_unittests.cc.

407{ return image_; }

◆ width()

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

Implements flutter::testing::RenderResult.

Definition at line 408 of file dl_rendering_unittests.cc.

408{ return pixmap_.width(); }

◆ write()

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

Implements flutter::testing::RenderResult.

Definition at line 413 of file dl_rendering_unittests.cc.

413 {
414 auto stream = SkFILEWStream(path.c_str());
415 SkPngEncoder::Options options;
416 SkPngEncoder::Encode(&stream, pixmap_, options);
417 stream.flush();
418 }
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 switch_defs.h:52

References flutter::path.


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