|
@@ -13,6 +13,7 @@ public class Texture : IDisposable
|
|
public VecI Size { get; }
|
|
public VecI Size { get; }
|
|
public DrawingSurface Surface { get; }
|
|
public DrawingSurface Surface { get; }
|
|
|
|
|
|
|
|
+ public event SurfaceChangedEventHandler? Changed;
|
|
|
|
|
|
public bool IsDisposed { get; private set; }
|
|
public bool IsDisposed { get; private set; }
|
|
|
|
|
|
@@ -26,8 +27,15 @@ public class Texture : IDisposable
|
|
GpuBacked = true
|
|
GpuBacked = true
|
|
});
|
|
});
|
|
|
|
|
|
|
|
+ Surface.Changed += SurfaceOnChanged;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ private void SurfaceOnChanged(RectD? changedRect)
|
|
|
|
+ {
|
|
|
|
+ Changed?.Invoke(changedRect);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
public static Texture Load(string path)
|
|
public static Texture Load(string path)
|
|
{
|
|
{
|
|
if (!File.Exists(path))
|
|
if (!File.Exists(path))
|
|
@@ -99,6 +107,7 @@ public class Texture : IDisposable
|
|
return;
|
|
return;
|
|
|
|
|
|
IsDisposed = true;
|
|
IsDisposed = true;
|
|
|
|
+ Surface.Changed -= SurfaceOnChanged;
|
|
Surface.Dispose();
|
|
Surface.Dispose();
|
|
}
|
|
}
|
|
}
|
|
}
|