summaryrefslogtreecommitdiffstats
path: root/hacks/glx/boxed.c
diff options
context:
space:
mode:
authorSimon Rettberg2021-04-06 14:23:46 +0200
committerSimon Rettberg2021-04-06 14:23:46 +0200
commit26b6e4255d4b9ff79a6dca10de5bec7bfc8691f9 (patch)
treea51e1637554bcd84e63cccb1cb220c898a2c4ee8 /hacks/glx/boxed.c
parent5.44 (diff)
downloadxscreensaver-26b6e4255d4b9ff79a6dca10de5bec7bfc8691f9.tar.gz
xscreensaver-26b6e4255d4b9ff79a6dca10de5bec7bfc8691f9.tar.xz
xscreensaver-26b6e4255d4b9ff79a6dca10de5bec7bfc8691f9.zip
xscreensaver 6.00
Diffstat (limited to 'hacks/glx/boxed.c')
-rw-r--r--hacks/glx/boxed.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/hacks/glx/boxed.c b/hacks/glx/boxed.c
index 7d1b5d0..ddc4af4 100644
--- a/hacks/glx/boxed.c
+++ b/hacks/glx/boxed.c
@@ -61,8 +61,6 @@ static const char sccsid[] = "@(#)boxed.c 0.9 01/09/26 xlockmore";
# define DEF_DECAY "0.07"
# define DEF_MOMENTUM "0.6"
-#undef countof
-#define countof(x) (int)(sizeof((x))/sizeof((*x)))
#undef rnd
#define rnd() (frand(1.0))
@@ -1029,15 +1027,13 @@ static void draw(ModeInfo * mi)
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glLoadIdentity();
-# ifdef HAVE_MOBILE /* Keep it the same relative size when rotated. */
{
- GLfloat h = MI_HEIGHT(mi) / (GLfloat) MI_WIDTH(mi);
- int o = (int) current_device_rotation();
- if (o != 0 && o != 180 && o != -180)
- glScalef (1/h, 1/h, 1/h);
- glRotatef(o, 0, 0, 1);
+ GLfloat s = (MI_WIDTH(mi) < MI_HEIGHT(mi)
+ ? (MI_WIDTH(mi) / (GLfloat) MI_HEIGHT(mi))
+ : 1);
+ glRotatef(current_device_rotation(), 0, 0, 1);
+ glScalef (s, s, s);
}
-# endif
gp->tic += 0.01f;
gp->camtic += 0.01f + 0.01f * sin(gp->tic * speed);