diff options
author | Marcel Admiraal <madmiraal@users.noreply.github.com> | 2020-09-07 10:59:52 +0100 |
---|---|---|
committer | Marcel Admiraal <madmiraal@users.noreply.github.com> | 2020-09-07 11:00:00 +0100 |
commit | 08bedf68ff053cfb2434cc7ead4b28433c94c2c5 (patch) | |
tree | abb6cf43fe5fd6471bbf024e10b05d797707017f | |
parent | 753b2bd01082ea6de89c58e73518326383441201 (diff) |
Clarify comparison precedence when enabling or disabling back buffer.
-rw-r--r-- | servers/rendering/rendering_server_canvas.cpp | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/servers/rendering/rendering_server_canvas.cpp b/servers/rendering/rendering_server_canvas.cpp index 5c0741bb3b..07eabfd430 100644 --- a/servers/rendering/rendering_server_canvas.cpp +++ b/servers/rendering/rendering_server_canvas.cpp @@ -900,13 +900,12 @@ void RenderingServerCanvas::canvas_item_attach_skeleton(RID p_item, RID p_skelet void RenderingServerCanvas::canvas_item_set_copy_to_backbuffer(RID p_item, bool p_enable, const Rect2 &p_rect) { Item *canvas_item = canvas_item_owner.getornull(p_item); ERR_FAIL_COND(!canvas_item); - if (bool(canvas_item->copy_back_buffer != nullptr) != p_enable) { - if (p_enable) { - canvas_item->copy_back_buffer = memnew(RasterizerCanvas::Item::CopyBackBuffer); - } else { - memdelete(canvas_item->copy_back_buffer); - canvas_item->copy_back_buffer = nullptr; - } + if (p_enable && (canvas_item->copy_back_buffer == nullptr)) { + canvas_item->copy_back_buffer = memnew(RasterizerCanvas::Item::CopyBackBuffer); + } + if (!p_enable && (canvas_item->copy_back_buffer != nullptr)) { + memdelete(canvas_item->copy_back_buffer); + canvas_item->copy_back_buffer = nullptr; } if (p_enable) { |