Revision: 2373
http://sourceforge.net/p/swingme/code/2373
Author: yuranet
Date: 2019-04-19 16:40:36 +0000 (Fri, 19 Apr 2019)
Log Message:
-----------
warning on size mismatch
Modified Paths:
--------------
AndroidME/src_MIDP/javax/microedition/lcdui/Image.java
Modified: AndroidME/src_MIDP/javax/microedition/lcdui/Image.java
===================================================================
--- AndroidME/src_MIDP/javax/microedition/lcdui/Image.java 2019-04-19 14:16:09 UTC (rev 2372)
+++ AndroidME/src_MIDP/javax/microedition/lcdui/Image.java 2019-04-19 16:40:36 UTC (rev 2373)
@@ -8,6 +8,7 @@
import javax.microedition.lcdui.game.Sprite;
import net.yura.android.AndroidMeApp;
+import net.yura.mobile.logging.Logger;
import android.content.res.Resources;
import android.graphics.Bitmap;
@@ -275,7 +276,7 @@
int id = res.getIdentifier(name, "drawable", AndroidMeApp.getContext().getPackageName() );
if (id > 0) {
- return new ResourceInputStream(res, id);
+ return new ResourceInputStream(res, id, name);
}
return null;
}
@@ -283,10 +284,12 @@
public static class ResourceInputStream extends InputStream {
private Resources res;
private int resId;
+ String name;
- public ResourceInputStream(Resources res, int resId) {
+ public ResourceInputStream(Resources res, int resId, String name) {
this.res = res;
this.resId = resId;
+ this.name = name;
}
@Override
@@ -299,12 +302,18 @@
}
public Bitmap getBitmap() {
- return ((BitmapDrawable)getDrawable()).getBitmap();
+ Drawable drawable = getDrawable();
+ Bitmap bitmap = ((BitmapDrawable)drawable).getBitmap();
+ if (bitmap.getWidth() != drawable.getIntrinsicWidth()) {
+ // TODO in target api 28 this will start happening
+ Logger.warn("size does not match " + this);
+ }
+ return bitmap;
}
@Override
public String toString() {
- return "RIS{res="+res+",id="+resId+"}";
+ return "RIS{name="+name+",res="+res+",id="+resId+"}";
}
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|