62 {
63 if (!is_valid_) {
64 return {};
65 }
66
69 }
70
72 const auto source_byte_size = size_.
Area() * bpp;
73 if (allocation_->GetSize() < source_byte_size) {
74 return {};
75 }
76
77 auto rgba_allocation = std::make_shared<Allocation>();
78 if (!rgba_allocation->Truncate(size_.
Area() * 4u,
false)) {
79 return {};
80 }
81
82 const uint8_t*
source = allocation_->GetMapping();
83 uint8_t*
dest = rgba_allocation->GetBuffer();
84
85 for (size_t i = 0, j = 0; i < source_byte_size; i += bpp, j += 4u) {
86 switch (format_) {
91 dest[j + 3] = std::numeric_limits<uint8_t>::max();
92 break;
94 dest[j + 0] = std::numeric_limits<uint8_t>::max();
95 dest[j + 1] = std::numeric_limits<uint8_t>::max();
96 dest[j + 2] = std::numeric_limits<uint8_t>::max();
98 break;
103 dest[j + 3] = std::numeric_limits<uint8_t>::max();
104 break;
107
108
110 break;
111 }
112 }
113
116 std::make_shared<fml::NonOwnedMapping>(
117 rgba_allocation->GetBuffer(),
118 rgba_allocation->GetLength(),
119 [rgba_allocation](auto, auto) {})
120 };
121}
#define FML_CHECK(condition)
static size_t GetBytesPerPixel(DecompressedImage::Format format)
constexpr Type Area() const