Changeset 1772 for libcaca/trunk
- Timestamp:
- Jun 27, 2007, 3:35:59 PM (15 years ago)
- Location:
- libcaca/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
libcaca/trunk/AUTHORS
r823 r1772 14 14 - Term::Caca Perl wrapper 15 15 16 Ben Wiley Sittler <bsittler@gmail.com> 17 - numerous bugfixes and enhancements 18 16 19 */ -
libcaca/trunk/caca/driver_gl.c
r1462 r1772 2 2 * libcaca Colour ASCII-Art library 3 3 * Copyright (c) 2002-2006 Sam Hocevar <sam@zoy.org> 4 * 2006 Jean-Yves Lamoureux <jylam@lnxscene.org> 5 * 2007 Ben Wiley Sittler <bsittler@gmail.com> 4 6 * All Rights Reserved 5 7 * … … 282 284 glVertex2f(x, y); 283 285 glTexCoord2f(dp->drv.p->sw, dp->drv.p->sh); 284 glVertex2f(x + dp->drv.p->font_width , y);286 glVertex2f(x + dp->drv.p->font_width * (fullwidth ? 2 : 1), y); 285 287 glTexCoord2f(dp->drv.p->sw, 0); 286 glVertex2f(x + dp->drv.p->font_width ,288 glVertex2f(x + dp->drv.p->font_width * (fullwidth ? 2 : 1), 287 289 y + dp->drv.p->font_height); 288 290 glTexCoord2f(0, 0); … … 513 515 514 516 /* Allocate a libcucul canvas and print all the glyphs on it */ 515 cv = cucul_create_canvas( 1, b);517 cv = cucul_create_canvas(2, b); 516 518 cucul_set_color_ansi(cv, CUCUL_WHITE, CUCUL_BLACK); 517 519 … … 527 529 528 530 /* Draw the cucul canvas onto an image buffer */ 529 image = malloc(b * dp->drv.p->font_height 530 531 cucul_render_canvas(cv, dp->drv.p->f, image, dp->drv.p->font_width,532 b * dp->drv.p->font_height, 4* dp->drv.p->font_width);531 image = malloc(b * dp->drv.p->font_height * 532 2 * dp->drv.p->font_width * sizeof(uint32_t)); 533 cucul_render_canvas(cv, dp->drv.p->f, image, 2 * dp->drv.p->font_width, 534 b * dp->drv.p->font_height, 8 * dp->drv.p->font_width); 533 535 cucul_free_canvas(cv); 534 536 … … 539 541 h = dp->drv.p->font_height <= 16 ? dp->drv.p->font_height : 16; 540 542 541 for(i = 0; i < b; i++) 542 { 543 uint8_t tmp[16 * 4 * 16]; 544 uint32_t *glyph = image + (int)(i * dp->drv.p->font_width 545 * dp->drv.p->font_height); 546 memset(tmp, 0, 16 * 4 * 16); 547 548 for(y = 0; y < h; y++) 543 for(b = 0, i = 0; dp->drv.p->blocks[i + 1]; i += 2) 544 { 545 int j, n = (int)(dp->drv.p->blocks[i + 1] - dp->drv.p->blocks[i]); 546 547 for(j = 0; j < n; j++) 549 548 { 550 for(x = 0; x < w; x++) 549 uint8_t tmp[16 * 8 * 16]; 550 uint32_t *glyph = image + (int)((b + j) * dp->drv.p->font_width * 2 551 * dp->drv.p->font_height); 552 int fullwidth = 553 cucul_utf32_is_fullwidth(dp->drv.p->blocks[i] + j); 554 555 memset(tmp, 0, 16 * 8 * 16); 556 557 for(y = 0; y < h; y++) 551 558 { 552 uint32_t offset = x + (15 - y) * 16; 553 uint8_t c = glyph[x + y * (int)dp->drv.p->font_width] >> 8; 554 tmp[offset * 4] = c; 555 tmp[offset * 4 + 1] = c; 556 tmp[offset * 4 + 2] = c; 557 tmp[offset * 4 + 3] = c; 559 for(x = 0; x < w * (fullwidth ? 2 : 1); x++) 560 { 561 int offset = x + (15 - y) * (fullwidth ? 32 : 16); 562 uint8_t c = glyph[x + y * 2 * (int)dp->drv.p->font_width] 563 >> 8; 564 tmp[offset * 4] = c; 565 tmp[offset * 4 + 1] = c; 566 tmp[offset * 4 + 2] = c; 567 tmp[offset * 4 + 3] = c; 568 } 558 569 } 570 571 glGenTextures(1, (GLuint*)&dp->drv.p->txid[b + j]); 572 glBindTexture(GL_TEXTURE_2D, dp->drv.p->txid[b + j]); 573 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); 574 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); 575 glTexImage2D(GL_TEXTURE_2D, 0, 4, (fullwidth ? 32 : 16), 16, 0, 576 GL_RGBA, GL_UNSIGNED_BYTE, tmp); 559 577 } 560 578 561 glGenTextures(1, (GLuint*)&dp->drv.p->txid[i]); 562 glBindTexture(GL_TEXTURE_2D, dp->drv.p->txid[i]); 563 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); 564 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); 565 glTexImage2D(GL_TEXTURE_2D, 0, 4, 16, 16, 0, 566 GL_RGBA, GL_UNSIGNED_BYTE, tmp); 579 b += n; 567 580 } 568 581
Note: See TracChangeset
for help on using the changeset viewer.