mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-18 14:34:04 +09:00
no memory leak on ImageBuffer rendering
Turns out, <ImageBuffer>.image creates new Image instance which will NEVER be reclaimed (which causes OutOfMemoryError) unless manually destroy()ed. Former-commit-id: 34840cf63e52e5635ec8acd5fb1bb78923c61063 Former-commit-id: aca4388320fae022a4744f75c1b0f66b544bdafb
This commit is contained in:
@@ -155,10 +155,13 @@ class StateNoiseTexGen : BasicGameState() {
|
||||
g.drawString("CPUs: ${Terrarum.THREADS}", Terrarum.WIDTH - 90f, 8f)
|
||||
|
||||
g.background = Color.cyan
|
||||
g.drawImage(noiseImageBuffer.image,//noiseImage,
|
||||
val img = noiseImageBuffer.image
|
||||
g.drawImage(img,//noiseImage,
|
||||
Terrarum.WIDTH.minus(imagesize).div(2).toFloat(),
|
||||
Terrarum.HEIGHT.minus(imagesize).div(2).toFloat()
|
||||
)
|
||||
|
||||
img.destroy()
|
||||
}
|
||||
|
||||
override fun keyPressed(key: Int, c: Char) {
|
||||
|
||||
Reference in New Issue
Block a user