forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

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

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Lua Player Development
View previous topic :: View next topic  
Author Message
Durante



Joined: 02 Oct 2005
Posts: 65
Location: Austria

PostPosted: Sun Oct 02, 2005 6:13 am    Post subject: Bug in clearImage? ([edit] Rather: question & suggestion Reply with quote

[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:
int size = image->textureWidth * image->textureWidth;
Unless there's something going on that's way over my head, that should be
Code:
int size = image->imageWidth * image->imageHeight;



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

void clearImage(Color color, Image* image)
{
   Color *data = image->data;
   Color *end = data + (image->imageWidth * image->imageHeight);
   do *data = color; while(++data < end);
}
Back to top
View user's profile Send private message
LuMo



Joined: 21 Aug 2005
Posts: 410
Location: Austria

PostPosted: Sun Oct 02, 2005 6:30 am    Post subject: Reply with quote

images do not have to be squares (eg 512x512)
_________________
"Good artists copy, great artists steal."
Pablo Picasso
go2lumo.com
Back to top
View user's profile Send private message Visit poster's website
Shine



Joined: 03 Dec 2004
Posts: 728
Location: Germany

PostPosted: Sun Oct 02, 2005 9:01 am    Post subject: Re: Bug in clearImage? ([edit] Rather: question & sugges Reply with quote

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.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Lua Player Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group