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>2010-11-26 19:33:42 +0300
committerCampbell Barton <ideasman42@gmail.com>2010-11-26 19:33:42 +0300
commitcf0820d6285c3a9379dd529ee50dcf39e2efa21c (patch)
tree08fb7672ce9f8e355ca2e99f6a52a14e3584f986 /source/blender/blenkernel
parent782d7b312ff6799258fb318e2aa5bbd64dbd2a9d (diff)
change monospace font to be an extern, not good final design but better then loading the same font 3 times.
need to load twice still because render may use the font in a thread.
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r--source/blender/blenkernel/intern/image.c24
-rw-r--r--source/blender/blenkernel/intern/image_gen.c9
2 files changed, 10 insertions, 23 deletions
diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c
index 8be52022dce..b624feeaf9d 100644
--- a/source/blender/blenkernel/intern/image.c
+++ b/source/blender/blenkernel/intern/image.c
@@ -985,29 +985,13 @@ static void stampdata(Scene *scene, StampData *stamp_data, int do_prefix)
}
}
-// XXX - Bad level call.
-extern int datatoc_bmonofont_ttf_size;
-extern char datatoc_bmonofont_ttf[];
-
-// XXX - copied from text_font_begin ! Change all the BLF_* here
-static int mono= -1;
-
-int stamp_font_begin(int size)
-{
- if (mono == -1)
- mono= BLF_load_mem_unique("monospace", (unsigned char *)datatoc_bmonofont_ttf, datatoc_bmonofont_ttf_size);
-
- BLF_aspect(mono, 1.0);
- BLF_size(mono, size, 72);
- return(mono); // XXX This is for image_gen.c!!
-}
-
void BKE_stamp_buf(Scene *scene, unsigned char *rect, float *rectf, int width, int height, int channels)
{
struct StampData stamp_data;
float w, h, pad;
int x, y;
float h_fixed;
+ const int mono= blf_mono_font_render; // XXX
if (!rect && !rectf)
return;
@@ -1018,8 +1002,10 @@ void BKE_stamp_buf(Scene *scene, unsigned char *rect, float *rectf, int width, i
if(scene->r.stamp_font_id < 8)
scene->r.stamp_font_id= 12;
- stamp_font_begin(scene->r.stamp_font_id);
-
+ /* set before return */
+ BLF_aspect(mono, 1.0);
+ BLF_size(mono, scene->r.stamp_font_id, 72);
+
BLF_buffer(mono, rectf, rect, width, height, channels);
BLF_buffer_col(mono, scene->r.fg_stamp[0], scene->r.fg_stamp[1], scene->r.fg_stamp[2], 1.0);
pad= BLF_width(mono, "--");
diff --git a/source/blender/blenkernel/intern/image_gen.c b/source/blender/blenkernel/intern/image_gen.c
index 9248ce69280..b765cf29a3d 100644
--- a/source/blender/blenkernel/intern/image_gen.c
+++ b/source/blender/blenkernel/intern/image_gen.c
@@ -298,16 +298,17 @@ static void checker_board_grid_fill(unsigned char *rect, float *rect_float, int
}
/* defined in image.c */
-extern int stamp_font_begin(int size);
static void checker_board_text(unsigned char *rect, float *rect_float, int width, int height, int step, int outline)
{
- int x, y, mono;
+ int x, y;
int pen_x, pen_y;
char text[3]= {'A', '1', '\0'};
+ const int mono= blf_mono_font;
+
+ BLF_aspect(mono, 1.0);
+ BLF_size(mono, 54, 72); /* hard coded size! */
- /* hard coded size! */
- mono= stamp_font_begin(54);
BLF_buffer(mono, rect_float, rect, width, height, 4);
for(y= 0; y < height; y+=step)