diff --git a/src/app/gfx/bitmap.cc b/src/app/gfx/bitmap.cc index 295a633d..47044121 100644 --- a/src/app/gfx/bitmap.cc +++ b/src/app/gfx/bitmap.cc @@ -1,7 +1,9 @@ #include "bitmap.h" #include +#if YAZE_LIB_PNG == 1 #include +#endif #include #include @@ -187,6 +189,11 @@ void ConvertPngToSurface(const std::vector &png_data, SDL_Log("Successfully created SDL_Surface from PNG data"); } +std::vector 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 Bitmap::GetPngData() { - ConvertSurfaceToPNG(surface_.get(), png_data_); - return png_data_; -} - void Bitmap::SaveSurfaceToFile(std::string_view filename) { SDL_SaveBMP(surface_.get(), filename.data()); } diff --git a/src/app/gfx/bitmap.h b/src/app/gfx/bitmap.h index 066f7ee6..601e9f7e 100644 --- a/src/app/gfx/bitmap.h +++ b/src/app/gfx/bitmap.h @@ -46,6 +46,7 @@ enum BitmapFormat { k8bpp = 3, }; +#if YAZE_LIB_PNG == 1 /** * @brief Convert SDL_Surface to PNG image data. */ @@ -56,6 +57,7 @@ bool ConvertSurfaceToPNG(SDL_Surface *surface, std::vector &buffer); */ void ConvertPngToSurface(const std::vector &png_data, SDL_Surface **outSurface); +#endif /** * @brief Represents a bitmap image. @@ -87,7 +89,10 @@ class Bitmap { } } +#if YAZE_LIB_PNG == 1 std::vector GetPngData(); +#endif + void SaveSurfaceToFile(std::string_view filename); /**