Skip to content

Commit

Permalink
improve bitmap
Browse files Browse the repository at this point in the history
  • Loading branch information
xianjimli committed Nov 28, 2024
1 parent 4cb0140 commit 2c6747d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/base/bitmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,8 @@ static ret_t bitmap_platform_create(bitmap_t* bitmap) {
bitmap_format_t format = bitmap->format;

uint8_t* data = bitmap_lock_buffer_for_write(bitmap);
return_value_if_fail(format == BITMAP_FMT_RGBA8888, NULL);
return_value_if_fail(format == BITMAP_FMT_RGBA8888, RET_BAD_PARAMS);

int32_t id = EM_ASM_INT(
{ return VGCanvas.createMutableImage($0, $1, $2, $3, $4); }, data, w, h, line_length, format);
bitmap->specific = tk_pointer_from_int(id);
Expand Down Expand Up @@ -607,7 +608,7 @@ ret_t bitmap_init_ex(bitmap_t* bitmap, uint32_t w, uint32_t h, uint32_t line_len
bitmap->should_free_data = TRUE;
}

if (bitmap->buffer == NULL) {
if (bitmap->buffer != NULL) {
bitmap_platform_create(bitmap);
}

Expand Down

0 comments on commit 2c6747d

Please sign in to comment.