diff options
-rw-r--r-- | apps/plugins/pictureflow.c | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/apps/plugins/pictureflow.c b/apps/plugins/pictureflow.c index bd51a88b36..4a4d6b405e 100644 --- a/apps/plugins/pictureflow.c +++ b/apps/plugins/pictureflow.c | |||
@@ -113,7 +113,7 @@ typedef fb_data pix_t; | |||
113 | #define DISPLAY_OFFS ((LCD_HEIGHT / 2) - REFLECT_HEIGHT) | 113 | #define DISPLAY_OFFS ((LCD_HEIGHT / 2) - REFLECT_HEIGHT) |
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_ONE / 2) | 116 | #define DISPLAY_LEFT_R (PFREAL_HALF - LCD_WIDTH * PFREAL_HALF) |
117 | 117 | ||
118 | #define SLIDE_CACHE_SIZE 100 | 118 | #define SLIDE_CACHE_SIZE 100 |
119 | 119 | ||
@@ -1207,25 +1207,27 @@ void reset_slides(void) | |||
1207 | Call this when the viewport size or slide dimension is changed. | 1207 | Call this when the viewport size or slide dimension is changed. |
1208 | * | 1208 | * |
1209 | * To calculate the offset that will provide the proper margin, we use the same | 1209 | * To calculate the offset that will provide the proper margin, we use the same |
1210 | * projection used to render the slides. Assuming zo == 0, the solution for xc, | 1210 | * projection used to render the slides. The solution for xc, the slide center, |
1211 | * the slide center, is: | 1211 | * is: |
1212 | * xp * xs * sin(r) | 1212 | * xp * (zo + xs * sin(r)) |
1213 | * xc = xp - xs * cos(r) + ──────────────── | 1213 | * xc = xp - xs * cos(r) + ─────────────────────── |
1214 | * z | 1214 | * z |
1215 | * TODO: support moving the side slides toward or away from the camera | 1215 | * TODO: support moving the side slides toward or away from the camera |
1216 | */ | 1216 | */ |
1217 | void recalc_offsets(void) | 1217 | void recalc_offsets(void) |
1218 | { | 1218 | { |
1219 | PFreal xs = PFREAL_HALF - DISPLAY_WIDTH * PFREAL_HALF; | 1219 | PFreal xs = PFREAL_HALF - DISPLAY_WIDTH * PFREAL_HALF; |
1220 | PFreal xp = DISPLAY_WIDTH * PFREAL_HALF - PFREAL_HALF + center_margin * | 1220 | PFreal zo = CAM_DIST_R * 100 / zoom - CAM_DIST_R; |
1221 | PFREAL_ONE; | 1221 | PFreal xp = (DISPLAY_WIDTH * PFREAL_HALF - PFREAL_HALF + center_margin * |
1222 | PFREAL_ONE) * zoom / 100; | ||
1222 | PFreal cosr, sinr; | 1223 | PFreal cosr, sinr; |
1223 | 1224 | ||
1224 | itilt = 70 * IANGLE_MAX / 360; /* approx. 70 degrees tilted */ | 1225 | itilt = 70 * IANGLE_MAX / 360; /* approx. 70 degrees tilted */ |
1225 | cosr = fcos(-itilt); | 1226 | cosr = fcos(-itilt); |
1226 | sinr = fsin(-itilt); | 1227 | sinr = fsin(-itilt); |
1227 | offsetX = xp - fmul(xs, cosr) + fmuln(xp, | 1228 | offsetX = xp - fmul(xs, cosr) + fmuln(xp, |
1228 | fmuln(xs, sinr, PFREAL_SHIFT - 2, 0), PFREAL_SHIFT - 2, 0)/CAM_DIST; | 1229 | zo + fmuln(xs, sinr, PFREAL_SHIFT - 2, 0), PFREAL_SHIFT - 2, 0) |
1230 | / CAM_DIST; | ||
1229 | offsetY = DISPLAY_WIDTH / 2 * (fsin(itilt) + PFREAL_ONE / 2); | 1231 | offsetY = DISPLAY_WIDTH / 2 * (fsin(itilt) + PFREAL_ONE / 2); |
1230 | } | 1232 | } |
1231 | 1233 | ||
@@ -1303,8 +1305,8 @@ void render_slide(struct slide_data *slide, const int alpha) | |||
1303 | const int w = LCD_WIDTH; | 1305 | const int w = LCD_WIDTH; |
1304 | 1306 | ||
1305 | 1307 | ||
1306 | PFreal zo = (CAM_DIST_R + PFREAL_ONE * slide->distance) * 100 / zoom - | 1308 | PFreal zo = PFREAL_ONE * slide->distance + CAM_DIST_R * 100 / zoom |
1307 | CAM_DIST_R; | 1309 | - CAM_DIST_R; |
1308 | PFreal cosr = fcos(slide->angle); | 1310 | PFreal cosr = fcos(slide->angle); |
1309 | PFreal sinr = fsin(slide->angle); | 1311 | PFreal sinr = fsin(slide->angle); |
1310 | PFreal xs = slide_left, xsnum, xsnumi, xsden, xsdeni; | 1312 | PFreal xs = slide_left, xsnum, xsnumi, xsden, xsdeni; |