cache: store original pixels and palette too, and add normalize()
This commit is contained in:
@@ -22,7 +22,6 @@
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package net.runelite.cache.definitions;
|
||||
|
||||
import lombok.Data;
|
||||
@@ -39,4 +38,30 @@ public class SpriteDefinition
|
||||
private int[] pixels;
|
||||
private int maxWidth;
|
||||
private int maxHeight;
|
||||
|
||||
public transient byte[] pixelIdx;
|
||||
public transient int[] palette;
|
||||
|
||||
public void normalize()
|
||||
{
|
||||
if (this.width != this.maxWidth || this.height != this.maxHeight)
|
||||
{
|
||||
byte[] var1 = new byte[this.maxWidth * this.maxHeight];
|
||||
int var2 = 0;
|
||||
|
||||
for (int var3 = 0; var3 < this.height; ++var3)
|
||||
{
|
||||
for (int var4 = 0; var4 < this.width; ++var4)
|
||||
{
|
||||
var1[var4 + (var3 + this.offsetY) * this.maxWidth + this.offsetX] = this.pixelIdx[var2++];
|
||||
}
|
||||
}
|
||||
|
||||
this.pixelIdx = var1;
|
||||
this.width = this.maxWidth;
|
||||
this.height = this.maxHeight;
|
||||
this.offsetX = 0;
|
||||
this.offsetY = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -105,6 +105,8 @@ public class SpriteLoader
|
||||
int dimension = spriteWidth * spriteHeight;
|
||||
byte[] pixelPaletteIndicies = new byte[dimension];
|
||||
byte[] pixelAlphas = new byte[dimension];
|
||||
def.pixelIdx = pixelPaletteIndicies;
|
||||
def.palette = palette;
|
||||
|
||||
int flags = is.readUnsignedByte();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user