diff options
| author | ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> | 2022-03-31 10:35:50 +0200 |
|---|---|---|
| committer | ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> | 2022-03-31 10:36:01 +0200 |
| commit | d9a6ec88e47b9c3c7993018f4f2be13d55b8fca2 (patch) | |
| tree | f0c68938623020dd949369f944b7469a9101c28e /src/drivers/Wayland | |
| parent | a638f5a545817365897bc7892999b74d3ef83e34 (diff) | |
Add support of Fl_Region to the Cairo graphics driver
and remove it from the Wayland graphics driver.
Diffstat (limited to 'src/drivers/Wayland')
| -rw-r--r-- | src/drivers/Wayland/Fl_Wayland_Graphics_Driver.H | 4 | ||||
| -rw-r--r-- | src/drivers/Wayland/Fl_Wayland_Graphics_Driver.cxx | 50 |
2 files changed, 0 insertions, 54 deletions
diff --git a/src/drivers/Wayland/Fl_Wayland_Graphics_Driver.H b/src/drivers/Wayland/Fl_Wayland_Graphics_Driver.H index 379db286f..c2d5f9554 100644 --- a/src/drivers/Wayland/Fl_Wayland_Graphics_Driver.H +++ b/src/drivers/Wayland/Fl_Wayland_Graphics_Driver.H @@ -77,10 +77,6 @@ public: Fl_Wayland_Graphics_Driver(); static const uint32_t wld_format; void activate(struct fl_wld_buffer *buffer, float scale); - void clip_region(Fl_Region r); - Fl_Region XRectangleRegion(int x, int y, int w, int h); - void add_rectangle_to_region(Fl_Region r, int X, int Y, int W, int H); - void XDestroyRegion(Fl_Region r); void set_color(Fl_Color i, unsigned c); void copy_offscreen(int x, int y, int w, int h, Fl_Offscreen osrc, int srcx, int srcy); static struct fl_wld_buffer *create_shm_buffer(int width, int height); diff --git a/src/drivers/Wayland/Fl_Wayland_Graphics_Driver.cxx b/src/drivers/Wayland/Fl_Wayland_Graphics_Driver.cxx index d0ef19724..c593a207b 100644 --- a/src/drivers/Wayland/Fl_Wayland_Graphics_Driver.cxx +++ b/src/drivers/Wayland/Fl_Wayland_Graphics_Driver.cxx @@ -177,56 +177,6 @@ void Fl_Wayland_Graphics_Driver::activate(struct fl_wld_buffer *buffer, float sc } -void Fl_Wayland_Graphics_Driver::clip_region(Fl_Region r) { - if (cairo_) { - cairo_reset_clip(cairo_); - if (r) { - for (int i = 0; i < r->count; i++) { - cairo_rectangle(cairo_, r->rects[i].x-0.5 , r->rects[i].y-0.5 , r->rects[i].width , r->rects[i].height); - } - cairo_clip(cairo_); - } - } -} - - -Fl_Region Fl_Wayland_Graphics_Driver::XRectangleRegion(int x, int y, int w, int h) { - Fl_Region R = (Fl_Region)malloc(sizeof(*R)); - R->count = 1; - R->rects = (cairo_rectangle_t *)malloc(sizeof(cairo_rectangle_t)); - R->rects->x=x, R->rects->y=y, R->rects->width=w; R->rects->height=h; - return R; -} - - -// r1 ⊂ r2 -static bool CairoRectContainsRect(cairo_rectangle_t *r1, cairo_rectangle_t *r2) { - return r1->x >= r2->x && r1->y >= r2->y && r1->x+r1->width <= r2->x+r2->width && - r1->y+r1->height <= r2->y+r2->height; -} - - -void Fl_Wayland_Graphics_Driver::add_rectangle_to_region(Fl_Region r, int X, int Y, int W, int H) { - cairo_rectangle_t arg = {double(X), double(Y), double(W), double(H)}; - int j; // don't add a rectangle totally inside the Fl_Region - for (j = 0; j < r->count; j++) { - if (CairoRectContainsRect(&arg, &(r->rects[j]))) break; - } - if (j >= r->count) { - r->rects = (cairo_rectangle_t*)realloc(r->rects, (++(r->count)) * sizeof(cairo_rectangle_t)); - r->rects[r->count - 1] = arg; - } -} - - -void Fl_Wayland_Graphics_Driver::XDestroyRegion(Fl_Region r) { - if (r) { - free(r->rects); - free(r); - } -} - - void Fl_Wayland_Graphics_Driver::set_color(Fl_Color i, unsigned c) { if (fl_cmap[i] != c) { fl_cmap[i] = c; |
