X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=hacks%2Fglx%2Fjigglypuff.c;h=fea13fdd675b4a25b5b4264e4c9a806f7ca9f917;hb=78add6e627ee5f10e1fa6f3852602ea5066eee5a;hp=4a77c8c562687b8992f5dc816d6c02bcd0ebe9d9;hpb=4361b69d3178d7fc98d0388f9a223af6c2651aba;p=xscreensaver diff --git a/hacks/glx/jigglypuff.c b/hacks/glx/jigglypuff.c index 4a77c8c5..fea13fdd 100644 --- a/hacks/glx/jigglypuff.c +++ b/hacks/glx/jigglypuff.c @@ -41,7 +41,7 @@ "*wireframe: False\n" \ "*suppressRotationAnimation: True\n" \ -# define refresh_jigglypuff 0 +# define free_jigglypuff 0 # define release_jigglypuff 0 # include "xlockmore.h" #else @@ -52,9 +52,9 @@ # include "config.h" #endif -#include "xpm-ximage.h" +#include "ximage-loader.h" #include "gltrackball.h" -#include "../images/jigglymap.xpm" +#include "images/gen/jigglymap_png.h" #ifdef USE_GL @@ -768,8 +768,8 @@ static void update_shape(jigglystruct *js) static void init_texture(ModeInfo *mi) { - XImage *img = xpm_to_ximage(mi->dpy, mi->xgwa.visual, - mi->xgwa.colormap, jigglymap_xpm); + XImage *img = image_data_to_ximage(mi->dpy, mi->xgwa.visual, + jigglymap_png, sizeof(jigglymap_png)); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, img->width, img->height, 0, GL_RGBA, @@ -940,13 +940,19 @@ ENTRYPOINT Bool jigglypuff_handle_event(ModeInfo *mi, XEvent *event) ENTRYPOINT void reshape_jigglypuff(ModeInfo *mi, int width, int height) { - GLfloat aspect = (GLfloat)width / (GLfloat)height; - - glViewport(0, 0, width, height); - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glFrustum(-0.5*aspect, 0.5*aspect, -0.5, 0.5, 1, 20); -/* glTranslatef(0, 0, -10);*/ + double h = (GLfloat) height / (GLfloat) width; + int y = 0; + + if (width > height * 5) { /* tiny window: show middle */ + height = width * 9/16; + y = -height/2; + h = height / (GLfloat) width; + } + + glViewport(0, y, width, height); + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + glFrustum(-0.5*(1/h), 0.5*(1/h), -0.5, 0.5, 1, 20); } ENTRYPOINT void draw_jigglypuff(ModeInfo *mi) @@ -1010,7 +1016,7 @@ ENTRYPOINT void init_jigglypuff(ModeInfo *mi) jigglystruct *js; int subdivs; - MI_INIT(mi, jss, NULL); + MI_INIT(mi, jss); js = &jss[MI_SCREEN(mi)];