[dia/cairo-port: 150/165] Make cairo a hard dep (It's already pulled in by Pango anyway)



commit 26ced4989c9b08c4651a1f12373ac189285d34a5
Author: Zander Brown <zbrown gnome org>
Date:   Thu Dec 6 14:58:47 2018 +0000

    Make cairo a hard dep (It's already pulled in by Pango anyway)

 app/app_procs.c                    | 10 -------
 app/toolbox.c                      |  2 --
 lib/Doxyfile                       |  2 --
 objects/standard/outline.c         | 11 --------
 objects/standard/standard.c        |  2 --
 plug-ins/cairo/diacairo-renderer.c | 56 +-------------------------------------
 plug-ins/cairo/diacairo.c          | 20 +-------------
 7 files changed, 2 insertions(+), 101 deletions(-)
---
diff --git a/app/app_procs.c b/app/app_procs.c
index aab2a590..49dc6517 100644
--- a/app/app_procs.c
+++ b/app/app_procs.c
@@ -369,15 +369,11 @@ dump_dependencies(void)
 #ifdef G_THREADS_ENABLED
   "threads "
 #endif
-#ifdef HAVE_CAIRO
   "cairo "
-#endif
 #ifdef HAVE_LIBART
   "libart "
 #endif
-#ifdef HAVE_PANGOCAIRO
   "pangocairo "
-#endif
   "\n");
 
   /* print out all those dependies, both compile and runtime if possible 
@@ -437,13 +433,7 @@ dump_dependencies(void)
 #else
   g_print ("pango   : version not available (>= 1.14.x)\n"); /* Pango did not provide such */
 #endif
-#if HAVE_CAIRO
-#  ifdef CAIRO_VERSION_STRING
   g_print ("cairo   : %s (%s)\n", cairo_version_string(), CAIRO_VERSION_STRING);
-#  else
-  g_print ("cairo   : %s (%d.%d.%d)\n", cairo_version_string(), CAIRO_VERSION_MAJOR, CAIRO_VERSION_MINOR, 
CAIRO_VERSION_MICRO);
-#  endif
-#endif
 #if 0
   {
     gchar  linkedname[1024];
diff --git a/app/toolbox.c b/app/toolbox.c
index 8fdb424e..25e21e90 100644
--- a/app/toolbox.c
+++ b/app/toolbox.c
@@ -159,14 +159,12 @@ ToolButton tool_data[] =
     "I",
     "ToolsImage",
     { CREATE_OBJECT_TOOL, "Standard - Image", NULL }
-#ifdef HAVE_CAIRO
   },
   { NULL,
     N_("Outline"),
     NULL,
     "ToolsOutline",
     { CREATE_OBJECT_TOOL, "Standard - Outline", NULL }
-#endif
   }
 };
 
diff --git a/lib/Doxyfile b/lib/Doxyfile
index 961b5ad1..859afa32 100644
--- a/lib/Doxyfile
+++ b/lib/Doxyfile
@@ -16,8 +16,6 @@ INPUT                  = ../lib ../objects/standard ../objects/custom \
                        ../plug-ins/wpg ../plug-ins/drs
 #STRIP_FROM_PATH        = ../
 FILE_PATTERNS          = *.c *.h *.dox *.py *.cpp
-# define HAVE_CAIRO to get the Outline dox
-PREDEFINED             = HAVE_CAIRO
 REFERENCES_RELATION    = NO
 VERBATIM_HEADERS       = NO
 GENERATE_LATEX         = NO
diff --git a/objects/standard/outline.c b/objects/standard/outline.c
index 1cb5541a..deaaebac 100644
--- a/objects/standard/outline.c
+++ b/objects/standard/outline.c
@@ -37,12 +37,8 @@
 
 #include "tool-icons.h"
 
-#ifdef HAVE_CAIRO
 #include <cairo.h>
-
-#ifdef CAIRO_HAS_SVG_SURFACE 
 #include <cairo-svg.h>
-#endif
 
 #define NUM_HANDLES 2
 
@@ -277,12 +273,7 @@ outline_update_data (Outline *outline)
     cairo_path_destroy (outline->path);
   outline->path = NULL;
   /* surface will not be used to render anything, it is just to create the cairo context */
-#ifdef CAIRO_HAS_SVG_SURFACE
   surface = cairo_svg_surface_create_for_stream (write_nul, NULL, 100, 100);
-#else
-  /* if only I could remember why I have choosen the svg surface in the first place */
-  surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, 100, 100);
-#endif
   cr = cairo_create (surface);
   cairo_surface_destroy (surface); /* in fact: unref() */
   style = dia_font_get_style (outline->font);
