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:
authorBastien Montagne <montagne29@wanadoo.fr>2011-09-01 21:49:57 +0400
committerBastien Montagne <montagne29@wanadoo.fr>2011-09-01 21:49:57 +0400
commite4fd20c20c6a64678e7fe3907f795f527498414f (patch)
tree7fed9b1f23d8f59254ba7cdb022e4d7b5ba6fe0c /source/blender/blenfont
parente89046907327228fe0c8e5f554341d791e0fe0a5 (diff)
parentf940e5fdd91ef02a454cd6a509f76953a77754dd (diff)
Merging r39652 through r39842 from trunk into vgroup_modifiers.
Diffstat (limited to 'source/blender/blenfont')
-rw-r--r--source/blender/blenfont/intern/blf.c30
-rw-r--r--source/blender/blenfont/intern/blf_font.c9
2 files changed, 23 insertions, 16 deletions
diff --git a/source/blender/blenfont/intern/blf.c b/source/blender/blenfont/intern/blf.c
index c0e62b1c0c7..fc812d652b3 100644
--- a/source/blender/blenfont/intern/blf.c
+++ b/source/blender/blenfont/intern/blf.c
@@ -369,28 +369,28 @@ void BLF_position(int fontid, float x, float y, float z)
za= 1.0f;
}
- remainder= x - floor(x);
- if (remainder > 0.4 && remainder < 0.6) {
- if (remainder < 0.5)
- x -= 0.1 * xa;
+ remainder= x - floorf(x);
+ if (remainder > 0.4f && remainder < 0.6f) {
+ if (remainder < 0.5f)
+ x -= 0.1f * xa;
else
- x += 0.1 * xa;
+ x += 0.1f * xa;
}
- remainder= y - floor(y);
- if (remainder > 0.4 && remainder < 0.6) {
- if (remainder < 0.5)
- y -= 0.1 * ya;
+ remainder= y - floorf(y);
+ if (remainder > 0.4f && remainder < 0.6f) {
+ if (remainder < 0.5f)
+ y -= 0.1f * ya;
else
- y += 0.1 * ya;
+ y += 0.1f * ya;
}
- remainder= z - floor(z);
- if (remainder > 0.4 && remainder < 0.6) {
- if (remainder < 0.5)
- z -= 0.1 * za;
+ remainder= z - floorf(z);
+ if (remainder > 0.4f && remainder < 0.6f) {
+ if (remainder < 0.5f)
+ z -= 0.1f * za;
else
- z += 0.1 * za;
+ z += 0.1f * za;
}
font->pos[0]= x;
diff --git a/source/blender/blenfont/intern/blf_font.c b/source/blender/blenfont/intern/blf_font.c
index 708b3708ab7..fb6505fe935 100644
--- a/source/blender/blenfont/intern/blf_font.c
+++ b/source/blender/blenfont/intern/blf_font.c
@@ -213,7 +213,7 @@ void blf_font_buffer(FontBLF *font, const char *str)
{
unsigned char *cbuf;
unsigned int c;
- unsigned char b_col_char[3];
+ unsigned char b_col_char[4];
GlyphBLF *g, *g_prev;
FT_Vector delta;
FT_UInt glyph_index;
@@ -232,6 +232,7 @@ void blf_font_buffer(FontBLF *font, const char *str)
b_col_char[0]= font->b_col[0] * 255;
b_col_char[1]= font->b_col[1] * 255;
b_col_char[2]= font->b_col[2] * 255;
+ b_col_char[3]= font->b_col[3] * 255;
while (str[i]) {
int pen_y;
@@ -296,16 +297,19 @@ void blf_font_buffer(FontBLF *font, const char *str)
a= *(g->bitmap + x + (yb * g->pitch)) / 255.0f;
if(a > 0.0f) {
+ float alphatest;
fbuf= font->b_fbuf + font->bch * ((chx + x) + ((pen_y + y)*font->bw));
if (a >= 1.0f) {
fbuf[0]= font->b_col[0];
fbuf[1]= font->b_col[1];
fbuf[2]= font->b_col[2];
+ fbuf[3]= (alphatest= (fbuf[3] + (font->b_col[3]))) < 1.0f ? alphatest : 1.0f;
}
else {
fbuf[0]= (font->b_col[0]*a) + (fbuf[0] * (1-a));
fbuf[1]= (font->b_col[1]*a) + (fbuf[1] * (1-a));
fbuf[2]= (font->b_col[2]*a) + (fbuf[2] * (1-a));
+ fbuf[3]= (alphatest= (fbuf[3] + (font->b_col[3]*a))) < 1.0f ? alphatest : 1.0f;
}
}
}
@@ -324,16 +328,19 @@ void blf_font_buffer(FontBLF *font, const char *str)
a= *(g->bitmap + x + (yb * g->pitch)) / 255.0f;
if(a > 0.0f) {
+ int alphatest;
cbuf= font->b_cbuf + font->bch * ((chx + x) + ((pen_y + y)*font->bw));
if (a >= 1.0f) {
cbuf[0]= b_col_char[0];
cbuf[1]= b_col_char[1];
cbuf[2]= b_col_char[2];
+ cbuf[3]= (alphatest= ((int)cbuf[3] + (int)b_col_char[3])) < 255 ? alphatest : 255;
}
else {
cbuf[0]= (b_col_char[0]*a) + (cbuf[0] * (1-a));
cbuf[1]= (b_col_char[1]*a) + (cbuf[1] * (1-a));
cbuf[2]= (b_col_char[2]*a) + (cbuf[2] * (1-a));
+ cbuf[3]= (alphatest= ((int)cbuf[3] + (int)((font->b_col[3]*a)*255.0f))) < 255 ? alphatest : 255;
}
}
}