|
@@ -10,7 +10,6 @@ import com.bomostory.sceneeditmodule.basicdata.Scene
|
|
|
import kotlin.math.pow
|
|
|
|
|
|
object SceneDrawer {
|
|
|
- lateinit var actorBitmap: Bitmap
|
|
|
fun drawScene(context: Context, scene: Scene, trackX: Int, scaleWidth: Int, scaleHeight: Int): Bitmap? {
|
|
|
var sceneBitmap: Bitmap? = null
|
|
|
|
|
@@ -22,7 +21,7 @@ object SceneDrawer {
|
|
|
for (layer in layers) {
|
|
|
for (actor in layer.actors) {
|
|
|
if (!actor.isDialogue) {
|
|
|
- actorBitmap = BitmapFactory.decodeFile(actor.resourcePath)
|
|
|
+ var actorBitmap = BitmapFactory.decodeFile(actor.resourcePath)
|
|
|
actorBitmap = Bitmap.createScaledBitmap(actorBitmap, actor.sideLength, actor.sideHeight, true)
|
|
|
|
|
|
canvas.save()
|
|
@@ -30,7 +29,9 @@ object SceneDrawer {
|
|
|
canvas.drawBitmap(actorBitmap, actor.positionX.toFloat(), actor.positionY.toFloat(), Paint())
|
|
|
canvas.restore()
|
|
|
|
|
|
- actorBitmap.recycle()
|
|
|
+ if (!actorBitmap.isRecycled) {
|
|
|
+ actorBitmap.recycle()
|
|
|
+ }
|
|
|
} else {
|
|
|
canvas.save()
|
|
|
canvas.translate(trackX / 2f.pow(layers.indexOf(layer)), 0f)
|