Revision: 2967
http://sourceforge.net/p/swingme/code/2967
Author: yuranet
Date: 2025-12-12 15:22:03 +0000 (Fri, 12 Dec 2025)
Log Message:
-----------
fix scale both x and y when getting rgb from image
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 2025-12-11 18:29:42 UTC (rev 2966)
+++ AndroidME/src_MIDP/javax/microedition/lcdui/Image.java 2025-12-12 15:22:03 UTC (rev 2967)
@@ -457,7 +457,7 @@
int systemDensity = getTargetDensity();
if (bitmapDensity != Bitmap.DENSITY_NONE && bitmapDensity != systemDensity) {
if (scanlength < width) {
- throw new IllegalArgumentException("scanlength ("+scanHeight+") must be >= width ("+width+")");
+ throw new IllegalArgumentException("scanlength ("+scanlength+") must be >= width ("+width+")");
}
x = scaleFromDensity(x, systemDensity, bitmapDensity);
y = scaleFromDensity(y, systemDensity, bitmapDensity);
@@ -508,7 +508,7 @@
int systemDensity = getTargetDensity();
if (bitmapDensity != Bitmap.DENSITY_NONE && bitmapDensity != systemDensity) {
for (int c = scanlength * scanHeight - 1; c >= 0; c--) {
- rgb[offset + c] = rgb[offset + ((c / scanlength) * scanlength) + scaleFromDensity(c % scanlength, systemDensity, bitmapDensity)];
+ rgb[offset + c] = rgb[offset + scaleFromDensity(c / scanlength, systemDensity, bitmapDensity) * scanlength + scaleFromDensity(c % scanlength, systemDensity, bitmapDensity)];
}
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|