Browse Source

Review config flags #1784

Ray 4 years ago
parent
commit
89e734de6b
1 changed files with 9 additions and 1 deletions
  1. 9 1
      src/textures.c

+ 9 - 1
src/textures.c

@@ -67,6 +67,7 @@
 #include <stdlib.h>             // Required for: malloc(), free()
 #include <stdlib.h>             // Required for: malloc(), free()
 #include <string.h>             // Required for: strlen() [Used in ImageTextEx()]
 #include <string.h>             // Required for: strlen() [Used in ImageTextEx()]
 #include <math.h>               // Required for: fabsf()
 #include <math.h>               // Required for: fabsf()
+#include <stdio.h>              // Required for: sprintf() [Used in ExportImageAsCode()]
 
 
 #include "utils.h"              // Required for: fopen() Android mapping
 #include "utils.h"              // Required for: fopen() Android mapping
 
 
@@ -122,7 +123,7 @@
                                             // NOTE: Used to read image data (multiple formats support)
                                             // NOTE: Used to read image data (multiple formats support)
 #endif
 #endif
 
 
-#if (defined(SUPPORT_IMAGE_EXPORT) || defined(SUPPORT_COMPRESSION_API))
+#if defined(SUPPORT_IMAGE_EXPORT)
     #define STBIW_MALLOC RL_MALLOC
     #define STBIW_MALLOC RL_MALLOC
     #define STBIW_FREE RL_FREE
     #define STBIW_FREE RL_FREE
     #define STBIW_REALLOC RL_REALLOC
     #define STBIW_REALLOC RL_REALLOC
@@ -459,6 +460,8 @@ bool ExportImageAsCode(Image image, const char *fileName)
 {
 {
     bool success = false;
     bool success = false;
 
 
+#if defined(SUPPORT_IMAGE_EXPORT)
+
 #ifndef TEXT_BYTES_PER_LINE
 #ifndef TEXT_BYTES_PER_LINE
     #define TEXT_BYTES_PER_LINE     20
     #define TEXT_BYTES_PER_LINE     20
 #endif
 #endif
@@ -500,6 +503,11 @@ bool ExportImageAsCode(Image image, const char *fileName)
     success = SaveFileText(fileName, txtData);
     success = SaveFileText(fileName, txtData);
 
 
     RL_FREE(txtData);
     RL_FREE(txtData);
+    
+#endif      // SUPPORT_IMAGE_EXPORT
+
+    if (success != 0) TRACELOG(LOG_INFO, "FILEIO: [%s] Image exported successfully", fileName);
+    else TRACELOG(LOG_WARNING, "FILEIO: [%s] Failed to export image", fileName);
 
 
     return success;
     return success;
 }
 }