diff options
| author | Daniel Stenberg <daniel@haxx.se> | 2002-09-10 07:07:44 +0000 |
|---|---|---|
| committer | Daniel Stenberg <daniel@haxx.se> | 2002-09-10 07:07:44 +0000 |
| commit | cd864070e466022873305b4fc6c6e9b915ce3b78 (patch) | |
| tree | 1accac8187a35f5f9eb3372675a6ffc2d8243032 | |
| parent | 331fcf628a55508f4b2cf2d0f54308ebf42af6b8 (diff) | |
| download | rockbox-cd864070e466022873305b4fc6c6e9b915ce3b78.zip rockbox-cd864070e466022873305b4fc6c6e9b915ce3b78.tar.gz rockbox-cd864070e466022873305b4fc6c6e9b915ce3b78.tar.bz2 rockbox-cd864070e466022873305b4fc6c6e9b915ce3b78.tar.xz | |
added lcd_update_rect() simulator-style
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@2255 a1c6a512-1295-4272-9138-f99709370657
| -rw-r--r-- | uisimulator/x11/lcd-x11.c | 78 |
1 files changed, 62 insertions, 16 deletions
diff --git a/uisimulator/x11/lcd-x11.c b/uisimulator/x11/lcd-x11.c index e1d1953..7547008 100644 --- a/uisimulator/x11/lcd-x11.c +++ b/uisimulator/x11/lcd-x11.c @@ -56,33 +56,75 @@ void lcd_update (void) int cp=0; XPoint clearpoints[LCD_WIDTH * LCD_HEIGHT]; -#if 0 - screen_resized(LCD_WIDTH, LCD_HEIGHT); - for(y=0; y<LCD_HEIGHT; y+=8) { for(x=0; x<LCD_WIDTH; x++) { - if(lcd_framebuffer[x][y/8]) { - /* one or more bits/pixels are set */ + if(lcd_framebuffer[x][y/8] || lcd_framebuffer_copy[x][y/8]) { + /* one or more bits/pixels are changed */ + unsigned char diff = + lcd_framebuffer[x][y/8] ^ lcd_framebuffer_copy[x][y/8]; + for(bit=0; bit<8; bit++) { if(lcd_framebuffer[x][y/8]&(1<<bit)) { + /* set a dot */ points[p].x = x + MARGIN_X; points[p].y = y+bit + MARGIN_Y; p++; /* increase the point counter */ } + else if(diff &(1<<bit)) { + /* clear a dot */ + clearpoints[cp].x = x + MARGIN_X; + clearpoints[cp].y = y+bit + MARGIN_Y; + cp++; /* increase the point counter */ + } } } } } -#else - for(y=0; y<LCD_HEIGHT; y+=8) { - for(x=0; x<LCD_WIDTH; x++) { - if(lcd_framebuffer[x][y/8] || lcd_framebuffer_copy[x][y/8]) { + + /* copy a huge block */ + memcpy(lcd_framebuffer_copy, lcd_framebuffer, sizeof(lcd_framebuffer)); + + drawdots(0, &clearpoints[0], cp); + drawdots(1, &points[0], p); +/* Logf("lcd_update: Draws %d pixels, clears %d pixels", p, cp);*/ + XSync(dpy,False); +} + +void lcd_update_rect(int x_start, int y_start, + int width, int height) +{ + int x; + int yline=y_start; + int y; + int p=0; + int bit; + int cp=0; + int xmax; + int ymax; + XPoint points[LCD_WIDTH * LCD_HEIGHT]; + XPoint clearpoints[LCD_WIDTH * LCD_HEIGHT]; + + /* The Y coordinates have to work on even 8 pixel rows */ + ymax = (yline + height)/8; + yline /= 8; + + xmax = x_start + width; + + if(xmax > LCD_WIDTH) + xmax = LCD_WIDTH; + if(ymax >= LCD_HEIGHT/8) + ymax = LCD_HEIGHT/8-1; + + for(; yline<ymax; yline++) { + y = yline * 8; + for(x=x_start; x<xmax; x++) { + if(lcd_framebuffer[x][yline] || lcd_framebuffer_copy[x][yline]) { /* one or more bits/pixels are changed */ unsigned char diff = - lcd_framebuffer[x][y/8] ^ lcd_framebuffer_copy[x][y/8]; + lcd_framebuffer[x][yline] ^ lcd_framebuffer_copy[x][yline]; for(bit=0; bit<8; bit++) { - if(lcd_framebuffer[x][y/8]&(1<<bit)) { + if(lcd_framebuffer[x][yline]&(1<<bit)) { /* set a dot */ points[p].x = x + MARGIN_X; points[p].y = y+bit + MARGIN_Y; @@ -95,17 +137,21 @@ void lcd_update (void) cp++; /* increase the point counter */ } } + + /* update the copy */ + lcd_framebuffer_copy[x][yline] = lcd_framebuffer[x][yline]; } } } - /* copy a huge block */ - memcpy(lcd_framebuffer_copy, lcd_framebuffer, sizeof(lcd_framebuffer)); - -#endif - drawdots(0, &clearpoints[0], cp); drawdots(1, &points[0], p); /* Logf("lcd_update: Draws %d pixels, clears %d pixels", p, cp);*/ XSync(dpy,False); } + +/* ----------------------------------------------------------------- + * local variables: + * eval: (load-file "../../firmware/rockbox-mode.el") + * end: + */ |