MCPcopy Create free account
hub / github.com/PCSX2/pcsx2 / SaveToBuffer

Method SaveToBuffer

common/Image.cpp:170–187  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

168}
169
170std::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
189static bool PNGCommonLoader(RGBA8Image* image, png_structp png_ptr, png_infop info_ptr, std::vector<u32>& new_data,
190 std::vector<png_bytep>& row_pointers)

Callers

nothing calls this directly

Calls 4

GetFormatHandlerFunction · 0.85
ErrorFmtMethod · 0.45
valueMethod · 0.45
resetMethod · 0.45

Tested by

no test coverage detected