~ubuntu-branches/ubuntu/utopic/blender/utopic-proposed

« back to all changes in this revision

Viewing changes to source/blender/editors/space_info/textview.c

  • Committer: Package Import Robot
  • Author(s): Matthias Klose
  • Date: 2014-02-19 11:24:23 UTC
  • mfrom: (14.2.23 sid)
  • Revision ID: package-import@ubuntu.com-20140219112423-rkmaz2m7ha06d4tk
Tags: 2.69-3ubuntu1
* Merge with Debian; remaining changes:
  - Configure without OpenImageIO on armhf, as it is not available on
    Ubuntu.

Show diffs side-by-side

added added

removed removed

Lines of Context:
57
57
typedef struct ConsoleDrawContext {
58
58
        int cwidth;
59
59
        int lheight;
 
60
        int lofs; /* text vertical offset */
60
61
        int console_width; /* number of characters that fit into the width of the console (fixed width) */
61
62
        int winx;
62
63
        int ymin, ymax;
122
123
static int console_draw_string(ConsoleDrawContext *cdc, const char *str, int str_len,
123
124
                               const unsigned char fg[3], const unsigned char bg[3], const unsigned char bg_sel[4])
124
125
{
125
 
        int rct_ofs = cdc->lheight / 4;
126
126
        int tot_lines;            /* total number of lines for wrapping */
127
127
        int *offsets;             /* offsets of line beginnings for wrapping */
128
128
        int y_next;
186
186
                
187
187
                if (bg) {
188
188
                        glColor3ubv(bg);
189
 
                        glRecti(0, cdc->xy[1] - rct_ofs, cdc->winx, (cdc->xy[1] + (cdc->lheight * tot_lines)) + rct_ofs);
 
189
                        glRecti(0, cdc->xy[1], cdc->winx, (cdc->xy[1] + (cdc->lheight * tot_lines)));
190
190
                }
191
191
 
192
192
                glColor3ubv(fg);
193
193
 
194
194
                /* last part needs no clipping */
195
 
                BLF_position(mono, cdc->xy[0], cdc->xy[1], 0);
 
195
                BLF_position(mono, cdc->xy[0], cdc->lofs + cdc->xy[1], 0);
196
196
                BLF_draw_mono(mono, s, len, cdc->cwidth);
197
197
 
198
198
                if (cdc->sel[0] != cdc->sel[1]) {
208
208
                        len = offsets[i] - offsets[i - 1];
209
209
                        s = str + offsets[i - 1];
210
210
 
211
 
                        BLF_position(mono, cdc->xy[0], cdc->xy[1], 0);
 
211
                        BLF_position(mono, cdc->xy[0], cdc->lofs + cdc->xy[1], 0);
212
212
                        BLF_draw_mono(mono, s, len, cdc->cwidth);
213
213
                        
214
214
                        if (cdc->sel[0] != cdc->sel[1]) {
234
234
 
235
235
                if (bg) {
236
236
                        glColor3ubv(bg);
237
 
                        glRecti(0, cdc->xy[1] - rct_ofs, cdc->winx, cdc->xy[1] + cdc->lheight - rct_ofs);
 
237
                        glRecti(0, cdc->xy[1], cdc->winx, cdc->xy[1] + cdc->lheight);
238
238
                }
239
239
 
240
240
                glColor3ubv(fg);
241
241
 
242
 
                BLF_position(mono, cdc->xy[0], cdc->xy[1], 0);
 
242
                BLF_position(mono, cdc->xy[0], cdc->lofs + cdc->xy[1], 0);
243
243
                BLF_draw_mono(mono, str, str_len, cdc->cwidth);
244
244
                
245
245
                if (cdc->sel[0] != cdc->sel[1]) {
291
291
        cdc.cwidth = (int)BLF_fixed_width(mono);
292
292
        assert(cdc.cwidth > 0);
293
293
        cdc.lheight = tvc->lheight;
 
294
        cdc.lofs = -BLF_descender(mono);
294
295
        /* note, scroll bar must be already subtracted () */
295
296
        cdc.console_width = (tvc->winx - (CONSOLE_DRAW_MARGIN * 2) ) / cdc.cwidth;
296
297
        CLAMP(cdc.console_width, 1, INT_MAX); /* avoid divide by zero on small windows */