bgra flip fixes

This commit is contained in:
luboslenco
2025-11-18 09:57:00 +01:00
parent ece2cb8448
commit 6326b6c713
4 changed files with 12 additions and 16 deletions
+10
View File
@@ -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;
+2 -1
View File
@@ -86,7 +86,8 @@ type context_t = {
node_preview_map?: map_t<i32, gpu_texture_t>;
node_preview_name?: string;
node_previews?: map_t<string, gpu_texture_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;
-10
View File
@@ -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);
-5
View File
@@ -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);