mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2025-12-20 17:26:01 +08:00
Ensured compatibility with MonoGame for iOS.
iOS MonoGame has no implementation for GetData/SetData, however we don't need to worry about the volatility of Textures with regards to screen resolution re-size as this is not an issue on iOS.
This commit is contained in:
parent
d91caa8eba
commit
021714bf0d
@ -76,19 +76,23 @@ namespace Spine {
|
|||||||
// Release the GPU back to drawing to the screen
|
// Release the GPU back to drawing to the screen
|
||||||
device.SetRenderTarget(null);
|
device.SetRenderTarget(null);
|
||||||
|
|
||||||
|
#if IOS
|
||||||
|
return result as Texture2D;
|
||||||
|
#else
|
||||||
// RenderTarget2D are volatile and will be lost on screen resolution changes.
|
// RenderTarget2D are volatile and will be lost on screen resolution changes.
|
||||||
// So instead of using this directly, we create a non-voliate Texture2D.
|
// 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
|
// This is computationally slower, but should be safe as long as it is done
|
||||||
// on load.
|
// on load.
|
||||||
Texture2D resultTexture = new Texture2D(device, file.Width, file.Height);
|
Texture2D resultTexture = new Texture2D(device, file.Width, file.Height);
|
||||||
Color[] resultContent = new Color[Convert.ToInt32(file.Width * file.Height)];
|
Color[] resultContent = new Color[Convert.ToInt32(file.Width * file.Height)];
|
||||||
result.GetData(resultContent);
|
result.GetData(resultContent);
|
||||||
resultTexture.SetData(resultContent);
|
resultTexture.SetData(resultContent);
|
||||||
|
|
||||||
// Dispose of the RenderTarget2D immediately.
|
// Dispose of the RenderTarget2D immediately.
|
||||||
result.Dispose();
|
result.Dispose();
|
||||||
|
|
||||||
return resultTexture;
|
return resultTexture;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user