~ubuntu-branches/ubuntu/precise/gnome-games/precise-updates

« back to all changes in this revision

Viewing changes to libgames-support/games-preimage.c

  • Committer: Package Import Robot
  • Author(s): Jeremy Bicha
  • Date: 2012-03-19 20:46:10 UTC
  • mfrom: (1.1.105)
  • Revision ID: package-import@ubuntu.com-20120319204610-2nd2xqq39j8y7t5q
Tags: 1:3.3.92-0ubuntu1
* New upstream release.
  - Swell Foop ported to Vala, no longer in staging
    (LP: #939200, LP: #939210)
* debian/patches/git_fix-iagno-ai.patch: Dropped, upstream
* debian/control.in:
  - Drop no longer needed swell-foop dependencies
* debian/rules:
  - Don't install staging games
* debian/swell-foop.install:
  - Don't install gir files any more; they're not needed

Show diffs side-by-side

added added

removed removed

Lines of Context:
30
30
/* For gdkcairo */
31
31
#include <gdk/gdk.h>
32
32
 
33
 
#ifdef HAVE_RSVG
34
33
#include <librsvg/rsvg.h>
35
34
#include <librsvg/rsvg-cairo.h>
36
 
#endif /* HAVE_RSVG */
37
35
 
38
36
 
39
37
#include "games-preimage.h"
44
42
  gint width;
45
43
  gint height;
46
44
 
47
 
#ifdef HAVE_RSVG
48
45
  RsvgHandle *rsvg_handle;
49
46
  cairo_font_options_t *font_options;
50
 
#endif
51
47
 
52
48
  /* raster pixbuf data */
53
49
  GdkPixbuf *pixbuf;
70
66
{
71
67
  GamesPreimage *preimage = GAMES_PREIMAGE (object);
72
68
 
73
 
#ifdef HAVE_RSVG
74
69
  if (preimage->rsvg_handle != NULL) {
75
70
    g_object_unref (preimage->rsvg_handle);
76
71
  }
77
72
  if (preimage->font_options) {
78
73
    cairo_font_options_destroy (preimage->font_options);
79
74
  }
80
 
#endif
81
75
 
82
76
  if (preimage->pixbuf != NULL) {
83
77
    g_object_unref (preimage->pixbuf);
93
87
 
94
88
  oclass->finalize = games_preimage_finalize;
95
89
 
96
 
#ifdef HAVE_RSVG
97
90
  rsvg_init ();
98
 
#endif
99
91
}
100
92
 
101
93
/**
117
109
  g_return_val_if_fail (width > 0 && height > 0, NULL);
118
110
  g_return_val_if_fail (preimage != NULL, NULL);
119
111
 
120
 
#ifdef HAVE_RSVG
121
112
  if (preimage->scalable) {     /* Render vector image */
122
113
    pixbuf = games_preimage_render_sub (preimage,
123
114
                                        NULL,
129
120
                                        ((double) height) /
130
121
                                        ((double) preimage->height));
131
122
  } else
132
 
#endif /* HAVE_RSVG */
133
123
  {
134
124
    /* Render raster image */
135
125
    pixbuf = gdk_pixbuf_scale_simple (preimage->pixbuf,
158
148
  g_return_if_fail (width > 0 && height > 0);
159
149
  g_return_if_fail (preimage != NULL);
160
150
 
161
 
#ifdef HAVE_RSVG
162
151
  if (preimage->scalable) {     /* Render vector image */
163
152
    games_preimage_render_cairo_sub (preimage,
164
153
                                     cr,
171
160
                                     ((double) height) /
172
161
                                     ((double) preimage->height));
173
162
  } else
174
 
#endif /* HAVE_RSVG */
175
163
  {
176
164
    GdkPixbuf *pixbuf;
177
165
 
189
177
  }
190
178
}
191
179
 
192
 
#ifdef HAVE_RSVG
193
 
 
194
180
/* This routine is copied from librsvg:
195
181
   Copyright © 2005 Dom Lachowicz <cinamod@hotmail.com>
196
182
   Copyright © 2005 Caleb Moore <c.moore@student.unsw.edu.au>
342
328
                                   (GdkPixbufDestroyNotify) g_free, data);
343
329
}
344
330
 
345
 
#endif /* HAVE_RSVG */
346
 
 
347
331
/**
348
332
 * games_preimage_new_from_file:
349
333
 * @filename:
363
347
 
364
348
  preimage = g_object_new (GAMES_TYPE_PREIMAGE, NULL);
365
349
 
366
 
#ifdef HAVE_RSVG
367
350
  preimage->rsvg_handle = rsvg_handle_new_from_file (filename, NULL);
368
351
  if (preimage->rsvg_handle) {
369
352
    RsvgDimensionData data;
385
368
 
386
369
    return preimage;
387
370
  }
388
 
#endif /* HAVE_RSVG */
389
371
 
390
372
  /* Not an SVG */
391
373
  preimage->scalable = FALSE;
415
397
games_preimage_set_font_options (GamesPreimage * preimage,
416
398
                                 const cairo_font_options_t * font_options)
417
399
{
418
 
#ifdef HAVE_RSVG
419
400
  g_return_if_fail (GAMES_IS_PREIMAGE (preimage));
420
401
 
421
402
  if (preimage->font_options) {
427
408
  } else {
428
409
    preimage->font_options = NULL;
429
410
  }
430
 
#endif /* HAVE_RSVG */
431
411
}
432
412
 
433
413
/**