aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--graphics/png.cpp5
-rw-r--r--graphics/png.h14
2 files changed, 19 insertions, 0 deletions
diff --git a/graphics/png.cpp b/graphics/png.cpp
index 6fd3e2b24b..e6dceab3fa 100644
--- a/graphics/png.cpp
+++ b/graphics/png.cpp
@@ -21,6 +21,9 @@
*/
#include "graphics/png.h"
+
+#ifdef GRAPHICS_PNG_H
+
#include "graphics/pixelformat.h"
#include "graphics/surface.h"
@@ -489,3 +492,5 @@ void PNG::readTransparencyChunk(uint32 chunkLength) {
}
} // End of Graphics namespace
+
+#endif // GRAPHICS_PNG_H
diff --git a/graphics/png.h b/graphics/png.h
index 50e7a17ec8..3f8ea85320 100644
--- a/graphics/png.h
+++ b/graphics/png.h
@@ -23,8 +23,20 @@
/*
* PNG decoder used in engines:
* - sword25
+ * Dependencies:
+ * - zlib
*/
+// Currently, only the sword25 engine uses the PNG decoder, so skip compiling
+// it if sword25 is not enabled, or if zlib (a required dependency) is not
+// enabled.
+
+#if !(defined(ENABLE_SWORD25) || defined(USE_ZLIB))
+
+// Do not compile the PNG decoder code
+
+#else
+
#ifndef GRAPHICS_PNG_H
#define GRAPHICS_PNG_H
@@ -164,3 +176,5 @@ private:
} // End of Graphics namespace
#endif // GRAPHICS_PNG_H
+
+#endif // Engine and zlib guard