mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-02-06 07:14:55 +08:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
306f394100
@ -76,7 +76,19 @@ namespace Spine {
|
||||
// Release the GPU back to drawing to the screen
|
||||
device.SetRenderTarget(null);
|
||||
|
||||
return result as Texture2D;
|
||||
// RenderTarget2D are volatile and will be lost on screen resolution changes.
|
||||
// So instead of using this directly, we create a non-voliate Texture2D.
|
||||
// This is computationally slower, but should be safe as long as it is done
|
||||
// on load.
|
||||
Texture2D resultTexture = new Texture2D(device, file.Width, file.Height);
|
||||
Color[] resultContent = new Color[Convert.ToInt32(file.Width * file.Height)];
|
||||
result.GetData(resultContent);
|
||||
resultTexture.SetData(resultContent);
|
||||
|
||||
// Dispose of the RenderTarget2D immediately.
|
||||
result.Dispose();
|
||||
|
||||
return resultTexture;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user