diff options
author | Anilforextra <anilforextra@gmail.com> | 2022-01-08 17:43:15 +0545 |
---|---|---|
committer | Anilforextra <anilforextra@gmail.com> | 2022-01-08 17:43:15 +0545 |
commit | c9f5d88f3a152be03450af364075420e10dc1f18 (patch) | |
tree | 5712375f0d445caa60d5199aa98c17e01cbf2cbf /editor | |
parent | c09c4e0154160f74f1d9889f74cd3e411ba7a08c (diff) |
Use fill() to fill an entire image instead of setting pixels individually.
Diffstat (limited to 'editor')
-rw-r--r-- | editor/plugins/curve_editor_plugin.cpp | 7 | ||||
-rw-r--r-- | editor/plugins/editor_preview_plugins.cpp | 6 |
2 files changed, 3 insertions, 10 deletions
diff --git a/editor/plugins/curve_editor_plugin.cpp b/editor/plugins/curve_editor_plugin.cpp index 81fb36276f..a9a276fc18 100644 --- a/editor/plugins/curve_editor_plugin.cpp +++ b/editor/plugins/curve_editor_plugin.cpp @@ -803,11 +803,8 @@ Ref<Texture2D> CurvePreviewGenerator::generate(const Ref<Resource> &p_from, cons im.create(thumbnail_size, thumbnail_size / 2, false, Image::FORMAT_RGBA8); Color bg_color(0.1, 0.1, 0.1, 1.0); - for (int i = 0; i < thumbnail_size; i++) { - for (int j = 0; j < thumbnail_size / 2; j++) { - im.set_pixel(i, j, bg_color); - } - } + + im.fill(bg_color); Color line_color(0.8, 0.8, 0.8, 1.0); float range_y = curve.get_max_value() - curve.get_min_value(); diff --git a/editor/plugins/editor_preview_plugins.cpp b/editor/plugins/editor_preview_plugins.cpp index 2053194dc1..cef505181a 100644 --- a/editor/plugins/editor_preview_plugins.cpp +++ b/editor/plugins/editor_preview_plugins.cpp @@ -514,11 +514,7 @@ Ref<Texture2D> EditorScriptPreviewPlugin::generate(const RES &p_from, const Size } bg_color.a = MAX(bg_color.a, 0.2); // some background - for (int i = 0; i < thumbnail_size; i++) { - for (int j = 0; j < thumbnail_size; j++) { - img->set_pixel(i, j, bg_color); - } - } + img->fill(bg_color); const int x0 = thumbnail_size / 8; const int y0 = thumbnail_size / 8; |