Skip to content

Commit 365c39e

Browse files
committed
Corrected issue with color conversion
1 parent 1789e81 commit 365c39e

File tree

5 files changed

+8
-9
lines changed

5 files changed

+8
-9
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ set(CMAKE_CXX_COMPILER_NAMES clang++ g++ icpc c++ cxx)
1414
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DDEBUG")
1515

1616
# chrgfx library
17-
project(chrgfx VERSION 2.0.1 LANGUAGES CXX)
17+
project(chrgfx VERSION 2.0.2 LANGUAGES CXX)
1818
add_subdirectory(chrgfx)
1919

2020
# conversion executables

chrgfx/inc/utils.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@ namespace chrgfx
1616
* @param data color channel data
1717
* @param bitcount target bitdepth
1818
*/
19-
byte_t reduce_bitdepth(byte_t data, u8 bitdepth);
19+
u8 reduce_bitdepth(u8 data, u8 bitdepth);
2020

2121
/**
2222
* @brief Increase bitdepth of a color channel to 8 bits
2323
*
2424
* @param data color channel data
2525
* @param bitdepth bitdepth of the input channel
2626
*/
27-
byte_t expand_bitdepth(byte_t data, u8 bitdepth);
27+
u8 expand_bitdepth(u8 data, u8 bitdepth);
2828

2929
/**
3030
* @brief Returns an 32 bit value with the specified number of bits set

chrgfx/src/app.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
namespace APP {
88
static unsigned int const VERSION_MAJOR{2};
99
static unsigned int const VERSION_MINOR{0};
10-
static unsigned int const VERSION_PATCH{1};
11-
static char const * VERSION{"2.0.1"};
10+
static unsigned int const VERSION_PATCH{2};
11+
static char const * VERSION{"2.0.2"};
1212

1313
static char const * NAME{"chrgfx"};
1414
static char const * CONTACT{"Damian R (damian@motoi.pro)"};

chrgfx/src/colconv.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ u32 encode_col(rgbcoldef const & rgbcoldef, color const & color)
2828

2929
u32 out { 0 };
3030
u8 bitdepth = rgbcoldef.bitdepth();
31-
byte_t red { reduce_bitdepth(color.red, bitdepth) }, red_pass_shift { 0 },
31+
u8 red { reduce_bitdepth(color.red, bitdepth) }, red_pass_shift { 0 },
3232
green { reduce_bitdepth(color.green, bitdepth) }, green_pass_shift { 0 },
3333
blue { reduce_bitdepth(color.blue, bitdepth) }, blue_pass_shift { 0 };
3434

chrgfx/src/utils.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
namespace chrgfx
44
{
55

6-
byte_t reduce_bitdepth(byte_t data, u8 bitdepth)
6+
u8 reduce_bitdepth(u8 data, u8 bitdepth)
77
{
88
// convert color bit depths algo:
99
// (bitdepth_a_value * bitdepth_b_max) / bitdepth_a_max = bitdepth_b_value
@@ -12,7 +12,7 @@ byte_t reduce_bitdepth(byte_t data, u8 bitdepth)
1212
return (data * (create_bitmask8(bitdepth) + 1)) / 256;
1313
}
1414

15-
byte_t expand_bitdepth(byte_t data, u8 bitdepth)
15+
u8 expand_bitdepth(u8 data, u8 bitdepth)
1616
{
1717
// shamelessly stolen from MAME
1818
if(bitdepth == 1)
@@ -124,7 +124,6 @@ palette make_pal_random()
124124
return outpal;
125125
}
126126

127-
128127
bool is_system_bigendian()
129128
{
130129
// shamelessly stolen from stack overflow

0 commit comments

Comments
 (0)