Skip to content

Commit

Permalink
improve for awtk-web
Browse files Browse the repository at this point in the history
  • Loading branch information
xianjimli committed Nov 28, 2024
1 parent cb10277 commit 18aec83
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/base/bitmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -125,15 +125,16 @@ static ret_t bitmap_web_destroy(bitmap_t* bitmap) {
}

static ret_t bitmap_platform_create(bitmap_t* bitmap) {
int32_t id = 0;
uint8_t* data = NULL;
uint32_t w = bitmap->w;
uint32_t h = bitmap->h;
uint32_t line_length = bitmap_get_physical_line_length(bitmap);
bitmap_format_t format = bitmap->format;

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

int32_t id = EM_ASM_INT(
data = bitmap_lock_buffer_for_write(bitmap);
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);
bitmap->specific_destroy = bitmap_web_destroy;
Expand Down

0 comments on commit 18aec83

Please sign in to comment.