Renormalize line endings and fix copyright headers again.
This commit is contained in:
@@ -6,25 +6,25 @@
|
||||
* as published by the Free Software Foundation. For more information,
|
||||
* see COPYING.
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Imaging;
|
||||
using System.IO;
|
||||
using OpenRA.FileFormats.Graphics;
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Imaging;
|
||||
using System.IO;
|
||||
using OpenRA.FileFormats.Graphics;
|
||||
using Tao.OpenGl;
|
||||
|
||||
namespace OpenRA.Renderer.Glsl
|
||||
{
|
||||
public class Texture : ITexture
|
||||
{
|
||||
internal int texture;
|
||||
internal int memory;
|
||||
internal int texture;
|
||||
internal int memory;
|
||||
GraphicsDevice dev;
|
||||
|
||||
public Texture(GraphicsDevice dev)
|
||||
{
|
||||
{
|
||||
this.dev = dev;
|
||||
|
||||
Gl.glGenTextures(1, out texture);
|
||||
@@ -32,7 +32,7 @@ namespace OpenRA.Renderer.Glsl
|
||||
}
|
||||
|
||||
public Texture(GraphicsDevice dev, Bitmap bitmap)
|
||||
{
|
||||
{
|
||||
this.dev = dev;
|
||||
|
||||
Gl.glGenTextures(1, out texture);
|
||||
@@ -54,18 +54,18 @@ namespace OpenRA.Renderer.Glsl
|
||||
GraphicsDevice.CheckGlError();
|
||||
Gl.glTexParameteri(Gl.GL_TEXTURE_2D, Gl.GL_TEXTURE_MAX_LEVEL, 0);
|
||||
GraphicsDevice.CheckGlError();
|
||||
}
|
||||
|
||||
void UpdateMemoryUsage( int newSize )
|
||||
{
|
||||
if (newSize == memory)
|
||||
return;
|
||||
|
||||
dev.GpuMemoryUsed -= memory;
|
||||
memory = newSize;
|
||||
dev.GpuMemoryUsed += memory;
|
||||
|
||||
Log.Write("debug", "GPU Memory: {0:F2} MiB", dev.GpuMemoryUsed / 1024 / 1024f);
|
||||
}
|
||||
|
||||
void UpdateMemoryUsage( int newSize )
|
||||
{
|
||||
if (newSize == memory)
|
||||
return;
|
||||
|
||||
dev.GpuMemoryUsed -= memory;
|
||||
memory = newSize;
|
||||
dev.GpuMemoryUsed += memory;
|
||||
|
||||
Log.Write("debug", "GPU Memory: {0:F2} MiB", dev.GpuMemoryUsed / 1024 / 1024f);
|
||||
}
|
||||
|
||||
public void SetData(byte[] colors, int width, int height)
|
||||
@@ -83,8 +83,8 @@ namespace OpenRA.Renderer.Glsl
|
||||
0, Gl.GL_BGRA, Gl.GL_UNSIGNED_BYTE, intPtr);
|
||||
GraphicsDevice.CheckGlError();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
UpdateMemoryUsage(colors.Length);
|
||||
}
|
||||
|
||||
@@ -107,8 +107,8 @@ namespace OpenRA.Renderer.Glsl
|
||||
0, Gl.GL_BGRA, Gl.GL_UNSIGNED_BYTE, intPtr);
|
||||
GraphicsDevice.CheckGlError();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
UpdateMemoryUsage(width * height * sizeof(uint));
|
||||
}
|
||||
|
||||
@@ -129,8 +129,8 @@ namespace OpenRA.Renderer.Glsl
|
||||
Gl.glTexImage2D(Gl.GL_TEXTURE_2D, 0, Gl.GL_RGBA8, bits.Width, bits.Height,
|
||||
0, Gl.GL_BGRA, Gl.GL_UNSIGNED_BYTE, bits.Scan0); // todo: weird strides
|
||||
GraphicsDevice.CheckGlError();
|
||||
bitmap.UnlockBits(bits);
|
||||
|
||||
bitmap.UnlockBits(bits);
|
||||
|
||||
UpdateMemoryUsage(bitmap.Width * bitmap.Height * sizeof(uint));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user