You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2023/08/10 12:36:48 UTC

[nuttx-apps] 05/06: drivertest/lcd: fix draw area calc error in LCD rect

This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx-apps.git

commit 6d11e1e7e2f23058187aa9ee08959953c90eed4b
Author: rongyichang <ro...@xiaomi.com>
AuthorDate: Fri Apr 7 15:20:16 2023 +0800

    drivertest/lcd: fix draw area calc error in LCD rect
    
    Signed-off-by: rongyichang <ro...@xiaomi.com>
---
 testing/drivertest/drivertest_framebuffer.c |  4 ++--
 testing/drivertest/drivertest_lcd.c         | 18 +++++++++---------
 2 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/testing/drivertest/drivertest_framebuffer.c b/testing/drivertest/drivertest_framebuffer.c
index a92af7f29..5302c5919 100644
--- a/testing/drivertest/drivertest_framebuffer.c
+++ b/testing/drivertest/drivertest_framebuffer.c
@@ -315,13 +315,13 @@ static void test_case_fb_3(FAR void **state)
   const uint32_t xres = fb_state->fb_info.video_info.xres;
   const uint32_t yres = fb_state->fb_info.video_info.yres;
 
-  step_height = xres / step_num;
+  step_height = yres / step_num;
   for (i = 0; i < step_num; i++)
     {
       start_y = step_height * i;
       if (i == step_num - 1)
         {
-          step_height = yres - start_y + 1;
+          step_height = yres - start_y;
         }
 
       gray_color = (0xff / step_num) * i;
diff --git a/testing/drivertest/drivertest_lcd.c b/testing/drivertest/drivertest_lcd.c
index a4b0d7583..6e97b3a8d 100644
--- a/testing/drivertest/drivertest_lcd.c
+++ b/testing/drivertest/drivertest_lcd.c
@@ -225,18 +225,18 @@ static void draw_rect(FAR struct lcd_info_s *lcd_info, int x, int y,
       valid_h = yres - y;
     }
 
-  draw_area.row_start = x;
-  draw_area.col_start = y;
-  draw_area.row_end = x + valid_w - 1;
-  draw_area.col_end = y + valid_h - 1;
+  draw_area.row_start = y;
+  draw_area.col_start = x;
+  draw_area.row_end = y + valid_h - 1;
+  draw_area.col_end = x + valid_w - 1;
   draw_area.data = malloc(valid_w * valid_h * (bpp >> 3));
   assert_ptr_not_equal(draw_area.data, NULL);
   fb_bpp16 = (uint16_t *)draw_area.data;
   fb_bpp32 = (uint32_t *)draw_area.data;
-  for (j = 0; j <= (draw_area.col_end - draw_area.col_start); j++)
+  for (j = 0; j <= (draw_area.row_end - draw_area.row_start); j++)
     {
       offset = j  * valid_w;
-      for (i = 0; i <= (draw_area.row_end - draw_area.row_start); i++)
+      for (i = 0; i <= (draw_area.col_end - draw_area.col_start); i++)
         {
           if (bpp == 32)
             {
@@ -310,7 +310,7 @@ static void test_case_lcd_2(FAR void **state)
       start_x = step_width * i;
       if (i == step_num - 1)
         {
-          step_width = xres - start_x + 1;
+          step_width = xres - start_x;
         }
 
       draw_rect(&lcd_state->lcd_info, start_x, 0, step_width, yres,
@@ -334,13 +334,13 @@ static void test_case_lcd_3(FAR void **state)
   const uint32_t xres = lcd_state->lcd_info.video_info.xres;
   const uint32_t yres = lcd_state->lcd_info.video_info.yres;
 
-  step_height = xres / step_num;
+  step_height = yres / step_num;
   for (i = 0; i < step_num; i++)
     {
       start_y = step_height * i;
       if (i == step_num - 1)
         {
-          step_height = yres - start_y + 1;
+          step_height = yres - start_y;
         }
 
       gray_color = (0xff / step_num) * i;