@@ -554,5 +545,3 @@ outline_select (Outline *outline, Point *clicked_point,
 {
   outline_update_handles (outline);
 }
-
-#endif /* HAVE_CAIRO */
diff --git a/objects/standard/standard.c b/objects/standard/standard.c
index 837cd9e7..4d1e5c1b 100644
--- a/objects/standard/standard.c
+++ b/objects/standard/standard.c
@@ -68,9 +68,7 @@ dia_plugin_init(PluginInfo *info)
   object_register_type(_bezierline_type);
   object_register_type(_textobj_type);
   object_register_type(_image_type);
-#ifdef HAVE_CAIRO
   object_register_type(_outline_type);
-#endif
   object_register_type(_polygon_type);
   object_register_type(_beziergon_type);
 
diff --git a/plug-ins/cairo/diacairo-renderer.c b/plug-ins/cairo/diacairo-renderer.c
index ea22235e..1c5c0144 100644
--- a/plug-ins/cairo/diacairo-renderer.c
+++ b/plug-ins/cairo/diacairo-renderer.c
@@ -30,24 +30,18 @@
 #include <glib.h>
 #include <glib/gstdio.h>
 
-#ifdef HAVE_PANGOCAIRO_H
 #include <pango/pangocairo.h>
-#endif
 
 #include <cairo.h>
 /* some backend headers, win32 missing in official Cairo */
-#ifdef CAIRO_HAS_PNG_SURFACE_FEATURE
 #include <cairo-png.h>
-#endif
+#include <cairo-svg.h>
 #ifdef  CAIRO_HAS_PS_SURFACE
 #include <cairo-ps.h>
 #endif
 #ifdef  CAIRO_HAS_PDF_SURFACE
 #include <cairo-pdf.h>
 #endif
-#ifdef CAIRO_HAS_SVG_SURFACE
-#include <cairo-svg.h>
-#endif
 
 #include "intl.h"
 #include "message.h"
@@ -149,10 +143,8 @@ begin_render(DiaRenderer *self, const Rectangle *update)
                              background.blue,
                              1.0);
     }
-#ifdef HAVE_PANGOCAIRO_H
   if (!renderer->layout)
     renderer->layout = pango_cairo_create_layout (renderer->cr);
-#endif
 
   cairo_set_fill_rule (renderer->cr, CAIRO_FILL_RULE_EVEN_ODD);
 
@@ -520,26 +512,10 @@ set_font(DiaRenderer *self, DiaFont *font, real height)
   PangoFontDescription *pfd = pango_font_description_copy (dia_font_get_description (font));
   DIAG_NOTE(g_message("set_font %f %s", height, dia_font_get_family(font)));
 
-#ifdef HAVE_PANGOCAIRO_H
   /* select font and size */
   pango_font_description_set_absolute_size (pfd, (int)(size * FONT_SIZE_TWEAK * PANGO_SCALE));
   pango_layout_set_font_description (renderer->layout, pfd);
   pango_font_description_free (pfd);
