gnome-games r8426 - trunk/libgames-support
- From: chpe svn gnome org
- To: svn-commits-list gnome org
- Subject: gnome-games r8426 - trunk/libgames-support
- Date: Tue, 6 Jan 2009 18:18:19 +0000 (UTC)
Author: chpe
Date: Tue Jan 6 18:18:18 2009
New Revision: 8426
URL: http://svn.gnome.org/viewvc/gnome-games?rev=8426&view=rev
Log:
Use rsvg_handle_get_dimension/position_sub in the KDE theme.
Added:
trunk/libgames-support/games-preimage-private.h
Modified:
trunk/libgames-support/Makefile.am
trunk/libgames-support/games-card-theme-kde.c
trunk/libgames-support/games-card-theme.c
trunk/libgames-support/games-preimage.c
trunk/libgames-support/games-preimage.h
Modified: trunk/libgames-support/Makefile.am
==============================================================================
--- trunk/libgames-support/Makefile.am (original)
+++ trunk/libgames-support/Makefile.am Tue Jan 6 18:18:18 2009
@@ -64,6 +64,7 @@
games-card-theme-sliced.c \
games-preimage.c \
games-preimage.h \
+ games-preimage-private.h \
games-score.h \
games-score.c \
games-scores.c \
Modified: trunk/libgames-support/games-card-theme-kde.c
==============================================================================
--- trunk/libgames-support/games-card-theme-kde.c (original)
+++ trunk/libgames-support/games-card-theme-kde.c Tue Jan 6 18:18:18 2009
@@ -27,6 +27,7 @@
#include "games-find-file.h"
#include "games-files.h"
#include "games-preimage.h"
+#include "games-preimage-private.h"
#include "games-runtime.h"
#include "games-card-theme.h"
@@ -40,13 +41,9 @@
GamesCardThemePreimage parent_instance;
};
-#if defined(HAVE_RSVG)
#include <librsvg/librsvg-features.h>
-#endif
#if defined(HAVE_RSVG) && defined(LIBRSVG_CHECK_VERSION) && LIBRSVG_CHECK_VERSION(2, 22, 4)
#define HAVE_RSVG_BBOX
-#else
-#error version check
#endif
#define N_ROWS ((double) 5.0)
@@ -117,9 +114,10 @@
int suit, rank;
double card_width, card_height;
double width, height;
- double offsetx, offsety;
double zoomx, zoomy;
char node[64];
+ RsvgDimensionData dimension;
+ RsvgPositionData position;
if (!preimage_card_theme->theme_loaded)
return NULL;
@@ -135,25 +133,28 @@
return subpixbuf;
}
+ games_card_get_node_by_suit_and_rank_snprintf (node, sizeof (node), suit, rank);
+
+ if (!rsvg_handle_get_dimension_sub (preimage->rsvg_handle, &dimension, node) ||
+ !rsvg_handle_get_position_sub (preimage->rsvg_handle, &position, node)) {
+ g_print ("Failed to get dim or pos for '%s'\n", node);
+ return NULL;
+ }
+
card_width = ((double) games_preimage_get_width (preimage)) / N_COLS;
card_height = ((double) games_preimage_get_height (preimage)) / N_ROWS;
width = preimage_card_theme->card_size.width - 2 * DELTA;
height = preimage_card_theme->card_size.height - 2 * DELTA;
- offsetx = -((double) rank) * card_width + DELTA;
- offsety = -((double) suit) * card_height + DELTA;
-
- zoomx = width / card_width;
- zoomy = height / card_height;
-
- games_card_get_node_by_suit_and_rank_snprintf (node, sizeof (node), suit, rank);
+ zoomx = width / dimension.width;
+ zoomy = height / dimension.height;
subpixbuf = games_preimage_render_sub (preimage,
node,
preimage_card_theme->card_size.width,
preimage_card_theme->card_size.height,
- offsetx, offsety,
+ -position.x, -position.y,
zoomx, zoomy);
return subpixbuf;
Modified: trunk/libgames-support/games-card-theme.c
==============================================================================
--- trunk/libgames-support/games-card-theme.c (original)
+++ trunk/libgames-support/games-card-theme.c Tue Jan 6 18:18:18 2009
@@ -68,12 +68,12 @@
#ifdef HAVE_RSVG
if (strcmp (env, "svg") == 0)
type = GAMES_TYPE_CARD_THEME_SVG;
+ else if (strcmp (env, "kde") == 0)
+ type = GAMES_TYPE_CARD_THEME_KDE;
else
#endif
if (strcmp (env, "sliced") == 0)
type = GAMES_TYPE_CARD_THEME_SLICED;
- else if (strcmp (env, "kde") == 0)
- type = GAMES_TYPE_CARD_THEME_KDE;
else if (strcmp (env, "fixed") == 0)
type = GAMES_TYPE_CARD_THEME_FIXED;
}
Added: trunk/libgames-support/games-preimage-private.h
==============================================================================
--- (empty file)
+++ trunk/libgames-support/games-preimage-private.h Tue Jan 6 18:18:18 2009
@@ -0,0 +1,40 @@
+/*
+ Copyright  2004 Richard Hoelscher
+ Copyright  2007 Christian Persch
+
+ This library is free software; you can redistribute it and'or modify
+ it under the terms of the GNU Library General Public License as published
+ by the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
+
+/* Authors: Richard Hoelscher <rah rahga com> */
+
+#ifdef HAVE_RSVG
+#include <librsvg/rsvg.h>
+#endif
+
+struct _GamesPreimage {
+ GObject parent;
+
+ gint width;
+ gint height;
+
+#ifdef HAVE_RSVG
+ RsvgHandle *rsvg_handle;
+ cairo_font_options_t *font_options;
+#endif
+
+ /* raster pixbuf data */
+ GdkPixbuf *pixbuf;
+
+ guint scalable : 1;
+};
Modified: trunk/libgames-support/games-preimage.c
==============================================================================
--- trunk/libgames-support/games-preimage.c (original)
+++ trunk/libgames-support/games-preimage.c Tue Jan 6 18:18:18 2009
@@ -34,23 +34,7 @@
#endif /* HAVE_RSVG */
#include "games-preimage.h"
-
-struct _GamesPreimage {
- GObject parent;
-
- gint width;
- gint height;
-
-#ifdef HAVE_RSVG
- RsvgHandle *rsvg_handle;
- cairo_font_options_t *font_options;
-#endif
-
- /* raster pixbuf data */
- GdkPixbuf *pixbuf;
-
- guint scalable : 1;
-};
+#include "games-preimage-private.h"
G_DEFINE_TYPE (GamesPreimage, games_preimage, G_TYPE_OBJECT);
Modified: trunk/libgames-support/games-preimage.h
==============================================================================
--- trunk/libgames-support/games-preimage.h (original)
+++ trunk/libgames-support/games-preimage.h Tue Jan 6 18:18:18 2009
@@ -36,7 +36,6 @@
#define GAMES_GET_PREIMAGE_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GAMES_TYPE_PREIMAGE, GamesPreimageClass))
typedef struct _GamesPreimage GamesPreimage;
-
typedef GObjectClass GamesPreimageClass;
GType games_preimage_get_type (void);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]