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

Function Save

pcsx2/GS/GSPng.cpp:91–113  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

89 }
90
91 bool Save(GSPng::Format fmt, const std::string& file, const u8* image, int w, int h, int pitch, int compression, bool rb_swapped)
92 {
93 std::string root = file;
94 root.replace(file.length() - 4, 4, "");
95
96 pxAssert(fmt >= Format::START && fmt < Format::COUNT);
97
98 if (compression < 0 || compression > Z_BEST_COMPRESSION)
99 compression = Z_BEST_SPEED;
100
101 std::unique_ptr<u8[]> row(new u8[pixel[fmt].bytes_per_pixel_out * w]);
102
103 std::string filename = root + pixel[fmt].extension[0];
104 if (!SaveFile(filename, fmt, image, row.get(), w, h, pitch, compression, rb_swapped, true))
105 return false;
106
107 // Second image
108 if (pixel[fmt].extension[1] == nullptr)
109 return true;
110
111 filename = root + pixel[fmt].extension[1];
112 return SaveFile(filename, fmt, image, row.get(), w, h, pitch, compression);
113 }
114
115 Transaction::Transaction(GSPng::Format fmt, const std::string& file, const u8* image, int w, int h, int pitch, int compression)
116 : m_fmt(fmt), m_file(file), m_w(w), m_h(h), m_pitch(pitch), m_compression(compression)

Callers 12

SaveMethod · 0.85
SaveFileMethod · 0.85
~INISettingsInterfaceMethod · 0.85
SaveMethod · 0.85
WriteWithoutCacheMethod · 0.85
EraseBlockMethod · 0.85
SetSizeInClustersMethod · 0.85
ProcessFunction · 0.85
SaveBMPMethod · 0.85
SaveMethod · 0.85
UpdateSourceMethod · 0.85
SaveMethod · 0.85

Calls 4

SaveFileFunction · 0.85
replaceMethod · 0.45
lengthMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected