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

Method SaveBMP

pcsx2/GS/GSLocalMemory.cpp:623–650  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

621//
622
623void GSLocalMemory::SaveBMP(const std::string& fn, u32 bp, u32 bw, u32 psm, int w, int h, int x, int y)
624{
625 int pitch = w * 4;
626 int size = pitch * h;
627 void* bits = _aligned_malloc(size, VECTOR_ALIGNMENT);
628
629 GIFRegTEX0 TEX0;
630
631 TEX0.TBP0 = bp;
632 TEX0.TBW = bw;
633 TEX0.PSM = psm;
634
635 readPixel rp = m_psm[psm].rp;
636
637 u8* p = (u8*)bits;
638
639 for (int j = 0; j < h; j++, p += pitch)
640 {
641 for (int i = 0; i < w; i++)
642 {
643 ((u32*)p)[i] = (this->*rp)(x + i, y + j, TEX0.TBP0, TEX0.TBW);
644 }
645 }
646
647 GSPng::Save((IsDevBuild || GSConfig.SaveAlpha) ? GSPng::RGB_A_PNG : GSPng::RGB_PNG, fn, static_cast<u8*>(bits), w, h, pitch, GSConfig.PNGCompressionLevel, false);
648
649 _aligned_free(bits);
650}
651
652// GSOffset
653

Callers 4

DumpTransferImagesMethod · 0.80
InitReadFIFOMethod · 0.80
DrawMethod · 0.80
SyncMethod · 0.80

Calls 3

_aligned_mallocFunction · 0.85
SaveFunction · 0.85
_aligned_freeFunction · 0.85

Tested by

no test coverage detected