diff options
author | Romain Guy <romainguy@google.com> | 2013-09-24 18:44:54 -0700 |
---|---|---|
committer | Romain Guy <romainguy@google.com> | 2013-09-25 22:31:31 +0000 |
commit | 318ae7bb92869d99a05388c598ad105e7aa4cdbd (patch) | |
tree | 45220c2560535adb2b4c4dc81470ce7c20347d27 /libs/hwui/font/CacheTexture.cpp | |
parent | 8e4b16d67851ad5eb91c82955b3c3d59f0770b6b (diff) | |
download | frameworks_base-318ae7bb92869d99a05388c598ad105e7aa4cdbd.zip frameworks_base-318ae7bb92869d99a05388c598ad105e7aa4cdbd.tar.gz frameworks_base-318ae7bb92869d99a05388c598ad105e7aa4cdbd.tar.bz2 |
Take SkBitmap's stride into account when uploading textures
Bug #10151807
Change-Id: I7ba4804fa3619088fea70eb55f10519fff0bf5f0
Diffstat (limited to 'libs/hwui/font/CacheTexture.cpp')
-rw-r--r-- | libs/hwui/font/CacheTexture.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/libs/hwui/font/CacheTexture.cpp b/libs/hwui/font/CacheTexture.cpp index cbed3e4..d5f38b5 100644 --- a/libs/hwui/font/CacheTexture.cpp +++ b/libs/hwui/font/CacheTexture.cpp @@ -119,7 +119,7 @@ CacheTexture::CacheTexture(uint16_t width, uint16_t height, GLenum format, uint3 // OpenGL ES 3.0+ lets us specify the row length for unpack operations such // as glTexSubImage2D(). This allows us to upload a sub-rectangle of a texture. // With OpenGL ES 2.0 we have to upload entire stripes instead. - mHasES3 = Extensions::getInstance().getMajorGlVersion() >= 3; + mHasUnpackRowLength = Extensions::getInstance().hasUnpackRowLength(); } CacheTexture::~CacheTexture() { @@ -206,21 +206,21 @@ void CacheTexture::allocateTexture() { bool CacheTexture::upload() { const Rect& dirtyRect = mDirtyRect; - uint32_t x = mHasES3 ? dirtyRect.left : 0; + uint32_t x = mHasUnpackRowLength ? dirtyRect.left : 0; uint32_t y = dirtyRect.top; - uint32_t width = mHasES3 ? dirtyRect.getWidth() : mWidth; + uint32_t width = mHasUnpackRowLength ? dirtyRect.getWidth() : mWidth; uint32_t height = dirtyRect.getHeight(); // The unpack row length only needs to be specified when a new // texture is bound - if (mHasES3) { + if (mHasUnpackRowLength) { glPixelStorei(GL_UNPACK_ROW_LENGTH, mWidth); } mTexture->upload(x, y, width, height); setDirty(false); - return mHasES3; + return mHasUnpackRowLength; } void CacheTexture::setDirty(bool dirty) { |