filename | src/drivers/video_gdk.c |
changeset | 736:a02d1475ccfd |
prev | 669:ab344e42bca9 |
next | 1066:ddffe9d2b332 |
author | nkeynes |
date | Wed Oct 29 23:51:58 2008 +0000 (15 years ago) |
permissions | -rw-r--r-- |
last change | Use regparam calling conventions for all functions called from translated code, along with a few other high-use functions. Can probably extend this to all functions, but as it is this is a nice performance boost |
file | annotate | diff | log | raw |
1.1 --- a/src/drivers/video_gdk.c Mon May 12 10:00:13 2008 +00001.2 +++ b/src/drivers/video_gdk.c Wed Oct 29 23:51:58 2008 +00001.3 @@ -63,12 +63,12 @@1.4 {1.5 unsigned int i;1.6 for( i=0; i<pixbuf_max; i++ ) {1.7 - if( pixbuf_array[i] == NULL ) {1.8 - return i;1.9 - }1.10 + if( pixbuf_array[i] == NULL ) {1.11 + return i;1.12 + }1.13 }1.14 if( i < MAX_PIXBUF ) {1.15 - return pixbuf_max++;1.16 + return pixbuf_max++;1.17 }1.18 return -1;1.19 }1.20 @@ -77,10 +77,10 @@1.21 {1.22 unsigned int i;1.23 for( i=0; i<pixbuf_max; i++ ) {1.24 - if( pixbuf_array[i] != NULL ) {1.25 - g_free(pixbuf_array[i]);1.26 - pixbuf_array[i] = NULL;1.27 - }1.28 + if( pixbuf_array[i] != NULL ) {1.29 + g_free(pixbuf_array[i]);1.30 + pixbuf_array[i] = NULL;1.31 + }1.32 }1.33 pixbuf_max = 0;1.34 OSMesaDestroyContext( osmesa_context );1.35 @@ -103,7 +103,7 @@1.36 g_free(pixbuf_array[buffer->buf_id] );1.37 pixbuf_array[buffer->buf_id] = NULL;1.38 if( buffer->buf_id == (pixbuf_max-1) ) {1.39 - pixbuf_max--;1.40 + pixbuf_max--;1.41 }1.42 }1.44 @@ -123,30 +123,30 @@1.47 if( ah > video_height ) {1.48 - int w = (video_height/0.75);1.49 - x1 = (video_width - w)/2;1.50 - x2 -= x1;1.51 - gdk_gc_set_foreground( gc, &black );1.52 - gdk_gc_set_background( gc, &black );1.53 - gdk_draw_rectangle( gtk_video_drawable->window, gc, TRUE, 0, 0, x1, video_height );1.54 - gdk_draw_rectangle( gtk_video_drawable->window, gc, TRUE, x2, 0, video_width, video_height );1.55 + int w = (video_height/0.75);1.56 + x1 = (video_width - w)/2;1.57 + x2 -= x1;1.58 + gdk_gc_set_foreground( gc, &black );1.59 + gdk_gc_set_background( gc, &black );1.60 + gdk_draw_rectangle( gtk_video_drawable->window, gc, TRUE, 0, 0, x1, video_height );1.61 + gdk_draw_rectangle( gtk_video_drawable->window, gc, TRUE, x2, 0, video_width, video_height );1.62 } else if( ah < video_height ) {1.63 - y1 = (video_height - ah)/2;1.64 - y2 -= y1;1.65 - gdk_gc_set_foreground( gc, &black );1.66 - gdk_gc_set_background( gc, &black );1.67 - gdk_draw_rectangle( gtk_video_drawable->window, gc, TRUE, 0, 0, video_width, y1 );1.68 - gdk_draw_rectangle( gtk_video_drawable->window, gc, TRUE, 0, y2, video_width, video_height );1.69 + y1 = (video_height - ah)/2;1.70 + y2 -= y1;1.71 + gdk_gc_set_foreground( gc, &black );1.72 + gdk_gc_set_background( gc, &black );1.73 + gdk_draw_rectangle( gtk_video_drawable->window, gc, TRUE, 0, 0, video_width, y1 );1.74 + gdk_draw_rectangle( gtk_video_drawable->window, gc, TRUE, 0, y2, video_width, video_height );1.75 }1.76 int w = x2-x1;1.77 int h = y2-y1;1.78 -1.79 +1.80 if( w != buffer->width || h != buffer->height ) {1.81 - gdk_draw_rgb_32_image( gtk_video_drawable->window, gc, x1, y1, buffer->width, buffer->height, GDK_RGB_DITHER_NONE,1.82 - pb, buffer->width*4 );1.83 + gdk_draw_rgb_32_image( gtk_video_drawable->window, gc, x1, y1, buffer->width, buffer->height, GDK_RGB_DITHER_NONE,1.84 + pb, buffer->width*4 );1.85 } else {1.86 - gdk_draw_rgb_32_image( gtk_video_drawable->window, gc, x1, y1, buffer->width, buffer->height, GDK_RGB_DITHER_NONE,1.87 - pb, buffer->width*4 );1.88 + gdk_draw_rgb_32_image( gtk_video_drawable->window, gc, x1, y1, buffer->width, buffer->height, GDK_RGB_DITHER_NONE,1.89 + pb, buffer->width*4 );1.90 }1.91 }1.93 @@ -165,7 +165,7 @@1.94 glFinish();1.95 void *pb = pixbuf_array[buffer->buf_id];1.96 OSMesaMakeCurrent( osmesa_context, pb, GL_UNSIGNED_BYTE,1.97 - buffer->width, buffer->height );1.98 + buffer->width, buffer->height );1.99 //OSMesaPixelStore( OSMESA_Y_UP, 0 );1.100 glViewport( 0, 0, buffer->width, buffer->height );1.101 glDrawBuffer(GL_FRONT);1.102 @@ -177,12 +177,12 @@1.103 glFinish();1.104 void *pb = pixbuf_array[buffer->buf_id];1.105 OSMesaMakeCurrent( osmesa_context, pb, GL_UNSIGNED_BYTE,1.106 - buffer->width, buffer->height );1.107 + buffer->width, buffer->height );1.108 GLenum type = colour_formats[frame->colour_format].type;1.109 GLenum format = colour_formats[frame->colour_format].format;1.110 int bpp = colour_formats[frame->colour_format].bpp;1.111 int rowstride = (frame->rowstride / bpp) - frame->width;1.112 -1.113 +1.114 gl_reset_state();1.115 glPixelStorei( GL_UNPACK_ROW_LENGTH, rowstride );1.116 glRasterPos2f(0.375, frame->height-0.375);1.117 @@ -196,7 +196,7 @@1.118 glFinish();1.119 void *pb = pixbuf_array[buffer->buf_id];1.120 OSMesaMakeCurrent( osmesa_context, pb, GL_UNSIGNED_BYTE,1.121 - buffer->width, buffer->height );1.122 + buffer->width, buffer->height );1.123 glReadBuffer( GL_FRONT );1.124 return gl_read_render_buffer( target, buffer, rowstride, format );
.