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

Function WebPBufferLoader

common/Image.cpp:688–708  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

686}
687
688bool WebPBufferLoader(RGBA8Image* image, const void* buffer, size_t buffer_size)
689{
690 int width, height;
691 if (!WebPGetInfo(static_cast<const u8*>(buffer), buffer_size, &width, &height) || width <= 0 || height <= 0)
692 {
693 Console.Error("WebPGetInfo() failed");
694 return false;
695 }
696
697 std::vector<u32> pixels;
698 pixels.resize(static_cast<u32>(width) * static_cast<u32>(height));
699 if (!WebPDecodeRGBAInto(static_cast<const u8*>(buffer), buffer_size, reinterpret_cast<u8*>(pixels.data()),
700 sizeof(u32) * pixels.size(), sizeof(u32) * static_cast<u32>(width)))
701 {
702 Console.Error("WebPDecodeRGBAInto() failed");
703 return false;
704 }
705
706 image->SetPixels(static_cast<u32>(width), static_cast<u32>(height), std::move(pixels));
707 return true;
708}
709
710bool WebPBufferSaver(const RGBA8Image& image, std::vector<u8>* buffer, u8 quality)
711{

Callers 1

WebPFileLoaderFunction · 0.85

Calls 5

SetPixelsMethod · 0.80
ErrorMethod · 0.45
resizeMethod · 0.45
dataMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected