| 168 | } |
| 169 | |
| 170 | std::optional<std::vector<u8>> RGBA8Image::SaveToBuffer(const char* filename, u8 quality) const |
| 171 | { |
| 172 | std::optional<std::vector<u8>> ret; |
| 173 | |
| 174 | const std::string_view extension(Path::GetExtension(filename)); |
| 175 | const FormatHandler* handler = GetFormatHandler(extension); |
| 176 | if (!handler || !handler->file_saver) |
| 177 | { |
| 178 | Console.ErrorFmt("Unknown extension '{}'", extension); |
| 179 | return ret; |
| 180 | } |
| 181 | |
| 182 | ret = std::vector<u8>(); |
| 183 | if (!handler->buffer_saver(*this, &ret.value(), quality)) |
| 184 | ret.reset(); |
| 185 | |
| 186 | return ret; |
| 187 | } |
| 188 | |
| 189 | static bool PNGCommonLoader(RGBA8Image* image, png_structp png_ptr, png_infop info_ptr, std::vector<u32>& new_data, |
| 190 | std::vector<png_bytep>& row_pointers) |
nothing calls this directly
no test coverage detected