修复旋转后gif错位

This commit is contained in:
zzh 2026-03-03 10:43:01 +08:00
parent 3c2f2634c3
commit ee6c39d016
5 changed files with 29 additions and 8 deletions

Binary file not shown.

View File

@ -91,7 +91,7 @@
#endif
#endif /*LV_USE_STDLIB_MALLOC == LV_STDLIB_BUILTIN*/
#define LV_DEF_REFR_PERIOD 180 /**< [ms] 150ms (6.7fps),优化后支持 tag.gif + 02.gif + 视频长时间稳定运行 */
#define LV_DEF_REFR_PERIOD 280 /**< [ms] 150ms (6.7fps),优化后支持 tag.gif + 02.gif + 视频长时间稳定运行 */
#define LV_DPI_DEF 130 /**< [px/inch] */

View File

@ -1 +1 @@
205283fc5104c1ba9df3bba600eecd69 /home/hyx/work/0212/demo/release/e_player-single-00-70-1.0.84.tar
90d2dde9ce45b7396b151bb68a77abe7 /home/hyx/work/0212/demo/release/e_player-single-00-70-1.0.84.tar

View File

@ -115,21 +115,42 @@ int main(int argc, char **argv)
// 根据屏幕旋转调整小动画位置
extern int g_screen_rotation;
int small_x = 800 - 150; // 650 (原始右下角)
int small_y = 1280 - 150; // 1130 (原始右下角)
int small_x, small_y;
if (g_screen_rotation == 2) {
// 180度旋转显示系统已旋转逻辑坐标需要反向
// 要显示在左上角,逻辑坐标应该是右下角
small_x = 800 - 150; // 650
small_y = 1280 - 150; // 1130
printf("[DEBUG] Rotation 2: using original bottom-right position for top-left display\n");
small_x = 800 - 280; // 520为280宽度留出空间
small_y = 1280 - 280; // 1000为280高度留出空间
printf("[DEBUG] Rotation 2: position (%d, %d) will display at top-left\n", small_x, small_y);
} else {
// 不旋转:右下角位置
small_x = 800 - 280 - 20; // 500右下角留20像素边距
small_y = 1280 - 280 - 20; // 980右下角留20像素边距
printf("[DEBUG] No rotation: position (%d, %d) at bottom-right\n", small_x, small_y);
}
lv_obj_set_pos(small_gif, small_x, small_y);
lv_obj_set_size(small_gif, 150, 150);
lv_obj_set_size(small_gif, 280, 280); // 增加尺寸到280x280
lv_obj_clear_flag(small_gif, LV_OBJ_FLAG_HIDDEN);
lv_gif_restart(small_gif);
printf("[DEBUG] GIF position: (%d, %d), size: 280x280\n", small_x, small_y);
/* 创建 03.gif 在 02.gif 正上方 */
lv_obj_t *third_gif = lv_gif_create(disp.root_obj);
lv_gif_set_src(third_gif, "A:usrdata/pic/03.gif");
// 计算 03.gif 位置:在 02.gif 正上方
int third_x = small_x; // X 坐标相同
int third_y = small_y - 280 - 20; // Y 坐标在 02.gif 上方间距20像素
printf("[DEBUG] 03.gif position: (%d, %d), size: 280x280\n", third_x, third_y);
lv_obj_set_pos(third_gif, third_x, third_y);
lv_obj_set_size(third_gif, 280, 280);
lv_obj_clear_flag(third_gif, LV_OBJ_FLAG_HIDDEN);
lv_gif_restart(third_gif);
//创建视频播放器
VideoPlayer *video_player=video_player_init(0);