Lazily generate buffer in Sheet.
The managed byte buffer is created on demand, meaning a newly allocated sheet will not waste memory holding onto the buffer until some changes are actually required to be written. This avoids a newly allocated sheet wasting memory on buffers that do not differ from their backing texture.
This commit is contained in:
committed by
RoosterDragon
parent
e6852e2b50
commit
ff16690b86
@@ -28,7 +28,7 @@ namespace OpenRA.Mods.Common.Widgets
|
||||
|
||||
using (var hueBitmap = new Bitmap(256, 256))
|
||||
{
|
||||
var hueSheet = new Sheet(new Size(256, 256), false);
|
||||
var hueSheet = new Sheet(new Size(256, 256));
|
||||
hueSprite = new Sprite(hueSheet, new Rectangle(0, 0, 256, 1), TextureChannel.Alpha);
|
||||
|
||||
var bitmapData = hueBitmap.LockBits(hueBitmap.Bounds(),
|
||||
|
||||
Reference in New Issue
Block a user