diff options
| author | 2012-10-16 18:44:09 -0700 | |
|---|---|---|
| committer | 2012-10-16 18:44:09 -0700 | |
| commit | 713e1bb9df6bdfc21bd5c40d1a6ecf6c822a4be5 (patch) | |
| tree | d2cb42c7e05fff03274f9acdbdee80d848a86da2 /libs/hwui/Texture.h | |
| parent | d43b22da291fd08017fac627561091a633c85807 (diff) | |
Add API to enable mipmaps on Bitmap
Bug #7353771
This API can be used when scaling large images down to a small size
to get nicer looking results.
Change-Id: If09087eed36077eee5355f6047a3ca67747d7d9e
Diffstat (limited to 'libs/hwui/Texture.h')
| -rw-r--r-- | libs/hwui/Texture.h | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/libs/hwui/Texture.h b/libs/hwui/Texture.h index 03e2172a7aaf..8d88bdce3c9e 100644 --- a/libs/hwui/Texture.h +++ b/libs/hwui/Texture.h @@ -36,6 +36,8 @@ struct Texture { minFilter = GL_NEAREST; magFilter = GL_NEAREST; + mipMap = false; + firstFilter = true; firstWrap = true; @@ -83,6 +85,8 @@ struct Texture { glBindTexture(renderTarget, id); } + if (mipMap && min == GL_LINEAR) min = GL_LINEAR_MIPMAP_LINEAR; + glTexParameteri(renderTarget, GL_TEXTURE_MIN_FILTER, min); glTexParameteri(renderTarget, GL_TEXTURE_MAG_FILTER, mag); } @@ -116,7 +120,12 @@ struct Texture { * Optional, size of the original bitmap. */ uint32_t bitmapSize; + /** + * Indicates whether this texture will use trilinear filtering. + */ + bool mipMap; +private: /** * Last wrap modes set on this texture. Defaults to GL_CLAMP_TO_EDGE. */ @@ -129,7 +138,6 @@ struct Texture { GLenum minFilter; GLenum magFilter; -private: bool firstFilter; bool firstWrap; }; // struct Texture |