8#ifndef SkCodecPriv_DEFINED
9#define SkCodecPriv_DEFINED
20#ifdef SK_PRINT_CODEC_MESSAGES
21 #define SkCodecPrintf SkDebugf
23 #define SkCodecPrintf(...)
32 return 1.0f / ((float) sampleSize);
45 if (sampleSize > srcDimension) {
48 return srcDimension / sampleSize;
67static inline int get_dst_coord(
int srcCoord,
int sampleFactor) {
return srcCoord / sampleFactor; }
82 if (srcCoord < startCoord ||
get_dst_coord(srcCoord, sampleFactor) >= scaledDim) {
87 return ((srcCoord - startCoord) % sampleFactor) == 0;
97 SkCodecPrintf(
"Warning: an opaque image should be decoded as opaque "
98 "- it is being decoded as non-opaque, which will draw slower\n");
110 return nullptr != colorTable ? colorTable->
readColors() :
nullptr;
117 return (
width + pixelsPerByte - 1) / pixelsPerByte;
124 return width * bytesPerPixel;
131 if (bitsPerPixel < 16) {
133 const uint32_t pixelsPerByte = 8 / bitsPerPixel;
137 const uint32_t bytesPerPixel = bitsPerPixel / 8;
186 if ((
'I' != data[0] ||
'I' != data[1]) && (
'M' != data[0] ||
'M' != data[1])) {
190 *isLittleEndian = (
'I' == data[0]);
196 return (data[1] << 8) | (data[0]);
199 return (data[0] << 8) | (data[1]);
204 return (data[3] << 24) | (data[2] << 16) | (data[1] << 8) | (data[0]);
207 return (data[0] << 24) | (data[1] << 16) | (data[2] << 8) | (data[3]);
231#ifdef SK_PMCOLOR_IS_RGBA
@ kUnknown_SkAlphaType
uninitialized
@ kOpaque_SkAlphaType
pixel is opaque
static bool is_coord_necessary(int srcCoord, int sampleFactor, int scaledDim)
static uint8_t get_byte(const uint8_t *buffer, uint32_t i)
uint32_t(* PackColorProc)(U8CPU a, U8CPU r, U8CPU g, U8CPU b)
static uint32_t get_endian_int(const uint8_t *data, bool littleEndian)
static PackColorProc choose_pack_color_proc(bool isPremul, SkColorType colorType)
static size_t compute_row_bytes(int width, uint32_t bitsPerPixel)
static bool is_valid_subset(const SkIRect &subset, const SkISize &imageDims)
static const SkPMColor * get_color_ptr(SkColorPalette *colorTable)
static bool valid_alpha(SkAlphaType dstAlpha, bool srcIsOpaque)
static size_t compute_row_bytes_bpp(int width, uint32_t bytesPerPixel)
static int get_dst_coord(int srcCoord, int sampleFactor)
static size_t compute_row_bytes_ppb(int width, uint32_t pixelsPerByte)
static float get_scale_from_sample_size(int sampleSize)
static int get_scaled_dimension(int srcDimension, int sampleSize)
static SkPMColor premultiply_argb_as_rgba(U8CPU a, U8CPU r, U8CPU g, U8CPU b)
bool sk_select_xform_format(SkColorType colorType, bool forColorTable, skcms_PixelFormat *outFormat)
static uint32_t get_int(const uint8_t *buffer, uint32_t i)
static uint16_t get_endian_short(const uint8_t *data, bool littleEndian)
#define SkCodecPrintf(...)
static uint16_t get_short(const uint8_t *buffer, uint32_t i)
static bool is_valid_endian_marker(const uint8_t *data, bool *isLittleEndian)
static SkPMColor premultiply_argb_as_bgra(U8CPU a, U8CPU r, U8CPU g, U8CPU b)
static bool is_rgba(SkColorType colorType)
static int get_start_coord(int sampleFactor)
static uint32_t SkPackARGB_as_RGBA(U8CPU a, U8CPU r, U8CPU g, U8CPU b)
static uint32_t SkPackARGB_as_BGRA(U8CPU a, U8CPU r, U8CPU g, U8CPU b)
@ kBGRA_8888_SkColorType
pixel with 8 bits for blue, green, red, alpha; in 32-bit word
@ kRGBA_8888_SkColorType
pixel with 8 bits for red, green, blue, alpha; in 32-bit word
static uint16_t SkEndianSwap16(uint16_t value)
static constexpr uint32_t SkEndianSwap32(uint32_t value)
static SkColorType colorType(AImageDecoder *decoder, const AImageDecoderHeaderInfo *headerInfo)
static U8CPU SkMulDiv255Round(U16CPU a, U16CPU b)
const SkPMColor * readColors() const
static const uint8_t buffer[]
bool HasDecoder(std::string_view id)
static constexpr SkIRect MakeSize(const SkISize &size)
bool contains(int32_t x, int32_t y) const