diff options
author | Rémi Verschelde <remi@verschelde.fr> | 2020-12-19 21:32:14 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-19 21:32:14 +0100 |
commit | e9d12f9e4ea30a6c3f2cf179f104a153d668c2a3 (patch) | |
tree | f1d12e916b17a749335ef2e39151863e7d56280c /scene | |
parent | 93acaca8ca0ae0cd369aa2ffa1a8f1128a08e42b (diff) | |
parent | 2df9a8ccadf3e7f99d767456eedb0e559c96572c (diff) | |
download | redot-engine-e9d12f9e4ea30a6c3f2cf179f104a153d668c2a3.tar.gz |
Merge pull request #44521 from madmiraal/rename-rect2-clip
Rename Rect2 and Rect2i clip() to intersection()
Diffstat (limited to 'scene')
-rw-r--r-- | scene/resources/bit_map.cpp | 6 | ||||
-rw-r--r-- | scene/resources/texture.cpp | 4 |
2 files changed, 5 insertions, 5 deletions
diff --git a/scene/resources/bit_map.cpp b/scene/resources/bit_map.cpp index 10f0de8ff8..d07447179d 100644 --- a/scene/resources/bit_map.cpp +++ b/scene/resources/bit_map.cpp @@ -63,7 +63,7 @@ void BitMap::create_from_image_alpha(const Ref<Image> &p_image, float p_threshol } void BitMap::set_bit_rect(const Rect2 &p_rect, bool p_value) { - Rect2i current = Rect2i(0, 0, width, height).clip(p_rect); + Rect2i current = Rect2i(0, 0, width, height).intersection(p_rect); uint8_t *data = bitmask.ptrw(); for (int i = current.position.x; i < current.position.x + current.size.x; i++) { @@ -482,7 +482,7 @@ static void fill_bits(const BitMap *p_src, Ref<BitMap> &p_map, const Point2i &p_ } Vector<Vector<Vector2>> BitMap::clip_opaque_to_polygons(const Rect2 &p_rect, float p_epsilon) const { - Rect2i r = Rect2i(0, 0, width, height).clip(p_rect); + Rect2i r = Rect2i(0, 0, width, height).intersection(p_rect); print_verbose("BitMap: Rect: " + r); Point2i from; @@ -522,7 +522,7 @@ void BitMap::grow_mask(int p_pixels, const Rect2 &p_rect) { bool bit_value = p_pixels > 0; p_pixels = Math::abs(p_pixels); - Rect2i r = Rect2i(0, 0, width, height).clip(p_rect); + Rect2i r = Rect2i(0, 0, width, height).intersection(p_rect); Ref<BitMap> copy; copy.instance(); diff --git a/scene/resources/texture.cpp b/scene/resources/texture.cpp index 1507537cd0..706b18d2b5 100644 --- a/scene/resources/texture.cpp +++ b/scene/resources/texture.cpp @@ -1253,7 +1253,7 @@ bool AtlasTexture::get_rect_region(const Rect2 &p_rect, const Rect2 &p_src_rect, Vector2 scale = p_rect.size / src.size; src.position += (rc.position - margin.position); - Rect2 src_c = rc.clip(src); + Rect2 src_c = rc.intersection(src); if (src_c.size == Size2()) { return false; } @@ -1575,7 +1575,7 @@ void LargeTexture::draw_rect_region(RID p_canvas_item, const Rect2 &p_rect, cons if (!p_src_rect.intersects(rect)) { continue; } - Rect2 local = p_src_rect.clip(rect); + Rect2 local = p_src_rect.intersection(rect); Rect2 target = local; target.size *= scale; target.position = p_rect.position + (p_src_rect.position + rect.position) * scale; |