projects
/
blender.git
/ commitdiff
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
ed76b3c
)
fix [#27221] stamp text bug in lower lines
author
Campbell Barton <ideasman42@gmail.com>
Sat, 30 Apr 2011 08:54:06 +0000
(08:54 +0000)
committer
Campbell Barton <ideasman42@gmail.com>
Sat, 30 Apr 2011 08:54:06 +0000
(08:54 +0000)
source/blender/blenfont/BLF_api.h
patch
|
blob
|
history
source/blender/blenfont/intern/blf.c
patch
|
blob
|
history
source/blender/blenfont/intern/blf_font.c
patch
|
blob
|
history
source/blender/blenfont/intern/blf_internal_types.h
patch
|
blob
|
history
diff --git
a/source/blender/blenfont/BLF_api.h
b/source/blender/blenfont/BLF_api.h
index 93b9cbc0bdf00e300102ec9aa0925c984e938a4f..44d3cf2c61bdc874253e10dbe84462a569d85f8a 100644
(file)
--- a/
source/blender/blenfont/BLF_api.h
+++ b/
source/blender/blenfont/BLF_api.h
@@
-157,7
+157,7
@@
void BLF_shadow_offset(int fontid, int x, int y);
*
* BLF_buffer(NULL, NULL, 0, 0, 0);
*/
*
* BLF_buffer(NULL, NULL, 0, 0, 0);
*/
-void BLF_buffer(int fontid, float *fbuf, unsigned char *cbuf,
unsigned int w, unsigned
int h, int nch);
+void BLF_buffer(int fontid, float *fbuf, unsigned char *cbuf,
int w,
int h, int nch);
/*
* Set the color to be used for text.
/*
* Set the color to be used for text.
diff --git
a/source/blender/blenfont/intern/blf.c
b/source/blender/blenfont/intern/blf.c
index 930f55a48fae83e08fbf4f4a1deacaca7b334ce8..5db71948024987837688670125a4a7a480d92947 100644
(file)
--- a/
source/blender/blenfont/intern/blf.c
+++ b/
source/blender/blenfont/intern/blf.c
@@
-657,7
+657,7
@@
void BLF_shadow_offset(int fontid, int x, int y)
}
}
}
}
-void BLF_buffer(int fontid, float *fbuf, unsigned char *cbuf,
unsigned int w, unsigned
int h, int nch)
+void BLF_buffer(int fontid, float *fbuf, unsigned char *cbuf,
int w,
int h, int nch)
{
FontBLF *font;
{
FontBLF *font;
diff --git
a/source/blender/blenfont/intern/blf_font.c
b/source/blender/blenfont/intern/blf_font.c
index 80d0a48954a0063fc251368a55adf74ea03ba255..708b3708ab7fbcd12b20779324098d98f95cd3f9 100644
(file)
--- a/
source/blender/blenfont/intern/blf_font.c
+++ b/
source/blender/blenfont/intern/blf_font.c
@@
-218,7
+218,7
@@
void blf_font_buffer(FontBLF *font, const char *str)
FT_Vector delta;
FT_UInt glyph_index;
float a, *fbuf;
FT_Vector delta;
FT_UInt glyph_index;
float a, *fbuf;
- int pen_x, y, x
, yb
;
+ int pen_x, y, x;
int i, has_kerning, st, chx, chy;
if (!font->glyph_cache || (!font->b_fbuf && !font->b_cbuf))
int i, has_kerning, st, chx, chy;
if (!font->glyph_cache || (!font->b_fbuf && !font->b_cbuf))
@@
-276,13
+276,20
@@
void blf_font_buffer(FontBLF *font, const char *str)
/* dont draw beyond the buffer bounds */
int width_clip= g->width;
int height_clip= g->height;
/* dont draw beyond the buffer bounds */
int width_clip= g->width;
int height_clip= g->height;
+ int yb_start= g->pitch < 0 ? 0 : g->height-1;
if (width_clip + chx > font->bw) width_clip -= chx + width_clip - font->bw;
if (height_clip + pen_y > font->bh) height_clip -= pen_y + height_clip - font->bh;
if (width_clip + chx > font->bw) width_clip -= chx + width_clip - font->bw;
if (height_clip + pen_y > font->bh) height_clip -= pen_y + height_clip - font->bh;
-
- yb= g->pitch < 0 ? 0 : g->height-1;
+ /* drawing below the image? */
+ if(pen_y < 0) {
+ yb_start += (g->pitch < 0) ? -pen_y : pen_y;
+ height_clip += pen_y;
+ pen_y= 0;
+ }
+
if (font->b_fbuf) {
if (font->b_fbuf) {
+ int yb= yb_start;
for (y=(chy >= 0 ? 0:-chy); y < height_clip; y++) {
for (x=(chx >= 0 ? 0:-chx); x < width_clip; x++) {
for (y=(chy >= 0 ? 0:-chy); y < height_clip; y++) {
for (x=(chx >= 0 ? 0:-chx); x < width_clip; x++) {
@@
-311,6
+318,7
@@
void blf_font_buffer(FontBLF *font, const char *str)
}
if (font->b_cbuf) {
}
if (font->b_cbuf) {
+ int yb= yb_start;
for (y= 0; y < height_clip; y++) {
for (x= 0; x < width_clip; x++) {
a= *(g->bitmap + x + (yb * g->pitch)) / 255.0f;
for (y= 0; y < height_clip; y++) {
for (x= 0; x < width_clip; x++) {
a= *(g->bitmap + x + (yb * g->pitch)) / 255.0f;
diff --git
a/source/blender/blenfont/intern/blf_internal_types.h
b/source/blender/blenfont/intern/blf_internal_types.h
index deb13006eafb11a9b249c8352ed27931b26bdcf7..c4e192626e870f08b56166f062c42e6dc90166b1 100644
(file)
--- a/
source/blender/blenfont/intern/blf_internal_types.h
+++ b/
source/blender/blenfont/intern/blf_internal_types.h
@@
-200,9
+200,9
@@
typedef struct FontBLF {
/* the same but unsigned char */
unsigned char *b_cbuf;
/* the same but unsigned char */
unsigned char *b_cbuf;
- /* buffer size
.
*/
-
unsigned
int bw;
-
unsigned
int bh;
+ /* buffer size
, keep signed so comparisons with negative values work
*/
+ int bw;
+ int bh;
/* number of channels. */
int bch;
/* number of channels. */
int bch;