Changeset 67ec84b in mainline
- Timestamp:
- 2006-06-04T12:13:34Z (18 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- dd641e3
- Parents:
- d530237a
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
fb/fb.c
rd530237a r67ec84b 205 205 } 206 206 207 static void draw_rectangle(int vp, unsigned int sx, unsigned int sy, 208 unsigned int width, unsigned int height, 209 int color) 210 { 211 unsigned int x, y; 212 213 /* Clear first line */ 214 for (x = 0; x < width; x++) 215 putpixel(vp, sx + x, sy, color); 216 217 /* Recompute to screen coords */ 218 sx += viewports[vp].x; 219 sy += viewports[vp].y; 220 /* Copy the rest */ 221 for (y = sy+1;y < sy+height; y++) 222 memcpy(&screen.fbaddress[POINTPOS(sx,y)], 223 &screen.fbaddress[POINTPOS(sx,sy)], 224 screen.pixelbytes * width); 225 226 } 227 207 228 /** Fill viewport with background color */ 208 229 static void clear_port(int vp) 209 230 { 210 unsigned int y; 211 212 clear_line(vp, 0); 213 for (y = viewports[vp].y+1; y < viewports[vp].y+viewports[vp].height; y++) { 214 memcpy(&screen.fbaddress[POINTPOS(viewports[vp].x,y)], 215 &screen.fbaddress[POINTPOS(viewports[vp].x,viewports[vp].y)], 216 screen.pixelbytes * viewports[vp].width); 217 } 231 viewport_t *vport = &viewports[vp]; 232 233 draw_rectangle(vp, 0, 0, vport->width, vport->height, vport->style.bg_color); 218 234 } 219 235 … … 228 244 int startline; 229 245 int endline; 246 viewport_t *vport = &viewports[vp]; 230 247 231 248 if (rows > 0) { 232 for (y=viewports[vp].y; y < viewports[vp].y+viewports[vp].height - rows*FONT_SCANLINES; y++) 233 memcpy(&screen.fbaddress[POINTPOS(viewports[vp].x,y)], 234 &screen.fbaddress[POINTPOS(viewports[vp].x,y + rows*FONT_SCANLINES)], 235 screen.pixelbytes * viewports[vp].width); 236 /* Clear last row */ 237 startline = viewports[vp].y+FONT_SCANLINES*(viewports[vp].rows-1); 238 endline = viewports[vp].y + viewports[vp].height; 239 clear_line(vp, startline); 240 for (y=startline+1;y < endline; y++) 241 memcpy(&screen.fbaddress[POINTPOS(viewports[vp].x,y)], 242 &screen.fbaddress[POINTPOS(viewports[vp].x,startline)], 243 screen.pixelbytes * viewports[vp].width); 244 249 for (y=vport->y; y < vport->y+vport->height - rows*FONT_SCANLINES; y++) 250 memcpy(&screen.fbaddress[POINTPOS(vport->x,y)], 251 &screen.fbaddress[POINTPOS(vport->x,y + rows*FONT_SCANLINES)], 252 screen.pixelbytes * vport->width); 253 draw_rectangle(vp, 0, FONT_SCANLINES*(vport->rows - 1), 254 vport->width, FONT_SCANLINES, vport->style.bg_color); 245 255 } else if (rows < 0) { 246 256 rows = -rows; 247 for (y=viewports[vp].y + viewports[vp].height-1; y >= viewports[vp].y + rows*FONT_SCANLINES; y--) 248 memcpy(&screen.fbaddress[POINTPOS(viewports[vp].x,y)], 249 &screen.fbaddress[POINTPOS(viewports[vp].x,y - rows*FONT_SCANLINES)], 250 screen.pixelbytes * viewports[vp].width); 251 /* Clear first row */ 252 clear_line(0, viewports[vp].style.bg_color); 253 for (y=1;y < rows*FONT_SCANLINES; y++) 254 memcpy(&screen.fbaddress[POINTPOS(viewports[vp].x,viewports[vp].y+y)], 255 &screen.fbaddress[POINTPOS(viewports[vp].x,viewports[vp].y)], 256 screen.pixelbytes * viewports[vp].width); 257 for (y=vport->y + vport->height-1; y >= vport->y + rows*FONT_SCANLINES; y--) 258 memcpy(&screen.fbaddress[POINTPOS(vport->x,y)], 259 &screen.fbaddress[POINTPOS(vport->x,y - rows*FONT_SCANLINES)], 260 screen.pixelbytes * vport->width); 261 draw_rectangle(vp, 0, 0, vport->width, FONT_SCANLINES, vport->style.bg_color); 257 262 } 258 263 }
Note:
See TracChangeset
for help on using the changeset viewer.