Bug in clearImage? ([edit] Rather: question & suggestion

Discuss using and improving Lua and the Lua Player specific to the PSP.

Moderators: Shine, Insert_witty_name

Post Reply
Durante
Posts: 65
Joined: Sun Oct 02, 2005 6:07 am
Location: Austria

Bug in clearImage? ([edit] Rather: question & suggestion

Post by Durante »

[edit]Disregard the following, I didn't notice that currently all textures are 2^n*2^n. Does the PSP support non-square textures?
Still, I think my cleaner variant is valid, and that the pixels outside of the real image area don't have to be cleared.
[/edit]

In graphics.c, line 233:

Code: Select all

int size = image->textureWidth * image->textureWidth;
Unless there's something going on that's way over my head, that should be

Code: Select all

int size = image->imageWidth * image->imageHeight;

In fact, I'd suggest a cleaner (IMHO) variant like the following:

Code: Select all

void clearImage(Color color, Image* image)
{
	Color *data = image->data;
	Color *end = data + (image->imageWidth * image->imageHeight);
	do *data = color; while&#40;++data < end&#41;;
&#125;
LuMo
Posts: 410
Joined: Sun Aug 21, 2005 2:45 am
Location: Austria
Contact:

Post by LuMo »

images do not have to be squares (eg 512x512)
"Good artists copy, great artists steal."
Pablo Picasso
go2lumo.com
Shine
Posts: 728
Joined: Fri Dec 03, 2004 12:10 pm
Location: Germany

Re: Bug in clearImage? ([edit] Rather: question & sugges

Post by Shine »

Durante wrote:Does the PSP support non-square textures?
I hope, I've changed this in the new version, would save some memory.
Durante wrote: Still, I think my cleaner variant is valid, and that the pixels outside of the real image area don't have to be cleared.
Your fix won't work, because the internal image size is larger than imageWidth, but I think this doesn't matter much any more, now that we can have non-square (internal, texture) image sizes.
Post Reply