Skip to content

Commit

Permalink
Small performances improvement
Browse files Browse the repository at this point in the history
  • Loading branch information
dwursteisen committed Jan 14, 2024
1 parent fa312f0 commit 88789ae
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class PixelArray(val width: Pixel, val height: Pixel, val pixelFormat: Int = Pix
assert(x in 0 until width) { "x ($x) has to be between 0 and $width (excluded)" }
assert(y in 0 until height) { "y ($y) has to be between 0 and $height (excluded)" }
val position = (x + y * width) * pixelFormat
tmp.forEachIndexed { index, _ ->
(0 until pixelFormat).forEach { index ->
tmp[index] = pixels[position + index]
}
return tmp
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ class MapLib(private val resourceAccess: GameResourceAccess, private val spriteS
arg1.checkint() to arg2.checkint()
}

return LuaTable().apply {
return LuaTable(2, 2).apply {
set("x", valueOf(cx * spriteSize.first.toDouble()))
set("y", valueOf(cy * spriteSize.second.toDouble()))
}
Expand All @@ -152,7 +152,7 @@ class MapLib(private val resourceAccess: GameResourceAccess, private val spriteS
arg1.checkint() to arg2.checkint()
}

return LuaTable().apply {
return LuaTable(2, 2).apply {
set("cx", valueOf(floor(x / spriteSize.first.toDouble())))
set("cy", valueOf(floor(y / spriteSize.second.toDouble())))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -658,7 +658,7 @@ class ShapeLib(private val resourceAccess: GameResourceAccess) : TwoArgFunction(
}
dither.call(previous)

return NONE
return NIL
}
}
}

0 comments on commit 88789ae

Please sign in to comment.