remove duplicated NextPowerOf2 definition

This commit is contained in:
Chris Forbes
2011-07-12 20:49:15 +12:00
committed by Paul Chote
parent 2259a0e7a5
commit 2ec88a6f64
7 changed files with 55 additions and 75 deletions

View File

@@ -12,6 +12,7 @@ using System;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using OpenRA.FileFormats;
using OpenRA.FileFormats.Graphics;
using Tao.OpenGl;
@@ -120,7 +121,7 @@ namespace OpenRA.Renderer.Glsl
if (!IsPowerOf2(bitmap.Width) || !IsPowerOf2(bitmap.Height))
{
//throw new InvalidOperationException( "non-power-of-2-texture" );
bitmap = new Bitmap(bitmap, new Size(NextPowerOf2(bitmap.Width), NextPowerOf2(bitmap.Height)));
bitmap = new Bitmap(bitmap, new Size(Exts.NextPowerOf2(bitmap.Width), Exts.NextPowerOf2(bitmap.Height)));
}
var bits = bitmap.LockBits(
@@ -141,16 +142,5 @@ namespace OpenRA.Renderer.Glsl
{
return (v & (v - 1)) == 0;
}
int NextPowerOf2(int v)
{
--v;
v |= v >> 1;
v |= v >> 2;
v |= v >> 4;
v |= v >> 8;
++v;
return v;
}
}
}