- Timestamp:
- 2006-09-07T19:56:44Z (19 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- ab1ae2d9
- Parents:
- 801579fe
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/fb/fb.c
r801579fe r253f35a1 71 71 72 72 struct { 73 uint8_t *fbaddress ; 74 75 unsigned int xres ; 76 unsigned int yres ; 77 unsigned int scanline ; 78 unsigned int pixelbytes ; 73 uint8_t *fbaddress; 74 75 unsigned int xres; 76 unsigned int yres; 77 unsigned int scanline; 78 unsigned int pixelbytes; 79 unsigned int invert_colors; 79 80 80 81 conv2scr_fn_t rgb2scr; … … 141 142 #define POINTPOS(x, y) ((y) * screen.scanline + (x) * screen.pixelbytes) 142 143 144 static inline int COLOR(int color) 145 { 146 return screen.invert_colors ? ~color : color; 147 } 148 143 149 /* Conversion routines between different color representations */ 144 150 static void rgb_4byte(void *dst, int rgb) … … 164 170 scr[0] = BLUE(rgb, 8); 165 171 #endif 166 167 168 172 } 169 173 … … 218 222 219 223 if (! (vport->paused && vport->dbdata)) 220 (*screen.rgb2scr)(&screen.fbaddress[POINTPOS(dx,dy)], color);224 (*screen.rgb2scr)(&screen.fbaddress[POINTPOS(dx,dy)], COLOR(color)); 221 225 222 226 if (vport->dbdata) { 223 227 int dline = (y + vport->dboffset) % vport->height; 224 228 int doffset = screen.pixelbytes * (dline * vport->width + x); 225 (*screen.rgb2scr)(&vport->dbdata[doffset], color);229 (*screen.rgb2scr)(&vport->dbdata[doffset], COLOR(color)); 226 230 } 227 231 } … … 233 237 int dy = vport->y + y; 234 238 235 return (*screen.scr2rgb)(&screen.fbaddress[POINTPOS(dx,dy)]);239 return COLOR((*screen.scr2rgb)(&screen.fbaddress[POINTPOS(dx,dy)])); 236 240 } 237 241 … … 239 243 int color) 240 244 { 241 (*screen.rgb2scr)(&mem[POINTPOS(x,y)], color);245 (*screen.rgb2scr)(&mem[POINTPOS(x,y)], COLOR(color)); 242 246 } 243 247 … … 455 459 * @param scan Bytes per one scanline 456 460 * @param align Alignment for 24bpp mode. 461 * @param invert_colors Inverted colors. 457 462 * 458 463 */ 459 464 static void 460 screen_init(void *addr, unsigned int xres, unsigned int yres, unsigned int bpp, unsigned int scan, int align) 465 screen_init(void *addr, unsigned int xres, unsigned int yres, unsigned int bpp, unsigned int scan, 466 int align, int invert_colors) 461 467 { 462 468 switch (bpp) { … … 491 497 screen.yres = yres; 492 498 screen.scanline = scan; 499 screen.invert_colors = invert_colors; 493 500 494 501 /* Create first viewport */ … … 594 601 int pos = (y * pmap->width + x) * screen.pixelbytes; 595 602 596 (*screen.rgb2scr)(&pmap->data[pos], color);603 (*screen.rgb2scr)(&pmap->data[pos],COLOR(color)); 597 604 } 598 605 … … 1224 1231 unsigned int fb_bpp_align; 1225 1232 unsigned int fb_scanline; 1233 unsigned int fb_invert_colors; 1226 1234 void *fb_addr; 1227 1235 size_t asz; … … 1235 1243 fb_bpp_align=sysinfo_value("fb.bpp-align"); 1236 1244 fb_scanline=sysinfo_value("fb.scanline"); 1245 fb_invert_colors=sysinfo_value("fb.invert-colors"); 1237 1246 1238 1247 asz = fb_scanline*fb_height; … … 1242 1251 AS_AREA_READ | AS_AREA_WRITE | AS_AREA_CACHEABLE); 1243 1252 1244 screen_init(fb_addr, fb_width, fb_height, fb_bpp, fb_scanline, fb_bpp_align );1253 screen_init(fb_addr, fb_width, fb_height, fb_bpp, fb_scanline, fb_bpp_align, fb_invert_colors); 1245 1254 1246 1255 return 0;
Note:
See TracChangeset
for help on using the changeset viewer.