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



commit ea1a2d0cdffbaf5ced2d064c4dc79caf5b57dfa8
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 9976bd6..cd13247 100644
--- a/plug-ins/cairo/diacairo-renderer.c
+++ b/plug-ins/cairo/diacairo-renderer.c
@@ -243,6 +243,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:
@@ -291,6 +293,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
@@ -953,6 +958,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 f1af16b..88ae76e 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]