From 96eff08efdb21e462e667a550429122b6b41223a Mon Sep 17 00:00:00 2001 From: Collin Smith Date: Sun, 24 Mar 2019 01:06:33 -0700 Subject: [PATCH] Optimization to pixmap wrapper to upload pixels faster --- core/src/com/riiablo/graphics/PaletteIndexedPixmap.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core/src/com/riiablo/graphics/PaletteIndexedPixmap.java b/core/src/com/riiablo/graphics/PaletteIndexedPixmap.java index 4c53947b..b87fb2a6 100644 --- a/core/src/com/riiablo/graphics/PaletteIndexedPixmap.java +++ b/core/src/com/riiablo/graphics/PaletteIndexedPixmap.java @@ -1,6 +1,7 @@ package com.riiablo.graphics; import com.badlogic.gdx.graphics.Pixmap; +import com.badlogic.gdx.utils.BufferUtils; public class PaletteIndexedPixmap extends Pixmap { public PaletteIndexedPixmap(int width, int height) { @@ -11,6 +12,6 @@ public class PaletteIndexedPixmap extends Pixmap { public PaletteIndexedPixmap(int width, int height, byte[] data) { this(width, height); - getPixels().put(data).rewind(); + BufferUtils.copy(data, 0, getPixels(), data.length); } }