Skip to content

Commit 2916cea

Browse files
authored
Merge pull request #153 from saxbophone/develop
v0.24.2 - PNG Output bugfix
2 parents 4f12cc8 + 2f6a33c commit 2916cea

File tree

5 files changed

+17
-18
lines changed

5 files changed

+17
-18
lines changed

CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
# begin basic metadata
2424
cmake_minimum_required(VERSION 3.0)
2525

26-
project(sxbp VERSION 0.24.1 LANGUAGES C)
26+
project(sxbp VERSION 0.24.2 LANGUAGES C)
2727

2828
# set default C standard to use (C99) if not already set
2929
if(NOT DEFINED LIBSXBP_C_STANDARD)
@@ -148,7 +148,7 @@ set_target_properties(
148148
# link libsxbp with C math library
149149
target_link_libraries(sxbp m)
150150
# Link libsxbp with libpng so we get libpng symbols (if support enabled)
151-
if(SXBP_PNG_SUPPORT)
151+
if(LIBSXBP_PNG_SUPPORT)
152152
target_link_libraries(sxbp ${PNG_LIBRARY})
153153
endif()
154154

sxbp/render_backends/backend_png.c

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,10 @@
2828
*/
2929
#include <assert.h>
3030
// only include these extra dependencies if support for PNG output was enabled
31-
#ifdef SAXBOSPIRAL_PNG_SUPPORT
31+
#ifdef LIBSXBP_PNG_SUPPORT
3232
#include <stdlib.h>
3333
#include <string.h>
34-
#endif
3534

36-
// only include libpng if support for it was enabled
37-
#ifdef SAXBOSPIRAL_PNG_SUPPORT
3835
#include <png.h>
3936
#endif
4037

@@ -48,7 +45,7 @@ extern "C"{
4845
#endif
4946

5047
// only define the following private functions if libpng support was enabled
51-
#ifdef SAXBOSPIRAL_PNG_SUPPORT
48+
#ifdef LIBSXBP_PNG_SUPPORT
5249
// private custom libPNG buffer write function
5350
static void buffer_write_data(
5451
png_structp png_ptr, png_bytep data, png_size_t length
@@ -93,7 +90,14 @@ static void cleanup_png_lib(
9390
free(row);
9491
}
9592
}
96-
#endif // SAXBOSPIRAL_PNG_SUPPORT
93+
#endif // LIBSXBP_PNG_SUPPORT
94+
95+
// flag for whether PNG output support has been compiled in based, on macro
96+
#ifdef LIBSXBP_PNG_SUPPORT
97+
const bool SXBP_PNG_SUPPORT = true;
98+
#else
99+
const bool SXBP_PNG_SUPPORT = false;
100+
#endif
97101

98102
/*
99103
* given a bitmap_t struct and a pointer to a blank buffer_t, write the bitmap
@@ -112,7 +116,7 @@ sxbp_status_t sxbp_render_backend_png(
112116
assert(bitmap.pixels != NULL);
113117
assert(buffer->bytes == NULL);
114118
// only do PNG operations if support is enabled
115-
#ifndef SAXBOSPIRAL_PNG_SUPPORT
119+
#ifndef LIBSXBP_PNG_SUPPORT
116120
// return SXBP_NOT_IMPLEMENTED
117121
return SXBP_NOT_IMPLEMENTED;
118122
#else
@@ -206,7 +210,7 @@ sxbp_status_t sxbp_render_backend_png(
206210
// status ok
207211
result = SXBP_OPERATION_OK;
208212
return result;
209-
#endif // SAXBOSPIRAL_PNG_SUPPORT
213+
#endif // LIBSXBP_PNG_SUPPORT
210214
}
211215

212216
#ifdef __cplusplus

sxbp/render_backends/backend_png.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@
3737
extern "C"{
3838
#endif
3939

40+
// flag for whether PNG output support has been compiled in based, on macro
41+
extern const bool SXBP_PNG_SUPPORT;
42+
4043
/*
4144
* given a bitmap_t struct and a pointer to a blank buffer_t, write the bitmap
4245
* data as a PNG image to the buffer, using libpng.

sxbp/saxbospiral.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,6 @@ const sxbp_version_t LIB_SXBP_VERSION = {
3737
.patch = LIBSXBP_VERSION_PATCH,
3838
.string = LIBSXBP_VERSION_STRING,
3939
};
40-
// flag for whether PNG output support has been compiled in based, on macro
41-
#ifdef LIBSXBP_PNG_SUPPORT
42-
const bool SXBP_PNG_SUPPORT = true;
43-
#else
44-
const bool SXBP_PNG_SUPPORT = false;
45-
#endif
4640

4741
/*
4842
* computes a version_hash_t for a given version_t,

sxbp/saxbospiral.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,6 @@ typedef struct sxbp_version_t {
4141
} sxbp_version_t;
4242

4343
extern const sxbp_version_t LIB_SXBP_VERSION;
44-
// flag for whether PNG output support has been compiled in based, on macro
45-
extern const bool SXBP_PNG_SUPPORT;
4644

4745
// used for indexing and comparing different versions in order
4846
typedef uint32_t sxbp_version_hash_t;

0 commit comments

Comments
 (0)