removed possible undefined behavior

This commit is contained in:
vurtun 2015-05-17 15:30:11 +02:00
parent 89c9f3f7e2
commit 4a2fab0024
2 changed files with 10 additions and 11 deletions

View File

@ -411,7 +411,7 @@ while (1) {
### Tiling
Stacked windows are only one side of the coin for panel layouts while
tiled layout are the other. Tiled layout divide the screen into regions in this
a tiled layout is the other. Tiled layout divide the screen into regions in this
case the top, left, center, right and bottom region. Each region occupies a
certain percentage on the screen and can be filled with panels. The combination
of regions, ratio and multiple panels per region support a rich set of vertical,
@ -452,8 +452,7 @@ while (1) {
gui_layout_slot(&tiled, GUI_SLOT_LEFT, 1);
gui_buffer_begin(&canvas, &buffer, window_width, window_height);
gui_panel_hook_begin_tiled(&layout, &win.hook, &tiled, GUI_SLOT_LEFT, 0,
"Demo", &canvas, &input);
gui_panel_hook_begin_tiled(&layout, &win.hook, &tiled, GUI_SLOT_LEFT, 0, "Demo", &canvas, &input);
gui_panel_row(&layout, 30, 1);
if (gui_panel_button_text(&layout, "button", GUI_BUTTON_DEFAULT))
fprintf(stdout, "button pressed!\n");

16
gui.c
View File

@ -927,8 +927,8 @@ gui_buffer_push_scissor(struct gui_command_buffer *buffer, gui_float x, gui_floa
cmd->x = (gui_short)x;
cmd->y = (gui_short)y;
cmd->w = (gui_ushort)w;
cmd->h = (gui_ushort)h;
cmd->w = (gui_ushort)MAX(0, w);
cmd->h = (gui_ushort)MAX(0, h);
}
void
@ -971,8 +971,8 @@ gui_buffer_push_rect(struct gui_command_buffer *buffer, gui_float x, gui_float y
if (!cmd) return;
cmd->x = (gui_short)x;
cmd->y = (gui_short)y;
cmd->w = (gui_ushort)w;
cmd->h = (gui_ushort)h;
cmd->w = (gui_ushort)MAX(0, w);
cmd->h = (gui_ushort)MAX(0, h);
cmd->color = c;
}
@ -998,8 +998,8 @@ gui_buffer_push_circle(struct gui_command_buffer *buffer, gui_float x, gui_float
if (!cmd) return;
cmd->x = (gui_short)x;
cmd->y = (gui_short)y;
cmd->w = (gui_ushort)w;
cmd->h = (gui_ushort)h;
cmd->w = (gui_ushort)MAX(w, 0);
cmd->h = (gui_ushort)MAX(h, 0);
cmd->color = c;
}
@ -1055,8 +1055,8 @@ gui_buffer_push_image(struct gui_command_buffer *buffer, gui_float x, gui_float
if (!cmd) return;
cmd->x = (gui_short)x;
cmd->y = (gui_short)y;
cmd->w = (gui_ushort)w;
cmd->h = (gui_ushort)h;
cmd->w = (gui_ushort)MAX(0, w);
cmd->h = (gui_ushort)MAX(0, h);
cmd->img = img;
}