Clean up
This commit is contained in:
1 parent
512fef80db
commit
4c3c84f1a6
8 files changed
+22
-22
No files matched your search
@@ -53,7 +53,7 @@ public abstract class BasicTexture implements Texture {
|
||||
protected GLCanvas mCanvasRef = null;
|
||||
private final static WeakHashMap<BasicTexture, Object> sAllTextures
|
||||
= new WeakHashMap<>();
|
||||
private static ThreadLocal<Class> sInFinalizer = new ThreadLocal<>();
|
||||
private static final ThreadLocal<Class> sInFinalizer = new ThreadLocal<>();
|
||||
|
||||
protected BasicTexture(GLCanvas canvas, int id, int state) {
|
||||
setAssociatedCanvas(canvas);
|
||||
|
||||
@@ -20,7 +20,7 @@ package com.hippo.gl.glrenderer;
|
||||
// Before drawing, setSize() should be called.
|
||||
public class ExtTexture extends BasicTexture {
|
||||
|
||||
private int mTarget;
|
||||
private final int mTarget;
|
||||
|
||||
public ExtTexture(GLCanvas canvas, int target) {
|
||||
GLId glId = canvas.getGLId();
|
||||
|
||||
@@ -13,12 +13,12 @@ import java.util.Arrays;
|
||||
* <br>
|
||||
* Only support single line now
|
||||
*/
|
||||
public class MovableTextTexture extends SpriteTexture {
|
||||
public final class MovableTextTexture extends SpriteTexture {
|
||||
|
||||
private char[] mCharacters;
|
||||
private float[] mWidths;
|
||||
private float mHeight;
|
||||
private float mMaxWidth;
|
||||
private final char[] mCharacters;
|
||||
private final float[] mWidths;
|
||||
private final float mHeight;
|
||||
private final float mMaxWidth;
|
||||
|
||||
private MovableTextTexture(Bitmap bitmap, int count, int[] rects, char[] characters,
|
||||
float[] widths, float height, float maxWidth) {
|
||||
@@ -137,7 +137,7 @@ public class MovableTextTexture extends SpriteTexture {
|
||||
float[] widths = new float[length];
|
||||
paint.getTextWidths(characters, 0, length, widths);
|
||||
|
||||
// Caculate bitmap size
|
||||
// Calculate bitmap size
|
||||
float maxWidth = 0.0f;
|
||||
for (float f : widths) {
|
||||
maxWidth = Math.max(maxWidth, f);
|
||||
|
||||
@@ -7,11 +7,11 @@ import com.hippo.yorozuya.AssertUtils;
|
||||
|
||||
public class SpriteTexture extends TiledTexture {
|
||||
|
||||
private int mCount;
|
||||
private int[] mRects;
|
||||
private final int mCount;
|
||||
private final int[] mRects;
|
||||
|
||||
private RectF mTempSource = new RectF();
|
||||
private RectF mTempTarget = new RectF();
|
||||
private final RectF mTempSource = new RectF();
|
||||
private final RectF mTempTarget = new RectF();
|
||||
|
||||
public SpriteTexture(Bitmap bitmap, boolean isOpaque, int count, int[] rects) {
|
||||
super(bitmap, isOpaque);
|
||||
|
||||
@@ -25,9 +25,9 @@ public class TextureUploader implements GLRoot.OnGLIdleListener {
|
||||
private static final int QUOTA_PER_FRAME = 1;
|
||||
|
||||
private final ArrayDeque<UploadedTexture> mFgTextures =
|
||||
new ArrayDeque<UploadedTexture>(INIT_CAPACITY);
|
||||
new ArrayDeque<>(INIT_CAPACITY);
|
||||
private final ArrayDeque<UploadedTexture> mBgTextures =
|
||||
new ArrayDeque<UploadedTexture>(INIT_CAPACITY);
|
||||
new ArrayDeque<>(INIT_CAPACITY);
|
||||
private final GLRoot mGLRoot;
|
||||
private volatile boolean mIsQueued = false;
|
||||
|
||||
|
||||
@@ -47,10 +47,10 @@ public class TiledTexture implements Texture {
|
||||
private static Tile sFreeTileHead = null;
|
||||
private static final Object sFreeTileLock = new Object();
|
||||
|
||||
private static Bitmap sUploadBitmap;
|
||||
private static Canvas sCanvas;
|
||||
private static Paint sBitmapPaint;
|
||||
private static Paint sPaint;
|
||||
private static final Bitmap sUploadBitmap;
|
||||
private static final Canvas sCanvas;
|
||||
private static final Paint sBitmapPaint;
|
||||
private static final Paint sPaint;
|
||||
|
||||
private int mUploadIndex = 0;
|
||||
|
||||
|
||||
@@ -44,9 +44,9 @@ public abstract class UploadedTexture extends BasicTexture {
|
||||
|
||||
// To prevent keeping allocation the borders, we store those used borders here.
|
||||
// Since the length will be power of two, it won't use too much memory.
|
||||
private static HashMap<BorderKey, Bitmap> sBorderLines =
|
||||
private static final HashMap<BorderKey, Bitmap> sBorderLines =
|
||||
new HashMap<>();
|
||||
private static BorderKey sBorderKey = new BorderKey();
|
||||
private static final BorderKey sBorderKey = new BorderKey();
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private static final String TAG = "Texture";
|
||||
|
||||
@@ -25,8 +25,8 @@ import android.support.v4.content.ContextCompat;
|
||||
|
||||
public class XmlResourceTexture extends UploadedTexture {
|
||||
|
||||
private Context mContext;
|
||||
private int mResId;
|
||||
private final Context mContext;
|
||||
private final int mResId;
|
||||
private int mWidth;
|
||||
private int mHeight;
|
||||
|
||||
|
||||
Reference in new issue
Block a user