#include <compressed_image_skia.h>
|
| CompressedImage (std::shared_ptr< const fml::Mapping > allocation) |
|
const std::shared_ptr< const fml::Mapping > | source_ |
|
Definition at line 12 of file compressed_image_skia.h.
◆ CompressedImageSkia()
impeller::CompressedImageSkia::CompressedImageSkia |
( |
std::shared_ptr< const fml::Mapping > |
allocation | ) |
|
|
explicit |
◆ ~CompressedImageSkia()
impeller::CompressedImageSkia::~CompressedImageSkia |
( |
| ) |
|
|
overridedefault |
◆ Create()
std::shared_ptr< CompressedImage > impeller::CompressedImageSkia::Create |
( |
std::shared_ptr< const fml::Mapping > |
allocation | ) |
|
|
static |
◆ Decode()
Implements impeller::CompressedImage.
Definition at line 34 of file compressed_image_skia.cc.
42 auto src =
new std::shared_ptr<const fml::Mapping>(
source_);
43 auto sk_data = SkData::MakeWithProc(
45 [](
const void* ptr,
void* context) {
46 delete reinterpret_cast<decltype(src)>(context);
50 auto image = SkImages::DeferredFromEncodedData(sk_data);
55 const auto dims = image->imageInfo().dimensions();
56 auto info = SkImageInfo::Make(dims.width(), dims.height(),
57 kRGBA_8888_SkColorType, kPremul_SkAlphaType);
59 auto bitmap = std::make_shared<SkBitmap>();
60 if (!bitmap->tryAllocPixels(info)) {
61 VALIDATION_LOG <<
"Could not allocate arena for decompressing image.";
65 if (!image->readPixels(
nullptr, bitmap->pixmap(), 0, 0)) {
70 auto mapping = std::make_shared<fml::NonOwnedMapping>(
71 reinterpret_cast<const uint8_t*
>(bitmap->pixmap().addr()),
72 bitmap->pixmap().rowBytes() * bitmap->pixmap().height(),
73 [bitmap](
const uint8_t*
data,
size_t size)
mutable {
79 {bitmap->pixmap().dimensions().fWidth,
80 bitmap->pixmap().dimensions().fHeight},
const std::shared_ptr< const fml::Mapping > source_
std::shared_ptr< const fml::Mapping > data
References data, impeller::CompressedImage::IsValid(), impeller::DecompressedImage::kRGBA, impeller::CompressedImage::source_, and VALIDATION_LOG.
The documentation for this class was generated from the following files: