Changeset bea947f in mainline for uspace/lib/congfx/src/console.c
- Timestamp:
- 2020-05-24T17:59:02Z (5 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- b3b00b6
- Parents:
- ef20a91
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/congfx/src/console.c
ref20a91 rbea947f 129 129 console_gc_t *cgc = NULL; 130 130 gfx_context_t *gc = NULL; 131 sysarg_t rows; 132 sysarg_t cols; 131 133 errno_t rc; 132 134 … … 137 139 } 138 140 141 rc = console_get_size(con, &cols, &rows); 142 if (rc != EOK) 143 goto error; 144 139 145 rc = gfx_context_new(&console_gc_ops, cgc, &gc); 140 146 if (rc != EOK) … … 144 150 cgc->con = con; 145 151 cgc->fout = fout; 152 cgc->rect.p0.x = 0; 153 cgc->rect.p0.y = 0; 154 cgc->rect.p1.x = cols; 155 cgc->rect.p1.y = rows - 1; /* make sure we avoid bottom-right corner */ 156 146 157 *rgc = cgc; 147 158 return EOK; … … 201 212 gfx_coord2_subtract(¶ms->rect.p1, ¶ms->rect.p0, &dim); 202 213 cbm->rect = params->rect; 214 cbm->flags = params->flags; 215 cbm->key_color = params->key_color; 203 216 204 217 if (alloc == NULL) { … … 256 269 gfx_rect_t srect; 257 270 gfx_rect_t drect; 271 gfx_rect_t crect; 258 272 gfx_coord2_t offs; 259 273 … … 270 284 } 271 285 272 // XXX Add function to translate rectangle273 286 gfx_rect_translate(&offs, &srect, &drect); 287 gfx_rect_clip(&drect, &cbm->cgc->rect, &crect); 274 288 275 289 pixelmap.width = cbm->rect.p1.x - cbm->rect.p0.x; … … 277 291 pixelmap.data = cbm->alloc.pixels; 278 292 279 for (y = drect.p0.y; y < drect.p1.y; y++) { 280 console_set_pos(cbm->cgc->con, drect.p0.x, y); 281 282 for (x = drect.p0.x; x < drect.p1.x; x++) { 283 clr = pixelmap_get_pixel(&pixelmap, 284 x - offs.x - cbm->rect.p0.x, 285 y - offs.y - cbm->rect.p0.y); 286 console_set_rgb_color(cbm->cgc->con, clr, clr); 287 288 rv = fputc('X', cbm->cgc->fout); 289 if (rv < 0) 290 return EIO; 291 292 console_flush(cbm->cgc->con); 293 if ((cbm->flags & bmpf_color_key) == 0) { 294 for (y = crect.p0.y; y < crect.p1.y; y++) { 295 console_set_pos(cbm->cgc->con, crect.p0.x, y); 296 297 for (x = crect.p0.x; x < crect.p1.x; x++) { 298 clr = pixelmap_get_pixel(&pixelmap, 299 x - offs.x - cbm->rect.p0.x, 300 y - offs.y - cbm->rect.p0.y); 301 console_set_rgb_color(cbm->cgc->con, clr, clr); 302 303 rv = fputc('X', cbm->cgc->fout); 304 if (rv < 0) 305 return EIO; 306 307 console_flush(cbm->cgc->con); 308 } 309 } 310 } else { 311 for (y = crect.p0.y; y < crect.p1.y; y++) { 312 for (x = crect.p0.x; x < crect.p1.x; x++) { 313 314 clr = pixelmap_get_pixel(&pixelmap, 315 x - offs.x - cbm->rect.p0.x, 316 y - offs.y - cbm->rect.p0.y); 317 console_set_rgb_color(cbm->cgc->con, clr, clr); 318 319 if (clr != cbm->key_color) { 320 console_set_pos(cbm->cgc->con, x, y); 321 rv = fputc('X', cbm->cgc->fout); 322 if (rv < 0) 323 return EIO; 324 325 console_flush(cbm->cgc->con); 326 } 327 328 } 293 329 } 294 330 }
Note:
See TracChangeset
for help on using the changeset viewer.