Changeset 0e6e77f in mainline for uspace/srv/hid/display/window.c
- Timestamp:
- 2020-02-28T15:44:55Z (4 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- a8eed5f
- Parents:
- 2a515dcd
- git-author:
- Jiri Svoboda <jiri@…> (2020-02-26 18:26:13)
- git-committer:
- Jiri Svoboda <jiri@…> (2020-02-28 15:44:55)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/hid/display/window.c
r2a515dcd r0e6e77f 264 264 gfx_context_t *gc = NULL; 265 265 gfx_context_t *dgc; 266 gfx_rect_t rect;267 266 gfx_coord2_t dims; 268 267 gfx_bitmap_params_t bparams; … … 282 281 ds_client_add_window(client, wnd); 283 282 ds_display_add_window(client->display, wnd); 284 285 gfx_rect_points_sort(¶ms->rect, &rect);286 gfx_coord2_subtract(&rect.p1, &rect.p0, &dims);287 283 288 284 bparams.rect = params->rect; … … 298 294 goto error; 299 295 296 gfx_rect_dims(¶ms->rect, &dims); 300 297 wnd->pixelmap.width = dims.x; 301 298 wnd->pixelmap.height = dims.y; 302 299 wnd->pixelmap.data = alloc.pixels; 303 304 if (wnd->pixelmap.data == NULL) {305 rc = ENOMEM;306 goto error;307 }308 300 } 309 301 … … 323 315 } 324 316 325 /** De lete window GC.326 * 327 * @param wnd Window GC317 /** Destroy window. 318 * 319 * @param wnd Window 328 320 */ 329 321 void ds_window_destroy(ds_window_t *wnd) … … 343 335 344 336 (void) ds_display_paint(disp, NULL); 337 } 338 339 /** Resize window. 340 * 341 * @param wnd Window 342 */ 343 errno_t ds_window_resize(ds_window_t *wnd, gfx_coord2_t *offs, 344 gfx_rect_t *nrect) 345 { 346 gfx_context_t *dgc; 347 gfx_bitmap_params_t bparams; 348 gfx_bitmap_t *nbitmap; 349 pixelmap_t npixelmap; 350 gfx_coord2_t dims; 351 gfx_bitmap_alloc_t alloc; 352 gfx_coord2_t ndpos; 353 errno_t rc; 354 355 dgc = ds_display_get_gc(wnd->display); // XXX 356 if (dgc != NULL) { 357 bparams.rect = *nrect; 358 359 rc = gfx_bitmap_create(dgc, &bparams, NULL, &nbitmap); 360 if (rc != EOK) 361 return ENOMEM; 362 363 rc = gfx_bitmap_get_alloc(nbitmap, &alloc); 364 if (rc != EOK) { 365 gfx_bitmap_destroy(nbitmap); 366 return ENOMEM; 367 } 368 369 gfx_rect_dims(nrect, &dims); 370 npixelmap.width = dims.x; 371 npixelmap.height = dims.y; 372 npixelmap.data = alloc.pixels; 373 374 /* TODO: Transfer contents within overlap */ 375 376 if (wnd->bitmap != NULL) 377 gfx_bitmap_destroy(wnd->bitmap); 378 379 wnd->bitmap = nbitmap; 380 wnd->pixelmap = npixelmap; 381 } 382 383 gfx_coord2_add(&wnd->dpos, offs, &ndpos); 384 385 wnd->dpos = ndpos; 386 wnd->rect = *nrect; 387 388 (void) ds_display_paint(wnd->display, NULL); 389 return EOK; 345 390 } 346 391
Note:
See TracChangeset
for help on using the changeset viewer.