iOS/libraries/allegro/allegro/src/psp/pgfx.c
/* psp_draw_to_screen:
 *  ONLY in 8 bpp video mode.
 *  Draws the texture representing the screen to the PSP display
 *  maximizing the use of the texture-cache.
 */
ONLY in 8 bpp video mode.
Draws the texture representing the screen to the PSP display
maximizing the use of the texture-cache.
ONLY in 8 bpp video mode . Draws the texture representing the screen to the PSP display maximizing the use of the texture - cache .
void psp_draw_to_screen()
{
   unsigned short texture_x;
   unsigned char *texture_ptr;
   short dest_x, dest_y;
   int slice_w = 64;
   int num_slices = ceil(SCREEN_W/(float)(slice_w));
   int i;
   struct TEX_VERTEX *vertices;
   texture_x = (unsigned int)texture_start & 0xF;
   texture_ptr = (unsigned char *)((unsigned int)texture_start & ~0xF);
   dest_x = (MAX_SCR_WIDTH - SCREEN_W) / 2;
   dest_y = (MAX_SCR_HEIGHT - SCREEN_H) / 2;
   sceKernelDcacheWritebackAll();
   sceGuStart(GU_DIRECT,list);
   sceGuTexMode(GU_PSM_T8,0,0,0);
   sceGuTexImage(0, 512, 512, framebuf_width, texture_ptr);
   sceGuTexFunc(GU_TFX_REPLACE, GU_TCC_RGB);
   sceGuTexFilter(GU_LINEAR, GU_LINEAR);
   for (i=0; i < num_slices; i++) {
      vertices = (struct TEX_VERTEX*)sceGuGetMemory(2 * sizeof(struct TEX_VERTEX));
      vertices[0].u = texture_x + i * slice_w;
      vertices[0].v = 0;
      vertices[1].u = vertices[0].u + slice_w;
      if (vertices[1].u > texture_x + SCREEN_W)
         vertices[1].u = texture_x + SCREEN_W;
      vertices[1].v = vertices[0].v + SCREEN_H;
      vertices[0].x =  dest_x + i * slice_w;
      vertices[0].y = dest_y;
      vertices[0].z = 0;
      vertices[1].x = vertices[0].x + slice_w;
      if (vertices[1].x > dest_x + SCREEN_W)
         vertices[1].x = dest_x + SCREEN_W;
      vertices[1].y = vertices[0].y + SCREEN_H;
      vertices[1].z = 0;
      sceGuDrawArray(GU_SPRITES,GU_TEXTURE_16BIT|GU_VERTEX_16BIT|GU_TRANSFORM_2D, 2,0,vertices);
   }
   sceGuFinish();
   sceGuSync(0,0);
}
void psp_draw_to_screen ( ) { unsigned short texture_x ; unsigned char * texture_ptr ; short dest_x , dest_y ; int slice_w = 64 ; int num_slices = ceil ( SCREEN_W / ( float ) ( slice_w ) ) ; int i ; struct TEX_VERTEX * vertices ; texture_x = ( unsigned int ) texture_start & 0xF ; texture_ptr = ( unsigned char * ) ( ( unsigned int ) texture_start & ~ 0xF ) ; dest_x = ( MAX_SCR_WIDTH - SCREEN_W ) / 2 ; dest_y = ( MAX_SCR_HEIGHT - SCREEN_H ) / 2 ; sceKernelDcacheWritebackAll ( ) ; sceGuStart ( GU_DIRECT , list ) ; sceGuTexMode ( GU_PSM_T8 , 0 , 0 , 0 ) ; sceGuTexImage ( 0 , 512 , 512 , framebuf_width , texture_ptr ) ; sceGuTexFunc ( GU_TFX_REPLACE , GU_TCC_RGB ) ; sceGuTexFilter ( GU_LINEAR , GU_LINEAR ) ; for ( i = 0 ; i < num_slices ; i ++ ) { vertices = ( struct TEX_VERTEX * ) sceGuGetMemory ( 2 * sizeof ( struct TEX_VERTEX ) ) ; vertices [ 0 ] . u = texture_x + i * slice_w ; vertices [ 0 ] . v = 0 ; vertices [ 1 ] . u = vertices [ 0 ] . u + slice_w ; if ( vertices [ 1 ] . u > texture_x + SCREEN_W ) vertices [ 1 ] . u = texture_x + SCREEN_W ; vertices [ 1 ] . v = vertices [ 0 ] . v + SCREEN_H ; vertices [ 0 ] . x = dest_x + i * slice_w ; vertices [ 0 ] . y = dest_y ; vertices [ 0 ] . z = 0 ; vertices [ 1 ] . x = vertices [ 0 ] . x + slice_w ; if ( vertices [ 1 ] . x > dest_x + SCREEN_W ) vertices [ 1 ] . x = dest_x + SCREEN_W ; vertices [ 1 ] . y = vertices [ 0 ] . y + SCREEN_H ; vertices [ 1 ] . z = 0 ; sceGuDrawArray ( GU_SPRITES , GU_TEXTURE_16BIT | GU_VERTEX_16BIT | GU_TRANSFORM_2D , 2 , 0 , vertices ) ; } sceGuFinish ( ) ; sceGuSync ( 0 , 0 ) ; }
psp_draw_to_screen:
  ONLY in 8 bpp video mode.
psp_draw_to_screen : ONLY in 8 bpp video mode .
/* We align the texture data pointer to 16 bytes.
    * The texture u coordinate is modified accordly.
    */ /* Blit the texture at the center of the screen. */