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

#include <DMSrcSink.h>

Inheritance diagram for DM::RasterSink:
DM::Sink

Public Member Functions

 RasterSink (SkColorType)
 
Result draw (const Src &, SkBitmap *, SkWStream *, SkString *) const override
 
const char * fileExtension () const override
 
SinkFlags flags () const override
 
void setColorSpace (sk_sp< SkColorSpace > colorSpace) override
 
SkColorInfo colorInfo () const override
 
- Public Member Functions inherited from DM::Sink
virtual ~Sink ()
 
virtual Result draw (const Src &, SkBitmap *, SkWStream *, SkString *log) const =0
 
virtual void setColorSpace (sk_sp< SkColorSpace >)
 
virtual bool serial () const
 
virtual const char * fileExtension () const =0
 
virtual SinkFlags flags () const =0
 
virtual SkColorInfo colorInfo () const
 

Detailed Description

Definition at line 515 of file DMSrcSink.h.

Constructor & Destructor Documentation

◆ RasterSink()

DM::RasterSink::RasterSink ( SkColorType  colorType)
explicit

Definition at line 2120 of file DMSrcSink.cpp.

2121 : fColorType(colorType) {}
static SkColorType colorType(AImageDecoder *decoder, const AImageDecoderHeaderInfo *headerInfo)

Member Function Documentation

◆ colorInfo()

SkColorInfo DM::RasterSink::colorInfo ( ) const
inlineoverridevirtual

Returns the color type and space used by the sink.

Reimplemented from DM::Sink.

Definition at line 524 of file DMSrcSink.h.

524 {
525 // If there's an appropriate alpha type for this color type, use it, otherwise use premul.
527 (void)SkColorTypeValidateAlphaType(fColorType, alphaType, &alphaType);
528
529 return SkColorInfo(fColorType, alphaType, fColorSpace);
530 }
SkAlphaType
Definition: SkAlphaType.h:26
@ kPremul_SkAlphaType
pixel components are premultiplied by alpha
Definition: SkAlphaType.h:29
SK_API bool SkColorTypeValidateAlphaType(SkColorType colorType, SkAlphaType alphaType, SkAlphaType *canonical=nullptr)

◆ draw()

Result DM::RasterSink::draw ( const Src src,
SkBitmap dst,
SkWStream ,
SkString  
) const
overridevirtual

Implements DM::Sink.

Definition at line 2123 of file DMSrcSink.cpp.

2123 {
2124 const SkISize size = src.size();
2125 if (size.isEmpty()) {
2126 return Result(Result::Status::Skip,
2127 SkStringPrintf("Skipping empty source: %s", src.name().c_str()));
2128 }
2129
2130 dst->allocPixelsFlags(SkImageInfo::Make(size, this->colorInfo()),
2132
2133 SkSurfaceProps props(/*flags=*/0, kRGB_H_SkPixelGeometry);
2134 auto surface = SkSurfaces::WrapPixels(dst->pixmap(), &props);
2135 return src.draw(surface->getCanvas(), /*GraphiteTestContext=*/nullptr);
2136}
SK_API SkString SkStringPrintf(const char *format,...) SK_PRINTF_LIKE(1
Creates a new string and writes into it using a printf()-style format.
@ kRGB_H_SkPixelGeometry
SkColorInfo colorInfo() const override
Definition: DMSrcSink.h:524
@ kZeroPixels_AllocFlag
zero pixel memory. No effect. This is the default.
Definition: SkBitmap.h:435
VkSurfaceKHR surface
Definition: main.cc:49
SK_API sk_sp< SkSurface > WrapPixels(const SkImageInfo &imageInfo, void *pixels, size_t rowBytes, const SkSurfaceProps *surfaceProps=nullptr)
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
dst
Definition: cp.py:12
Definition: SkSize.h:16
static SkImageInfo Make(int width, int height, SkColorType ct, SkAlphaType at)

◆ fileExtension()

const char * DM::RasterSink::fileExtension ( ) const
inlineoverridevirtual

Implements DM::Sink.

Definition at line 520 of file DMSrcSink.h.

520{ return "png"; }

◆ flags()

SinkFlags DM::RasterSink::flags ( ) const
inlineoverridevirtual

Implements DM::Sink.

Definition at line 521 of file DMSrcSink.h.

521{ return SinkFlags{ SinkFlags::kRaster, SinkFlags::kDirect }; }

◆ setColorSpace()

void DM::RasterSink::setColorSpace ( sk_sp< SkColorSpace colorSpace)
inlineoverridevirtual

Reimplemented from DM::Sink.

Definition at line 522 of file DMSrcSink.h.

522{ fColorSpace = colorSpace; }

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