Changeset 2305 for libcaca/trunk/cucul/font.c
- Timestamp:
- Apr 19, 2008, 9:25:52 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libcaca/trunk/cucul/font.c
r2303 r2305 71 71 #define DECLARE_UNPACKGLYPH(bpp) \ 72 72 static inline void \ 73 unpack_glyph ## bpp(uint8_t *glyph, uint8_t *packed_data, \ 74 unsigned int n) \ 73 unpack_glyph ## bpp(uint8_t *glyph, uint8_t *packed_data, int n) \ 75 74 { \ 76 unsignedint i; \75 int i; \ 77 76 \ 78 77 for(i = 0; i < n; i++) \ … … 112 111 * \return A font handle or NULL in case of error. 113 112 */ 114 cucul_font_t *cucul_load_font(void const *data, unsigned int size)113 cucul_font_t *cucul_load_font(void const *data, size_t size) 115 114 { 116 115 cucul_font_t *f; 117 unsignedint i;116 int i; 118 117 119 118 if(size == 0) … … 248 247 + f->header.blocks * sizeof(struct block_info), 249 248 f->header.glyphs * sizeof(struct glyph_info)); 250 for(i = 0; i < f->header.glyphs; i++)249 for(i = 0; i < (int)f->header.glyphs; i++) 251 250 { 252 251 f->glyph_list[i].width = hton16(f->glyph_list[i].width); … … 325 324 * \return The standard glyph width. 326 325 */ 327 unsignedint cucul_get_font_width(cucul_font_t const *f)326 int cucul_get_font_width(cucul_font_t const *f) 328 327 { 329 328 return f->header.width; … … 340 339 * \return The standard glyph height. 341 340 */ 342 unsignedint cucul_get_font_height(cucul_font_t const *f)341 int cucul_get_font_height(cucul_font_t const *f) 343 342 { 344 343 return f->header.height; … … 405 404 * all. They may be cropped instead in future versions. 406 405 * 407 * This function never fails. 406 * If an error occurs, -1 is returned and \b errno is set accordingly: 407 * - \c EINVAL Specified width, height or pitch is invalid. 408 408 * 409 409 * \param cv The canvas to render … … 413 413 * \param height The height (in pixels) of the image buffer 414 414 * \param pitch The pitch (in bytes) of an image buffer line. 415 * \return This function always returns 0.415 * \return 0 in case of success, -1 if an error occurred. 416 416 */ 417 417 int cucul_render_canvas(cucul_canvas_t const *cv, cucul_font_t const *f, 418 void *buf, unsigned int width, 419 unsigned int height, unsigned int pitch) 418 void *buf, int width, int height, int pitch) 420 419 { 421 420 uint8_t *glyph = NULL; 422 unsigned int x, y, xmax, ymax; 421 int x, y, xmax, ymax; 422 423 if(width < 0 || height < 0 || pitch < 0) 424 { 425 seterrno(EINVAL); 426 return -1; 427 } 423 428 424 429 if(f->header.bpp != 8) … … 440 445 { 441 446 uint8_t argb[8]; 442 unsignedint starty = y * f->header.height;443 unsignedint startx = x * f->header.width;447 int starty = y * f->header.height; 448 int startx = x * f->header.width; 444 449 uint32_t ch = cv->chars[y * cv->width + x]; 445 450 uint32_t attr = cv->attrs[y * cv->width + x]; 446 unsignedint b, i, j;451 int b, i, j; 447 452 struct glyph_info *g; 448 453
Note: See TracChangeset
for help on using the changeset viewer.