From 72275d240d704f0c42f2ab3049b35f21f691db02 Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Tue, 6 Jul 2021 18:19:51 -0400 Subject: [PATCH] v0.9.4: removed unnecessary texture reference in TextureFilm --- .../com/watabou/gltextures/SmartTexture.java | 2 +- .../java/com/watabou/noosa/TextureFilm.java | 21 ++++++++++--------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/SPD-classes/src/main/java/com/watabou/gltextures/SmartTexture.java b/SPD-classes/src/main/java/com/watabou/gltextures/SmartTexture.java index fa8f750bc..4c792a230 100644 --- a/SPD-classes/src/main/java/com/watabou/gltextures/SmartTexture.java +++ b/SPD-classes/src/main/java/com/watabou/gltextures/SmartTexture.java @@ -109,7 +109,7 @@ public class SmartTexture extends Texture { public RectF uvRect( float left, float top, float right, float bottom ) { return new RectF( - left / width, + left / width, top / height, right / width, bottom / height ); diff --git a/SPD-classes/src/main/java/com/watabou/noosa/TextureFilm.java b/SPD-classes/src/main/java/com/watabou/noosa/TextureFilm.java index c5d1a7d4f..34acbb4dd 100644 --- a/SPD-classes/src/main/java/com/watabou/noosa/TextureFilm.java +++ b/SPD-classes/src/main/java/com/watabou/noosa/TextureFilm.java @@ -33,14 +33,12 @@ public class TextureFilm { private int texWidth; private int texHeight; - - private SmartTexture texture; protected HashMap frames = new HashMap<>(); public TextureFilm( Object tx ) { - - texture = TextureCache.get( tx ); + + SmartTexture texture = TextureCache.get( tx ); texWidth = texture.width; texHeight = texture.height; @@ -53,8 +51,8 @@ public class TextureFilm { } public TextureFilm( Object tx, int width, int height ) { - - texture = TextureCache.get( tx ); + + SmartTexture texture = TextureCache.get( tx ); texWidth = texture.width; texHeight = texture.height; @@ -73,8 +71,6 @@ public class TextureFilm { } public TextureFilm( TextureFilm atlas, Object key, int width, int height ) { - - texture = atlas.texture; texWidth = atlas.texWidth; texHeight = atlas.texHeight; @@ -99,8 +95,13 @@ public class TextureFilm { frames.put( id, rect ); } - public void add( Object id, int left, int top, int right, int bottom){ - frames.put( id, texture.uvRect(left, top, right, bottom)); + public void add( Object id, float left, float top, float right, float bottom){ + frames.put( id, + new RectF( + left / texWidth, + top / texHeight, + right / texWidth, + bottom / texHeight )); } public RectF get( Object id ) {