Changeset 7b882c1f in mainline for uspace/lib/guigfx/src/canvas.c
- Timestamp:
- 2019-10-21T18:23:29Z (5 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 0008c0f
- Parents:
- 1822545
- git-author:
- Jiri Svoboda <jiri@…> (2019-10-21 00:37:28)
- git-committer:
- Jiri Svoboda <jiri@…> (2019-10-21 18:23:29)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/guigfx/src/canvas.c
r1822545 r7b882c1f 188 188 canvas_gc_t *cgc = (canvas_gc_t *) arg; 189 189 canvas_gc_bitmap_t *cbm = NULL; 190 gfx_coord _t w, h;190 gfx_coord2_t dim; 191 191 errno_t rc; 192 192 … … 195 195 return ENOMEM; 196 196 197 w = params->rect.p1.x - params->rect.p0.x; 198 h = params->rect.p1.y - params->rect.p0.y; 197 gfx_coord2_subtract(¶ms->rect.p1, ¶ms->rect.p0, &dim); 199 198 cbm->rect = params->rect; 200 199 201 200 if (alloc == NULL) { 202 cbm->surface = surface_create( w, h, NULL, 0);201 cbm->surface = surface_create(dim.x, dim.y, NULL, 0); 203 202 if (cbm->surface == NULL) { 204 203 rc = ENOMEM; … … 206 205 } 207 206 208 cbm->alloc.pitch = w* sizeof(uint32_t);207 cbm->alloc.pitch = dim.x * sizeof(uint32_t); 209 208 cbm->alloc.off0 = 0; 210 209 cbm->alloc.pixels = surface_direct_access(cbm->surface); 211 210 cbm->myalloc = true; 212 211 } else { 213 cbm->surface = surface_create( w, h, alloc->pixels, 0);212 cbm->surface = surface_create(dim.x, dim.y, alloc->pixels, 0); 214 213 if (cbm->surface == NULL) { 215 214 rc = ENOMEM; … … 259 258 gfx_rect_t drect; 260 259 gfx_coord2_t offs; 260 gfx_coord2_t dim; 261 261 262 262 if (srect0 != NULL) … … 272 272 } 273 273 274 // XXX Add function to translate rectangle 275 drect.p0.x = srect.p0.x + offs.x; 276 drect.p0.y = srect.p0.y + offs.y; 277 drect.p1.x = srect.p1.x + offs.x; 278 drect.p1.y = srect.p1.y + offs.y; 274 /* Destination rectangle */ 275 gfx_rect_translate(&offs, &srect, &drect); 276 277 gfx_coord2_subtract(&drect.p1, &drect.p0, &dim); 279 278 280 279 transform_t transform; … … 293 292 294 293 drawctx_set_source(&drawctx, &source); 295 drawctx_transfer(&drawctx, drect.p0.x, drect.p0.y, 296 drect.p1.x - drect.p0.x, drect.p1.y - drect.p0.y); 294 drawctx_transfer(&drawctx, drect.p0.x, drect.p0.y, dim.x, dim.y); 297 295 298 296 update_canvas(cbm->cgc->canvas, cbm->cgc->surface);
Note:
See TracChangeset
for help on using the changeset viewer.