PsppireOutputWindow: Draw the entire page instead of just the exposed area.
authorJohn Darrington <john@darrington.wattle.id.au>
Tue, 28 May 2013 17:35:01 +0000 (19:35 +0200)
committerJohn Darrington <john@darrington.wattle.id.au>
Tue, 28 May 2013 17:47:25 +0000 (19:47 +0200)
Gtk3 doesn't require (or provide the necessary information for) the drawn
widget to be cliped to the exposed area.  So this change removes the clip
from the expose callback of the PsppireOutputWindow.  It also removes some
functions which are now not necessary.

src/output/cairo.c
src/output/cairo.h
src/output/render.c
src/output/render.h
src/ui/gui/psppire-output-window.c

index 4bb601be22f4c66495e9e67a88af6b4e8fdc8ff4..abef72289cd6219f6d4b300ee2eef969da3ad72a 100644 (file)
@@ -1028,11 +1028,9 @@ xr_rendering_measure (struct xr_rendering *r, int *w, int *h)
 static void xr_draw_chart (const struct chart_item *, cairo_t *,
                     double x, double y, double width, double height);
 
-/* Draws onto CR at least the region of R that is enclosed in (X,Y)-(X+W,Y+H),
-   and possibly some additional parts. */
+/* Draws onto CR */
 void
-xr_rendering_draw (struct xr_rendering *r, cairo_t *cr,
-                   int x, int y, int w, int h)
+xr_rendering_draw_all (struct xr_rendering *r, cairo_t *cr)
 {
   if (is_table_item (r->item))
     {
@@ -1048,9 +1046,7 @@ xr_rendering_draw (struct xr_rendering *r, cairo_t *cr,
         }
 
       xr->y = r->title_height;
-      render_page_draw_region (r->page, 
-                              x * XR_POINT, (y * XR_POINT) - r->title_height,
-                               w * XR_POINT, h * XR_POINT);
+      render_page_draw (r->page);
     }
   else
     xr_draw_chart (to_chart_item (r->item), cr,
index 974acb444e5f6e191896fad3036891dfc159bb94..9a0e17a1d52bf03461d5095f1c6fe66d54db86ff 100644 (file)
@@ -41,8 +41,7 @@ struct xr_rendering *xr_rendering_create (struct xr_driver *,
 
 void xr_rendering_apply_options (struct xr_rendering *, struct string_map *o);
 void xr_rendering_measure (struct xr_rendering *, int *w, int *h);
-void xr_rendering_draw (struct xr_rendering *, cairo_t *,
-                        int x, int y, int w, int h);
+void xr_rendering_draw_all (struct xr_rendering *r, cairo_t *cr);
 
 /* Functions for rendering a series of output items to a series of Cairo
    contexts, with pagination, possibly including headers.
index 8332b85d98ecb51e1ad3849eb6072eab5ceec130..d61a39aae304ebdee23a1be2e943981381fc6ea9 100644 (file)
@@ -958,69 +958,6 @@ render_page_draw (const struct render_page *page)
   render_page_draw_cells (page, bb);
 }
 
-/* Returns the greatest value i, 0 <= i < n, such that cp[i] <= x0. */
-static int
-get_clip_min_extent (int x0, const int cp[], int n)
-{
-  int low, high, best;
-
-  low = 0;
-  high = n;
-  best = 0;
-  while (low < high)
-    {
-      int middle = low + (high - low) / 2;
-
-      if (cp[middle] <= x0)
-        {
-          best = middle;
-          low = middle + 1;
-        }
-      else
-        high = middle;
-    }
-
-  return best;
-}
-
-/* Returns the least value i, 0 <= i < n, such that cp[i + 1] >= x1. */
-static int
-get_clip_max_extent (int x1, const int cp[], int n)
-{
-  int low, high, best;
-
-  low = 0;
-  high = n;
-  best = n;
-  while (low < high)
-    {
-      int middle = low + (high - low) / 2;
-
-      if (cp[middle] >= x1)
-        best = high = middle;
-      else
-        low = middle + 1;
-    }
-
-  return best;
-}
-
-/* Renders the cells of PAGE that intersect (X,Y)-(X+W,Y+H), by calling the
-   'draw_line' and 'draw_cell' functions from the render_params provided to
-   render_page_create(). */
-void
-render_page_draw_region (const struct render_page *page,
-                         int x, int y, int w, int h)
-{
-  int bb[TABLE_N_AXES][2];
-
-  bb[H][0] = get_clip_min_extent (x, page->cp[H], page->n[H] * 2 + 1);
-  bb[H][1] = get_clip_max_extent (x + w, page->cp[H], page->n[H] * 2 + 1);
-  bb[V][0] = get_clip_min_extent (y, page->cp[V], page->n[V] * 2 + 1);
-  bb[V][1] = get_clip_max_extent (y + h, page->cp[V], page->n[V] * 2 + 1);
-
-  render_page_draw_cells (page, bb);
-}
 \f
 /* Breaking up tables to fit on a page. */
 
index 51b84a3005cf03705739266c6e68e3d357f8833b..bdcc01264f92022536d1df6a7cf4d5fd66e7dc73 100644 (file)
@@ -93,8 +93,6 @@ void render_page_unref (struct render_page *);
 
 int render_page_get_size (const struct render_page *, enum table_axis);
 void render_page_draw (const struct render_page *);
-void render_page_draw_region (const struct render_page *,
-                              int x, int y, int w, int h);
 \f
 /* An iterator for breaking render_pages into smaller chunks. */
 struct render_break
index 661d6a58633fac0a5f5c9701867f545d4f38ab78..d72179396527859a348009bbf4a11e9a35dcb47d 100644 (file)
@@ -196,13 +196,14 @@ expose_event_callback (GtkWidget *widget, GdkEventExpose *event, gpointer data)
 
   xr_rendering_apply_options (r, &viewer->render_opts);
 
-  xr_rendering_draw (r, cr, event->area.x, event->area.y,
-                     event->area.width, event->area.height);
+  xr_rendering_draw_all (r, cr);
+
   cairo_destroy (cr);
 
   return TRUE;
 }
 
+
 static void
 psppire_output_submit (struct output_driver *this,
                        const struct output_item *item)