diff options
author | Romain Guy <romainguy@google.com> | 2011-07-07 21:05:04 -0700 |
---|---|---|
committer | Romain Guy <romainguy@google.com> | 2011-07-07 21:27:14 -0700 |
commit | ec19b4a764d512091a780fc93ced567dfbf80914 (patch) | |
tree | d984af1d55edf6bb305ca36617db679bc546f23a /libs | |
parent | 9ace8f5e79e76893fe4ca9e4d10f6c4056330485 (diff) | |
download | frameworks_base-ec19b4a764d512091a780fc93ced567dfbf80914.zip frameworks_base-ec19b4a764d512091a780fc93ced567dfbf80914.tar.gz frameworks_base-ec19b4a764d512091a780fc93ced567dfbf80914.tar.bz2 |
Use NEAREST filtering mode for TextureView.getBitmap().
Change-Id: I4649062bbdf18ebba7924bdf578f39ad8f6576ac
Diffstat (limited to 'libs')
-rw-r--r-- | libs/hwui/LayerRenderer.cpp | 4 | ||||
-rw-r--r-- | libs/hwui/OpenGLRenderer.cpp | 8 |
2 files changed, 8 insertions, 4 deletions
diff --git a/libs/hwui/LayerRenderer.cpp b/libs/hwui/LayerRenderer.cpp index 44f2a40..1fa343b 100644 --- a/libs/hwui/LayerRenderer.cpp +++ b/libs/hwui/LayerRenderer.cpp @@ -368,8 +368,8 @@ bool LayerRenderer::copyLayer(Layer* layer, SkBitmap* bitmap) { glActiveTexture(GL_TEXTURE0); glBindTexture(GL_TEXTURE_2D, texture); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); diff --git a/libs/hwui/OpenGLRenderer.cpp b/libs/hwui/OpenGLRenderer.cpp index cb5a82b..06e3b29 100644 --- a/libs/hwui/OpenGLRenderer.cpp +++ b/libs/hwui/OpenGLRenderer.cpp @@ -645,7 +645,9 @@ void OpenGLRenderer::drawTextureLayer(Layer* layer, const Rect& rect) { } else { setupDrawExternalTexture(layer->getTexture()); } - if (mSnapshot->transform->isPureTranslate()) { + if (mSnapshot->transform->isPureTranslate() && + layer->getWidth() == (uint32_t) rect.getWidth() && + layer->getHeight() == (uint32_t) rect.getHeight()) { const float x = (int) floorf(rect.left + mSnapshot->transform->getTranslateX() + 0.5f); const float y = (int) floorf(rect.top + mSnapshot->transform->getTranslateY() + 0.5f); @@ -673,7 +675,9 @@ void OpenGLRenderer::composeLayerRect(Layer* layer, const Rect& rect, bool swap) float y = rect.top; bool simpleTransform = mSnapshot->transform->isPureTranslate(); - if (simpleTransform) { + if (simpleTransform && + layer->getWidth() == (uint32_t) rect.getWidth() && + layer->getHeight() == (uint32_t) rect.getHeight()) { // When we're swapping, the layer is already in screen coordinates if (!swap) { x = (int) floorf(rect.left + mSnapshot->transform->getTranslateX() + 0.5f); |