Skip to content

Commit

Permalink
Don't write conditionals backwards
Browse files Browse the repository at this point in the history
  • Loading branch information
aaaaaa123456789 committed Jan 29, 2022
1 parent ec181e7 commit 568e8c1
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/bmpwrite.c
Original file line number Diff line number Diff line change
Expand Up @@ -336,12 +336,13 @@ void generate_BMP_RGB_data (struct context * context, unsigned char * offset_poi
attributes[12] = 1;
attributes[14] = 24;
uint32_t * data;
if ((context -> source -> color_format & PLUM_COLOR_MASK) != PLUM_COLOR_32) {
if ((context -> source -> color_format & PLUM_COLOR_MASK) == PLUM_COLOR_32)
data = context -> source -> data;
else {
data = ctxmalloc(context, sizeof *data * context -> source -> width * context -> source -> height);
plum_convert_colors(data, context -> source -> data, (size_t) context -> source -> width * context -> source -> height,
PLUM_COLOR_32, context -> source -> color_format);
} else
data = context -> source -> data;
}
size_t rowsize = (size_t) context -> source -> width * 3, padding = 0;
if (rowsize & 3) {
padding = 4 - (rowsize & 3);
Expand Down

0 comments on commit 568e8c1

Please sign in to comment.