Search
lxdream.org :: lxdream/src/pvr2/pvr2mem.c :: diff
lxdream 0.9.1
released Jun 29
Download Now
filename src/pvr2/pvr2mem.c
changeset 327:00d55a462af3
prev325:5717ae5d4746
next333:e29561c998f5
author nkeynes
date Thu Jan 25 11:46:35 2007 +0000 (13 years ago)
permissions -rw-r--r--
last change Cleanup framebuffer formats by adding a central source for the information
file annotate diff log raw
1.1 --- a/src/pvr2/pvr2mem.c Thu Jan 25 10:16:32 2007 +0000
1.2 +++ b/src/pvr2/pvr2mem.c Thu Jan 25 11:46:35 2007 +0000
1.3 @@ -1,5 +1,5 @@
1.4 /**
1.5 - * $Id: pvr2mem.c,v 1.6 2007-01-25 10:16:32 nkeynes Exp $
1.6 + * $Id: pvr2mem.c,v 1.7 2007-01-25 11:46:35 nkeynes Exp $
1.7 *
1.8 * PVR2 (Video) VRAM handling routines (mainly for the 64-bit region)
1.9 *
1.10 @@ -520,34 +520,10 @@
1.11 {
1.12 if( buffer->render_addr == -1 )
1.13 return;
1.14 - GLenum type, format = GL_BGRA;
1.15 - int line_size = buffer->width, size;
1.16 -
1.17 - switch( buffer->colour_format ) {
1.18 - case COLFMT_RGB565:
1.19 - type = GL_UNSIGNED_SHORT_5_6_5;
1.20 - format = GL_BGR;
1.21 - line_size <<= 1;
1.22 - break;
1.23 - case COLFMT_RGB888:
1.24 - type = GL_UNSIGNED_BYTE;
1.25 - format = GL_BGR;
1.26 - line_size = (line_size<<1)+line_size;
1.27 - break;
1.28 - case COLFMT_ARGB1555:
1.29 - type = GL_UNSIGNED_SHORT_5_5_5_1;
1.30 - line_size <<= 1;
1.31 - break;
1.32 - case COLFMT_ARGB4444:
1.33 - type = GL_UNSIGNED_SHORT_4_4_4_4;
1.34 - line_size <<= 1;
1.35 - break;
1.36 - case COLFMT_ARGB8888:
1.37 - type = GL_UNSIGNED_INT_8_8_8_8;
1.38 - line_size <<= 2;
1.39 - break;
1.40 - }
1.41 - size = line_size * buffer->height;
1.42 + GLenum type = colour_formats[buffer->colour_format].type;
1.43 + GLenum format = colour_formats[buffer->colour_format].format;
1.44 + int line_size = buffer->width * colour_formats[buffer->colour_format].bpp;
1.45 + int size = line_size * buffer->height;
1.46
1.47 if( backBuffer ) {
1.48 glFinish();
1.49 @@ -583,34 +559,12 @@
1.50 {
1.51 if( buffer->render_addr == -1 )
1.52 return;
1.53 - GLenum type, format = GL_RGBA;
1.54 - int size = buffer->width * buffer->height;
1.55
1.56 - switch( buffer->colour_format ) {
1.57 - case COLFMT_RGB565:
1.58 - type = GL_UNSIGNED_SHORT_5_6_5;
1.59 - format = GL_RGB;
1.60 - size <<= 1;
1.61 - break;
1.62 - case COLFMT_RGB888:
1.63 - type = GL_UNSIGNED_BYTE;
1.64 - format = GL_BGR;
1.65 - size = (size<<1)+size;
1.66 - break;
1.67 - case COLFMT_ARGB1555:
1.68 - type = GL_UNSIGNED_SHORT_5_5_5_1;
1.69 - size <<= 1;
1.70 - break;
1.71 - case COLFMT_ARGB4444:
1.72 - type = GL_UNSIGNED_SHORT_4_4_4_4;
1.73 - size <<= 1;
1.74 - break;
1.75 - case COLFMT_ARGB8888:
1.76 - type = GL_UNSIGNED_INT_8_8_8_8;
1.77 - size <<= 2;
1.78 - break;
1.79 - }
1.80 -
1.81 + GLenum type = colour_formats[buffer->colour_format].type;
1.82 + GLenum format = colour_formats[buffer->colour_format].format;
1.83 + int line_size = buffer->width * colour_formats[buffer->colour_format].bpp;
1.84 + int size = line_size * buffer->height;
1.85 +
1.86 if( backBuffer ) {
1.87 glDrawBuffer( GL_BACK );
1.88 } else {
.