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:
authorCampbell Barton <ideasman42@gmail.com>2011-08-31 05:05:40 +0400
committerCampbell Barton <ideasman42@gmail.com>2011-08-31 05:05:40 +0400
commit79249f8aede5c5481c625335b5ef7bd9b4cf28cc (patch)
tree086a359a188266ebf6ca0bda3ffa97b36e739ce3 /source/blender/blenfont
parent2457c2134aaef5faec561757ecb1d4afbd1dabcd (diff)
fix [#28430] Image with Stampinfo does not get saved correctly with alpha
Diffstat (limited to 'source/blender/blenfont')
-rw-r--r--source/blender/blenfont/intern/blf_font.c9
1 files changed, 8 insertions, 1 deletions
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;
}
}
}