[libchamplain] Add Memphis debug flag
- From: Pierre-Luc Beaudoin <plbeaudoin src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [libchamplain] Add Memphis debug flag
- Date: Sun, 24 Jan 2010 20:07:09 +0000 (UTC)
commit d459b88b793d6f6560d02fc7d8b485448cb14123
Author: Simon Wenner <simon wenner ch>
Date: Wed Jun 24 10:43:56 2009 +0200
Add Memphis debug flag
champlain/champlain-debug.c | 1 +
champlain/champlain-debug.h | 3 ++-
champlain/champlain-local-map-data-source.c | 3 +++
champlain/champlain-map-data-source.c | 3 +++
champlain/champlain-memphis-map-source.c | 18 +++++++++++++-----
5 files changed, 22 insertions(+), 6 deletions(-)
---
diff --git a/champlain/champlain-debug.c b/champlain/champlain-debug.c
index be9b942..40828c7 100644
--- a/champlain/champlain-debug.c
+++ b/champlain/champlain-debug.c
@@ -41,6 +41,7 @@ static GDebugKey keys[] = {
{ "Network", CHAMPLAIN_DEBUG_NETWORK },
{ "Cache", CHAMPLAIN_DEBUG_CACHE },
{ "Selection", CHAMPLAIN_DEBUG_SELECTION },
+ { "Memphis", CHAMPLAIN_DEBUG_MEMPHIS },
{ "Other", CHAMPLAIN_DEBUG_OTHER },
{ 0, }
};
diff --git a/champlain/champlain-debug.h b/champlain/champlain-debug.h
index 26534e9..5566c72 100644
--- a/champlain/champlain-debug.h
+++ b/champlain/champlain-debug.h
@@ -36,7 +36,8 @@ typedef enum
CHAMPLAIN_DEBUG_NETWORK = 1 << 4,
CHAMPLAIN_DEBUG_CACHE = 1 << 5,
CHAMPLAIN_DEBUG_SELECTION = 1 << 6,
- CHAMPLAIN_DEBUG_OTHER = 1 << 7,
+ CHAMPLAIN_DEBUG_MEMPHIS = 1 << 7,
+ CHAMPLAIN_DEBUG_OTHER = 1 << 8,
} ChamplainDebugFlags;
gboolean champlain_debug_flag_is_set (ChamplainDebugFlags flag);
diff --git a/champlain/champlain-local-map-data-source.c b/champlain/champlain-local-map-data-source.c
index 87b90dd..4e4f326 100644
--- a/champlain/champlain-local-map-data-source.c
+++ b/champlain/champlain-local-map-data-source.c
@@ -18,6 +18,9 @@
#include "champlain-local-map-data-source.h"
+#define DEBUG_FLAG CHAMPLAIN_DEBUG_MEMPHIS
+#include "champlain-debug.h"
+
#include <memphis/memphis.h>
G_DEFINE_TYPE (ChamplainLocalMapDataSource, champlain_local_map_data_source, CHAMPLAIN_TYPE_MAP_DATA_SOURCE)
diff --git a/champlain/champlain-map-data-source.c b/champlain/champlain-map-data-source.c
index 03a3e29..1210aef 100644
--- a/champlain/champlain-map-data-source.c
+++ b/champlain/champlain-map-data-source.c
@@ -18,6 +18,9 @@
#include "champlain-map-data-source.h"
+#define DEBUG_FLAG CHAMPLAIN_DEBUG_MEMPHIS
+#include "champlain-debug.h"
+
G_DEFINE_TYPE (ChamplainMapDataSource, champlain_map_data_source, G_TYPE_OBJECT)
#define GET_PRIVATE(o) \
diff --git a/champlain/champlain-memphis-map-source.c b/champlain/champlain-memphis-map-source.c
index c4d8e0b..b327ebb 100644
--- a/champlain/champlain-memphis-map-source.c
+++ b/champlain/champlain-memphis-map-source.c
@@ -18,7 +18,10 @@
#include "champlain-memphis-map-source.h"
#include "champlain.h"
+
+#define DEBUG_FLAG CHAMPLAIN_DEBUG_MEMPHIS
#include "champlain-debug.h"
+
#include "champlain-cache.h"
#include "champlain-defines.h"
#include "champlain-enum-types.h"
@@ -30,9 +33,10 @@
/* Tuning parameters */
#define MAX_THREADS 4
-#define DEFAULT_TILE_SIZE 256
-#define DEFAULT_RULES_PATH "rule.xml"
-#define MEMPHIS_DEBUG_LEVEL 1
+#define DEFAULT_TILE_SIZE 256 // FIXME find the bug
+#define DEFAULT_RULES_PATH "default-rules.xml"
+/* 0: Be quiet, 1: Normal output, 2: Be verbose */
+#define MEMPHIS_INTERNAL_DEBUG_LEVEL 0
G_DEFINE_TYPE (ChamplainMemphisMapSource, champlain_memphis_map_source, CHAMPLAIN_TYPE_MAP_SOURCE)
@@ -173,6 +177,8 @@ memphis_worker_thread (gpointer data, gpointer user_data)
cst = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, size, size);
cr = cairo_create (cst);
+ DEBUG ("Draw Tile (%d, %d, %d)", x, y, z);
+
memphis_renderer_draw_tile (renderer, cr, x, y, z);
cairo_destroy (cr);
@@ -237,13 +243,15 @@ champlain_memphis_map_source_new_full (ChamplainMapSourceDesc *desc,
priv->map_data_source = g_object_ref (map_data_source);
priv->rules = memphis_rule_set_new ();
- memphis_rule_set_load_from_file (priv->rules, DEFAULT_RULES_PATH); //???
+ memphis_rule_set_load_from_file (priv->rules, DEFAULT_RULES_PATH);
+ // TODO: Do we want to ship a default rule-set?
map = champlain_map_data_source_get_map_data (priv->map_data_source);
priv->renderer = memphis_renderer_new_full (priv->rules, map);
memphis_renderer_set_resolution (priv->renderer, DEFAULT_TILE_SIZE);
- memphis_renderer_set_debug_level (priv->renderer, MEMPHIS_DEBUG_LEVEL);
+ memphis_renderer_set_debug_level (priv->renderer,
+ MEMPHIS_INTERNAL_DEBUG_LEVEL);
priv->thpool = g_thread_pool_new (memphis_worker_thread, priv->renderer,
MAX_THREADS, FALSE, NULL);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]