mirror of
https://github.com/yuzu-emu/FasTC.git
synced 2025-01-23 19:21:09 +00:00
Add a debug function to our intermediate PVRTC images
This commit is contained in:
parent
0d0c65f536
commit
92827c23fc
|
@ -57,6 +57,9 @@
|
|||
|
||||
#include "Pixel.h"
|
||||
|
||||
#include "Core/include/Image.h"
|
||||
#include "IO/include/ImageFile.h"
|
||||
|
||||
namespace PVRTCC {
|
||||
|
||||
Image::Image(uint32 height, uint32 width)
|
||||
|
@ -231,4 +234,25 @@ const Pixel & Image::operator()(uint32 i, uint32 j) const {
|
|||
return m_Pixels[j * m_Width + i];
|
||||
}
|
||||
|
||||
void Image::DebugOutput(const char *filename) const {
|
||||
uint32 *outPixels = new uint32[m_Width * m_Height];
|
||||
const uint8 fullDepth[4] = { 8, 8, 8, 8 };
|
||||
for(int j = 0; j < m_Height; j++) {
|
||||
for(int i = 0; i < m_Width; i++) {
|
||||
uint32 idx = j * m_Width + i;
|
||||
Pixel p = m_Pixels[idx];
|
||||
p.ChangeBitDepth(fullDepth);
|
||||
outPixels[idx] = p.PackRGBA();
|
||||
}
|
||||
}
|
||||
|
||||
::Image img(m_Height, m_Width, outPixels);
|
||||
|
||||
char debugFilename[256];
|
||||
sprintf(debugFilename, "%s.png", filename);
|
||||
|
||||
::ImageFile imgFile(debugFilename, eFileFormat_PNG, img);
|
||||
imgFile.Write();
|
||||
}
|
||||
|
||||
} // namespace PVRTCC
|
||||
|
|
|
@ -77,6 +77,8 @@ class Image {
|
|||
uint32 GetWidth() const { return m_Width; }
|
||||
uint32 GetHeight() const { return m_Height; }
|
||||
|
||||
void DebugOutput(const char *filename) const;
|
||||
|
||||
private:
|
||||
uint32 m_Width;
|
||||
uint32 m_Height;
|
||||
|
|
Loading…
Reference in a new issue