Undo revision 23130 which was a merge with 2.5, a messy one because I did something...
[blender.git] / source / blender / blenfont / intern / blf_font.c
index 2cd7280..432c3b5 100644 (file)
@@ -151,7 +151,7 @@ void blf_font_draw(FontBLF *font, char *str)
 
 void blf_font_buffer(FontBLF *font, char *str)
 {
-       unsigned char *data, *cbuf;
+       unsigned char *data;
        unsigned int c;
        GlyphBLF *g, *g_prev;
        FT_Vector delta;
@@ -197,27 +197,30 @@ void blf_font_buffer(FontBLF *font, char *str)
                                pen_x += delta.x >> 6;
                }
 
-               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 (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;
+                       }
+
+
                        if (g->pitch < 0)
-                               pen_y -= diff;
+                               chy= pen_y - ((int)g->pos_y);
                        else
-                               pen_y += diff;
-               }
+                               chy= pen_y + ((int)g->pos_y);
 
-               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;
@@ -248,52 +251,20 @@ void blf_font_buffer(FontBLF *font, char *str)
                                                yb--;
                                }
                        }
-               }
 
-               if (font->b_cbuf) {
-                       if (chx >= 0 && chx < font->bw && pen_y >= 0 && pen_y < font->bh) {
+                       if (diff > 0) {
                                if (g->pitch < 0)
-                                       yb= 0;
+                                       pen_x -= diff;
                                else
-                                       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--;
-                               }
+                                       pen_y += diff;
+                       }
+                       else if (diff < 0) {
+                               if (g->pitch < 0)
+                                       pen_x += diff;
+                               else
+                                       pen_y -= diff;
                        }
-               }
 
-               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;