From c494246759426cfb584ac33f1bcd13efaec7b36a Mon Sep 17 00:00:00 2001 From: Simon Ars <127692841+SimonArs@users.noreply.github.com> Date: Mon, 10 Aug 2026 23:43:15 +0200 Subject: [PATCH 1/2] Fix findFrame leak --- flixel/graphics/frames/FlxAtlasFrames.hx | 1 + 1 file changed, 1 insertion(+) diff --git a/flixel/graphics/frames/FlxAtlasFrames.hx b/flixel/graphics/frames/FlxAtlasFrames.hx index 5e0a7523dd..cc48041dff 100644 --- a/flixel/graphics/frames/FlxAtlasFrames.hx +++ b/flixel/graphics/frames/FlxAtlasFrames.hx @@ -420,6 +420,7 @@ class FlxAtlasFrames extends FlxFramesCollection if (atlas.border.equals(border)) return atlas; + border.putWeak(); return null; } From 9330a312a5738210b71286019f1b9e1001d84814 Mon Sep 17 00:00:00 2001 From: GeoKureli-BlackbookPro Date: Thu, 29 Oct 2026 11:53:05 -0500 Subject: [PATCH 2/2] add findFrameWithBorder --- flixel/graphics/frames/FlxAtlasFrames.hx | 27 ++++++++++++++++++------ 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/flixel/graphics/frames/FlxAtlasFrames.hx b/flixel/graphics/frames/FlxAtlasFrames.hx index cc48041dff..181e6f23da 100644 --- a/flixel/graphics/frames/FlxAtlasFrames.hx +++ b/flixel/graphics/frames/FlxAtlasFrames.hx @@ -412,15 +412,28 @@ class FlxAtlasFrames extends FlxFramesCollection public static function findFrame(graphic:FlxGraphic, ?border:FlxPoint):FlxAtlasFrames { if (border == null) - border = FlxPoint.weak(); - - var atlasFrames:Array = cast graphic.getFramesCollections(FlxFrameCollectionType.ATLAS); - + return findFrameWithBorder(graphic, 0, 0); + + final result = findFrameWithBorder(graphic, Math.round(border.x), Math.round(border.y)); + border.putWeak(); + return result; + } + + /** + * Returns the `FlxAtlasFrame` of the specified `FlxGraphic` object with the specified border. + * + * @param graphic `FlxGraphic` object to find the `FlxAtlasFrames` collection for. + * @return `FlxAtlasFrames` collection for the specified `FlxGraphic` object + * Could be `null` if `FlxGraphic` doesn't have it yet, or no atlas has the target border size. + */ + static function findFrameWithBorder(graphic:FlxGraphic, borderX:Int, borderY:Int):Null // TODO: Make public in next minor version (6.3.0) + { + final atlasFrames:Array = cast graphic.getFramesCollections(FlxFrameCollectionType.ATLAS); + for (atlas in atlasFrames) - if (atlas.border.equals(border)) + if (Math.round(atlas.border.x) == borderX && Math.round(atlas.border.y) == borderY) return atlas; - - border.putWeak(); + return null; }