Skip to content

Commit

Permalink
Minor refactoring to fix code analysis warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
cameronwhite committed Dec 26, 2024
1 parent a767c4a commit 9125657
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Pinta.Resources/ResourceManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,9 @@ private static bool TryGetIconFromTheme (string name, int size, [NotNullWhen (tr
// This will also load any icons added by Gtk.IconFactory.AddDefault() .
var icon_theme = Gtk.IconTheme.GetForDisplay (Gdk.Display.GetDefault ()!);
var icon_paintable = icon_theme.LookupIcon (name, Array.Empty<string> (), size, 1, TextDirection.None, Gtk.IconLookupFlags.Preload);
if (icon_paintable == null || (name != StandardIcons.ImageMissing && icon_paintable.IconName!.StartsWith ("image-missing")))
if (icon_paintable == null)
return false;
if (name != StandardIcons.ImageMissing && icon_paintable.IconName!.StartsWith ("image-missing", StringComparison.InvariantCulture))
return false;

var snapshot = Gtk.Snapshot.New ();
Expand Down Expand Up @@ -130,7 +132,7 @@ private static bool HasResource (Assembly asm, string name)
// https://github.com/mono/monodevelop/blob/master/main/src/core/MonoDevelop.Ide/gtk-gui/generated.cs
private static Texture CreateMissingImage (int size)
{
var surf = new Cairo.ImageSurface (Cairo.Format.Argb32, size, size);
using var surf = new Cairo.ImageSurface (Cairo.Format.Argb32, size, size);
using Cairo.Context g = new (surf);
g.SetSourceRgb (1, 1, 1);
g.Rectangle (0, 0, size, size);
Expand Down

0 comments on commit 9125657

Please sign in to comment.