diff options
author | Chris Craik <ccraik@google.com> | 2014-02-28 12:26:34 -0800 |
---|---|---|
committer | Chris Craik <ccraik@google.com> | 2014-02-28 12:26:34 -0800 |
commit | 67862524056ee2e73a94395139bb8bd0ec1ef38a (patch) | |
tree | 20273dae825bf5256ca8703038f7357825d090c2 /libs/hwui/OpenGLRenderer.cpp | |
parent | 9f6a372ca08c657447ef4b8dc6c80a89202247f8 (diff) | |
download | frameworks_base-67862524056ee2e73a94395139bb8bd0ec1ef38a.zip frameworks_base-67862524056ee2e73a94395139bb8bd0ec1ef38a.tar.gz frameworks_base-67862524056ee2e73a94395139bb8bd0ec1ef38a.tar.bz2 |
Fix use of Skia deprecated methods
Change-Id: Ib89c20fc94bcce29b7490d6f55c73492735befda
Diffstat (limited to 'libs/hwui/OpenGLRenderer.cpp')
-rw-r--r-- | libs/hwui/OpenGLRenderer.cpp | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/libs/hwui/OpenGLRenderer.cpp b/libs/hwui/OpenGLRenderer.cpp index 1c59c30..b620b80 100644 --- a/libs/hwui/OpenGLRenderer.cpp +++ b/libs/hwui/OpenGLRenderer.cpp @@ -52,7 +52,12 @@ namespace uirenderer { #define ALPHA_THRESHOLD 0 -#define FILTER(paint) (!paint || paint->isFilterBitmap() ? GL_LINEAR : GL_NEAREST) +static GLenum getFilter(const SkPaint* paint) { + if (!paint || paint->getFilterLevel() != SkPaint::kNone_FilterLevel) { + return GL_LINEAR; + } + return GL_NEAREST; +} /////////////////////////////////////////////////////////////////////////////// // Globals @@ -1973,7 +1978,7 @@ void OpenGLRenderer::drawAlphaBitmap(Texture* texture, float left, float top, co texture->setFilter(GL_NEAREST, true); } else { - texture->setFilter(FILTER(paint), true); + texture->setFilter(getFilter(paint), true); } // No need to check for a UV mapper on the texture object, only ARGB_8888 @@ -1998,7 +2003,7 @@ status_t OpenGLRenderer::drawBitmaps(const SkBitmap* bitmap, AssetAtlas::Entry* const AutoTexture autoCleanup(texture); texture->setWrap(GL_CLAMP_TO_EDGE, true); - texture->setFilter(pureTranslate ? GL_NEAREST : FILTER(paint), true); + texture->setFilter(pureTranslate ? GL_NEAREST : getFilter(paint), true); const float x = (int) floorf(bounds.left + 0.5f); const float y = (int) floorf(bounds.top + 0.5f); @@ -2174,7 +2179,7 @@ status_t OpenGLRenderer::drawBitmapMesh(const SkBitmap* bitmap, int meshWidth, i const AutoTexture autoCleanup(texture); texture->setWrap(GL_CLAMP_TO_EDGE, true); - texture->setFilter(FILTER(paint), true); + texture->setFilter(getFilter(paint), true); int alpha; SkXfermode::Mode mode; @@ -2259,10 +2264,10 @@ status_t OpenGLRenderer::drawBitmap(const SkBitmap* bitmap, dstLeft = x; dstTop = y; - texture->setFilter(scaled ? FILTER(paint) : GL_NEAREST, true); + texture->setFilter(scaled ? getFilter(paint) : GL_NEAREST, true); ignoreTransform = true; } else { - texture->setFilter(FILTER(paint), true); + texture->setFilter(getFilter(paint), true); } if (CC_UNLIKELY(useScaleTransform)) { @@ -3382,7 +3387,7 @@ void OpenGLRenderer::drawTextureRect(float left, float top, float right, float b paint, texture->blend, vertices, texCoords, GL_TRIANGLE_STRIP, gMeshCount, false, true); } else { - texture->setFilter(FILTER(paint), true); + texture->setFilter(getFilter(paint), true); drawTextureMesh(left, top, right, bottom, texture->id, paint, texture->blend, vertices, texCoords, GL_TRIANGLE_STRIP, gMeshCount); } |