Bug 1288649 - Remove NextPowerOfTwo. - r=jrmuizel

MozReview-Commit-ID: 9CR6lscs3d2
This commit is contained in:
Jeff Gilbert 2016-07-22 01:47:44 -07:00
parent c6bdac40c5
commit 6790ba91a7
6 changed files with 9 additions and 19 deletions

View File

@ -261,8 +261,8 @@ TexImage2DHelper(GLContext* gl,
// Pad out texture width and height to the next power of two
// as we don't support/want non power of two texture uploads
GLsizei paddedWidth = NextPowerOfTwo(width);
GLsizei paddedHeight = NextPowerOfTwo(height);
GLsizei paddedWidth = RoundUpPow2((uint32_t)width);
GLsizei paddedHeight = RoundUpPow2((uint32_t)height);
GLvoid* paddedPixels = new unsigned char[paddedWidth * paddedHeight * pixelsize];

View File

@ -445,7 +445,7 @@ CalculatePOTSize(const IntSize& aSize, GLContext* gl)
if (CanUploadNonPowerOfTwo(gl))
return aSize;
return IntSize(NextPowerOfTwo(aSize.width), NextPowerOfTwo(aSize.height));
return IntSize(RoundUpPow2(aSize.width), RoundUpPow2(aSize.height));
}
// |aRect| is the rectangle we want to draw to. We will draw it with

View File

@ -126,8 +126,8 @@ GLBlitTextureImageHelper::BlitTextureImage(TextureImage *aSrc, const gfx::IntRec
gfx::IntSize realTexSize = srcSize;
if (!CanUploadNonPowerOfTwo(gl)) {
realTexSize = gfx::IntSize(gfx::NextPowerOfTwo(srcSize.width),
gfx::NextPowerOfTwo(srcSize.height));
realTexSize = gfx::IntSize(RoundUpPow2(srcSize.width),
RoundUpPow2(srcSize.height));
}
if (aSrc->GetWrapMode() == LOCAL_GL_REPEAT) {

View File

@ -1202,7 +1202,7 @@ gfxPlatform::ComputeTileSize()
// Choose a size so that there are between 2 and 4 tiles per screen width.
// FIXME: we should probably make sure this is within the max texture size,
// but I think everything should at least support 1024
w = h = clamped(NextPowerOfTwo(screenSize.width) / 4, 256, 1024);
w = h = clamped(int32_t(RoundUpPow2(screenSize.width)) / 4, 256, 1024);
}
#ifdef MOZ_WIDGET_GONK
@ -2500,7 +2500,7 @@ gfxPlatform::IsGfxInfoStatusOkay(int32_t aFeature, nsCString* aOutMessage, nsCSt
return true;
}
int32_t status;
int32_t status;
if (NS_SUCCEEDED(gfxInfo->GetFeatureStatus(aFeature, aFailureId, &status)) &&
status != nsIGfxInfo::FEATURE_STATUS_OK)
{

View File

@ -292,16 +292,6 @@ namespace gfx {
Color ToDeviceColor(Color aColor);
Color ToDeviceColor(nscolor aColor);
/**
* Returns the first integer greater than |aNumber| which is a power of two.
*/
static int
NextPowerOfTwo(int aNumber)
{
MOZ_ASSERT(aNumber >= 0);
return RoundUpPow2((size_t)aNumber + 1);
}
/**
* Performs a checked multiply of the given width, height, and bytes-per-pixel
* values.

View File

@ -2160,8 +2160,8 @@ CreateCGContext(const LayoutDeviceIntSize& aSize)
LayoutDeviceIntSize
TextureSizeForSize(const LayoutDeviceIntSize& aSize)
{
return LayoutDeviceIntSize(gfx::NextPowerOfTwo(aSize.width),
gfx::NextPowerOfTwo(aSize.height));
return LayoutDeviceIntSize(RoundUpPow2(aSize.width),
RoundUpPow2(aSize.height));
}
// When this method is entered, mEffectsLock is already being held.