X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=hacks%2Fglx%2Fglslideshow.c;h=5b48a383936ce7a42acfb0027e14969e99ad311f;hb=f8cf5ac7b2f53510f80a0eaf286a25298be17bfe;hp=386b4d8ff8a0b9b84bb6e59c472ff3e8dffc0780;hpb=50be9bb40dc60130c99ffa568e6677779904ff70;p=xscreensaver diff --git a/hacks/glx/glslideshow.c b/hacks/glx/glslideshow.c index 386b4d8f..5b48a383 100644 --- a/hacks/glx/glslideshow.c +++ b/hacks/glx/glslideshow.c @@ -1,4 +1,4 @@ -/* glslideshow, Copyright (c) 2003-2008 Jamie Zawinski +/* glslideshow, Copyright (c) 2003-2012 Jamie Zawinski * Loads a sequence of images and smoothly pans around them; crossfades * when loading new images. * @@ -160,8 +160,12 @@ typedef struct { Bool checked_fps_p; /* Whether we have checked for a low frame rate. */ +# ifdef HAVE_GLBITMAP XFontStruct *xfont; /* for printing image file names */ GLuint font_dlist; +# else + texture_font_data *font_data; +# endif int sprite_id, image_id; /* debugging id counters */ @@ -358,8 +362,12 @@ image_loaded_cb (const char *filename, XRectangle *geom, img->geom.height *= scale; } - if (img->title) /* strip filename to part between last "/" and last ".". */ + /* xscreensaver-getimage returns paths relative to the image directory + now, so leave the sub-directory part in. Unless it's an absolute path. + */ + if (img->title && img->title[0] == '/') { + /* strip filename to part between last "/" and last ".". */ char *s = strrchr (img->title, '/'); if (s) strcpy (img->title, s+1); s = strrchr (img->title, '.'); @@ -808,12 +816,22 @@ draw_sprite (ModeInfo *mi, sprite *sp) int x = 10; int y = mi->xgwa.height - 10; glColor4f (0, 0, 0, sp->opacity); /* cheap-assed dropshadow */ - print_gl_string (mi->dpy, ss->xfont, ss->font_dlist, + print_gl_string (mi->dpy, +# ifdef HAVE_GLBITMAP + ss->xfont, ss->font_dlist, +# else + ss->font_data, +# endif mi->xgwa.width, mi->xgwa.height, x, y, img->title, False); x++; y++; glColor4f (1, 1, 1, sp->opacity); - print_gl_string (mi->dpy, ss->xfont, ss->font_dlist, + print_gl_string (mi->dpy, +# ifdef HAVE_GLBITMAP + ss->xfont, ss->font_dlist, +# else + ss->font_data, +# endif mi->xgwa.width, mi->xgwa.height, x, y, img->title, False); } @@ -869,6 +887,20 @@ draw_sprites (ModeInfo *mi) glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glPushMatrix(); + + { + GLfloat rot = current_device_rotation(); + glTranslatef (0.5, 0.5, 0); + glRotatef(rot, 0, 0, 1); + if ((rot > 45 && rot < 135) || + (rot < -45 && rot > -135)) + { + GLfloat s = MI_WIDTH(mi) / (GLfloat) MI_HEIGHT(mi); + glScalef (s, 1/s, 1); + } + glTranslatef (-0.5, -0.5, 0); + } + for (i = 0; i < ss->nsprites; i++) draw_sprite (mi, ss->sprites[i]); glPopMatrix(); @@ -1116,7 +1148,11 @@ init_slideshow (ModeInfo *mi) if (debug_p) glLineWidth (3); +#ifdef HAVE_GLBITMAP load_font (mi->dpy, "titleFont", &ss->xfont, &ss->font_dlist); +#else + ss->font_data = load_texture_font (mi->dpy, "Font"); +#endif if (debug_p) hack_resources(); @@ -1210,7 +1246,6 @@ draw_slideshow (ModeInfo *mi) draw_sprites (mi); - ss->fps = fps_compute (mi->fpst, 0); if (mi->fps_p) do_fps (mi); glFinish();