Subversion Repositories HelenOS-historic

Rev

Rev 1558 | Rev 1562 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1558 Rev 1559
Line 202... Line 202...
202
    unsigned int x;
202
    unsigned int x;
203
    for (x = 0; x < viewports[vp].width; x++)
203
    for (x = 0; x < viewports[vp].width; x++)
204
        putpixel(vp, x, y, viewports[vp].style.bg_color);
204
        putpixel(vp, x, y, viewports[vp].style.bg_color);
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
/** Fill viewport with background color */
228
/** Fill viewport with background color */
208
static void clear_port(int vp)
229
static void clear_port(int vp)
209
{
230
{
210
    unsigned int y;
231
    viewport_t *vport = &viewports[vp];
211
 
232
 
212
    clear_line(vp, 0);
-
 
213
    for (y = viewports[vp].y+1; y < viewports[vp].y+viewports[vp].height; y++) {
233
    draw_rectangle(vp, 0, 0, vport->width, vport->height, vport->style.bg_color);
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
    }  
-
 
218
}
234
}
219
 
235
 
220
/** Scroll port up/down
236
/** Scroll port up/down
221
 *
237
 *
222
 * @param vp Viewport to scroll
238
 * @param vp Viewport to scroll
Line 225... Line 241...
225
static void scroll_port(int vp, int rows)
241
static void scroll_port(int vp, int rows)
226
{
242
{
227
    int y;
243
    int y;
228
    int startline;
244
    int startline;
229
    int endline;
245
    int endline;
-
 
246
    viewport_t *vport = &viewports[vp];
230
   
247
   
231
    if (rows > 0) {
248
    if (rows > 0) {
232
        for (y=viewports[vp].y; y < viewports[vp].y+viewports[vp].height - rows*FONT_SCANLINES; y++)
249
        for (y=vport->y; y < vport->y+vport->height - rows*FONT_SCANLINES; y++)
233
            memcpy(&screen.fbaddress[POINTPOS(viewports[vp].x,y)],
250
            memcpy(&screen.fbaddress[POINTPOS(vport->x,y)],
234
                   &screen.fbaddress[POINTPOS(viewports[vp].x,y + rows*FONT_SCANLINES)],
251
                   &screen.fbaddress[POINTPOS(vport->x,y + rows*FONT_SCANLINES)],
235
                   screen.pixelbytes * viewports[vp].width);
252
                   screen.pixelbytes * vport->width);
236
        /* Clear last row */
-
 
237
        startline = viewports[vp].y+FONT_SCANLINES*(viewports[vp].rows-1);
253
        draw_rectangle(vp, 0, FONT_SCANLINES*(vport->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)],
254
                   vport->width, FONT_SCANLINES, vport->style.bg_color);
243
                   screen.pixelbytes * viewports[vp].width);
-
 
244
                 
-
 
245
    } else if (rows < 0) {
255
    } else if (rows < 0) {
246
        rows = -rows;
256
        rows = -rows;
247
        for (y=viewports[vp].y + viewports[vp].height-1; y >= viewports[vp].y + rows*FONT_SCANLINES; y--)
257
        for (y=vport->y + vport->height-1; y >= vport->y + rows*FONT_SCANLINES; y--)
248
            memcpy(&screen.fbaddress[POINTPOS(viewports[vp].x,y)],
258
            memcpy(&screen.fbaddress[POINTPOS(vport->x,y)],
249
                &screen.fbaddress[POINTPOS(viewports[vp].x,y - rows*FONT_SCANLINES)],
259
                &screen.fbaddress[POINTPOS(vport->x,y - rows*FONT_SCANLINES)],
250
                screen.pixelbytes * viewports[vp].width);
260
                screen.pixelbytes * vport->width);
251
        /* Clear first row */
-
 
252
        clear_line(0, viewports[vp].style.bg_color);
261
        draw_rectangle(vp, 0, 0, vport->width, FONT_SCANLINES, vport->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
    }
262
    }
258
}
263
}
259
 
264
 
260
static void invert_pixel(int vp,unsigned int x, unsigned int y)
265
static void invert_pixel(int vp,unsigned int x, unsigned int y)
261
{
266
{