Rev 1493 | Rev 1500 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1493 | Rev 1498 | ||
---|---|---|---|
Line 163... | Line 163... | ||
163 | { |
163 | { |
164 | int color = screen.fbaddress[POINTPOS(x, y)]; |
164 | int color = screen.fbaddress[POINTPOS(x, y)]; |
165 | return (((color >> 5) & 0x7) << (16 + 5)) | (((color >> 3) & 0x3) << (8 + 6)) | ((color & 0x7) << 5); |
165 | return (((color >> 5) & 0x7) << (16 + 5)) | (((color >> 3) & 0x3) << (8 + 6)) | ((color & 0x7) << 5); |
166 | } |
166 | } |
167 | 167 | ||
- | 168 | /** Put pixel into viewport |
|
- | 169 | * |
|
- | 170 | * @param vp Viewport identification |
|
- | 171 | * @param x X coord relative to viewport |
|
- | 172 | * @param y Y coord relative to viewport |
|
- | 173 | * @param color RGB color |
|
- | 174 | */ |
|
168 | static void putpixel(int vp, unsigned int x, unsigned int y, int color) |
175 | static void putpixel(int vp, unsigned int x, unsigned int y, int color) |
169 | { |
176 | { |
170 | screen.putpixel(viewports[vp].x + x, viewports[vp].y + y, color); |
177 | screen.putpixel(viewports[vp].x + x, viewports[vp].y + y, color); |
171 | } |
178 | } |
- | 179 | /** Get pixel from viewport */ |
|
172 | static int getpixel(int vp, unsigned int x, unsigned int y) |
180 | static int getpixel(int vp, unsigned int x, unsigned int y) |
173 | { |
181 | { |
174 | return screen.getpixel(viewports[vp].x + x, viewports[vp].y + y); |
182 | return screen.getpixel(viewports[vp].x + x, viewports[vp].y + y); |
175 | } |
183 | } |
176 | 184 | ||
Line 255... | Line 263... | ||
255 | 263 | ||
256 | /***************************************************************/ |
264 | /***************************************************************/ |
257 | /* Character-console functions */ |
265 | /* Character-console functions */ |
258 | 266 | ||
259 | /** Draw character at given position */ |
267 | /** Draw character at given position */ |
260 | static void draw_glyph(int vp,__u8 glyph, unsigned int row, unsigned int col) |
268 | static void draw_glyph(int vp,__u8 glyph, unsigned int sx, unsigned int sy) |
261 | { |
269 | { |
262 | unsigned int y; |
270 | unsigned int y; |
263 | 271 | ||
264 | for (y = 0; y < FONT_SCANLINES; y++) |
272 | for (y = 0; y < FONT_SCANLINES; y++) |
265 | draw_glyph_line(vp ,fb_font[glyph * FONT_SCANLINES + y], col * COL_WIDTH, row * FONT_SCANLINES + y); |
273 | draw_glyph_line(vp ,fb_font[glyph * FONT_SCANLINES + y], sx, sy + y); |
266 | } |
274 | } |
267 | 275 | ||
268 | /** Invert character at given position */ |
276 | /** Invert character at given position */ |
269 | static void invert_char(int vp,unsigned int row, unsigned int col) |
277 | static void invert_char(int vp,unsigned int row, unsigned int col) |
270 | { |
278 | { |
Line 385... | Line 393... | ||
385 | viewport_create(0,0,xres,yres); |
393 | viewport_create(0,0,xres,yres); |
386 | 394 | ||
387 | clear_port(0); |
395 | clear_port(0); |
388 | } |
396 | } |
389 | 397 | ||
- | 398 | /** Draw character at given position relative to viewport |
|
- | 399 | * |
|
- | 400 | * @param vp Viewport identification |
|
- | 401 | * @param c Character to print |
|
- | 402 | * @param row Screen position relative to viewport |
|
- | 403 | * @param col Screen position relative to viewport |
|
- | 404 | */ |
|
390 | static void draw_char(int vp, char c, unsigned int row, unsigned int col) |
405 | static void draw_char(int vp, char c, unsigned int row, unsigned int col) |
391 | { |
406 | { |
392 | viewport_t *vport = &viewports[vp]; |
407 | viewport_t *vport = &viewports[vp]; |
393 | 408 | ||
394 | if (vport->cursor_active && (vport->cur_col != col || vport->cur_row != row)) |
409 | if (vport->cursor_active && (vport->cur_col != col || vport->cur_row != row)) |
395 | invert_char(vp, vport->cur_row, vport->cur_col); |
410 | invert_char(vp, vport->cur_row, vport->cur_col); |
396 | 411 | ||
397 | draw_glyph(vp, c, row, col); |
412 | draw_glyph(vp, c, col * COL_WIDTH, row * FONT_SCANLINES); |
398 | 413 | ||
399 | vport->cur_col = col; |
414 | vport->cur_col = col; |
400 | vport->cur_row = row; |
415 | vport->cur_row = row; |
401 | 416 | ||
402 | vport->cur_col++; |
417 | vport->cur_col++; |
Line 408... | Line 423... | ||
408 | } |
423 | } |
409 | if (vport->cursor_active) |
424 | if (vport->cursor_active) |
410 | invert_char(vp, vport->cur_row, vport->cur_col); |
425 | invert_char(vp, vport->cur_row, vport->cur_col); |
411 | } |
426 | } |
412 | 427 | ||
- | 428 | /** Function for handling connections to FB |
|
- | 429 | * |
|
- | 430 | */ |
|
413 | static void fb_client_connection(ipc_callid_t iid, ipc_call_t *icall) |
431 | static void fb_client_connection(ipc_callid_t iid, ipc_call_t *icall) |
414 | { |
432 | { |
415 | ipc_callid_t callid; |
433 | ipc_callid_t callid; |
416 | ipc_call_t call; |
434 | ipc_call_t call; |
417 | int retval; |
435 | int retval; |
Line 543... | Line 561... | ||
543 | } |
561 | } |
544 | ipc_answer_fast(callid,retval,0,0); |
562 | ipc_answer_fast(callid,retval,0,0); |
545 | } |
563 | } |
546 | } |
564 | } |
547 | 565 | ||
- | 566 | /** Initialization of framebuffer */ |
|
548 | int fb_init(void) |
567 | int fb_init(void) |
549 | { |
568 | { |
550 | __address fb_ph_addr; |
569 | __address fb_ph_addr; |
551 | unsigned int fb_width; |
570 | unsigned int fb_width; |
552 | unsigned int fb_height; |
571 | unsigned int fb_height; |