53 return stream->read(data, 1) == 1;
60 const uint64_t kLimit = 0xFE00000000000000;
61 SkASSERT(kLimit == ~((~
static_cast<uint64_t
>(0)) >> 7));
66 if (stream->read(&data, 1) != 1) {
69 n = (n << 7) | (data & 0x7F);
70 }
while (data & 0x80);
78 if (!
read_byte(stream, &data) || data != 0) {
81 if (!
read_byte(stream, &data) || (data & 0x9F)) {
103bool SkWbmpCodec::readRow(uint8_t* row) {
104 return this->
stream()->
read(row, fSrcRowBytes) == fSrcRowBytes;
143 for (
int y = 0;
y < size.height(); ++
y) {
144 if (!this->readRow(src.get())) {
148 swizzler->swizzle(dstRow, src.get());
149 dstRow = SkTAddOffset<void>(dstRow, rowBytes);
182 if (!this->readRow(fSrcBuffer.
get())) {
185 fSwizzler->swizzle(dstRow, fSrcBuffer.
get());
186 dstRow = SkTAddOffset<void>(dstRow, dstRowBytes);
192 const size_t bytesToSkip =
count * fSrcRowBytes;
193 return this->
stream()->
skip(bytesToSkip) == bytesToSkip;
206 fSrcBuffer.
reset(fSrcRowBytes);
212bool IsWbmp(
const void* data,
size_t len) {
216std::unique_ptr<SkCodec>
Decode(std::unique_ptr<SkStream> stream,
218 SkCodecs::DecodeContext) {
221 outResult = &resultStorage;
228 SkCodecs::DecodeContext) {
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
static constexpr T SkAlign8(T x)
static bool valid_alpha(SkAlphaType dstAlpha, bool srcIsOpaque)
@ kBGRA_8888_SkColorType
pixel with 8 bits for blue, green, red, alpha; in 32-bit word
@ kRGBA_F16_SkColorType
pixel with half floats for red, green, blue, alpha;
@ kGray_8_SkColorType
pixel with grayscale level in 8-bit byte
@ kRGB_565_SkColorType
pixel with 5 bits red, 6 bits green, 5 bits blue, in 16-bit word
@ kRGBA_8888_SkColorType
pixel with 8 bits for red, green, blue, alpha; in 32-bit word
static SkCodec::Result read_header(SkStream *stream, SkPngChunkReader *chunkReader, SkCodec **outCodec, png_structp *png_ptrp, png_infop *info_ptrp)
#define INHERITED(method,...)
constexpr int32_t SkToS32(S x)
static bool read_mbf(SkStream *stream, uint64_t *value)
static bool read_byte(SkStream *stream, uint8_t *data)
static size_t get_src_row_bytes(int width)
static bool valid_color_type(const SkImageInfo &dstInfo)
static bool read_header(SkStream *stream, SkISize *size)
const SkEncodedInfo & getEncodedInfo() const
const Options & options() const
static std::unique_ptr< SkMemoryStream > Make(sk_sp< SkData > data)
virtual size_t read(void *buffer, size_t size)=0
static std::unique_ptr< SkSwizzler > Make(const SkEncodedInfo &encodedInfo, const SkPMColor *ctable, const SkImageInfo &dstInfo, const SkCodec::Options &, const SkIRect *frame=nullptr)
SkEncodedImageFormat onGetEncodedFormat() const override
Result onStartScanlineDecode(const SkImageInfo &dstInfo, const Options &options) override
static bool IsWbmp(const void *, size_t)
bool conversionSupported(const SkImageInfo &dst, bool srcIsOpaque, bool needsXform) override
bool onSkipScanlines(int count) override
int onGetScanlines(void *dst, int count, size_t dstRowBytes) override
Result onGetPixels(const SkImageInfo &, void *, size_t, const Options &, int *) override
static std::unique_ptr< SkCodec > MakeFromStream(std::unique_ptr< SkStream >, Result *)
T * reset(size_t count=0)
static const uint8_t buffer[]
SK_API bool IsWbmp(const void *, size_t)
SK_API std::unique_ptr< SkCodec > Decode(std::unique_ptr< SkStream >, SkCodec::Result *, SkCodecs::DecodeContext=nullptr)
static SkEncodedInfo Make(int width, int height, Color color, Alpha alpha, int bitsPerComponent)
static constexpr SkISize Make(int32_t w, int32_t h)
SkColorSpace * colorSpace() const
SkColorType colorType() const