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 

Need help to handle raw ARGB bitmap greater than 512x512

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



Joined: 05 Jul 2008
Posts: 229

PostPosted: Sun Aug 03, 2008 10:04 am    Post subject: Need help to handle raw ARGB bitmap greater than 512x512 Reply with quote

I there i'm have ported the execelnt sumatrapdf library to the psp but i stick with a problem when rendering the pdf i've got a buffer ARGB greater than 512x512
In the documentation of oslib or Easy_Accelerated_Image_lib they say that
the image must not greater than 512x512.

Is there a way to handle bitmaps that are greater than 512x512 or must i do
all by myself dividing the buffer in shunks of 512x512.

Another question can malloc use the extra 32mega of a psp slim ?
many thx for the replies (sorry for my poor english)
Back to top
View user's profile Send private message Send e-mail MSN Messenger
J.F.



Joined: 22 Feb 2004
Posts: 2906

PostPosted: Sun Aug 03, 2008 10:49 am    Post subject: Reply with quote

Look at the graphics.c blit code - it shows how to handle >512 horizontally. If you go >512 vertically, you'll have to do something similar for that direction as well. Basically, you're splitting the image up ANYWAY because the texture cache only handles 32 to 128 wide (depending on the depth). So most blit routines slice the image into 32 pixel wide stripes. You use the stride to allow for the fact that the image width does not equal the width you are blitting.

If you look at my refresh code in Basilisk II, you'll see where I split the blit both horizontally and vertically. My refresh handles >512 wide and up to 1024 vertically.

To get the extra memory on the Slim, you need to add "PSP_LARGE_MEMORY = 1" to the makefile.
Back to top
View user's profile Send private message AIM Address
sauron_le_noir



Joined: 05 Jul 2008
Posts: 229

PostPosted: Sun Aug 03, 2008 10:55 am    Post subject: Reply with quote

OK so when i but PSP_LARGE_MEMORY = 1 in my makefile the malloc function
automaticly give me the extra 32 Mega right ?
and has no effect when my homebrew run on a fat psp (just less heap space availaible) for know i need +- 20Méga of ram to rendering pdfs but i can use
the extra 32 mega for bitmap page caching thx a lot for the tips
Back to top
View user's profile Send private message Send e-mail MSN Messenger
J.F.



Joined: 22 Feb 2004
Posts: 2906

PostPosted: Sun Aug 03, 2008 12:47 pm    Post subject: Reply with quote

Yes. Specifying large memory only affects the Slim - the Phat ignores it. The memory is available to plain allocation commands as long as you set the heap size to max or a small negative value.

Code:
PSP_HEAP_SIZE_MAX();


takes all available user memory to the app.

Code:
PSP_HEAP_SIZE_KB(-kilobytes);


takes all available memory except for the number of KB specified. I generally use

Code:
PSP_HEAP_SIZE_KB(-256);


in my stuff. That leaves 256KB for threads and stuff. The heap size goes in your main.c, not the makefile (in case you were wondering).

Using the negative value is great if you want something that works on both the Slim and the Phat with a single executable while still giving all the extra memory on the Slim.
Back to top
View user's profile Send private message AIM Address
sauron_le_noir



Joined: 05 Jul 2008
Posts: 229

PostPosted: Sun Aug 03, 2008 10:06 pm    Post subject: Reply with quote

many thx for the replies just wat i need.
Back to top
View user's profile Send private message Send e-mail MSN Messenger
sauron_le_noir



Joined: 05 Jul 2008
Posts: 229

PostPosted: Wed Aug 06, 2008 7:15 am    Post subject: Reply with quote

can i create a bitmap > 512 with this
bitmap_page = createImage(pix->w, pix->h);
i fill bitmap_page->data with the correct data

to blit i use for example
blitAlphaImageToScreen(0,0,200,200,bitmap_page,0,0);

or must i realy divide the bitmap in severall bitmaps ?
Back to top
View user's profile Send private message Send e-mail MSN Messenger
J.F.



Joined: 22 Feb 2004
Posts: 2906

PostPosted: Wed Aug 06, 2008 9:38 am    Post subject: Reply with quote

You can create any size image. To load any size image, you have to comment out this block of code from the loadImage function:

Code:
   if (width > 512 || height > 512) {
      free(image);
      fclose(fp);
      png_destroy_read_struct(&png_ptr, png_infopp_NULL, png_infopp_NULL);
      return NULL;


Note that graphics.c doesn't handle vertical sizes >512, only horizontal. You'll have to modify the blits in the file to handle vertical as well as horizontal for heights >512.
Back to top
View user's profile Send private message AIM Address
a_noob



Joined: 17 Sep 2006
Posts: 97
Location: _start: jr 0xDEADBEEF

PostPosted: Wed Aug 06, 2008 11:35 am    Post subject: Reply with quote

Look at openTri game engine it supports > 512x512 (as long as the image fits into memory openTri can handle it)
_________________
Code:
.øOº'ºOø.
'ºOo.oOº'
Back to top
View user's profile Send private message AIM Address MSN Messenger
sauron_le_noir



Joined: 05 Jul 2008
Posts: 229

PostPosted: Fri Aug 08, 2008 3:22 am    Post subject: Reply with quote

many thx a_noob the openTri contrains the tri library it's even better than the
oslib. I've now a pdf reader for psp i will be release soon just correcting some
problems with the zoom fiunction
Back to top
View user's profile Send private message Send e-mail MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP 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