summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--editor/plugins/polygon_2d_editor_plugin.cpp2
-rw-r--r--editor/plugins/tiles/tile_set_atlas_source_editor.cpp12
-rw-r--r--scene/gui/rich_text_label.cpp3
-rw-r--r--scene/gui/tab_container.cpp4
-rw-r--r--scene/gui/tabs.cpp2
-rw-r--r--scene/gui/texture_progress_bar.cpp5
-rw-r--r--scene/gui/tree.cpp2
-rw-r--r--servers/rendering/renderer_rd/renderer_compositor_rd.cpp2
-rw-r--r--servers/rendering/renderer_rd/renderer_scene_render_rd.cpp14
-rw-r--r--tests/test_physics_2d.cpp2
10 files changed, 20 insertions, 28 deletions
diff --git a/editor/plugins/polygon_2d_editor_plugin.cpp b/editor/plugins/polygon_2d_editor_plugin.cpp
index ac18ff9f1c..5afe9ed60c 100644
--- a/editor/plugins/polygon_2d_editor_plugin.cpp
+++ b/editor/plugins/polygon_2d_editor_plugin.cpp
@@ -779,7 +779,7 @@ void Polygon2DEditor::_uv_input(const Ref<InputEvent> &p_input) {
if (mm.is_valid()) {
if ((mm->get_button_mask() & MOUSE_BUTTON_MASK_MIDDLE) || Input::get_singleton()->is_key_pressed(KEY_SPACE)) {
- Vector2 drag(mm->get_relative().x, mm->get_relative().y);
+ Vector2 drag = mm->get_relative();
uv_hscroll->set_value(uv_hscroll->get_value() - drag.x);
uv_vscroll->set_value(uv_vscroll->get_value() - drag.y);
diff --git a/editor/plugins/tiles/tile_set_atlas_source_editor.cpp b/editor/plugins/tiles/tile_set_atlas_source_editor.cpp
index 54185d1d2a..76a05449db 100644
--- a/editor/plugins/tiles/tile_set_atlas_source_editor.cpp
+++ b/editor/plugins/tiles/tile_set_atlas_source_editor.cpp
@@ -926,11 +926,11 @@ void TileSetAtlasSourceEditor::_tile_atlas_control_gui_input(const Ref<InputEven
can_grow[i] |= (i % 2 == 0) ? size_in_atlas.y > 1 : size_in_atlas.x > 1;
}
for (int i = 0; i < 4; i++) {
- Vector2 pos = rect.position + Vector2(rect.size.x, rect.size.y) * coords[i];
+ Vector2 pos = rect.position + rect.size * coords[i];
if (can_grow[i] && can_grow[(i + 3) % 4] && Rect2(pos, zoomed_size).has_point(mouse_local_pos)) {
cursor_shape = (i % 2) ? CURSOR_BDIAGSIZE : CURSOR_FDIAGSIZE;
}
- Vector2 next_pos = rect.position + Vector2(rect.size.x, rect.size.y) * coords[(i + 1) % 4];
+ Vector2 next_pos = rect.position + rect.size * coords[(i + 1) % 4];
if (can_grow[i] && Rect2((pos + next_pos) / 2.0, zoomed_size).has_point(mouse_local_pos)) {
cursor_shape = (i % 2) ? CURSOR_HSIZE : CURSOR_VSIZE;
}
@@ -1136,7 +1136,7 @@ void TileSetAtlasSourceEditor::_tile_atlas_control_gui_input(const Ref<InputEven
can_grow[i] |= (i % 2 == 0) ? size_in_atlas.y > 1 : size_in_atlas.x > 1;
}
for (int i = 0; i < 4; i++) {
- Vector2 pos = rect.position + Vector2(rect.size.x, rect.size.y) * coords[i];
+ Vector2 pos = rect.position + rect.size * coords[i];
if (can_grow[i] && can_grow[(i + 3) % 4] && Rect2(pos, zoomed_size).has_point(mouse_local_pos)) {
drag_type = (DragType)((int)DRAG_TYPE_RESIZE_TOP_LEFT + i * 2);
drag_start_mouse_pos = mouse_local_pos;
@@ -1145,7 +1145,7 @@ void TileSetAtlasSourceEditor::_tile_atlas_control_gui_input(const Ref<InputEven
drag_start_tile_shape = Rect2i(selected.tile, tile_set_atlas_source->get_tile_size_in_atlas(selected.tile));
cursor_shape = (i % 2) ? CURSOR_BDIAGSIZE : CURSOR_FDIAGSIZE;
}
- Vector2 next_pos = rect.position + Vector2(rect.size.x, rect.size.y) * coords[(i + 1) % 4];
+ Vector2 next_pos = rect.position + rect.size * coords[(i + 1) % 4];
if (can_grow[i] && Rect2((pos + next_pos) / 2.0, zoomed_size).has_point(mouse_local_pos)) {
drag_type = (DragType)((int)DRAG_TYPE_RESIZE_TOP + i * 2);
drag_start_mouse_pos = mouse_local_pos;
@@ -1614,13 +1614,13 @@ void TileSetAtlasSourceEditor::_tile_atlas_control_draw() {
can_grow[i] |= (i % 2 == 0) ? size_in_atlas.y > 1 : size_in_atlas.x > 1;
}
for (int i = 0; i < 4; i++) {
- Vector2 pos = rect.position + Vector2(rect.size.x, rect.size.y) * coords[i];
+ Vector2 pos = rect.position + rect.size * coords[i];
if (can_grow[i] && can_grow[(i + 3) % 4]) {
tile_atlas_control->draw_texture_rect(resize_handle, Rect2(pos, zoomed_size), false);
} else {
tile_atlas_control->draw_texture_rect(resize_handle_disabled, Rect2(pos, zoomed_size), false);
}
- Vector2 next_pos = rect.position + Vector2(rect.size.x, rect.size.y) * coords[(i + 1) % 4];
+ Vector2 next_pos = rect.position + rect.size * coords[(i + 1) % 4];
if (can_grow[i]) {
tile_atlas_control->draw_texture_rect(resize_handle, Rect2((pos + next_pos) / 2.0, zoomed_size), false);
} else {
diff --git a/scene/gui/rich_text_label.cpp b/scene/gui/rich_text_label.cpp
index 3eaae5181d..277026cc28 100644
--- a/scene/gui/rich_text_label.cpp
+++ b/scene/gui/rich_text_label.cpp
@@ -2378,8 +2378,7 @@ void RichTextLabel::add_image(const Ref<Texture2D> &p_image, const int p_width,
item->size.width = p_image->get_width() * p_height / p_image->get_height();
} else {
// keep original width and height
- item->size.height = p_image->get_height();
- item->size.width = p_image->get_width();
+ item->size = p_image->get_size();
}
}
diff --git a/scene/gui/tab_container.cpp b/scene/gui/tab_container.cpp
index a423dc0173..7844c6b309 100644
--- a/scene/gui/tab_container.cpp
+++ b/scene/gui/tab_container.cpp
@@ -79,7 +79,7 @@ void TabContainer::gui_input(const Ref<InputEvent> &p_event) {
Popup *popup = get_popup();
if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_LEFT) {
- Point2 pos(mb->get_position().x, mb->get_position().y);
+ Point2 pos = mb->get_position();
Size2 size = get_size();
// Click must be on tabs in the tab header area.
@@ -190,7 +190,7 @@ void TabContainer::gui_input(const Ref<InputEvent> &p_event) {
Ref<InputEventMouseMotion> mm = p_event;
if (mm.is_valid()) {
- Point2 pos(mm->get_position().x, mm->get_position().y);
+ Point2 pos = mm->get_position();
Size2 size = get_size();
// Mouse must be on tabs in the tab header area.
diff --git a/scene/gui/tabs.cpp b/scene/gui/tabs.cpp
index 3ca2d1c1e9..e1479b8bd6 100644
--- a/scene/gui/tabs.cpp
+++ b/scene/gui/tabs.cpp
@@ -167,7 +167,7 @@ void Tabs::gui_input(const Ref<InputEvent> &p_event) {
if (mb->is_pressed() && (mb->get_button_index() == MOUSE_BUTTON_LEFT || (select_with_rmb && mb->get_button_index() == MOUSE_BUTTON_RIGHT))) {
// clicks
- Point2 pos(mb->get_position().x, mb->get_position().y);
+ Point2 pos = mb->get_position();
if (buttons_visible) {
Ref<Texture2D> incr = get_theme_icon(SNAME("increment"));
diff --git a/scene/gui/texture_progress_bar.cpp b/scene/gui/texture_progress_bar.cpp
index 286f01ee33..35a098c6fd 100644
--- a/scene/gui/texture_progress_bar.cpp
+++ b/scene/gui/texture_progress_bar.cpp
@@ -471,7 +471,7 @@ void TextureProgressBar::_notification(int p_what) {
Vector<Point2> uvs;
Vector<Point2> points;
uvs.push_back(get_relative_center());
- points.push_back(progress_offset + Point2(s.x * get_relative_center().x, s.y * get_relative_center().y));
+ points.push_back(progress_offset + s * get_relative_center());
for (int i = 0; i < pts.size(); i++) {
Point2 uv = unit_val_to_uv(pts[i]);
if (uvs.find(uv) >= 0) {
@@ -493,8 +493,7 @@ void TextureProgressBar::_notification(int p_what) {
p = progress->get_size();
}
- p.x *= get_relative_center().x;
- p.y *= get_relative_center().y;
+ p *= get_relative_center();
p = p.floor();
draw_line(p - Point2(8, 0), p + Point2(8, 0), Color(0.9, 0.5, 0.5), 2);
draw_line(p - Point2(0, 8), p + Point2(0, 8), Color(0.9, 0.5, 0.5), 2);
diff --git a/scene/gui/tree.cpp b/scene/gui/tree.cpp
index f62c09925d..b1b0323c47 100644
--- a/scene/gui/tree.cpp
+++ b/scene/gui/tree.cpp
@@ -1712,7 +1712,7 @@ int Tree::draw_item(const Point2i &p_pos, const Point2 &p_draw_ofs, const Size2
}
if ((select_mode == SELECT_ROW && selected_item == p_item) || p_item->cells[i].selected || !p_item->has_meta("__focus_rect")) {
- Rect2i r(cell_rect.position, cell_rect.size);
+ Rect2i r = cell_rect;
p_item->set_meta("__focus_rect", Rect2(r.position, r.size));
diff --git a/servers/rendering/renderer_rd/renderer_compositor_rd.cpp b/servers/rendering/renderer_rd/renderer_compositor_rd.cpp
index c53c202bab..559e6d5ad7 100644
--- a/servers/rendering/renderer_rd/renderer_compositor_rd.cpp
+++ b/servers/rendering/renderer_rd/renderer_compositor_rd.cpp
@@ -197,7 +197,7 @@ void RendererCompositorRD::set_boot_image(const Ref<Image> &p_image, const Color
}
} else {
screenrect = imgrect;
- screenrect.position += ((Size2(window_size.width, window_size.height) - screenrect.size) / 2.0).floor();
+ screenrect.position += ((window_size - screenrect.size) / 2.0).floor();
}
screenrect.position /= window_size;
diff --git a/servers/rendering/renderer_rd/renderer_scene_render_rd.cpp b/servers/rendering/renderer_rd/renderer_scene_render_rd.cpp
index 8e31ec1d8b..b0fdd0b0a9 100644
--- a/servers/rendering/renderer_rd/renderer_scene_render_rd.cpp
+++ b/servers/rendering/renderer_rd/renderer_scene_render_rd.cpp
@@ -4258,10 +4258,7 @@ void RendererSceneRenderRD::_render_shadow_pass(RID p_light, RID p_shadow_atlas,
light_projection = light_instance->shadow_transform[p_pass].camera;
light_transform = light_instance->shadow_transform[p_pass].transform;
- atlas_rect.position.x = light_instance->directional_rect.position.x;
- atlas_rect.position.y = light_instance->directional_rect.position.y;
- atlas_rect.size.width = light_instance->directional_rect.size.x;
- atlas_rect.size.height = light_instance->directional_rect.size.y;
+ atlas_rect = light_instance->directional_rect;
if (storage->light_directional_get_shadow_mode(light_instance->light) == RS::LIGHT_DIRECTIONAL_SHADOW_PARALLEL_4_SPLITS) {
atlas_rect.size.width /= 2;
@@ -4272,8 +4269,7 @@ void RendererSceneRenderRD::_render_shadow_pass(RID p_light, RID p_shadow_atlas,
} else if (p_pass == 2) {
atlas_rect.position.y += atlas_rect.size.height;
} else if (p_pass == 3) {
- atlas_rect.position.x += atlas_rect.size.width;
- atlas_rect.position.y += atlas_rect.size.height;
+ atlas_rect.position += atlas_rect.size;
}
} else if (storage->light_directional_get_shadow_mode(light_instance->light) == RS::LIGHT_DIRECTIONAL_SHADOW_PARALLEL_2_SPLITS) {
atlas_rect.size.height /= 2;
@@ -4382,10 +4378,8 @@ void RendererSceneRenderRD::_render_shadow_pass(RID p_light, RID p_shadow_atlas,
_render_shadow_end();
//reblit
Rect2 atlas_rect_norm = atlas_rect;
- atlas_rect_norm.position.x /= float(atlas_size);
- atlas_rect_norm.position.y /= float(atlas_size);
- atlas_rect_norm.size.x /= float(atlas_size);
- atlas_rect_norm.size.y /= float(atlas_size);
+ atlas_rect_norm.position /= float(atlas_size);
+ atlas_rect_norm.size /= float(atlas_size);
storage->get_effects()->copy_cubemap_to_dp(render_texture, atlas_fb, atlas_rect_norm, atlas_rect.size, light_projection.get_z_near(), light_projection.get_z_far(), false);
atlas_rect_norm.position += Vector2(dual_paraboloid_offset) * atlas_rect_norm.size;
storage->get_effects()->copy_cubemap_to_dp(render_texture, atlas_fb, atlas_rect_norm, atlas_rect.size, light_projection.get_z_near(), light_projection.get_z_far(), true);
diff --git a/tests/test_physics_2d.cpp b/tests/test_physics_2d.cpp
index f63b866c3e..f6619db8fd 100644
--- a/tests/test_physics_2d.cpp
+++ b/tests/test_physics_2d.cpp
@@ -199,7 +199,7 @@ protected:
if (mb.is_valid()) {
if (mb->is_pressed()) {
- Point2 p(mb->get_position().x, mb->get_position().y);
+ Point2 p = mb->get_position();
if (mb->get_button_index() == 1) {
ray_to = p;