|
From: Kenny S. <ke...@pe...> - 2007-03-23 00:39:56
|
This fixes a bug where we want to draw a subregion from the larger =
image.
I just dropped the error checking, but I'm not sure if it is correct or =
not.
--- ./core/src/org/microemu/device/j2se/J2SEDisplayGraphics.java.orig =
2007-03-22 17:23:59.000000000 -0700
+++ ./core/src/org/microemu/device/j2se/J2SEDisplayGraphics.java =
2007-03-22 17:30:07.000000000 -0700
@@ -429,19 +429,19 @@
if (rgbData =3D=3D null)
throw new NullPointerException();
=20
- int l =3D rgbData.length;
- =20
- if (width <=3D 0 || height <=3D 0 || offset < 0 || offset =
>=3D l ||
- (scanlength < 0 && scanlength * (height-1) < 0) ||
- (scanlength >=3D 0 && scanlength * (height-1) + =
width-1 >=3D l))
- throw new ArrayIndexOutOfBoundsException();
- =20
- int [] rgb =3D new int[l - offset];
+ int area =3D width * height;
+
+ int [] rgb =3D new int[area];
// this way we dont create yet another array in createImage
int transparencyMask =3D processAlpha? 0 : 0xff000000;
- =20
- for(int i =3D 0; offset < l; offset++, i++)
- rgb[i] =3D rgbData[offset] | transparencyMask;
+
+ int i =3D 0;
+ for(int iy =3D 0; iy < height; ++iy) {
+ for (int ix =3D 0; ix < width; ++ix) {
+ rgb[i++] =3D rgbData[offset + =
ix] | transparencyMask;
+ }
+ offset +=3D scanlength;
+ }
=20
// help gc
rgbData =3D null;
-Kenny
|
|
From: Bartek T. <ba...@ba...> - 2007-03-23 14:16:49
|
That bug is already fixed in svn trunk and will be included in 2.0.1 release.
Bartek
2007/3/23, Kenny Simpson <ke...@pe...>:
>
>
>
> This fixes a bug where we want to draw a subregion from the larger image.
> I just dropped the error checking, but I'm not sure if it is correct or
> not.
>
> ---
> ./core/src/org/microemu/device/j2se/J2SEDisplayGraphics.java.orig
> 2007-03-22 17:23:59.000000000 -0700
> +++
> ./core/src/org/microemu/device/j2se/J2SEDisplayGraphics.java
> 2007-03-22 17:30:07.000000000 -0700
> @@ -429,19 +429,19 @@
> if (rgbData == null)
> throw new NullPointerException();
>
> - int l = rgbData.length;
> -
> - if (width <= 0 || height <= 0 || offset < 0 || offset >= l ||
> - (scanlength < 0 && scanlength * (height-1) < 0) ||
> - (scanlength >= 0 && scanlength * (height-1) + width-1
> >= l))
> - throw new
> ArrayIndexOutOfBoundsException();
> -
> - int [] rgb = new int[l - offset];
> + int area = width * height;
> +
> + int [] rgb = new int[area];
> // this way we dont create yet another array in createImage
> int transparencyMask = processAlpha? 0 : 0xff000000;
> -
> - for(int i = 0; offset < l; offset++, i++)
> - rgb[i] = rgbData[offset] | transparencyMask;
> +
> + int i = 0;
> + for(int iy = 0; iy < height; ++iy) {
> + for (int ix = 0; ix < width; ++ix) {
> + rgb[i++] =
> rgbData[offset + ix] | transparencyMask;
> + }
> + offset += scanlength;
> + }
>
> // help gc
> rgbData = null;
>
>
> -Kenny
>
> -------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share your
> opinions on IT & business topics through brief surveys-and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> _______________________________________________
> Microemulator-users mailing list
> Mic...@li...
> https://lists.sourceforge.net/lists/listinfo/microemulator-users
>
>
|
|
From: Kenny S. <ke...@pe...> - 2007-03-23 14:33:17
|
Excellent, thanks!
-----Original Message-----
From: ba...@gm... on behalf of Bartek Teodorczyk
Sent: Fri 3/23/2007 7:16 AM
To: Kenny Simpson
Cc: mic...@li...
Subject: Re: [Microemulator-users] patch for drawRGB
=20
That bug is already fixed in svn trunk and will be included in 2.0.1 =
release.
Bartek
2007/3/23, Kenny Simpson <ke...@pe...>:
>
>
>
> This fixes a bug where we want to draw a subregion from the larger =
image.
> I just dropped the error checking, but I'm not sure if it is correct =
or
> not.
>
> ---
> ./core/src/org/microemu/device/j2se/J2SEDisplayGraphics.java.orig
> 2007-03-22 17:23:59.000000000 -0700
> +++
> ./core/src/org/microemu/device/j2se/J2SEDisplayGraphics.java
> 2007-03-22 17:30:07.000000000 -0700
> @@ -429,19 +429,19 @@
> if (rgbData =3D=3D null)
> throw new NullPointerException();
>
> - int l =3D rgbData.length;
> -
> - if (width <=3D 0 || height <=3D 0 || offset < 0 || =
offset >=3D l ||
> - (scanlength < 0 && scanlength * (height-1) < 0) =
||
> - (scanlength >=3D 0 && scanlength * (height-1) + =
width-1
> >=3D l))
> - throw new
> ArrayIndexOutOfBoundsException();
> -
> - int [] rgb =3D new int[l - offset];
> + int area =3D width * height;
> +
> + int [] rgb =3D new int[area];
> // this way we dont create yet another array in =
createImage
> int transparencyMask =3D processAlpha? 0 : 0xff000000;
> -
> - for(int i =3D 0; offset < l; offset++, i++)
> - rgb[i] =3D rgbData[offset] | transparencyMask;
> +
> + int i =3D 0;
> + for(int iy =3D 0; iy < height; ++iy) {
> + for (int ix =3D 0; ix < width; ++ix) =
{
> + rgb[i++] =3D
> rgbData[offset + ix] | transparencyMask;
> + }
> + offset +=3D scanlength;
> + }
>
> // help gc
> rgbData =3D null;
>
>
> -Kenny
>
> =
-------------------------------------------------------------------------=
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to =
share your
> opinions on IT & business topics through brief surveys-and earn cash
> =
http://www.techsay.com/default.php?page=3Djoin.php&p=3Dsourceforge&CID=3D=
DEVDEV
> _______________________________________________
> Microemulator-users mailing list
> Mic...@li...
> https://lists.sourceforge.net/lists/listinfo/microemulator-users
>
>
|