Skip to content

Commit

Permalink
Merge pull request phoboslab#84 from xfmoulet/master
Browse files Browse the repository at this point in the history
Force a RGB source to have an alpha of 255
  • Loading branch information
phoboslab authored Dec 13, 2021
2 parents 2ee2169 + 99fa977 commit 6a95206
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions qoi.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ struct qoi_header_t {
uint8_t colorspace; // 0 = sRGB with linear alpha, 1 = all channels linear
};
The decoder and encoder start with {r: 0, g: 0, b: 0, a: 0} as the previous
The decoder and encoder start with {r: 0, g: 0, b: 0, a: 255} as the previous
pixel value. Pixels are either encoded as
- a run of the previous pixel
- an index into an array of previously seen pixels
Expand Down Expand Up @@ -389,7 +389,7 @@ void *qoi_encode(const void *data, const qoi_desc *desc, int *out_len) {
qoi_rgba_t index[64] = {0};

int run = 0;
qoi_rgba_t px_prev = {.rgba = {.r = 0, .g = 0, .b = 0, .a = 0}};
qoi_rgba_t px_prev = {.rgba = {.r = 0, .g = 0, .b = 0, .a = 255}};
qoi_rgba_t px = px_prev;

int px_len = desc->width * desc->height * desc->channels;
Expand Down Expand Up @@ -514,7 +514,7 @@ void *qoi_decode(const void *data, int size, qoi_desc *desc, int channels) {
return NULL;
}

qoi_rgba_t px = {.rgba = {.r = 0, .g = 0, .b = 0, .a = 0}};
qoi_rgba_t px = {.rgba = {.r = 0, .g = 0, .b = 0, .a = 255}};
qoi_rgba_t index[64] = {0};

int run = 0;
Expand Down

0 comments on commit 6a95206

Please sign in to comment.