diff --git a/base/sources/iron.h b/base/sources/iron.h index c6f64278..e0f78a29 100644 --- a/base/sources/iron.h +++ b/base/sources/iron.h @@ -1588,7 +1588,17 @@ void _write_image(char *path, buffer_t *bytes, i32 w, i32 h, i32 format, int ima unsigned char *rgba = (unsigned char *)bytes->buffer; if (format == 0) { // RGBA comp = 4; +#ifdef IRON_BGRA + pixels = (unsigned char *)malloc(w * h * comp); + for (int i = 0; i < w * h; ++i) { + pixels[i * 4] = rgba[i * 4 + 2]; + pixels[i * 4 + 1] = rgba[i * 4 + 1]; + pixels[i * 4 + 2] = rgba[i * 4]; + pixels[i * 4 + 3] = rgba[i * 4 + 3]; + } +#else pixels = rgba; +#endif } else if (format == 1) { // R comp = 1; diff --git a/paint/sources/context.ts b/paint/sources/context.ts index cfd01b87..c2ead05f 100644 --- a/paint/sources/context.ts +++ b/paint/sources/context.ts @@ -86,7 +86,8 @@ type context_t = { node_preview_map?: map_t; node_preview_name?: string; node_previews?: map_t; - node_previews_used?: string[]; selected_node_preview : bool; + node_previews_used?: string[]; + selected_node_preview?: bool; mask_preview_rgba32?: gpu_texture_t; mask_preview_last?: slot_layer_t; colorid_picked?: bool; diff --git a/paint/sources/export_arm.ts b/paint/sources/export_arm.ts index e330dbfd..b9766cff 100644 --- a/paint/sources/export_arm.ts +++ b/paint/sources/export_arm.ts @@ -158,16 +158,6 @@ function export_arm_run_project() { for (let i: i32 = 0; i < 256 * 256 * 4; ++i) { u8a[i] = math_floor(math_pow(u8a[i] / 255, 1.0 / 2.2) * 255); } - /// if IRON_BGRA - export_arm_bgra_swap(mesh_icon_pixels); - /// end - - // raw.mesh_icons = - // ///if IRON_BGRA - // [encode(bgra_swap(mesh_icon_pixels)]; - // ///else - // [encode(mesh_icon_pixels)]; - // ///end iron_write_png(substring(project_filepath, 0, project_filepath.length - 4) + "_icon.png", mesh_icon_pixels, 256, 256, 0); gpu_delete_texture(mesh_icon); diff --git a/paint/sources/tab_textures.ts b/paint/sources/tab_textures.ts index b1d8ac94..214a1a15 100644 --- a/paint/sources/tab_textures.ts +++ b/paint/sources/tab_textures.ts @@ -143,12 +143,7 @@ function tab_textures_draw(htab: ui_handle_t) { f += ".png"; } - /// if IRON_BGRA - let buf: buffer_t = export_arm_bgra_swap(gpu_get_texture_pixels(target)); - /// else let buf: buffer_t = gpu_get_texture_pixels(target); - /// end - iron_write_png(path + path_sep + f, buf, target.width, target.height, 0); gpu_delete_texture(target); }, target);