diff options
author | 2015-01-29 09:45:09 -0800 | |
---|---|---|
committer | 2015-01-30 10:49:05 -0800 | |
commit | 44eb2c00861098dd3e2950d923646814b4cc57c2 (patch) | |
tree | 2d232b14b931137cc7ebb3b012c3ce4530fa5cf4 /libs/hwui/Texture.cpp | |
parent | 1b68ce327aa37ee0c4e9580d75cb6781337c4312 (diff) |
Refactor blending and texture gl state
Change-Id: Ia6b3c8b2afd3dfcee7f3ce401d846b789612054a
Diffstat (limited to 'libs/hwui/Texture.cpp')
-rw-r--r-- | libs/hwui/Texture.cpp | 52 |
1 files changed, 39 insertions, 13 deletions
diff --git a/libs/hwui/Texture.cpp b/libs/hwui/Texture.cpp index 58fd972e3a63..512f5cf0d9a3 100644 --- a/libs/hwui/Texture.cpp +++ b/libs/hwui/Texture.cpp @@ -24,18 +24,44 @@ namespace android { namespace uirenderer { -Texture::Texture(): id(0), generation(0), blend(false), width(0), height(0), - cleanup(false), bitmapSize(0), mipMap(false), uvMapper(nullptr), isInUse(false), - mWrapS(GL_CLAMP_TO_EDGE), mWrapT(GL_CLAMP_TO_EDGE), - mMinFilter(GL_NEAREST), mMagFilter(GL_NEAREST), - mFirstFilter(true), mFirstWrap(true), mCaches(Caches::getInstance()) { +Texture::Texture() + : id(0) + , generation(0) + , blend(false) + , width(0) + , height(0) + , cleanup(false) + , bitmapSize(0) + , mipMap(false) + , uvMapper(nullptr) + , isInUse(false) + , mWrapS(GL_CLAMP_TO_EDGE) + , mWrapT(GL_CLAMP_TO_EDGE) + , mMinFilter(GL_NEAREST) + , mMagFilter(GL_NEAREST) + , mFirstFilter(true) + , mFirstWrap(true) + , mCaches(Caches::getInstance()) { } -Texture::Texture(Caches& caches): id(0), generation(0), blend(false), width(0), height(0), - cleanup(false), bitmapSize(0), mipMap(false), uvMapper(nullptr), isInUse(false), - mWrapS(GL_CLAMP_TO_EDGE), mWrapT(GL_CLAMP_TO_EDGE), - mMinFilter(GL_NEAREST), mMagFilter(GL_NEAREST), - mFirstFilter(true), mFirstWrap(true), mCaches(caches) { +Texture::Texture(Caches& caches) + : id(0) + , generation(0) + , blend(false) + , width(0) + , height(0) + , cleanup(false) + , bitmapSize(0) + , mipMap(false) + , uvMapper(nullptr) + , isInUse(false) + , mWrapS(GL_CLAMP_TO_EDGE) + , mWrapT(GL_CLAMP_TO_EDGE) + , mMinFilter(GL_NEAREST) + , mMagFilter(GL_NEAREST) + , mFirstFilter(true) + , mFirstWrap(true) + , mCaches(caches) { } void Texture::setWrapST(GLenum wrapS, GLenum wrapT, bool bindTexture, bool force, @@ -48,7 +74,7 @@ void Texture::setWrapST(GLenum wrapS, GLenum wrapT, bool bindTexture, bool force mWrapT = wrapT; if (bindTexture) { - mCaches.bindTexture(renderTarget, id); + mCaches.textureState().bindTexture(renderTarget, id); } glTexParameteri(renderTarget, GL_TEXTURE_WRAP_S, wrapS); @@ -66,7 +92,7 @@ void Texture::setFilterMinMag(GLenum min, GLenum mag, bool bindTexture, bool for mMagFilter = mag; if (bindTexture) { - mCaches.bindTexture(renderTarget, id); + mCaches.textureState().bindTexture(renderTarget, id); } if (mipMap && min == GL_LINEAR) min = GL_LINEAR_MIPMAP_LINEAR; @@ -77,7 +103,7 @@ void Texture::setFilterMinMag(GLenum min, GLenum mag, bool bindTexture, bool for } void Texture::deleteTexture() const { - mCaches.deleteTexture(id); + mCaches.textureState().deleteTexture(id); } }; // namespace uirenderer |