diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2022-01-08 23:38:06 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-08 23:38:06 +0100 |
commit | 32abe36cceacf7221fde09f84e0610c7d4741640 (patch) | |
tree | 6a48950aef7472d1baf57dc50403b20ef12fc1c3 /servers/rendering/renderer_rd | |
parent | e03714f66c1047024de5adc5b8f42f3edc8abcb9 (diff) | |
parent | c9f5d88f3a152be03450af364075420e10dc1f18 (diff) |
Merge pull request #56617 from AnilBK/use_fill
Use fill() to fill an entire image instead of setting pixels individually.
Diffstat (limited to 'servers/rendering/renderer_rd')
-rw-r--r-- | servers/rendering/renderer_rd/renderer_scene_render_rd.cpp | 6 | ||||
-rw-r--r-- | servers/rendering/renderer_rd/renderer_storage_rd.cpp | 21 |
2 files changed, 4 insertions, 23 deletions
diff --git a/servers/rendering/renderer_rd/renderer_scene_render_rd.cpp b/servers/rendering/renderer_rd/renderer_scene_render_rd.cpp index 7af4f0e849..77843ceee5 100644 --- a/servers/rendering/renderer_rd/renderer_scene_render_rd.cpp +++ b/servers/rendering/renderer_rd/renderer_scene_render_rd.cpp @@ -545,11 +545,7 @@ Ref<Image> RendererSceneRenderRD::environment_bake_panorama(RID p_env, bool p_ba Ref<Image> panorama; panorama.instantiate(); panorama->create(p_size.width, p_size.height, false, Image::FORMAT_RGBAF); - for (int x = 0; x < p_size.width; x++) { - for (int y = 0; y < p_size.height; y++) { - panorama->set_pixel(x, y, panorama_color); - } - } + panorama->fill(panorama_color); return panorama; } diff --git a/servers/rendering/renderer_rd/renderer_storage_rd.cpp b/servers/rendering/renderer_rd/renderer_storage_rd.cpp index 5507f206b5..932cdcaea8 100644 --- a/servers/rendering/renderer_rd/renderer_storage_rd.cpp +++ b/servers/rendering/renderer_rd/renderer_storage_rd.cpp @@ -971,12 +971,7 @@ void RendererStorageRD::texture_2d_placeholder_initialize(RID p_texture) { Ref<Image> image; image.instantiate(); image->create(4, 4, false, Image::FORMAT_RGBA8); - - for (int i = 0; i < 4; i++) { - for (int j = 0; j < 4; j++) { - image->set_pixel(i, j, Color(1, 0, 1, 1)); - } - } + image->fill(Color(1, 0, 1, 1)); texture_2d_initialize(p_texture, image); } @@ -987,12 +982,7 @@ void RendererStorageRD::texture_2d_layered_placeholder_initialize(RID p_texture, Ref<Image> image; image.instantiate(); image->create(4, 4, false, Image::FORMAT_RGBA8); - - for (int i = 0; i < 4; i++) { - for (int j = 0; j < 4; j++) { - image->set_pixel(i, j, Color(1, 0, 1, 1)); - } - } + image->fill(Color(1, 0, 1, 1)); Vector<Ref<Image>> images; if (p_layered_type == RS::TEXTURE_LAYERED_2D_ARRAY) { @@ -1013,12 +1003,7 @@ void RendererStorageRD::texture_3d_placeholder_initialize(RID p_texture) { Ref<Image> image; image.instantiate(); image->create(4, 4, false, Image::FORMAT_RGBA8); - - for (int i = 0; i < 4; i++) { - for (int j = 0; j < 4; j++) { - image->set_pixel(i, j, Color(1, 0, 1, 1)); - } - } + image->fill(Color(1, 0, 1, 1)); Vector<Ref<Image>> images; //cube |