fix building blenderplayer and a divide by zero bug with the console view.
authorCampbell Barton <ideasman42@gmail.com>
Fri, 26 Nov 2010 17:07:31 +0000 (17:07 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Fri, 26 Nov 2010 17:07:31 +0000 (17:07 +0000)
source/blender/blenfont/intern/blf.c
source/blender/editors/interface/interface_style.c
source/blender/editors/space_info/textview.c

index 360c79ed06a5a0db5098a9187ea07279ec4b14ef..eb7a89bf8408cf514d35bc9cdb3570365e81408b 100644 (file)
@@ -66,6 +66,10 @@ int global_font_default= -1;
 int global_font_points= 11;
 int global_font_dpi= 72;
 
+// XXX, should these be made into global_font_'s too?
+int blf_mono_font= -1;
+int blf_mono_font_render= -1;
+
 static FontBLF *BLF_get(int fontid)
 {
        if (fontid >= 0 && fontid < BLF_MAX_FONT)
index f7079c04a667cb3e121b943fbb26afb2a053a1ff..43f11ae421e22fe2b6f401612901fb132aeebd46 100644 (file)
@@ -264,9 +264,6 @@ void UI_DrawString(float x, float y, const char *str)
                BLF_disable(style->widget.uifont_id, BLF_KERNING_DEFAULT);
 }
 
-int blf_mono_font= -1;
-int blf_mono_font_render= -1;
-
 /* ************** init exit ************************ */
 
 /* called on each startup.blend read */
index 315130136a2cd2d49829810f2a032265bcd51f34..343130d96cedbede7c2966e5be6911772f76df2a 100644 (file)
@@ -238,6 +238,7 @@ int textview_draw(TextViewContext *tvc, int draw, int mval[2], void **mouse_pick
        assert(cdc.cwidth > 0);
        cdc.lheight= tvc->lheight;
        cdc.console_width= (tvc->winx - (CONSOLE_DRAW_SCROLL + CONSOLE_DRAW_MARGIN*2) ) / cdc.cwidth;
+       CLAMP(cdc.console_width, 1, INT_MAX); /* avoid divide by zero on small windows */
        cdc.winx= tvc->winx-(CONSOLE_DRAW_MARGIN+CONSOLE_DRAW_SCROLL);
        cdc.ymin= tvc->ymin;
        cdc.ymax= tvc->ymax;