#include <SkPngCodec.h>
|
void | setIdatLength (size_t len) |
|
| ~SkPngCodec () override |
|
virtual | ~SkCodec () |
|
SkImageInfo | getInfo () const |
|
SkISize | dimensions () const |
|
SkIRect | bounds () const |
|
const skcms_ICCProfile * | getICCProfile () const |
|
SkEncodedOrigin | getOrigin () const |
|
SkISize | getScaledDimensions (float desiredScale) const |
|
bool | getValidSubset (SkIRect *desiredSubset) const |
|
SkEncodedImageFormat | getEncodedFormat () const |
|
virtual std::unique_ptr< SkStream > | getEncodedData () const |
|
Result | getPixels (const SkImageInfo &info, void *pixels, size_t rowBytes, const Options *) |
|
Result | getPixels (const SkImageInfo &info, void *pixels, size_t rowBytes) |
|
Result | getPixels (const SkPixmap &pm, const Options *opts=nullptr) |
|
std::tuple< sk_sp< SkImage >, SkCodec::Result > | getImage (const SkImageInfo &info, const Options *opts=nullptr) |
|
std::tuple< sk_sp< SkImage >, SkCodec::Result > | getImage () |
|
bool | queryYUVAInfo (const SkYUVAPixmapInfo::SupportedDataTypes &supportedDataTypes, SkYUVAPixmapInfo *yuvaPixmapInfo) const |
|
Result | getYUVAPlanes (const SkYUVAPixmaps &yuvaPixmaps) |
|
Result | startIncrementalDecode (const SkImageInfo &dstInfo, void *dst, size_t rowBytes, const Options *) |
|
Result | startIncrementalDecode (const SkImageInfo &dstInfo, void *dst, size_t rowBytes) |
|
Result | incrementalDecode (int *rowsDecoded=nullptr) |
|
Result | startScanlineDecode (const SkImageInfo &dstInfo, const Options *options) |
|
Result | startScanlineDecode (const SkImageInfo &dstInfo) |
|
int | getScanlines (void *dst, int countLines, size_t rowBytes) |
|
bool | skipScanlines (int countLines) |
|
SkScanlineOrder | getScanlineOrder () const |
|
int | nextScanline () const |
|
int | outputScanline (int inputScanline) const |
|
int | getFrameCount () |
|
bool | getFrameInfo (int index, FrameInfo *info) const |
|
std::vector< FrameInfo > | getFrameInfo () |
|
int | getRepetitionCount () |
|
|
static bool | IsPng (const void *, size_t) |
|
static std::unique_ptr< SkCodec > | MakeFromStream (std::unique_ptr< SkStream >, Result *, SkPngChunkReader *=nullptr) |
|
static constexpr size_t | MinBufferedBytesNeeded () |
|
static const char * | ResultToString (Result) |
|
static std::unique_ptr< SkCodec > | MakeFromStream (std::unique_ptr< SkStream >, SkSpan< const SkCodecs::Decoder > decoders, Result *=nullptr, SkPngChunkReader *=nullptr, SelectionPolicy selectionPolicy=SelectionPolicy::kPreferStillImage) |
|
static std::unique_ptr< SkCodec > | MakeFromStream (std::unique_ptr< SkStream >, Result *=nullptr, SkPngChunkReader *=nullptr, SelectionPolicy selectionPolicy=SelectionPolicy::kPreferStillImage) |
|
static std::unique_ptr< SkCodec > | MakeFromData (sk_sp< SkData >, SkSpan< const SkCodecs::Decoder > decoders, SkPngChunkReader *=nullptr) |
|
static std::unique_ptr< SkCodec > | MakeFromData (sk_sp< SkData >, SkPngChunkReader *=nullptr) |
|
static void | Register (bool(*peek)(const void *, size_t), std::unique_ptr< SkCodec >(*make)(std::unique_ptr< SkStream >, SkCodec::Result *)) |
|
|
| SkPngCodec (SkEncodedInfo &&, std::unique_ptr< SkStream >, SkPngChunkReader *, void *png_ptr, void *info_ptr, int bitDepth) |
|
Result | onGetPixels (const SkImageInfo &, void *, size_t, const Options &, int *) override |
|
SkEncodedImageFormat | onGetEncodedFormat () const override |
|
bool | onRewind () override |
|
SkSampler * | getSampler (bool createIfNecessary) override |
|
void | applyXformRow (void *dst, const void *src) |
|
voidp | png_ptr () |
|
voidp | info_ptr () |
|
SkSwizzler * | swizzler () |
|
void | initializeXformParams () |
|
bool | processData () |
|
Result | onStartIncrementalDecode (const SkImageInfo &dstInfo, void *pixels, size_t rowBytes, const SkCodec::Options &) override |
|
Result | onIncrementalDecode (int *) override |
|
const SkEncodedInfo & | getEncodedInfo () const |
|
| SkCodec (SkEncodedInfo &&, XformFormat srcFormat, std::unique_ptr< SkStream >, SkEncodedOrigin=kTopLeft_SkEncodedOrigin) |
|
void | setSrcXformFormat (XformFormat pixelFormat) |
|
XformFormat | getSrcXformFormat () const |
|
virtual bool | onGetGainmapInfo (SkGainmapInfo *, std::unique_ptr< SkStream > *) |
|
virtual SkISize | onGetScaledDimensions (float) const |
|
virtual bool | onDimensionsSupported (const SkISize &) |
|
virtual bool | onQueryYUVAInfo (const SkYUVAPixmapInfo::SupportedDataTypes &, SkYUVAPixmapInfo *) const |
|
virtual Result | onGetYUVAPlanes (const SkYUVAPixmaps &) |
|
virtual bool | onGetValidSubset (SkIRect *) const |
|
bool | rewindIfNeeded () |
|
SkStream * | stream () |
|
virtual SkScanlineOrder | onGetScanlineOrder () const |
|
const SkImageInfo & | dstInfo () const |
|
const Options & | options () const |
|
int | currScanline () const |
|
virtual int | onOutputScanline (int inputScanline) const |
|
virtual bool | conversionSupported (const SkImageInfo &dst, bool srcIsOpaque, bool needsColorXform) |
|
virtual bool | usesColorXform () const |
|
void | applyColorXform (void *dst, const void *src, int count) const |
|
bool | colorXform () const |
|
bool | xformOnDecode () const |
|
virtual int | onGetFrameCount () |
|
virtual bool | onGetFrameInfo (int, FrameInfo *) const |
|
virtual int | onGetRepetitionCount () |
|
|
enum | Result {
kSuccess
, kIncompleteInput
, kErrorInInput
, kInvalidConversion
,
kInvalidScale
, kInvalidParameters
, kInvalidInput
, kCouldNotRewind
,
kInternalError
, kUnimplemented
} |
|
enum class | SelectionPolicy { kPreferStillImage
, kPreferAnimation
} |
|
enum | ZeroInitialized { kYes_ZeroInitialized
, kNo_ZeroInitialized
} |
|
enum | SkScanlineOrder { kTopDown_SkScanlineOrder
, kBottomUp_SkScanlineOrder
} |
|
static constexpr int | kNoFrame = -1 |
|
static constexpr int | kRepetitionCountInfinite = -1 |
|
using | XformFormat = skcms_PixelFormat |
|
Definition at line 27 of file SkPngCodec.h.
◆ ~SkPngCodec()
SkPngCodec::~SkPngCodec |
( |
| ) |
|
|
override |
Definition at line 1017 of file SkPngCodec.cpp.
1017 {
1018 this->destroyReadStruct();
1019}
◆ SkPngCodec()
Definition at line 1005 of file SkPngCodec.cpp.
1013 , fIdatLength(0)
1014 , fDecodedIdat(false)
1015{}
static skcms_PixelFormat png_select_xform_format(const SkEncodedInfo &info)
static T * SkSafeRef(T *obj)
sk_sp< SkPngChunkReader > fPngChunkReader
◆ applyXformRow()
void SkPngCodec::applyXformRow |
( |
void * |
dst, |
|
|
const void * |
src |
|
) |
| |
|
protected |
Definition at line 486 of file SkPngCodec.cpp.
486 {
487 switch (fXformMode) {
488 case kSwizzleOnly_XformMode:
489 fSwizzler->swizzle(dst, (
const uint8_t*) src);
490 break;
491 case kColorOnly_XformMode:
493 break;
494 case kSwizzleColor_XformMode:
497 break;
498 }
499}
void applyColorXform(void *dst, const void *src, int count) const
std::unique_ptr< SkSwizzler > fSwizzler
◆ decode()
virtual Result SkPngCodec::decode |
( |
int * |
rowsDecoded | ) |
|
|
privatepure virtual |
◆ decodeAllRows()
virtual Result SkPngCodec::decodeAllRows |
( |
void * |
dst, |
|
|
size_t |
rowBytes, |
|
|
int * |
rowsDecoded |
|
) |
| |
|
privatepure virtual |
◆ getSampler()
Return an object which will allow forcing scanline decodes to sample in X.
May create a sampler, if one is not currently being used. Otherwise, does not affect ownership.
Only valid during scanline decoding or incremental decoding.
Reimplemented from SkCodec.
Definition at line 1141 of file SkPngCodec.cpp.
1141 {
1144 }
1145
1146 this->initializeSwizzler(this->
dstInfo(), this->
options(),
true);
1148}
const SkImageInfo & dstInfo() const
const Options & options() const
◆ info_ptr()
voidp SkPngCodec::info_ptr |
( |
| ) |
|
|
inlineprotected |
◆ initializeXformParams()
void SkPngCodec::initializeXformParams |
( |
| ) |
|
|
protected |
Definition at line 1077 of file SkPngCodec.cpp.
1077 {
1078 switch (fXformMode) {
1079 case kColorOnly_XformMode:
1081 break;
1082 case kSwizzleColor_XformMode:
1084 break;
1085 default:
1086 break;
1087 }
1088}
◆ IsPng()
bool SkPngCodec::IsPng |
( |
const void * |
buf, |
|
|
size_t |
bytesRead |
|
) |
| |
|
static |
Definition at line 344 of file SkPngCodec.cpp.
344 {
345 return !png_sig_cmp((png_const_bytep) buf, (png_size_t)0, bytesRead);
346}
◆ MakeFromStream()
Definition at line 1216 of file SkPngCodec.cpp.
1217 {
1221 return nullptr;
1222 }
1226
1229 }
1230 return std::unique_ptr<SkCodec>(outCodec);
1231}
static SkCodec::Result read_header(SkStream *stream, SkPngChunkReader *chunkReader, SkCodec **outCodec, png_structp *png_ptrp, png_infop *info_ptrp)
◆ onGetEncodedFormat()
|
inlineoverrideprotectedvirtual |
◆ onGetPixels()
- Parameters
-
rowsDecoded | When the encoded image stream is incomplete, this function will return kIncompleteInput and rowsDecoded will be set to the number of scanlines that were successfully decoded. This will allow getPixels() to fill the uninitialized memory. |
Implements SkCodec.
Definition at line 1171 of file SkPngCodec.cpp.
1173 {
1177 }
1178
1181 }
1182
1183 this->allocateStorage(
dstInfo);
1186}
virtual Result decodeAllRows(void *dst, size_t rowBytes, int *rowsDecoded)=0
void initializeXformParams()
◆ onIncrementalDecode()
Reimplemented from SkCodec.
Definition at line 1209 of file SkPngCodec.cpp.
1209 {
1210
1212
1213 return this->
decode(rowsDecoded);
1214}
virtual Result decode(int *rowsDecoded)=0
◆ onRewind()
bool SkPngCodec::onRewind |
( |
| ) |
|
|
overrideprotectedvirtual |
Called by rewindIfNeeded, if the stream needed to be rewound.
Subclasses should do any set up needed after a rewind.
Reimplemented from SkCodec.
Definition at line 1150 of file SkPngCodec.cpp.
1150 {
1151
1152
1153
1154
1155
1156 this->destroyReadStruct();
1157
1162 return false;
1163 }
1164
1167 fDecodedIdat = false;
1168 return true;
1169}
◆ onStartIncrementalDecode()
Reimplemented from SkCodec.
Definition at line 1188 of file SkPngCodec.cpp.
1189 {
1193 }
1194
1195 this->allocateStorage(
dstInfo);
1196
1197 int firstRow, lastRow;
1201 } else {
1202 firstRow = 0;
1204 }
1205 this->
setRange(firstRow, lastRow, dst, rowBytes);
1207}
virtual void setRange(int firstRow, int lastRow, void *dst, size_t rowBytes)=0
constexpr int32_t top() const
constexpr int32_t bottom() const
◆ png_ptr()
voidp SkPngCodec::png_ptr |
( |
| ) |
|
|
inlineprotected |
◆ processData()
bool SkPngCodec::processData |
( |
| ) |
|
|
protected |
Pass available input to libpng to process it.
libpng will call any relevant callbacks installed. This will continue decoding until it reaches the end of the file, or until a callback tells libpng to stop.
Definition at line 213 of file SkPngCodec.cpp.
213 {
216
217
218 return false;
220
221 return true;
223
224 break;
225 default:
226
228 }
229
230
233
234 bool iend = false;
235 while (true) {
237 if (fDecodedIdat) {
238
240 break;
241 }
242
243 png_byte* chunk =
reinterpret_cast<png_byte*
>(
buffer);
246 iend = true;
247 }
248
249 length = png_get_uint_32(chunk);
250 } else {
252 png_byte idat[] = {0, 0, 0, 0, 'I', 'D', 'A', 'T'};
253 png_save_uint_32(idat,
length);
255 fDecodedIdat = true;
256 }
257
258
260 || iend) {
261 break;
262 }
263 }
264
265 return true;
266}
static bool read(SkStream *stream, void *buffer, size_t amount)
static bool process_data(png_structp png_ptr, png_infop info_ptr, SkStream *stream, void *buffer, size_t bufferSize, size_t length)
constexpr int kSetJmpOkay
constexpr int kStopDecoding
static bool is_chunk(const png_byte *chunk, const char *tag)
static const size_t kBufferSize
static const uint8_t buffer[]
◆ setIdatLength()
void SkPngCodec::setIdatLength |
( |
size_t |
len | ) |
|
|
inline |
◆ setRange()
virtual void SkPngCodec::setRange |
( |
int |
firstRow, |
|
|
int |
lastRow, |
|
|
void * |
dst, |
|
|
size_t |
rowBytes |
|
) |
| |
|
privatepure virtual |
◆ swizzler()
◆ fBitDepth
const int SkPngCodec::fBitDepth |
|
protected |
◆ fColorTable
◆ fColorXformSrcRow
void* SkPngCodec::fColorXformSrcRow |
|
protected |
◆ fInfo_ptr
voidp SkPngCodec::fInfo_ptr |
|
protected |
◆ fPng_ptr
voidp SkPngCodec::fPng_ptr |
|
protected |
◆ fPngChunkReader
◆ fStorage
◆ fSwizzler
The documentation for this class was generated from the following files: