diff options
author | Andrew Mahone <andrew.mahone@gmail.com> | 2009-02-08 22:17:21 +0000 |
---|---|---|
committer | Andrew Mahone <andrew.mahone@gmail.com> | 2009-02-08 22:17:21 +0000 |
commit | 0222d0a5ebcc0be2e511abeb3ea8fbe7b4df8475 (patch) | |
tree | 56d91e1f741d3824d9987064a0dbedbe24864a64 /apps/plugins | |
parent | c02e469bbba8f363317a8b54b388774fdb5d431d (diff) | |
download | rockbox-0222d0a5ebcc0be2e511abeb3ea8fbe7b4df8475.tar.gz rockbox-0222d0a5ebcc0be2e511abeb3ea8fbe7b4df8475.zip |
align frontmost edge of slides with plane of display
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19948 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins')
-rw-r--r-- | apps/plugins/pictureflow.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/apps/plugins/pictureflow.c b/apps/plugins/pictureflow.c index 4a4d6b405e..38a80dd5be 100644 --- a/apps/plugins/pictureflow.c +++ b/apps/plugins/pictureflow.c | |||
@@ -114,6 +114,7 @@ typedef fb_data pix_t; | |||
114 | #define CAM_DIST MAX(MIN(LCD_HEIGHT,LCD_WIDTH),120) | 114 | #define CAM_DIST MAX(MIN(LCD_HEIGHT,LCD_WIDTH),120) |
115 | #define CAM_DIST_R (CAM_DIST << PFREAL_SHIFT) | 115 | #define CAM_DIST_R (CAM_DIST << PFREAL_SHIFT) |
116 | #define DISPLAY_LEFT_R (PFREAL_HALF - LCD_WIDTH * PFREAL_HALF) | 116 | #define DISPLAY_LEFT_R (PFREAL_HALF - LCD_WIDTH * PFREAL_HALF) |
117 | #define MAXSLIDE_LEFT_R (PFREAL_HALF - DISPLAY_WIDTH * PFREAL_HALF) | ||
117 | 118 | ||
118 | #define SLIDE_CACHE_SIZE 100 | 119 | #define SLIDE_CACHE_SIZE 100 |
119 | 120 | ||
@@ -448,6 +449,7 @@ static inline PFreal fdiv(PFreal num, PFreal den) | |||
448 | 449 | ||
449 | #define fmin(a,b) (((a) < (b)) ? (a) : (b)) | 450 | #define fmin(a,b) (((a) < (b)) ? (a) : (b)) |
450 | #define fmax(a,b) (((a) > (b)) ? (a) : (b)) | 451 | #define fmax(a,b) (((a) > (b)) ? (a) : (b)) |
452 | #define fabs(a) (a < 0 ? -a : a) | ||
451 | #define fbound(min,val,max) (fmax((min),fmin((max),(val)))) | 453 | #define fbound(min,val,max) (fmax((min),fmin((max),(val)))) |
452 | 454 | ||
453 | 455 | ||
@@ -1217,7 +1219,7 @@ void reset_slides(void) | |||
1217 | void recalc_offsets(void) | 1219 | void recalc_offsets(void) |
1218 | { | 1220 | { |
1219 | PFreal xs = PFREAL_HALF - DISPLAY_WIDTH * PFREAL_HALF; | 1221 | PFreal xs = PFREAL_HALF - DISPLAY_WIDTH * PFREAL_HALF; |
1220 | PFreal zo = CAM_DIST_R * 100 / zoom - CAM_DIST_R; | 1222 | PFreal zo; |
1221 | PFreal xp = (DISPLAY_WIDTH * PFREAL_HALF - PFREAL_HALF + center_margin * | 1223 | PFreal xp = (DISPLAY_WIDTH * PFREAL_HALF - PFREAL_HALF + center_margin * |
1222 | PFREAL_ONE) * zoom / 100; | 1224 | PFREAL_ONE) * zoom / 100; |
1223 | PFreal cosr, sinr; | 1225 | PFreal cosr, sinr; |
@@ -1225,6 +1227,8 @@ void recalc_offsets(void) | |||
1225 | itilt = 70 * IANGLE_MAX / 360; /* approx. 70 degrees tilted */ | 1227 | itilt = 70 * IANGLE_MAX / 360; /* approx. 70 degrees tilted */ |
1226 | cosr = fcos(-itilt); | 1228 | cosr = fcos(-itilt); |
1227 | sinr = fsin(-itilt); | 1229 | sinr = fsin(-itilt); |
1230 | zo = CAM_DIST_R * 100 / zoom - CAM_DIST_R + | ||
1231 | fmuln(MAXSLIDE_LEFT_R, sinr, PFREAL_SHIFT - 2, 0); | ||
1228 | offsetX = xp - fmul(xs, cosr) + fmuln(xp, | 1232 | offsetX = xp - fmul(xs, cosr) + fmuln(xp, |
1229 | zo + fmuln(xs, sinr, PFREAL_SHIFT - 2, 0), PFREAL_SHIFT - 2, 0) | 1233 | zo + fmuln(xs, sinr, PFREAL_SHIFT - 2, 0), PFREAL_SHIFT - 2, 0) |
1230 | / CAM_DIST; | 1234 | / CAM_DIST; |
@@ -1305,10 +1309,10 @@ void render_slide(struct slide_data *slide, const int alpha) | |||
1305 | const int w = LCD_WIDTH; | 1309 | const int w = LCD_WIDTH; |
1306 | 1310 | ||
1307 | 1311 | ||
1308 | PFreal zo = PFREAL_ONE * slide->distance + CAM_DIST_R * 100 / zoom | ||
1309 | - CAM_DIST_R; | ||
1310 | PFreal cosr = fcos(slide->angle); | 1312 | PFreal cosr = fcos(slide->angle); |
1311 | PFreal sinr = fsin(slide->angle); | 1313 | PFreal sinr = fsin(slide->angle); |
1314 | PFreal zo = PFREAL_ONE * slide->distance + CAM_DIST_R * 100 / zoom | ||
1315 | - CAM_DIST_R - fmuln(MAXSLIDE_LEFT_R, fabs(sinr), PFREAL_SHIFT - 2, 0); | ||
1312 | PFreal xs = slide_left, xsnum, xsnumi, xsden, xsdeni; | 1316 | PFreal xs = slide_left, xsnum, xsnumi, xsden, xsdeni; |
1313 | PFreal xp = fdiv(CAM_DIST * (slide->cx + fmul(xs, cosr)), | 1317 | PFreal xp = fdiv(CAM_DIST * (slide->cx + fmul(xs, cosr)), |
1314 | (CAM_DIST_R + zo + fmul(xs,sinr))); | 1318 | (CAM_DIST_R + zo + fmul(xs,sinr))); |