19 std::shared_ptr<const fml::Mapping> allocation) {
24 return std::make_shared<CompressedImageSkia>(std::move(allocation));
28 std::shared_ptr<const fml::Mapping> allocation)
42 auto src =
new std::shared_ptr<const fml::Mapping>(
source_);
45 [](
const void* ptr,
void* context) {
46 delete reinterpret_cast<decltype(src)>(context);
59 auto bitmap = std::make_shared<SkBitmap>();
61 VALIDATION_LOG <<
"Could not allocate arena for decompressing image.";
70 auto mapping = std::make_shared<fml::NonOwnedMapping>(
71 reinterpret_cast<const uint8_t*
>(
bitmap->pixmap().addr()),
73 [
bitmap](
const uint8_t* data,
size_t size)
mutable {
79 {
bitmap->pixmap().dimensions().fWidth,
80 bitmap->pixmap().dimensions().fHeight},
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
@ kPremul_SkAlphaType
pixel components are premultiplied by alpha
@ kRGBA_8888_SkColorType
pixel with 8 bits for red, green, blue, alpha; in 32-bit word
static sk_sp< SkData > MakeWithProc(const void *ptr, size_t length, ReleaseProc proc, void *ctx)
const SkImageInfo & imageInfo() const
bool readPixels(GrDirectContext *context, const SkImageInfo &dstInfo, void *dstPixels, size_t dstRowBytes, int srcX, int srcY, CachingHint cachingHint=kAllow_CachingHint) const
CompressedImageSkia(std::shared_ptr< const fml::Mapping > allocation)
~CompressedImageSkia() override
static std::shared_ptr< CompressedImage > Create(std::shared_ptr< const fml::Mapping > allocation)
DecompressedImage Decode() const override
const std::shared_ptr< const fml::Mapping > source_
SK_API sk_sp< SkImage > DeferredFromEncodedData(sk_sp< SkData > encoded, std::optional< SkAlphaType > alphaType=std::nullopt)
SkISize dimensions() const
static SkImageInfo Make(int width, int height, SkColorType ct, SkAlphaType at)