gbrainy r404 - trunk/src
- From: jmas svn gnome org
- To: svn-commits-list gnome org
- Subject: gbrainy r404 - trunk/src
- Date: Fri, 1 Aug 2008 14:04:12 +0000 (UTC)
Author: jmas
Date: Fri Aug 1 14:04:11 2008
New Revision: 404
URL: http://svn.gnome.org/viewvc/gbrainy?rev=404&view=rev
Log:
2008-08-01 Jordi Mas <jmas softcatala org>
* CairoContextEx.cs: Cache the background image
* GameDrawingArea.cs: Call Destroy() for images
Modified:
trunk/src/CairoContextEx.cs
trunk/src/ChangeLog
trunk/src/GameDrawingArea.cs
Modified: trunk/src/CairoContextEx.cs
==============================================================================
--- trunk/src/CairoContextEx.cs (original)
+++ trunk/src/CairoContextEx.cs Fri Aug 1 14:04:11 2008
@@ -28,6 +28,7 @@
{
Pango.Layout layout;
double font_size;
+ static SVGImage image = null;
const double line_space = 0.018;
@@ -218,13 +219,13 @@
virtual public void DrawBackground ()
{
try {
- using (SVGImage image = new SVGImage (Defines.DATA_DIR + "background.svg"))
- {
- Save ();
- Scale (0.999 / image.Width, 0.999 / image.Height);
- image.RenderToCairo (Handle);
- Restore ();
- }
+ if (image == null)
+ image = new SVGImage (Defines.DATA_DIR + "background.svg");
+
+ Save ();
+ Scale (0.999 / image.Width, 0.999 / image.Height);
+ image.RenderToCairo (Handle);
+ Restore ();
} catch {
}
Modified: trunk/src/GameDrawingArea.cs
==============================================================================
--- trunk/src/GameDrawingArea.cs (original)
+++ trunk/src/GameDrawingArea.cs Fri Aug 1 14:04:11 2008
@@ -109,6 +109,7 @@
gr.SetSourceSurface (image, 0, 0);
gr.Paint ();
gr.Restore ();
+ image.Destroy ();
}
gr.DrawStringWithWrapping (0.23, y + 0.01, Catalog.GetString ("Logic puzzles. Designed to challenge your reasoning and thinking skills."));
@@ -121,6 +122,7 @@
gr.SetSourceSurface (image, 0, 0);
gr.Paint ();
gr.Restore ();
+ image.Destroy ();
}
gr.DrawStringWithWrapping (0.23, y + 0.01, Catalog.GetString ("Mental calculation. Based on arithmetical operations that test your mental calculation abilities."));
@@ -133,6 +135,7 @@
gr.SetSourceSurface (image, 0, 0);
gr.Paint ();
gr.Restore ();
+ image.Destroy ();
}
gr.DrawStringWithWrapping (0.23, y + 0.01, Catalog.GetString ("Memory trainers. To prove and enhance your short term memory."));
gr.Stroke ();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]