fota_gui_common : for considering case which is out of range, it calculate as 4 steps 87/247987/2
authordyamy-lee <dyamy.lee@samsung.com>
Wed, 18 Nov 2020 05:42:19 +0000 (14:42 +0900)
committerdyamy-lee <dyamy.lee@samsung.com>
Mon, 23 Nov 2020 08:38:22 +0000 (17:38 +0900)
Change-Id: Ibf19e73067905996eaead3d6ca438865649afa1d

fota_gui_common/fota_gr_direct_ro_common.c

index 5a86a57b4a2c6bba3cc6e4baf16870ed2e836886..2169cd5f5d204e0211d81851380a2247a8c8b54b 100644 (file)
@@ -60,8 +60,8 @@ const int x_offset_main_bg_text_pos = 518;
 const int y_offset_main_bg_text_pos = 300;
 const int x_offset_prog_bar_img_pos = 240;
 const int y_offset_prog_bar_img_pos = 355;
-int rotate_angle = -1;
-int rollback_rotate_angle = 0;
+int rotate_step = 0;
+int rollback_step = 0;
 int img_buf_width = 0;
 int img_buf_height = 0;
 
@@ -385,7 +385,7 @@ static void _gr_direct_draw_main_img(tbm_surface_info_s *surface_info)
 void _copy_buffers_by_rotate(void *srcptr, int srcw, int srch, int srcstride,
                                                  void *dstptr, int dstw, int dsth, int dststride,
                                                  int sx, int sy, int sw, int sh,
-                                                 int dx, int dy, int dw, int dh, int rotate)
+                                                 int dx, int dy, int dw, int dh, int rstep)
 {
        pixman_image_t *src_img = NULL, *dst_img = NULL;
        pixman_op_t op;
@@ -405,14 +405,12 @@ void _copy_buffers_by_rotate(void *srcptr, int srcw, int srch, int srcstride,
 
        struct pixman_f_transform ft;
        double scale_x, scale_y;
-       int rotate_step;
        pixman_transform_t t;
        pixman_f_transform_init_identity(&ft);
 
-       rotate_step = (rotate + 360) / 90 % 4;
-       if (rotate_step > 0) {
+       if (rstep > 0) {
                int c = 0, s = 0, tx = 0, ty = 0;
-               switch (rotate_step) {
+               switch (rstep) {
                case 1:
                        c = 0, s = -1, tx = -dw;
                        break;
@@ -427,7 +425,7 @@ void _copy_buffers_by_rotate(void *srcptr, int srcw, int srch, int srcstride,
                pixman_f_transform_rotate(&ft, NULL, c, s);
        }
 
-       if (rotate_step % 2 == 0) {
+       if (rstep % 2 == 0) {
                scale_x = (double)sw / dw;
                scale_y = (double)sh / dh;
        } else {
@@ -476,7 +474,7 @@ static void __init_screen(FbInfo *fbi)
        _copy_buffers_by_rotate(surface_info_ori.planes[0].ptr, surface_info_ori.width, surface_info_ori.height, surface_info_ori.planes[0].stride,
                                        fbi->buf[0], fbi->w, fbi->h, fbi->w * RGB32_PITCH,
                                        0,0,surface_info_ori.width, surface_info_ori.height,
-                                       0,0,fbi->w, fbi->h, rotate_angle);
+                                       0,0,fbi->w, fbi->h, rotate_step);
        tbm_surface_unmap(tbm_surface_ori);
        tbm_surface_destroy(tbm_surface_ori);
 }
@@ -626,6 +624,7 @@ void fota_gr_direct_clear_screen(u32 color)
 void _get_rotate(void)
 {
        char *rotate_state = getenv("ROTATE_STATE");
+       int rotate_angle = -1;
        if(!rotate_state)
        {
                rotate_angle = ROTATE;
@@ -636,9 +635,11 @@ void _get_rotate(void)
        }
 
        LOG("Print Rotate Angle value = %d\n", rotate_angle);
-       rollback_rotate_angle = 360 - rotate_angle;
 
-       int rotate_step = (rotate_angle + 360) / 90 % 4;
+       rotate_step = (rotate_angle + 360) / 90 % 4;
+       rollback_step = (4 - rotate_step) % 4;
+       LOG("rotate_step = %d, rollback_step = %d\n", rotate_step, rollback_step);
+
        if (rotate_step % 2 == 0) {
                img_buf_width = s_fbi.w;
                img_buf_height = s_fbi.h;