Java Code Examples for com.android.gallery3d.common.Utils#nextPowerOf2()

The following examples show how to use com.android.gallery3d.common.Utils#nextPowerOf2() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BasicTexture.java    From Trebuchet with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Sets the content size of this texture. In OpenGL, the actual texture
 * size must be of power of 2, the size of the content may be smaller.
 */
public void setSize(int width, int height) {
    mWidth = width;
    mHeight = height;
    mTextureWidth = width > 0 ? Utils.nextPowerOf2(width) : 0;
    mTextureHeight = height > 0 ? Utils.nextPowerOf2(height) : 0;
    if (mTextureWidth > MAX_TEXTURE_SIZE || mTextureHeight > MAX_TEXTURE_SIZE) {
        Log.w(TAG, String.format("texture is too large: %d x %d",
                mTextureWidth, mTextureHeight), new Exception());
    }
}
 
Example 2
Source File: BasicTexture.java    From TurboLauncher with Apache License 2.0 5 votes vote down vote up
/**
 * Sets the content size of this texture. In OpenGL, the actual texture
 * size must be of power of 2, the size of the content may be smaller.
 */
public void setSize(int width, int height) {
    mWidth = width;
    mHeight = height;
    mTextureWidth = width > 0 ? Utils.nextPowerOf2(width) : 0;
    mTextureHeight = height > 0 ? Utils.nextPowerOf2(height) : 0;
    if (mTextureWidth > MAX_TEXTURE_SIZE || mTextureHeight > MAX_TEXTURE_SIZE) {
        Log.w(TAG, String.format("texture is too large: %d x %d",
                mTextureWidth, mTextureHeight), new Exception());
    }
}
 
Example 3
Source File: BasicTexture.java    From LB-Launcher with Apache License 2.0 5 votes vote down vote up
/**
 * Sets the content size of this texture. In OpenGL, the actual texture
 * size must be of power of 2, the size of the content may be smaller.
 */
public void setSize(int width, int height) {
    mWidth = width;
    mHeight = height;
    mTextureWidth = width > 0 ? Utils.nextPowerOf2(width) : 0;
    mTextureHeight = height > 0 ? Utils.nextPowerOf2(height) : 0;
    if (mTextureWidth > MAX_TEXTURE_SIZE || mTextureHeight > MAX_TEXTURE_SIZE) {
        Log.w(TAG, String.format("texture is too large: %d x %d",
                mTextureWidth, mTextureHeight), new Exception());
    }
}