Changeset dbef30f in mainline for uspace/lib/memgfx/src/memgc.c
- Timestamp:
- 2020-06-03T16:36:35Z (4 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 978c9bc5
- Parents:
- f8375f7
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/memgfx/src/memgc.c
rf8375f7 rdbef30f 95 95 mem_gc_t *mgc = (mem_gc_t *) arg; 96 96 gfx_rect_t crect; 97 gfx_coord2_t dims;98 97 gfx_coord_t x, y; 99 98 pixelmap_t pixelmap; … … 102 101 gfx_rect_clip(rect, &mgc->rect, &crect); 103 102 104 gfx_rect_dims(&mgc->rect, &dims); 105 pixelmap.width = dims.x; 106 pixelmap.height = dims.y; 103 assert(mgc->rect.p0.x == 0); 104 assert(mgc->rect.p0.y == 0); 105 assert(mgc->alloc.pitch == mgc->rect.p1.x * (int)sizeof(uint32_t)); 106 pixelmap.width = mgc->rect.p1.x; 107 pixelmap.height = mgc->rect.p1.y; 107 108 pixelmap.data = mgc->alloc.pixels; 108 109 … … 150 151 mgc->alloc = *alloc; 151 152 152 /*153 * These are the limitations of pixelmap which we are using.154 * Rather than falling back to an ad-hoc method of pixel access155 * (which is not searchable), use pixelmap for now and switch156 * to a better, more universal method later (e.g. supporting157 * different color depths).158 */159 assert(rect->p0.x == 0);160 assert(rect->p0.y == 0);161 assert(alloc->pitch == rect->p1.x * (int)sizeof(uint32_t));162 163 153 mgc->update = update_cb; 164 154 mgc->cb_arg = cb_arg; … … 187 177 free(mgc); 188 178 return EOK; 179 } 180 181 /** Retarget memory GC to a different block of memory. 182 * 183 * @param mgc Memory GC 184 * @param rect New bounding rectangle 185 * @param alloc Allocation info of the new block 186 */ 187 void mem_gc_retarget(mem_gc_t *mgc, gfx_rect_t *rect, 188 gfx_bitmap_alloc_t *alloc) 189 { 190 mgc->rect = *rect; 191 mgc->alloc = *alloc; 189 192 } 190 193 … … 283 286 gfx_coord2_t dim; 284 287 gfx_coord_t x, y; 285 gfx_coord2_t sdims;286 gfx_coord2_t ddims;287 288 pixelmap_t smap; 288 289 pixelmap_t dmap; … … 306 307 gfx_coord2_subtract(&drect.p1, &drect.p0, &dim); 307 308 308 gfx_rect_dims(&mbm->rect, &sdims); 309 smap.width = sdims.x; 310 smap.height = sdims.y; 309 assert(mbm->rect.p0.x == 0); 310 assert(mbm->rect.p0.y == 0); 311 assert(mbm->alloc.pitch == mbm->rect.p1.x * (int)sizeof(uint32_t)); 312 smap.width = mbm->rect.p1.x; 313 smap.height = mbm->rect.p1.y; 311 314 smap.data = mbm->alloc.pixels; 312 315 313 gfx_rect_dims(&mbm->mgc->rect, &ddims); 314 dmap.width = ddims.x; 315 dmap.height = ddims.y; 316 assert(mbm->mgc->rect.p0.x == 0); 317 assert(mbm->mgc->rect.p0.y == 0); 318 assert(mbm->mgc->alloc.pitch == mbm->mgc->rect.p1.x * (int)sizeof(uint32_t)); 319 dmap.width = mbm->mgc->rect.p1.x; 320 dmap.height = mbm->mgc->rect.p1.y; 316 321 dmap.data = mbm->mgc->alloc.pixels; 317 322
Note:
See TracChangeset
for help on using the changeset viewer.