Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDiego Borghetti <bdiego@gmail.com>2009-08-20 22:34:14 +0400
committerDiego Borghetti <bdiego@gmail.com>2009-08-20 22:34:14 +0400
commit1772a0a62f86268f01540d4a3692c2bb4c7e6432 (patch)
tree486c02d0da5c8555bf2fd84a3ae5a224c489b443 /source/blender/blenfont
parentf6dcd9376b2d2d0e0b126f6e12a7d83d21d81783 (diff)
Add unsigned char buffer to BLF_draw_buffer and update makefiles for lzo and lzma.
I rename the original makefile of lzo (Makefile.bak) and a new one. Also four new option for user-def.mk: WITH_LZO, default true WITH_LZMA, default true NAN_LZO, default extern/lzo NAN_LZMA, default extern/lzma It's easy add support for system libs (using lzo and lzma from OS) but I don't know if it have much sense. Note that I can't test the "unsigned char" buffer because the OGL animation is not working (right ?), but is the same code that for float also the new Makefile work fine here (Linux), but maybe need some tweak on other OS.
Diffstat (limited to 'source/blender/blenfont')
-rw-r--r--source/blender/blenfont/intern/blf_font.c91
1 files changed, 60 insertions, 31 deletions
diff --git a/source/blender/blenfont/intern/blf_font.c b/source/blender/blenfont/intern/blf_font.c
index 432c3b5f854..2cd72809579 100644
--- a/source/blender/blenfont/intern/blf_font.c
+++ b/source/blender/blenfont/intern/blf_font.c
@@ -151,7 +151,7 @@ void blf_font_draw(FontBLF *font, char *str)
void blf_font_buffer(FontBLF *font, char *str)
{
- unsigned char *data;
+ unsigned char *data, *cbuf;
unsigned int c;
GlyphBLF *g, *g_prev;
FT_Vector delta;
@@ -197,30 +197,27 @@ void blf_font_buffer(FontBLF *font, char *str)
pen_x += delta.x >> 6;
}
- if (font->b_fbuf) {
- chx= pen_x + ((int)g->pos_x);
-
- diff= g->height - ((int)g->pos_y);
-
- if (diff > 0) {
- if (g->pitch < 0)
- pen_y += diff;
- else
- pen_y -= diff;
- }
- else if (diff < 0) {
- if (g->pitch < 0)
- pen_y -= diff;
- else
- pen_y += diff;
- }
-
-
+ chx= pen_x + ((int)g->pos_x);
+ diff= g->height - ((int)g->pos_y);
+ if (diff > 0) {
if (g->pitch < 0)
- chy= pen_y - ((int)g->pos_y);
+ pen_y += diff;
else
- chy= pen_y + ((int)g->pos_y);
+ pen_y -= diff;
+ }
+ else if (diff < 0) {
+ if (g->pitch < 0)
+ pen_y -= diff;
+ else
+ pen_y += diff;
+ }
+ if (g->pitch < 0)
+ chy= pen_y - ((int)g->pos_y);
+ else
+ chy= pen_y + ((int)g->pos_y);
+
+ if (font->b_fbuf) {
if (chx >= 0 && chx < font->bw && pen_y >= 0 && pen_y < font->bh) {
if (g->pitch < 0)
yb= 0;
@@ -251,20 +248,52 @@ void blf_font_buffer(FontBLF *font, char *str)
yb--;
}
}
+ }
- if (diff > 0) {
- if (g->pitch < 0)
- pen_x -= diff;
- else
- pen_y += diff;
- }
- else if (diff < 0) {
+ if (font->b_cbuf) {
+ if (chx >= 0 && chx < font->bw && pen_y >= 0 && pen_y < font->bh) {
if (g->pitch < 0)
- pen_x += diff;
+ yb= 0;
else
- pen_y -= diff;
+ yb= g->height-1;
+
+ for (y= 0; y < g->height; y++) {
+ for (x= 0; x < g->width; x++) {
+ cbuf= font->b_cbuf + font->bch * ((chx + x) + ((pen_y + y)*font->bw));
+ data= g->bitmap + x + (yb * g->pitch);
+ a= data[0];
+
+ if (a == 256) {
+ cbuf[0]= font->b_col[0];
+ cbuf[1]= font->b_col[1];
+ cbuf[2]= font->b_col[2];
+ }
+ else {
+ cbuf[0]= (font->b_col[0]*a) + (cbuf[0] * (256-a));
+ cbuf[1]= (font->b_col[1]*a) + (cbuf[1] * (256-a));
+ cbuf[2]= (font->b_col[2]*a) + (cbuf[2] * (256-a));
+ }
+ }
+
+ if (g->pitch < 0)
+ yb++;
+ else
+ yb--;
+ }
}
+ }
+ if (diff > 0) {
+ if (g->pitch < 0)
+ pen_x -= diff;
+ else
+ pen_y += diff;
+ }
+ else if (diff < 0) {
+ if (g->pitch < 0)
+ pen_x += diff;
+ else
+ pen_y -= diff;
}
pen_x += g->advance;