mirror of
https://github.com/Ellpeck/MLEM.git
synced 2024-11-22 20:58:34 +01:00
don't auto-dispose the texture
This commit is contained in:
parent
b34172d043
commit
94c9d45a43
1 changed files with 2 additions and 5 deletions
|
@ -103,7 +103,7 @@ namespace MLEM.Data {
|
||||||
stopwatch.Stop();
|
stopwatch.Stop();
|
||||||
this.LastCalculationTime = stopwatch.Elapsed;
|
this.LastCalculationTime = stopwatch.Elapsed;
|
||||||
|
|
||||||
// figure out texture size
|
// figure out texture size and generate texture
|
||||||
var width = this.textures.Max(t => t.PackedArea.Right);
|
var width = this.textures.Max(t => t.PackedArea.Right);
|
||||||
var height = this.textures.Max(t => t.PackedArea.Bottom);
|
var height = this.textures.Max(t => t.PackedArea.Bottom);
|
||||||
if (this.forcePowerOfTwo) {
|
if (this.forcePowerOfTwo) {
|
||||||
|
@ -112,11 +112,8 @@ namespace MLEM.Data {
|
||||||
}
|
}
|
||||||
if (this.forceSquare)
|
if (this.forceSquare)
|
||||||
width = height = Math.Max(width, height);
|
width = height = Math.Max(width, height);
|
||||||
|
|
||||||
// generate texture
|
|
||||||
this.PackedTexture = new Texture2D(device, width, height);
|
this.PackedTexture = new Texture2D(device, width, height);
|
||||||
device.Disposing += (o, a) => this.PackedTexture.Dispose();
|
|
||||||
|
|
||||||
// copy texture data onto the packed texture
|
// copy texture data onto the packed texture
|
||||||
stopwatch.Restart();
|
stopwatch.Restart();
|
||||||
using (var data = this.PackedTexture.GetTextureData()) {
|
using (var data = this.PackedTexture.GetTextureData()) {
|
||||||
|
|
Loading…
Reference in a new issue