gbasys

diff src/gfx.c @ 1:c50064b181c2

stuff
author John Tsiombikas <nuclear@member.fsf.org>
date Sun, 04 Mar 2012 07:06:41 +0200
parents 875ef6085efc
children 06726f0b8cd3
line diff
     1.1 --- a/src/gfx.c	Sun Mar 04 04:04:25 2012 +0200
     1.2 +++ b/src/gfx.c	Sun Mar 04 07:06:41 2012 +0200
     1.3 @@ -1,7 +1,7 @@
     1.4  /*
     1.5  Copyright 2004 John Tsiombikas <nuclear@siggraph.org>
     1.6  
     1.7 -This file is part of libgba, a library for GameBoy Advance development.
     1.8 +This file is part of gbasys, a library for GameBoy Advance development.
     1.9  
    1.10  This program is free software; you can redistribute it and/or modify
    1.11  it under the terms of the GNU General Public License as published by
    1.12 @@ -18,7 +18,7 @@
    1.13  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    1.14  */
    1.15  
    1.16 -#include "libgba_config.h"
    1.17 +#include "config.h"
    1.18  
    1.19  #include <stdlib.h>
    1.20  #include "gfx.h"
    1.21 @@ -70,7 +70,7 @@
    1.22  	front_buffer->x = back_buffer->x = xres;
    1.23  	front_buffer->y = back_buffer->y = yres;
    1.24  	front_buffer->bpp = back_buffer->bpp = sizeof_pixel * 8;
    1.25 -		
    1.26 +
    1.27  	if(mode > 3) {
    1.28  		page_flipping = 1;
    1.29  		back_buffer->pixels = (void*)0x600a000;
    1.30 @@ -84,7 +84,7 @@
    1.31  
    1.32  void flip(void) {
    1.33  	static void *tmp;
    1.34 -	
    1.35 +
    1.36  	if(page_flipping) {
    1.37  		swap_page();
    1.38  		tmp = front_buffer->pixels;
    1.39 @@ -121,13 +121,13 @@
    1.40  		color |= color << 8;
    1.41  		sz >>= 1;
    1.42  	}
    1.43 -		
    1.44 +
    1.45  	dma_fill16(3, pbuf->pixels, color, sz);
    1.46  }
    1.47  
    1.48  void copy_buffer(const struct pixel_buffer *src, struct pixel_buffer *dst) {
    1.49  	int words;
    1.50 -	
    1.51 +
    1.52  	if(src->x != dst->x || src->y != dst->y || src->bpp != dst->bpp) return;
    1.53  
    1.54  	words = (src->x * src->y) >> (src->bpp == 16 ? 1 : 2);
    1.55 @@ -145,21 +145,21 @@
    1.56  	ptr += y1 * pbuf->x + x1;
    1.57  	dx = x2 - x1;
    1.58  	dy = y2 - y1;
    1.59 -	
    1.60 +
    1.61  	if(dx >= 0) {
    1.62  		x_inc = 1;
    1.63  	} else {
    1.64  		x_inc = -1;
    1.65  		dx = -dx;
    1.66  	}
    1.67 -	
    1.68 +
    1.69  	if(dy >= 0) {
    1.70  		y_inc = pbuf->x;
    1.71  	} else {
    1.72  		y_inc = -pbuf->x;
    1.73  		dy = -dy;
    1.74  	}
    1.75 -	
    1.76 +
    1.77  	dx2 = dx << 1;
    1.78  	dy2 = dy << 1;
    1.79