[dia] Bug 619855 - Dash length ignored when exporting (with cairo)



commit a4dc4a12ff9ed4b9980a991209349113c884f760
Author: Hans Breuer <hans breuer org>
Date:   Thu Jun 3 21:39:37 2010 +0200

    Bug 619855 - Dash length ignored when exporting (with cairo)
    
    The implementation of DiaCairoRenderer was relying on the wrong sequence of DiaRenderer::set_dashlength() and DiaRenderer::set_linestyle(). Now using the set dash-length is independent of the calling sequence (though slightly less efficient).

 plug-ins/cairo/diacairo-renderer.c |    6 ++++++
 plug-ins/cairo/diacairo.h          |    1 +
 2 files changed, 7 insertions(+), 0 deletions(-)
---
diff --git a/plug-ins/cairo/diacairo-renderer.c b/plug-ins/cairo/diacairo-renderer.c
index aa55d8c..a380b06 100644
--- a/plug-ins/cairo/diacairo-renderer.c
+++ b/plug-ins/cairo/diacairo-renderer.c
@@ -253,6 +253,8 @@ set_linestyle(DiaRenderer *self, LineStyle mode)
 
   DIAG_NOTE(g_message("set_linestyle %d", mode));
 
+  /* also stored for use in set_dashlength */
+  renderer->line_style = mode;
   /* line type */
   switch (mode) {
   case LINESTYLE_SOLID:
@@ -301,6 +303,9 @@ set_dashlength(DiaRenderer *self, real length)
    * than one device unit. But the side-effect seems to end the endless loop */
   ensure_minimum_one_device_unit(renderer, &length);
   renderer->dash_length = length;
+  /* updating the line style (potentially once more) make the real
+   * style and it's length indepndent of the calling sequence */
+  set_linestyle(self, renderer->line_style);
 }
 
 static void
@@ -985,6 +990,7 @@ dia_cairo_renderer_get_type (void)
 static void
 cairo_renderer_init (DiaCairoRenderer *renderer, void *p)
 {
+  renderer->line_style = LINESTYLE_SOLID;
   /*
    * Initialize fields where 0 init isn't good enough. Bug #151716
    * appears to show that we are sometimes called to render a line
diff --git a/plug-ins/cairo/diacairo.h b/plug-ins/cairo/diacairo.h
index 83422ee..3183b86 100644
--- a/plug-ins/cairo/diacairo.h
+++ b/plug-ins/cairo/diacairo.h
@@ -55,6 +55,7 @@ struct _DiaCairoRenderer
   cairo_surface_t *surface; /**< can be NULL to use the provived cr */
  
   double dash_length;
+  LineStyle line_style;
   DiagramData *dia;
 
   real scale;



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