[pango] [pango-view] Don't clear the background for vector



commit 4eb4cf81312691516c2129f04f245401b5566235
Author: Behdad Esfahbod <behdad behdad org>
Date:   Sun Mar 15 15:50:13 2009 -0400

    [pango-view] Don't clear the background for vector output
---
 pango-view/viewer-cairo.c      |   28 ++++++++++++++++++++++++----
 pango-view/viewer-pangocairo.c |    3 ---
 2 files changed, 24 insertions(+), 7 deletions(-)

diff --git a/pango-view/viewer-cairo.c b/pango-view/viewer-cairo.c
index f50ddb5..5ecfb96 100644
--- a/pango-view/viewer-cairo.c
+++ b/pango-view/viewer-cairo.c
@@ -39,12 +39,22 @@ cairo_x_view_iface_create_surface (gpointer instance,
 				   int      width,
 				   int      height)
 {
+  cairo_t *cr;
+  cairo_surface_t *cairo_surface;
+
   XViewer *x = (XViewer *)instance;
   Drawable drawable = (Drawable) surface;
 
-  return cairo_xlib_surface_create (x->display, drawable,
-				    DefaultVisual (x->display, x->screen),
-				    width, height);
+  cairo_surface = cairo_xlib_surface_create (x->display, drawable,
+					     DefaultVisual (x->display, x->screen),
+					     width, height);
+
+  cr = cairo_create (cairo_surface);
+  cairo_set_source_rgb (cr, 1.0, 1.0, 1.0);
+  cairo_paint (cr);
+  cairo_destroy (cr);
+
+  return cairo_surface;
 }
 
 static CairoViewerIface cairo_x_viewer_iface = {
@@ -83,8 +93,18 @@ cairo_image_view_create_surface (gpointer instance,
 				 int      width,
 				 int      height)
 {
+  cairo_t *cr;
+  cairo_surface_t *surface;
+
   /* TODO: Be smarter about format? */
-  return cairo_image_surface_create (CAIRO_FORMAT_ARGB32, width, height);
+  surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, width, height);
+
+  cr = cairo_create (surface);
+  cairo_set_source_rgb (cr, 1.0, 1.0, 1.0);
+  cairo_paint (cr);
+  cairo_destroy (cr);
+
+  return surface;
 }
 
 static void
diff --git a/pango-view/viewer-pangocairo.c b/pango-view/viewer-pangocairo.c
index a477074..9631c05 100644
--- a/pango-view/viewer-pangocairo.c
+++ b/pango-view/viewer-pangocairo.c
@@ -318,9 +318,6 @@ pangocairo_view_render (gpointer      instance G_GNUC_UNUSED,
 
   transform_callback (context, NULL, cr, state);
 
-  cairo_set_source_rgb (cr, 1.0, 1.0, 1.0);
-  cairo_paint (cr);
-
   cairo_set_source_rgb (cr, 0.0, 0.0, 0.0);
   do_output (context, render_callback, transform_callback, cr, state, width, height);
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]