-#else
-  if (renderer->cr) {
-    DiaFontStyle style = dia_font_get_style (font);
-    const char *family_name = dia_font_get_family(font);
-
-    cairo_select_font_face (
-        renderer->cr,
-        family_name,
-        DIA_FONT_STYLE_GET_SLANT(style) == DIA_FONT_NORMAL ? CAIRO_FONT_SLANT_NORMAL : 
CAIRO_FONT_SLANT_ITALIC,
-        DIA_FONT_STYLE_GET_WEIGHT(style) < DIA_FONT_MEDIUM ? CAIRO_FONT_WEIGHT_NORMAL : 
CAIRO_FONT_WEIGHT_BOLD); 
-    cairo_set_font_size (renderer->cr, size);
-
-    DIAG_STATE(renderer->cr)
-  }
-#endif
 
   /* for the interactive case we must maintain the font field in the base class */
   if (self->is_interactive) {
@@ -893,7 +869,6 @@ draw_string(DiaRenderer *self,
   if (len < 1) return; /* shouldn't this be handled by Dia's core ? */
 
   cairo_set_source_rgba (renderer->cr, color->red, color->green, color->blue, color->alpha);
-#ifdef HAVE_PANGOCAIRO_H
   cairo_save (renderer->cr);
   /* alignment calculation done by pangocairo? */
   pango_layout_set_alignment (renderer->layout, alignment == ALIGN_CENTER ? PANGO_ALIGN_CENTER :
@@ -920,33 +895,6 @@ draw_string(DiaRenderer *self,
   pango_cairo_show_layout (renderer->cr, renderer->layout);
   /* restoring the previous scale */
   cairo_restore (renderer->cr);
-#else
-  /* using the 'toy API' */
-  {
-    cairo_text_extents_t extents;
-    double x = 0, y = 0;
-    cairo_set_source_rgba (renderer->cr, color->red, color->green, color->blue, color->alpha);
-    cairo_text_extents (renderer->cr,
-                        text,
-                        &extents);
-
-    y = pos->y; /* ?? */
-
-    switch (alignment) {
-    case ALIGN_LEFT:
-      x = pos->x;
-      break;
-    case ALIGN_CENTER:
-      x = pos->x - extents.width / 2 + +extents.x_bearing;
-      break;
-    case ALIGN_RIGHT:
-      x = pos->x - extents.width + extents.x_bearing;
-      break;
-    }
-    cairo_move_to (renderer->cr, x, y);
-    cairo_show_text (renderer->cr, text);
-  }
-#endif
 
   DIAG_STATE(renderer->cr)
 }
@@ -1239,10 +1187,8 @@ cairo_renderer_finalize (GObject *object)
   cairo_destroy (renderer->cr);
   if (renderer->surface)
     cairo_surface_destroy (renderer->surface);
-#ifdef HAVE_PANGOCAIRO_H
   if (renderer->layout)
     g_object_unref (renderer->layout);  
-#endif
 
   G_OBJECT_CLASS (parent_class)->finalize (object);
 }
diff --git a/plug-ins/cairo/diacairo.c b/plug-ins/cairo/diacairo.c
index 6e9aa442..90941da3 100644
--- a/plug-ins/cairo/diacairo.c
+++ b/plug-ins/cairo/diacairo.c
@@ -32,18 +32,14 @@
 
 #include <cairo.h>
 /* some backend headers, win32 missing in official Cairo */
-#ifdef CAIRO_HAS_PNG_SURFACE_FEATURE
 #include <cairo-png.h>
-#endif
+#include <cairo-svg.h>
 #ifdef  CAIRO_HAS_PS_SURFACE
 #include <cairo-ps.h>
 #endif
 #ifdef  CAIRO_HAS_PDF_SURFACE
 #include <cairo-pdf.h>
 #endif
-#ifdef CAIRO_HAS_SVG_SURFACE
-#include <cairo-svg.h>
-#endif
 #ifdef CAIRO_HAS_WIN32_SURFACE
 #include <cairo-win32.h>
 /* avoid namespace collisions */
@@ -53,9 +49,7 @@
 #include <cairo-script.h>
 #endif
 
-#ifdef HAVE_PANGOCAIRO_H
 #include <pango/pangocairo.h>
-#endif
 
 #include "intl.h"
 #include "geometry.h"
@@ -177,7 +171,6 @@ export_data(DiagramData *data, DiaContext *ctx,
 #undef DPI
     break;
 #endif
-#ifdef CAIRO_HAS_SVG_SURFACE
   case OUTPUT_SVG :
     /* quite arbitrary, but consistent with ../pixbuf ;-) */
     renderer->scale = 20.0 * data->paper.scaling; 
@@ -189,7 +182,6 @@ export_data(DiagramData *data, DiaContext *ctx,
                                                filename_crt,
                                                (int)width, (int)height);
     break;
-#endif
 #ifdef CAIRO_HAS_SCRIPT_SURFACE
   case OUTPUT_CAIRO_SCRIPT :
     /* quite arbitrary, but consistent with ../pixbuf ;-) */
@@ -382,7 +374,6 @@ static DiaExportFilter pdf_export_filter = {
 };
 #endif
 
-#ifdef CAIRO_HAS_SVG_SURFACE
 static const gchar *svg_extensions[] = { "svg", NULL };
 static DiaExportFilter svg_export_filter = {
     N_("Cairo Scalable Vector Graphics"),
@@ -392,7 +383,6 @@ static DiaExportFilter svg_export_filter = {
     "cairo-svg",
     FILTER_DONT_GUESS /* don't use this if not asked explicit */
 };
-#endif
 
 #ifdef CAIRO_HAS_SCRIPT_SURFACE
 static const gchar *cs_extensions[] = { "cs", NULL };
@@ -496,16 +486,12 @@ _plugin_unload (PluginInfo *info)
 #ifdef CAIRO_HAS_PDF_SURFACE
   filter_unregister_export(&pdf_export_filter);
 #endif
-#ifdef CAIRO_HAS_SVG_SURFACE
   filter_unregister_export(&svg_export_filter);
-#endif
 #ifdef CAIRO_HAS_SCRIPT_SURFACE
   filter_unregister_export(&cs_export_filter);
 #endif
-#if defined CAIRO_HAS_PNG_SURFACE || defined CAIRO_HAS_PNG_FUNCTIONS
   filter_unregister_export(&png_export_filter);
   filter_unregister_export(&pnga_export_filter);
-#endif
 #if DIA_CAIRO_CAN_EMF
   filter_unregister_export(&emf_export_filter);
   filter_unregister_export(&wmf_export_filter);
@@ -536,16 +522,12 @@ dia_plugin_init(PluginInfo *info)
 #ifdef CAIRO_HAS_PDF_SURFACE
   filter_register_export(&pdf_export_filter);
 #endif
-#ifdef CAIRO_HAS_SVG_SURFACE
   filter_register_export(&svg_export_filter);
-#endif
 #ifdef CAIRO_HAS_SCRIPT_SURFACE
   filter_register_export(&cs_export_filter);
 #endif
-#if defined CAIRO_HAS_PNG_SURFACE || defined CAIRO_HAS_PNG_FUNCTIONS
   filter_register_export(&png_export_filter);
   filter_register_export(&pnga_export_filter);
-#endif
 #if DIA_CAIRO_CAN_EMF
   filter_register_export(&emf_export_filter);
   filter_register_export(&wmf_export_filter);


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