Changeset d2100e2 in mainline for uspace/lib/gfxfont/src/glyph.c
- Timestamp:
- 2020-08-09T18:40:28Z (4 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 06b8383
- Parents:
- 5592c56
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/gfxfont/src/glyph.c
r5592c56 rd2100e2 36 36 #include <assert.h> 37 37 #include <errno.h> 38 #include <gfx/bitmap.h> 38 39 #include <gfx/glyph.h> 40 #include <io/pixelmap.h> 39 41 #include <mem.h> 40 42 #include <stdlib.h> … … 252 254 } 253 255 256 /** Transfer glyph to new font bitmap. 257 * 258 * @param glyph Glyph 259 * @param offs Offset in new font bitmap 260 * @param dest New font bitmap 261 * @param drect Bounding rectangle for @a dest 262 * 263 * @return EOK on success or an error code 264 */ 265 errno_t gfx_glyph_transfer(gfx_glyph_t *glyph, gfx_coord_t offs, 266 gfx_bitmap_t *dest, gfx_rect_t *drect) 267 { 268 pixelmap_t smap; 269 pixelmap_t dmap; 270 gfx_bitmap_alloc_t salloc; 271 gfx_bitmap_alloc_t dalloc; 272 gfx_coord_t x, y; 273 pixel_t pixel; 274 errno_t rc; 275 276 rc = gfx_bitmap_get_alloc(glyph->font->bitmap, &salloc); 277 if (rc != EOK) 278 return rc; 279 280 rc = gfx_bitmap_get_alloc(dest, &dalloc); 281 if (rc != EOK) 282 return rc; 283 284 smap.width = glyph->font->rect.p1.x; 285 smap.height = glyph->font->rect.p1.y; 286 smap.data = salloc.pixels; 287 288 dmap.width = drect->p1.x; 289 dmap.height = drect->p1.y; 290 dmap.data = dalloc.pixels; 291 292 for (y = drect->p0.y; y < drect->p1.y; y++) { 293 for (x = drect->p0.x; x < drect->p1.x; x++) { 294 pixel = pixelmap_get_pixel(&smap, x, y); 295 pixelmap_put_pixel(&dmap, x + offs, y, pixel); 296 } 297 } 298 299 return EOK; 300 } 301 254 302 /** @} 255 303 */
Note:
See TracChangeset
for help on using the changeset viewer.