diff options
author | Lluis Sanchez Gual <lluis@xamarin.com> | 2014-04-03 17:03:15 +0400 |
---|---|---|
committer | Lluis Sanchez Gual <lluis@xamarin.com> | 2014-04-03 17:03:33 +0400 |
commit | 3525e1854114cd02a718d02ca8c7872fba353a0d (patch) | |
tree | 6dcee3ef0370b3185b0aff8a81023f24fb44fd34 | |
parent | 75eedee6ab41417820f7f01db95ba3b52f8a0fc7 (diff) |
Fix issue #289: unable to use StockIcons in Gtk ListView
-rw-r--r-- | Xwt.Gtk/Xwt.GtkBackend/ImageHandler.cs | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/Xwt.Gtk/Xwt.GtkBackend/ImageHandler.cs b/Xwt.Gtk/Xwt.GtkBackend/ImageHandler.cs index ff590cf6..8202b2f2 100644 --- a/Xwt.Gtk/Xwt.GtkBackend/ImageHandler.cs +++ b/Xwt.Gtk/Xwt.GtkBackend/ImageHandler.cs @@ -404,12 +404,14 @@ namespace Xwt.GtkBackend Gdk.CairoHelper.SetSourcePixbuf (ctx, img, 0, 0); #pragma warning disable 618 - using (var pattern = (Cairo.SurfacePattern)ctx.Source) { - if (idesc.Size.Width > img.Width || idesc.Size.Height > img.Height) { - // Fixes blur issue when rendering on an image surface - pattern.Filter = Cairo.Filter.Fast; - } else - pattern.Filter = Cairo.Filter.Good; + using (var pattern = ctx.Source as Cairo.SurfacePattern) { + if (pattern != null) { + if (idesc.Size.Width > img.Width || idesc.Size.Height > img.Height) { + // Fixes blur issue when rendering on an image surface + pattern.Filter = Cairo.Filter.Fast; + } else + pattern.Filter = Cairo.Filter.Good; + } } #pragma warning restore 618 |