[banshee] [PixbufImageSurface] use PlatformDetection
- From: Aaron Bockover <abock src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [banshee] [PixbufImageSurface] use PlatformDetection
- Date: Sun, 7 Feb 2010 18:19:44 +0000 (UTC)
commit 2e13aa6db35d54b0515699baf376b4395a95f04e
Author: Aaron Bockover <abockover novell com>
Date: Sun Feb 7 12:57:40 2010 -0500
[PixbufImageSurface] use PlatformDetection
Fixed up to use PlatformDetection.IsWindows for the gross and
inefficient construction of PixbufImageSurface on Windows. Cleaned
up nasty looking code in this area.
.../Hyena.Gui/Hyena.Gui/PixbufImageSurface.cs | 19 +++++++++++--------
1 files changed, 11 insertions(+), 8 deletions(-)
---
diff --git a/src/Libraries/Hyena.Gui/Hyena.Gui/PixbufImageSurface.cs b/src/Libraries/Hyena.Gui/Hyena.Gui/PixbufImageSurface.cs
index 09c13ac..a733802 100644
--- a/src/Libraries/Hyena.Gui/Hyena.Gui/PixbufImageSurface.cs
+++ b/src/Libraries/Hyena.Gui/Hyena.Gui/PixbufImageSurface.cs
@@ -4,7 +4,7 @@
// Author:
// Aaron Bockover <abockover novell com>
//
-// Copyright (C) 2008 Novell, Inc.
+// Copyright 2008-2010 Novell, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
@@ -62,13 +62,14 @@ namespace Hyena.Gui
return null;
}
- if (Hyena.PlatformUtil.IsRunningUnix) {
+ if (!PlatformDetection.IsWindows) {
try {
return new PixbufImageSurface (pixbuf, disposePixbuf);
} catch {
return null;
}
} else {
+ // FIXME:
// Windows has some trouble running the PixbufImageSurface, so as a
// workaround a slower but working version of this factory method is
// implemented. One day we can come back and optimize this by finding
@@ -76,12 +77,14 @@ namespace Hyena.Gui
// violations when the object is disposed.
ImageSurface target = new ImageSurface (Format.ARGB32, pixbuf.Width, pixbuf.Height);
Context context = new Context (target);
- Gdk.CairoHelper.SetSourcePixbuf (context, pixbuf, 0, 0);
- context.Paint ();
- ((IDisposable)context).Dispose ();
-
- if (disposePixbuf) {
- ((IDisposable)pixbuf).Dispose ();
+ try {
+ Gdk.CairoHelper.SetSourcePixbuf (context, pixbuf, 0, 0);
+ context.Paint ();
+ } finally {
+ ((IDisposable)context).Dispose ();
+ if (disposePixbuf) {
+ ((IDisposable)pixbuf).Dispose ();
+ }
}
return target;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]