Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset 7470d97 in mainline for uspace/lib/congfx/src/console.c


Ignore:
Timestamp:
2021-04-30T15:05:06Z (7 months ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
master
Children:
051349b
Parents:
252d03c
Message:

Add GC operation to set clipping rectangle

The number of changed files is due to the proliferation of GC
implementations, mostly these are just dummies in unit tests.
Definitely need to tame those in the future.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/congfx/src/console.c

    r252d03c r7470d97  
    4848#include "../private/color.h"
    4949
     50static errno_t console_gc_set_clip_rect(void *, gfx_rect_t *);
    5051static errno_t console_gc_set_color(void *, gfx_color_t *);
    5152static errno_t console_gc_fill_rect(void *, gfx_rect_t *);
     
    5859
    5960gfx_context_ops_t console_gc_ops = {
     61        .set_clip_rect = console_gc_set_clip_rect,
    6062        .set_color = console_gc_set_color,
    6163        .fill_rect = console_gc_fill_rect,
     
    6769};
    6870
     71/** Set clipping rectangle on console GC.
     72 *
     73 * @param arg Console GC
     74 * @param rect Rectangle
     75 *
     76 * @return EOK on success or an error code
     77 */
     78static errno_t console_gc_set_clip_rect(void *arg, gfx_rect_t *rect)
     79{
     80        console_gc_t *cgc = (console_gc_t *) arg;
     81
     82        if (rect != NULL)
     83                gfx_rect_clip(rect, &cgc->rect, &cgc->clip_rect);
     84        else
     85                cgc->clip_rect = cgc->rect;
     86
     87        return EOK;
     88}
     89
    6990/** Set color on console GC.
    7091 *
     
    100121
    101122        /* Make sure rectangle is clipped and sorted */
    102         gfx_rect_clip(rect, &cgc->rect, &crect);
     123        gfx_rect_clip(rect, &cgc->clip_rect, &crect);
    103124
    104125        cols = cgc->rect.p1.x - cgc->rect.p0.x;
     
    188209        cgc->rect.p1.x = cols;
    189210        cgc->rect.p1.y = rows;
     211        cgc->clip_rect = cgc->rect;
    190212        cgc->buf = buf;
    191213
     
    330352
    331353        gfx_rect_translate(&offs, &srect, &drect);
    332         gfx_rect_clip(&drect, &cbm->cgc->rect, &crect);
     354        gfx_rect_clip(&drect, &cbm->cgc->clip_rect, &crect);
    333355
    334356        pixelmap.width = cbm->rect.p1.x - cbm->rect.p0.x;
Note: See TracChangeset for help on using the changeset viewer.