Commit 9b7d6abd2cf522e417d441f42d3e8ae887bf35eb
1 parent
0e86747c
Exists in
master
and in
5 other branches
Separando função de desenho de caractere já preparando para a desativação da "cairo-toy"
Showing
1 changed file
with
13 additions
and
13 deletions
Show diff stats
src/pw3270/v3270/draw.c
| ... | ... | @@ -142,6 +142,13 @@ void v3270_draw_element(cairo_t *cr, unsigned char chr, unsigned short attr, H32 |
| 142 | 142 | |
| 143 | 143 | } |
| 144 | 144 | |
| 145 | +void v3270_draw_text(cairo_t *cr, const GdkRectangle *rect, guint height, const char *str) { | |
| 146 | + | |
| 147 | + cairo_move_to(cr,rect->x,rect->y+height); | |
| 148 | + cairo_show_text(cr, str); | |
| 149 | + | |
| 150 | +} | |
| 151 | + | |
| 145 | 152 | void v3270_draw_char(cairo_t *cr, unsigned char chr, unsigned short attr, H3270 *session, guint height, GdkRectangle *rect, GdkRGBA *fg, GdkRGBA *bg) |
| 146 | 153 | { |
| 147 | 154 | // Clear element area |
| ... | ... | @@ -167,7 +174,6 @@ void v3270_draw_char(cairo_t *cr, unsigned char chr, unsigned short attr, H3270 |
| 167 | 174 | cairo_scale(cr, sz, sz); |
| 168 | 175 | cairo_arc(cr, 0., 0., 1., 0., 2 * M_PI); |
| 169 | 176 | |
| 170 | - | |
| 171 | 177 | cairo_restore(cr); |
| 172 | 178 | } |
| 173 | 179 | else if(attr & LIB3270_ATTR_CG) |
| ... | ... | @@ -244,28 +250,23 @@ void v3270_draw_char(cairo_t *cr, unsigned char chr, unsigned short attr, H3270 |
| 244 | 250 | break; |
| 245 | 251 | |
| 246 | 252 | case 0x8c: // CG 0xf7, less or equal "≤" |
| 247 | - cairo_move_to(cr,rect->x,rect->y+height); | |
| 248 | - cairo_show_text(cr, "≤"); | |
| 253 | + v3270_draw_text(cr,rect,height,"≤"); | |
| 249 | 254 | break; |
| 250 | 255 | |
| 251 | 256 | case 0xae: // CG 0xd9, greater or equal "≥" |
| 252 | - cairo_move_to(cr,rect->x,rect->y+height); | |
| 253 | - cairo_show_text(cr, "≥"); | |
| 257 | + v3270_draw_text(cr,rect,height,"≥"); | |
| 254 | 258 | break; |
| 255 | 259 | |
| 256 | 260 | case 0xbe: // CG 0x3e, not equal "≠" |
| 257 | - cairo_move_to(cr,rect->x,rect->y+height); | |
| 258 | - cairo_show_text(cr, "≠"); | |
| 261 | + v3270_draw_text(cr,rect,height,"≠"); | |
| 259 | 262 | break; |
| 260 | 263 | |
| 261 | 264 | case 0xad: // "[" |
| 262 | - cairo_move_to(cr,rect->x,rect->y+height); | |
| 263 | - cairo_show_text(cr, "["); | |
| 265 | + v3270_draw_text(cr,rect,height,"["); | |
| 264 | 266 | break; |
| 265 | 267 | |
| 266 | 268 | case 0xbd: // "]" |
| 267 | - cairo_move_to(cr,rect->x,rect->y+height); | |
| 268 | - cairo_show_text(cr, "]"); | |
| 269 | + v3270_draw_text(cr,rect,height,"]"); | |
| 269 | 270 | break; |
| 270 | 271 | |
| 271 | 272 | default: |
| ... | ... | @@ -278,8 +279,7 @@ void v3270_draw_char(cairo_t *cr, unsigned char chr, unsigned short attr, H3270 |
| 278 | 279 | |
| 279 | 280 | if(utf) |
| 280 | 281 | { |
| 281 | - cairo_move_to(cr,rect->x,rect->y+height); | |
| 282 | - cairo_show_text(cr, utf); | |
| 282 | + v3270_draw_text(cr,rect,height,utf); | |
| 283 | 283 | g_free(utf); |
| 284 | 284 | } |
| 285 | 285 | } | ... | ... |