summaryrefslogtreecommitdiff
path: root/meme/gui.c
diff options
context:
space:
mode:
authorWerner Almesberger <werner@almesberger.net>2014-09-14 14:59:25 (GMT)
committerWerner Almesberger <werner@almesberger.net>2014-09-14 14:59:25 (GMT)
commit57e0603cd3cf68f8adaefb32eec7efd17c43f99b (patch)
tree4de1a8e635bbf0f0ab295a8d971daaab69082b1a /meme/gui.c
parente2dc06ebc066399e7274a6627127f725e1f07b17 (diff)
downloadmisc-57e0603cd3cf68f8adaefb32eec7efd17c43f99b.zip
misc-57e0603cd3cf68f8adaefb32eec7efd17c43f99b.tar.gz
misc-57e0603cd3cf68f8adaefb32eec7efd17c43f99b.tar.bz2
meme/: use SDL_GetVideoInfo to set up SDL_AllocSurface, instead of SDL_DisplayFormat
Diffstat (limited to 'meme/gui.c')
-rw-r--r--meme/gui.c16
1 files changed, 3 insertions, 13 deletions
diff --git a/meme/gui.c b/meme/gui.c
index 2e562b4..8298970 100644
--- a/meme/gui.c
+++ b/meme/gui.c
@@ -21,6 +21,7 @@
#include "time.h"
#include "mesh.h"
#include "plane.h"
+#include "gaux.h"
#include "text.h"
@@ -226,7 +227,6 @@ static struct change {
static void change(SDL_Surface *s, int x, int y, int w, int h)
{
struct change *c;
- SDL_Surface *tmp;
if (x < 0) {
w += x;
@@ -241,22 +241,12 @@ static void change(SDL_Surface *s, int x, int y, int w, int h)
if (y+h >= yres)
h = yres-y-1;
- /*
- * @@@ this seems weird. do we really have no direct way to create
- * a surface that's compatible with the display ?
- */
c = alloc_type(struct change);
- tmp = SDL_CreateRGBSurface(SDL_SURFACE, w, h, 0, 0, 0, 0, 0);
- if (!tmp) {
- fprintf(stderr, "SDL_CreateRGBSurface failed\n");
- exit(1);
- }
- c->s = SDL_DisplayFormat(tmp);
+ c->s = sdl_surface(SDL_SURFACE, w, h);
if (!c->s) {
- fprintf(stderr, "SDL_DisplayFormat failed\n");
+ fprintf(stderr, "sdl_surface failed\n");
exit(1);
}
- SDL_FreeSurface(tmp);
c->r.x = x;
c->r.y = y;