projects
/
xscreensaver
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
From http://www.jwz.org/xscreensaver/xscreensaver-5.39.tar.gz
[xscreensaver]
/
hacks
/
glx
/
jigsaw.c
diff --git
a/hacks/glx/jigsaw.c
b/hacks/glx/jigsaw.c
index c7448361ca79bd8035550fc28fd67b64573f8fdf..934dbcc7a758bb89f95c080f277147bf65a1dfcf 100644
(file)
--- a/
hacks/glx/jigsaw.c
+++ b/
hacks/glx/jigsaw.c
@@
-1,4
+1,4
@@
-/* xscreensaver, Copyright (c) 1997-201
4
Jamie Zawinski <jwz@jwz.org>
+/* xscreensaver, Copyright (c) 1997-201
7
Jamie Zawinski <jwz@jwz.org>
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
@@
-48,22
+48,23
@@
#define DEF_WOBBLE "True"
#define DEF_DEBUG "False"
#define DEF_WOBBLE "True"
#define DEF_DEBUG "False"
-#define DEF_FONT "-*-helvetica-bold-r-normal-*-
240
-*"
+#define DEF_FONT "-*-helvetica-bold-r-normal-*-
*-240-*-*-*-*-*
-*"
#define DEFAULTS "*delay: 20000 \n" \
"*showFPS: False \n" \
"*font: " DEF_FONT"\n" \
"*wireframe: False \n" \
"*desktopGrabber: xscreensaver-getimage -no-desktop %s\n" \
"*grabDesktopImages: False \n" \
#define DEFAULTS "*delay: 20000 \n" \
"*showFPS: False \n" \
"*font: " DEF_FONT"\n" \
"*wireframe: False \n" \
"*desktopGrabber: xscreensaver-getimage -no-desktop %s\n" \
"*grabDesktopImages: False \n" \
- "*chooseRandomImages: True \n"
+ "*chooseRandomImages: True \n" \
+ "*suppressRotationAnimation: True\n" \
-# define
refresh
_jigsaw 0
+# define
free
_jigsaw 0
# define release_jigsaw 0
#undef countof
#define countof(x) (sizeof((x))/sizeof((*x)))
# define release_jigsaw 0
#undef countof
#define countof(x) (sizeof((x))/sizeof((*x)))
-#ifdef HAVE_
COCOA
+#ifdef HAVE_
JWXYZ
# include "jwxyz.h"
#else
# include <X11/Xlib.h>
# include "jwxyz.h"
#else
# include <X11/Xlib.h>
@@
-823,8
+824,8
@@
image_loaded_cb (const char *filename, XRectangle *geometry,
glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
- glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
- glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
+ glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP
_TO_EDGE
);
+ glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP
_TO_EDGE
);
make_puzzle_grid (mi);
}
make_puzzle_grid (mi);
}
@@
-1157,8
+1158,11
@@
loading_msg (ModeInfo *mi)
jigsaw_configuration *jc = &sps[MI_SCREEN(mi)];
int wire = MI_IS_WIREFRAME(mi);
const char *text = "Loading...";
jigsaw_configuration *jc = &sps[MI_SCREEN(mi)];
int wire = MI_IS_WIREFRAME(mi);
const char *text = "Loading...";
- int h;
- int w = texture_string_width (jc->texfont, text, &h);
+ XCharStruct e;
+ int w, h;
+ texture_string_metrics (jc->texfont, text, &e, 0, 0);
+ w = e.width;
+ h = e.ascent + e.descent;
if (wire) return;
if (wire) return;
@@
-1321,8
+1325,15
@@
reshape_jigsaw (ModeInfo *mi, int width, int height)
{
jigsaw_configuration *jc = &sps[MI_SCREEN(mi)];
GLfloat h = (GLfloat) height / (GLfloat) width;
{
jigsaw_configuration *jc = &sps[MI_SCREEN(mi)];
GLfloat h = (GLfloat) height / (GLfloat) width;
+ int y = 0;
- glViewport (0, 0, (GLint) width, (GLint) height);
+ if (width > height * 5) { /* tiny window: show middle */
+ height = width * 9/16;
+ y = -height/2;
+ h = height / (GLfloat) width;
+ }
+
+ glViewport (0, y, (GLint) width, (GLint) height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
@@
-1334,6
+1345,14
@@
reshape_jigsaw (ModeInfo *mi, int width, int height)
0.0, 0.0, 0.0,
0.0, 1.0, 0.0);
0.0, 0.0, 0.0,
0.0, 1.0, 0.0);
+# ifdef HAVE_MOBILE /* Keep it the same relative size when rotated. */
+ {
+ int o = (int) current_device_rotation();
+ if (o != 0 && o != 180 && o != -180)
+ glScalef (1/h, 1/h, 1/h);
+ }
+# endif
+
glClear(GL_COLOR_BUFFER_BIT);
jc->line_thickness = (MI_IS_WIREFRAME (mi) ? 1 : MAX (1, height / 300.0));
glClear(GL_COLOR_BUFFER_BIT);
jc->line_thickness = (MI_IS_WIREFRAME (mi) ? 1 : MAX (1, height / 300.0));
@@
-1366,14
+1385,7
@@
init_jigsaw (ModeInfo *mi)
jigsaw_configuration *jc;
int wire = MI_IS_WIREFRAME(mi);
jigsaw_configuration *jc;
int wire = MI_IS_WIREFRAME(mi);
- if (!sps) {
- sps = (jigsaw_configuration *)
- calloc (MI_NUM_SCREENS(mi), sizeof (jigsaw_configuration));
- if (!sps) {
- fprintf(stderr, "%s: out of memory\n", progname);
- exit(1);
- }
- }
+ MI_INIT (mi, sps);
jc = &sps[MI_SCREEN(mi)];
jc->glx_context = init_GL(mi);
jc = &sps[MI_SCREEN(mi)];
jc->glx_context = init_GL(mi);
@@
-1431,7
+1443,7
@@
draw_jigsaw (ModeInfo *mi)
mi->polygon_count = 0;
glPushMatrix ();
mi->polygon_count = 0;
glPushMatrix ();
- glRotatef(current_device_rotation(), 0, 0, 1);
+/* glRotatef(current_device_rotation(), 0, 0, 1); */
gltrackball_rotate (jc->trackball);
animate (mi);
gltrackball_rotate (jc->trackball);
animate (mi);