add YAZE_LIB_PNG if directives

This commit is contained in:
scawful
2024-08-13 00:32:02 -04:00
parent feaee62462
commit 9f9edc9666
2 changed files with 12 additions and 5 deletions

View File

@@ -1,7 +1,9 @@
#include "bitmap.h"
#include <SDL.h>
#if YAZE_LIB_PNG == 1
#include <png.h>
#endif
#include <cstdint>
#include <memory>
@@ -187,6 +189,11 @@ void ConvertPngToSurface(const std::vector<uint8_t> &png_data,
SDL_Log("Successfully created SDL_Surface from PNG data");
}
std::vector<uint8_t> Bitmap::GetPngData() {
ConvertSurfaceToPNG(surface_.get(), png_data_);
return png_data_;
}
#endif // YAZE_LIB_PNG
namespace {
@@ -214,11 +221,6 @@ Uint32 GetSnesPixelFormat(int format) {
}
} // namespace
std::vector<uint8_t> Bitmap::GetPngData() {
ConvertSurfaceToPNG(surface_.get(), png_data_);
return png_data_;
}
void Bitmap::SaveSurfaceToFile(std::string_view filename) {
SDL_SaveBMP(surface_.get(), filename.data());
}