From 072f6feabac70a6c4ed1a16f4e983bf31ad62d50 Mon Sep 17 00:00:00 2001 From: kobewi Date: Fri, 22 Jul 2022 20:06:19 +0200 Subject: Make some Image methods static --- servers/rendering/renderer_rd/environment/gi.cpp | 2 +- servers/rendering/renderer_rd/environment/sky.cpp | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) (limited to 'servers/rendering/renderer_rd/environment') diff --git a/servers/rendering/renderer_rd/environment/gi.cpp b/servers/rendering/renderer_rd/environment/gi.cpp index 9b6be0b422..f4a27144d9 100644 --- a/servers/rendering/renderer_rd/environment/gi.cpp +++ b/servers/rendering/renderer_rd/environment/gi.cpp @@ -2335,7 +2335,7 @@ void GI::SDFGI::render_region(Ref p_render_buffers, int p_ img.instantiate(); for (uint32_t i = 0; i < cascade_size; i++) { Vector subarr = data.slice(128 * 128 * i, 128 * 128 * (i + 1)); - img->create(cascade_size, cascade_size, false, Image::FORMAT_L8, subarr); + img->set_data(cascade_size, cascade_size, false, Image::FORMAT_L8, subarr); img->save_png("res://cascade_sdf_" + itos(cascade) + "_" + itos(i) + ".png"); } diff --git a/servers/rendering/renderer_rd/environment/sky.cpp b/servers/rendering/renderer_rd/environment/sky.cpp index 4ff2a66975..6940276040 100644 --- a/servers/rendering/renderer_rd/environment/sky.cpp +++ b/servers/rendering/renderer_rd/environment/sky.cpp @@ -772,9 +772,7 @@ Ref SkyRD::Sky::bake_panorama(float p_energy, int p_roughness_layers, con Vector data = RD::get_singleton()->texture_get_data(rad_tex, 0); RD::get_singleton()->free(rad_tex); - Ref img; - img.instantiate(); - img->create(p_size.width, p_size.height, false, Image::FORMAT_RGBAF, data); + Ref img = Image::create_from_data(p_size.width, p_size.height, false, Image::FORMAT_RGBAF, data); for (int i = 0; i < p_size.width; i++) { for (int j = 0; j < p_size.height; j++) { Color c = img->get_pixel(i, j); -- cgit v1.2.3