00001 #include "surface.h" 00002 #include <stdlib.h> 00003 #include <inttypes.h> // added for amd64 support 00004 00005 Surface * surface_new (int w, int h) { 00006 Surface * s = (Surface*)malloc(sizeof(Surface)); 00007 s->realstart = (int*)malloc(w*h*4 + 128); 00008 s->buf = (int*)((uintptr_t)s->realstart + 128 - (((uintptr_t)s->realstart) % 128)); 00009 s->size = w*h; 00010 s->width = w; 00011 s->height = h; 00012 return s; 00013 } 00014 00015 void surface_delete (Surface **s) { 00016 free ((*s)->realstart); 00017 free (*s); 00018 *s = NULL; 00019 }
1.5.5