Skip to content

Commit c6881bb

Browse files
authored
use view bounds in drawTriangles (#3484)
1 parent a98a969 commit c6881bb

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

flixel/FlxCamera.hx

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -832,13 +832,13 @@ class FlxCamera extends FlxBasic
832832
public function drawTriangles(graphic:FlxGraphic, vertices:DrawData<Float>, indices:DrawData<Int>, uvtData:DrawData<Float>, ?colors:DrawData<Int>,
833833
?position:FlxPoint, ?blend:BlendMode, repeat:Bool = false, smoothing:Bool = false, ?transform:ColorTransform, ?shader:FlxShader):Void
834834
{
835+
final cameraBounds = _bounds.set(viewMarginLeft, viewMarginTop, viewWidth, viewHeight);
836+
835837
if (FlxG.renderBlit)
836838
{
837839
if (position == null)
838840
position = renderPoint.set();
839841

840-
_bounds.set(0, 0, width, height);
841-
842842
var verticesLength:Int = vertices.length;
843843
var currentVertexPosition:Int = 0;
844844

@@ -869,7 +869,7 @@ class FlxCamera extends FlxBasic
869869

870870
position.putWeak();
871871

872-
if (!_bounds.overlaps(bounds))
872+
if (!cameraBounds.overlaps(bounds))
873873
{
874874
drawVertices.splice(drawVertices.length - verticesLength, verticesLength);
875875
}
@@ -907,17 +907,16 @@ class FlxCamera extends FlxBasic
907907
}
908908
else
909909
{
910-
_bounds.set(0, 0, width, height);
911910
var isColored:Bool = (colors != null && colors.length != 0);
912911

913912
#if !flash
914913
var hasColorOffsets:Bool = (transform != null && transform.hasRGBAOffsets());
915914
isColored = isColored || (transform != null && transform.hasRGBMultipliers());
916915
var drawItem:FlxDrawTrianglesItem = startTrianglesBatch(graphic, smoothing, isColored, blend, hasColorOffsets, shader);
917-
drawItem.addTriangles(vertices, indices, uvtData, colors, position, _bounds, transform);
916+
drawItem.addTriangles(vertices, indices, uvtData, colors, position, cameraBounds, transform);
918917
#else
919918
var drawItem:FlxDrawTrianglesItem = startTrianglesBatch(graphic, smoothing, isColored, blend);
920-
drawItem.addTriangles(vertices, indices, uvtData, colors, position, _bounds);
919+
drawItem.addTriangles(vertices, indices, uvtData, colors, position, cameraBounds);
921920
#end
922921
}
923922
}
@@ -1108,7 +1107,7 @@ class FlxCamera extends FlxBasic
11081107
_helperPoint = null;
11091108
}
11101109

1111-
_bounds = null;
1110+
_bounds = FlxDestroyUtil.put(_bounds);
11121111
scroll = FlxDestroyUtil.put(scroll);
11131112
targetOffset = FlxDestroyUtil.put(targetOffset);
11141113
deadzone = FlxDestroyUtil.put(deadzone);

0 commit comments

Comments
 (0)