forked from AuroraMiddleware/gtk
Make sure [xy]_offset are always being initialized, fix pixbuf renderer
2006-12-03 Kristian Rietveld <kris@gtk.org> Make sure [xy]_offset are always being initialized, fix pixbuf renderer padding. (#108235, Sven Neuman). * gtk/gtkcellrendererpixbuf.c (gtk_cell_renderer_pixbuf_get_size), (gtk_cell_renderer_pixbuf_render): add padding in _render instead of _get_size. * gtk/gtkcellrendererprogress.c (gtk_cell_renderer_progress_get_size): always initialize [xy]_offset. * gtk/gtkcellrenderertext.c (gtk_cell_renderer_text_get_size): ditto. * gtk/gtkcellrenderertoggle.c (gtk_cell_renderer_toggle_get_size): ditto.
This commit is contained in:
parent
44cac29d90
commit
817d667da8
15
ChangeLog
15
ChangeLog
@ -1,3 +1,18 @@
|
||||
2006-12-03 Kristian Rietveld <kris@gtk.org>
|
||||
|
||||
Make sure [xy]_offset are always being initialized, fix pixbuf
|
||||
renderer padding. (#108235, Sven Neuman).
|
||||
|
||||
* gtk/gtkcellrendererpixbuf.c (gtk_cell_renderer_pixbuf_get_size),
|
||||
(gtk_cell_renderer_pixbuf_render): add padding in _render instead
|
||||
of _get_size.
|
||||
|
||||
* gtk/gtkcellrendererprogress.c (gtk_cell_renderer_progress_get_size):
|
||||
always initialize [xy]_offset.
|
||||
* gtk/gtkcellrenderertext.c (gtk_cell_renderer_text_get_size): ditto.
|
||||
* gtk/gtkcellrenderertoggle.c (gtk_cell_renderer_toggle_get_size):
|
||||
ditto.
|
||||
|
||||
2006-12-03 Kristian Rietveld <kris@gtk.org>
|
||||
|
||||
* gtk/gtktreeview.c (validate_visible_area): when not using an
|
||||
|
@ -548,25 +548,27 @@ gtk_cell_renderer_pixbuf_get_size (GtkCellRenderer *cell,
|
||||
calc_width = (gint) cell->xpad * 2 + pixbuf_width;
|
||||
calc_height = (gint) cell->ypad * 2 + pixbuf_height;
|
||||
|
||||
if (x_offset) *x_offset = 0;
|
||||
if (y_offset) *y_offset = 0;
|
||||
|
||||
if (cell_area && pixbuf_width > 0 && pixbuf_height > 0)
|
||||
{
|
||||
if (x_offset)
|
||||
{
|
||||
*x_offset = (((gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL) ?
|
||||
1.0 - cell->xalign : cell->xalign) *
|
||||
(cell_area->width - calc_width - 2 * cell->xpad));
|
||||
*x_offset = MAX (*x_offset, 0) + cell->xpad;
|
||||
(1.0 - cell->xalign) : cell->xalign) *
|
||||
(cell_area->width - calc_width));
|
||||
*x_offset = MAX (*x_offset, 0);
|
||||
}
|
||||
if (y_offset)
|
||||
{
|
||||
*y_offset = (cell->yalign *
|
||||
(cell_area->height - calc_height - 2 * cell->ypad));
|
||||
*y_offset = MAX (*y_offset, 0) + cell->ypad;
|
||||
(cell_area->height - calc_height));
|
||||
*y_offset = MAX (*y_offset, 0);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (x_offset) *x_offset = 0;
|
||||
if (y_offset) *y_offset = 0;
|
||||
}
|
||||
|
||||
if (width)
|
||||
*width = calc_width;
|
||||
@ -602,8 +604,8 @@ gtk_cell_renderer_pixbuf_render (GtkCellRenderer *cell,
|
||||
&pix_rect.width,
|
||||
&pix_rect.height);
|
||||
|
||||
pix_rect.x += cell_area->x;
|
||||
pix_rect.y += cell_area->y;
|
||||
pix_rect.x += cell_area->x + cell->xpad;
|
||||
pix_rect.y += cell_area->y + cell->ypad;
|
||||
pix_rect.width -= cell->xpad * 2;
|
||||
pix_rect.height -= cell->ypad * 2;
|
||||
|
||||
|
@ -319,6 +319,9 @@ gtk_cell_renderer_progress_get_size (GtkCellRenderer *cell,
|
||||
if (height)
|
||||
*height = cell_area->height;
|
||||
}
|
||||
|
||||
if (x_offset) *x_offset = 0;
|
||||
if (y_offset) *y_offset = 0;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -1585,6 +1585,11 @@ get_size (GtkCellRenderer *cell,
|
||||
*y_offset = MAX (*y_offset, 0);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (x_offset) *x_offset = 0;
|
||||
if (y_offset) *y_offset = 0;
|
||||
}
|
||||
|
||||
g_object_unref (layout);
|
||||
}
|
||||
|
@ -310,6 +310,11 @@ gtk_cell_renderer_toggle_get_size (GtkCellRenderer *cell,
|
||||
*y_offset = MAX (*y_offset, 0);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (x_offset) *x_offset = 0;
|
||||
if (y_offset) *y_offset = 0;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
|
Loading…
Reference in New Issue
Block a user