aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/table
diff options
context:
space:
mode:
authorBenjamin Otte <otte@redhat.com>2010-10-17 20:15:07 +0800
committerMatthew Barnes <mbarnes@redhat.com>2010-10-30 01:50:01 +0800
commit8811cd67d3643f5fcdc46ea787ccab8bfbe2cf3c (patch)
treeea7ed366b9288173e7e6cbc8cd3766cfad31f1ba /widgets/table
parent7fe898ab0f07b516b6472a78ea1583c4cf014233 (diff)
downloadgsoc2013-evolution-8811cd67d3643f5fcdc46ea787ccab8bfbe2cf3c.tar
gsoc2013-evolution-8811cd67d3643f5fcdc46ea787ccab8bfbe2cf3c.tar.gz
gsoc2013-evolution-8811cd67d3643f5fcdc46ea787ccab8bfbe2cf3c.tar.bz2
gsoc2013-evolution-8811cd67d3643f5fcdc46ea787ccab8bfbe2cf3c.tar.lz
gsoc2013-evolution-8811cd67d3643f5fcdc46ea787ccab8bfbe2cf3c.tar.xz
gsoc2013-evolution-8811cd67d3643f5fcdc46ea787ccab8bfbe2cf3c.tar.zst
gsoc2013-evolution-8811cd67d3643f5fcdc46ea787ccab8bfbe2cf3c.zip
gnome-canvas: Convert canvas item transformation matrix to cairo
Also update the GnomeCanvasItem.update vfunc to take a cairo_matrix_t and no longer pass the clip_path (what was it used for anyway?).
Diffstat (limited to 'widgets/table')
-rw-r--r--widgets/table/e-table-field-chooser-item.c34
-rw-r--r--widgets/table/e-table-header-item.c35
-rw-r--r--widgets/table/e-table-item.c63
3 files changed, 58 insertions, 74 deletions
diff --git a/widgets/table/e-table-field-chooser-item.c b/widgets/table/e-table-field-chooser-item.c
index 3c28434205..fb8f2babca 100644
--- a/widgets/table/e-table-field-chooser-item.c
+++ b/widgets/table/e-table-field-chooser-item.c
@@ -176,38 +176,34 @@ etfci_reflow (GnomeCanvasItem *item, gint flags)
static void
etfci_update (GnomeCanvasItem *item,
- gdouble *affine,
- ArtSVP *clip_path,
+ const cairo_matrix_t *i2c,
gint flags)
{
ETableFieldChooserItem *etfci = E_TABLE_FIELD_CHOOSER_ITEM (item);
- gdouble i2c[6];
- ArtPoint c1, c2, i1, i2;
+ double x1, y1, x2, y2;
if (GNOME_CANVAS_ITEM_CLASS (etfci_parent_class)->update)
GNOME_CANVAS_ITEM_CLASS (etfci_parent_class)->update (
- item, affine, clip_path, flags);
+ item, i2c, flags);
- i1.x = i1.y = 0;
- i2.x = etfci->width;
- i2.y = etfci->height;
+ x1 = y1 = 0;
+ x2 = etfci->width;
+ y2 = etfci->height;
- gnome_canvas_item_i2c_affine (item, i2c);
- art_affine_point (&c1, &i1, i2c);
- art_affine_point (&c2, &i2, i2c);
+ gnome_canvas_matrix_transform_rect (i2c, &x1, &y1, &x2, &y2);
- if (item->x1 != c1.x ||
- item->y1 != c1.y ||
- item->x2 != c2.x ||
- item->y2 != c2.y)
+ if (item->x1 != x1 ||
+ item->y1 != y1 ||
+ item->x2 != x2 ||
+ item->y2 != y2)
{
gnome_canvas_request_redraw (
item->canvas, item->x1,
item->y1, item->x2, item->y2);
- item->x1 = c1.x;
- item->y1 = c1.y;
- item->x2 = c2.x;
- item->y2 = c2.y;
+ item->x1 = x1;
+ item->y1 = y1;
+ item->x2 = x2;
+ item->y2 = y2;
/* FIXME: Group Child bounds !? */
#if 0
gnome_canvas_group_child_bounds (
diff --git a/widgets/table/e-table-header-item.c b/widgets/table/e-table-header-item.c
index cf4cc9468a..e1c6c57198 100644
--- a/widgets/table/e-table-header-item.c
+++ b/widgets/table/e-table-header-item.c
@@ -184,18 +184,15 @@ e_table_header_item_get_height (ETableHeaderItem *ethi)
static void
ethi_update (GnomeCanvasItem *item,
- gdouble *affine,
- ArtSVP *clip_path,
+ const cairo_matrix_t *i2c,
gint flags)
{
ETableHeaderItem *ethi = E_TABLE_HEADER_ITEM (item);
-
- gdouble i2c[6];
- ArtPoint c1, c2, i1, i2;
+ double x1, y1, x2, y2;
if (GNOME_CANVAS_ITEM_CLASS (ethi_parent_class)->update)
GNOME_CANVAS_ITEM_CLASS (ethi_parent_class)->update (
- item, affine, clip_path, flags);
+ item, i2c, flags);
if (ethi->sort_info)
ethi->group_indent_width =
@@ -208,27 +205,25 @@ ethi_update (GnomeCanvasItem *item,
e_table_header_total_width (ethi->eth) +
ethi->group_indent_width;
- i1.x = i1.y = 0;
- i2.x = ethi->width;
- i2.y = ethi->height;
+ x1 = y1 = 0;
+ x2 = ethi->width;
+ y2 = ethi->height;
- gnome_canvas_item_i2c_affine (item, i2c);
- art_affine_point (&c1, &i1, i2c);
- art_affine_point (&c2, &i2, i2c);
+ gnome_canvas_matrix_transform_rect (i2c, &x1, &y1, &x2, &y2);
- if (item->x1 != c1.x ||
- item->y1 != c1.y ||
- item->x2 != c2.x ||
- item->y2 != c2.y)
+ if (item->x1 != x1 ||
+ item->y1 != y1 ||
+ item->x2 != x2 ||
+ item->y2 != y2)
{
gnome_canvas_request_redraw (
item->canvas,
item->x1, item->y1,
item->x2, item->y2);
- item->x1 = c1.x;
- item->y1 = c1.y;
- item->x2 = c2.x;
- item->y2 = c2.y;
+ item->x1 = x1;
+ item->y1 = y1;
+ item->x2 = x2;
+ item->y2 = y2;
/* FIXME: Group Child bounds !? (FOO BAA) */
#if 0
gnome_canvas_group_child_bounds (GNOME_CANVAS_GROUP (item->parent), item);
diff --git a/widgets/table/e-table-item.c b/widgets/table/e-table-item.c
index b6dc6ad188..5598f45419 100644
--- a/widgets/table/e-table-item.c
+++ b/widgets/table/e-table-item.c
@@ -435,25 +435,18 @@ eti_detach_cell_views (ETableItem *eti)
static void
eti_bounds (GnomeCanvasItem *item, gdouble *x1, gdouble *y1, gdouble *x2, gdouble *y2)
{
- gdouble i2c[6];
- ArtPoint c1, c2, i1, i2;
+ cairo_matrix_t i2c;
ETableItem *eti = E_TABLE_ITEM (item);
/* Wrong BBox's are the source of redraw nightmares */
- gnome_canvas_item_i2c_affine (GNOME_CANVAS_ITEM (eti), i2c);
-
- i1.x = 0;
- i1.y = 0;
- i2.x = eti->width;
- i2.y = eti->height;
- art_affine_point (&c1, &i1, i2c);
- art_affine_point (&c2, &i2, i2c);
+ *x1 = 0;
+ *y1 = 0;
+ *x2 = eti->width;
+ *y2 = eti->height;
- *x1 = c1.x;
- *y1 = c1.y;
- *x2 = c2.x + 1;
- *y2 = c2.y + 1;
+ gnome_canvas_item_i2c_matrix (GNOME_CANVAS_ITEM (eti), &i2c);
+ gnome_canvas_matrix_transform_rect (&i2c, x1, y1, x2, y2);
}
static void
@@ -488,25 +481,25 @@ eti_reflow (GnomeCanvasItem *item, gint flags)
* GnomeCanvasItem::update method
*/
static void
-eti_update (GnomeCanvasItem *item, gdouble *affine, ArtSVP *clip_path, gint flags)
+eti_update (GnomeCanvasItem *item, const cairo_matrix_t *i2c, gint flags)
{
- ArtPoint o1, o2;
ETableItem *eti = E_TABLE_ITEM (item);
+ double x1, x2, y1, y2;
if (GNOME_CANVAS_ITEM_CLASS (eti_parent_class)->update)
- (*GNOME_CANVAS_ITEM_CLASS (eti_parent_class)->update)(item, affine, clip_path, flags);
+ (*GNOME_CANVAS_ITEM_CLASS (eti_parent_class)->update)(item, i2c, flags);
- o1.x = item->x1;
- o1.y = item->y1;
- o2.x = item->x2;
- o2.y = item->y2;
+ x1 = item->x1;
+ y1 = item->y1;
+ x2 = item->x2;
+ y2 = item->y2;
eti_bounds (item, &item->x1, &item->y1, &item->x2, &item->y2);
- if (item->x1 != o1.x ||
- item->y1 != o1.y ||
- item->x2 != o2.x ||
- item->y2 != o2.y) {
- gnome_canvas_request_redraw (item->canvas, o1.x, o1.y, o2.x, o2.y);
+ if (item->x1 != x1 ||
+ item->y1 != y1 ||
+ item->x2 != x1 ||
+ item->y2 != y1) {
+ gnome_canvas_request_redraw (item->canvas, x1, y1, x2, y2);
eti->needs_redraw = 1;
}
@@ -799,18 +792,18 @@ static void
eti_item_region_redraw (ETableItem *eti, gint x0, gint y0, gint x1, gint y1)
{
GnomeCanvasItem *item = GNOME_CANVAS_ITEM (eti);
- ArtDRect rect;
- gdouble i2c[6];
+ double dx1, dy1, dx2, dy2;
+ cairo_matrix_t i2c;
- rect.x0 = x0;
- rect.y0 = y0;
- rect.x1 = x1;
- rect.y1 = y1;
+ dx1 = x0;
+ dy1 = y0;
+ dx2 = x1;
+ dy2 = y1;
- gnome_canvas_item_i2c_affine (item, i2c);
- art_drect_affine_transform (&rect, &rect, i2c);
+ gnome_canvas_item_i2c_matrix (item, &i2c);
+ gnome_canvas_matrix_transform_rect (&i2c, &dx1, &dy1, &dx2, &dy2);
- gnome_canvas_request_redraw (item->canvas, rect.x0, rect.y0, rect.x1, rect.y1);
+ gnome_canvas_request_redraw (item->canvas, floor (dx1), floor (dy1), ceil (dx2), ceil (dy2));
}
/*