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

Changeset 7470d97 in mainline for uspace/lib/memgfx/src/memgc.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/memgfx/src/memgc.c

    r252d03c r7470d97  
    4848#include "../private/memgc.h"
    4949
     50static errno_t mem_gc_set_clip_rect(void *, gfx_rect_t *);
    5051static errno_t mem_gc_set_color(void *, gfx_color_t *);
    5152static errno_t mem_gc_fill_rect(void *, gfx_rect_t *);
     
    5960
    6061gfx_context_ops_t mem_gc_ops = {
     62        .set_clip_rect = mem_gc_set_clip_rect,
    6163        .set_color = mem_gc_set_color,
    6264        .fill_rect = mem_gc_fill_rect,
     
    6870};
    6971
     72/** Set clipping rectangle on memory GC.
     73 *
     74 * @param arg Memory GC
     75 * @param rect Rectangle
     76 *
     77 * @return EOK on success or an error code
     78 */
     79static errno_t mem_gc_set_clip_rect(void *arg, gfx_rect_t *rect)
     80{
     81        mem_gc_t *mgc = (mem_gc_t *) arg;
     82
     83        if (rect != NULL)
     84                gfx_rect_clip(rect, &mgc->rect, &mgc->clip_rect);
     85        else
     86                mgc->clip_rect = mgc->rect;
     87
     88        return EOK;
     89}
     90
    7091/** Set color on memory GC.
    7192 *
     
    102123
    103124        /* Make sure we have a sorted, clipped rectangle */
    104         gfx_rect_clip(rect, &mgc->rect, &crect);
     125        gfx_rect_clip(rect, &mgc->clip_rect, &crect);
    105126
    106127        assert(mgc->rect.p0.x == 0);
     
    167188        mgc->gc = gc;
    168189        mgc->rect = *rect;
     190        mgc->clip_rect = *rect;
    169191        mgc->alloc = *alloc;
    170192
     
    208230{
    209231        mgc->rect = *rect;
     232        mgc->clip_rect = *rect;
    210233        mgc->alloc = *alloc;
    211234}
     
    370393        gfx_rect_translate(&offs, &srect, &drect);
    371394
     395        /* XXX Clip destination rectangle?! */
     396
    372397        assert(mbm->alloc.pitch == (mbm->rect.p1.x - mbm->rect.p0.x) *
    373398            (int)sizeof(uint32_t));
Note: See TracChangeset for help on using the changeset viewer.