Loading libs/hwui/LayerRenderer.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -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); Loading libs/hwui/OpenGLRenderer.cpp +6 −2 Original line number Diff line number Diff line Loading @@ -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); Loading Loading @@ -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); Loading tests/HwAccelerationTest/src/com/android/test/hwui/GLTextureViewActivity.java +26 −1 Original line number Diff line number Diff line Loading @@ -16,6 +16,8 @@ package com.android.test.hwui; import android.animation.Animator; import android.animation.AnimatorListenerAdapter; import android.animation.ObjectAnimator; import android.animation.ValueAnimator; import android.app.Activity; Loading @@ -40,6 +42,10 @@ import javax.microedition.khronos.egl.EGLDisplay; import javax.microedition.khronos.egl.EGLSurface; import javax.microedition.khronos.opengles.GL; import java.io.BufferedOutputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.nio.ByteBuffer; import java.nio.ByteOrder; import java.nio.FloatBuffer; Loading @@ -57,6 +63,25 @@ public class GLTextureViewActivity extends Activity implements TextureView.Surfa mTextureView = new TextureView(this); mTextureView.setSurfaceTextureListener(this); mTextureView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Bitmap b = mTextureView.getBitmap(600, 350); BufferedOutputStream out = null; try { out = new BufferedOutputStream(new FileOutputStream("/sdcard/out.png")); b.compress(Bitmap.CompressFormat.PNG, 100, out); } catch (FileNotFoundException e) { e.printStackTrace(); } finally { if (out != null) try { out.close(); } catch (IOException e) { e.printStackTrace(); } } } }); setContentView(mTextureView, new FrameLayout.LayoutParams( ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT, Loading @@ -77,7 +102,7 @@ public class GLTextureViewActivity extends Activity implements TextureView.Surfa animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator animation) { ((View) mTextureView.getParent()).invalidate(); mTextureView.invalidate(); } }); animator.start(); Loading tests/HwAccelerationTest/src/com/android/test/hwui/TextureViewActivity.java +0 −3 Original line number Diff line number Diff line Loading @@ -16,7 +16,6 @@ package com.android.test.hwui; import android.animation.AnimatorSet; import android.app.Activity; import android.graphics.SurfaceTexture; import android.hardware.Camera; Loading @@ -34,7 +33,6 @@ public class TextureViewActivity extends Activity implements TextureView.Surface private Camera mCamera; private TextureView mTextureView; private FrameLayout mContent; private AnimatorSet mAnimatorSet; @Override protected void onCreate(Bundle savedInstanceState) { Loading @@ -53,7 +51,6 @@ public class TextureViewActivity extends Activity implements TextureView.Surface @Override public void onClick(View v) { if (mAdded) { if (mAnimatorSet != null) mAnimatorSet.cancel(); mContent.removeView(mTextureView); } else { mContent.addView(mTextureView); Loading Loading
libs/hwui/LayerRenderer.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -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); Loading
libs/hwui/OpenGLRenderer.cpp +6 −2 Original line number Diff line number Diff line Loading @@ -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); Loading Loading @@ -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); Loading
tests/HwAccelerationTest/src/com/android/test/hwui/GLTextureViewActivity.java +26 −1 Original line number Diff line number Diff line Loading @@ -16,6 +16,8 @@ package com.android.test.hwui; import android.animation.Animator; import android.animation.AnimatorListenerAdapter; import android.animation.ObjectAnimator; import android.animation.ValueAnimator; import android.app.Activity; Loading @@ -40,6 +42,10 @@ import javax.microedition.khronos.egl.EGLDisplay; import javax.microedition.khronos.egl.EGLSurface; import javax.microedition.khronos.opengles.GL; import java.io.BufferedOutputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.nio.ByteBuffer; import java.nio.ByteOrder; import java.nio.FloatBuffer; Loading @@ -57,6 +63,25 @@ public class GLTextureViewActivity extends Activity implements TextureView.Surfa mTextureView = new TextureView(this); mTextureView.setSurfaceTextureListener(this); mTextureView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Bitmap b = mTextureView.getBitmap(600, 350); BufferedOutputStream out = null; try { out = new BufferedOutputStream(new FileOutputStream("/sdcard/out.png")); b.compress(Bitmap.CompressFormat.PNG, 100, out); } catch (FileNotFoundException e) { e.printStackTrace(); } finally { if (out != null) try { out.close(); } catch (IOException e) { e.printStackTrace(); } } } }); setContentView(mTextureView, new FrameLayout.LayoutParams( ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT, Loading @@ -77,7 +102,7 @@ public class GLTextureViewActivity extends Activity implements TextureView.Surfa animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator animation) { ((View) mTextureView.getParent()).invalidate(); mTextureView.invalidate(); } }); animator.start(); Loading
tests/HwAccelerationTest/src/com/android/test/hwui/TextureViewActivity.java +0 −3 Original line number Diff line number Diff line Loading @@ -16,7 +16,6 @@ package com.android.test.hwui; import android.animation.AnimatorSet; import android.app.Activity; import android.graphics.SurfaceTexture; import android.hardware.Camera; Loading @@ -34,7 +33,6 @@ public class TextureViewActivity extends Activity implements TextureView.Surface private Camera mCamera; private TextureView mTextureView; private FrameLayout mContent; private AnimatorSet mAnimatorSet; @Override protected void onCreate(Bundle savedInstanceState) { Loading @@ -53,7 +51,6 @@ public class TextureViewActivity extends Activity implements TextureView.Surface @Override public void onClick(View v) { if (mAdded) { if (mAnimatorSet != null) mAnimatorSet.cancel(); mContent.removeView(mTextureView); } else { mContent.addView(mTextureView); Loading