Don't use hardcoded coordinates.
authorbernie <bernie@38d2e660-2303-0410-9eaa-f027e97ec537>
Tue, 17 Jan 2006 23:00:26 +0000 (23:00 +0000)
committerbernie <bernie@38d2e660-2303-0410-9eaa-f027e97ec537>
Tue, 17 Jan 2006 23:00:26 +0000 (23:00 +0000)
git-svn-id: https://src.develer.com/svnoss/bertos/trunk@477 38d2e660-2303-0410-9eaa-f027e97ec537

drv/lcd_gfx_test.c

index d86c3936a48bb265079c73ab9968d7d917d38e44..07f7e0d67260130870a9a8f06c9ca3b54112be18 100755 (executable)
@@ -14,6 +14,9 @@
 
 /*#*
  *#* $Log$
+ *#* Revision 1.3  2006/01/17 23:00:26  bernie
+ *#* Don't use hardcoded coordinates.
+ *#*
  *#* Revision 1.2  2006/01/17 02:31:57  bernie
  *#* Test gfx with the usual pentagons.
  *#*
@@ -43,24 +46,26 @@ int main(int argc, char *argv[])
 
        coord_t x = 0, y = LCD_WIDTH / 2;
        coord_t xdir = +1, ydir = -1;
+       Bitmap *bm = &lcd_bitmap;
 
        for(;;)
        {
-               gfx_bitmapClear(&lcd_bitmap);
-               gfx_rectDraw(&lcd_bitmap, 10, 10, LCD_WIDTH-10, LCD_HEIGHT-10);
-               gfx_setClipRect(&lcd_bitmap, 10, 10, LCD_WIDTH-10, LCD_HEIGHT-10);
-               magic(&lcd_bitmap, x, y);
+               gfx_bitmapClear(bm);
+               gfx_setClipRect(bm, 0, 0, bm->width, bm->height);
+               gfx_rectDraw(bm, 10, 10, bm->width-10, bm->height-10);
+               gfx_setClipRect(bm, 11, 11, bm->width-11, bm->height-11);
+               magic(bm, x, y);
 
                x += xdir;
                y += ydir;
-               if (x >= LCD_WIDTH)  xdir = -1;
+               if (x >= bm->width)  xdir = -1;
                if (x <= -50)        xdir = +1;
-               if (y >= LCD_HEIGHT) ydir = -1;
+               if (y >= bm->height) ydir = -1;
                if (y <= -50)        ydir = +1;
 
-               lcd_blit_bitmap(&lcd_bitmap);
+               lcd_blit_bitmap(bm);
                emul_idle();
-               usleep(100);
+               usleep(10000);
        }
 
        emul_cleanup();