diff options
author | Bart Sears <bsears@google.com> | 2012-10-06 11:19:14 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2012-10-06 11:49:39 -0700 |
commit | 82da69ff867e4e19f0adb970933a42eb65d973ed (patch) | |
tree | 071d6e8448077adabd413c29091f67caefb66474 /src/com/android/gallery3d/ui/GLCanvasImpl.java | |
parent | 3da91380c6c8f701a9632a8da53ee551fa62063a (diff) | |
download | android_packages_apps_Snap-82da69ff867e4e19f0adb970933a42eb65d973ed.tar.gz android_packages_apps_Snap-82da69ff867e4e19f0adb970933a42eb65d973ed.tar.bz2 android_packages_apps_Snap-82da69ff867e4e19f0adb970933a42eb65d973ed.zip |
Revert "Upload screennails in tiles to prevent jank"
This CL is reported to cause images to not be displayed correctly when opened via the view intent.
Bug: 7299123
This reverts commit e29fc4a51b99f12f7fae13fae272858df2e1af36
Change-Id: I5052548a826c275cb4559eeb4721c19f06861b3d
Diffstat (limited to 'src/com/android/gallery3d/ui/GLCanvasImpl.java')
-rw-r--r-- | src/com/android/gallery3d/ui/GLCanvasImpl.java | 82 |
1 files changed, 21 insertions, 61 deletions
diff --git a/src/com/android/gallery3d/ui/GLCanvasImpl.java b/src/com/android/gallery3d/ui/GLCanvasImpl.java index 45903b3cd..d83daf3e4 100644 --- a/src/com/android/gallery3d/ui/GLCanvasImpl.java +++ b/src/com/android/gallery3d/ui/GLCanvasImpl.java @@ -415,7 +415,7 @@ public class GLCanvasImpl implements GLCanvas { // This function changes the source coordinate to the texture coordinates. // It also clips the source and target coordinates if it is beyond the // bound of the texture. - private static void convertCoordinate(RectF source, RectF target, + private void convertCoordinate(RectF source, RectF target, BasicTexture texture) { int width = texture.getWidth(); @@ -465,7 +465,23 @@ public class GLCanvasImpl implements GLCanvas { color[3] = alpha; } - private void setMixedColor(int toColor, float ratio, float alpha) { + private void drawMixed(BasicTexture from, int toColor, + float ratio, int x, int y, int width, int height, float alpha) { + // change from 0 to 0.01f to prevent getting divided by zero below + if (ratio <= 0.01f) { + drawTexture(from, x, y, width, height, alpha); + return; + } else if (ratio >= 1) { + fillRect(x, y, width, height, toColor); + return; + } + + mGLState.setBlendEnabled(mBlendEnabled && (!from.isOpaque() + || !Utils.isOpaque(toColor) || alpha < OPAQUE_ALPHA)); + + final GL11 gl = mGL; + if (!bindTexture(from)) return; + // // The formula we want: // alpha * ((1 - ratio) * from + ratio * to) @@ -479,6 +495,9 @@ public class GLCanvasImpl implements GLCanvas { float combo = alpha * (1 - ratio); float scale = alpha * ratio / (1 - combo); + // Interpolate the RGB and alpha values between both textures. + mGLState.setTexEnvMode(GL11.GL_COMBINE); + // Specify the interpolation factor via the alpha component of // GL_TEXTURE_ENV_COLORs. // RGB component are get from toColor and will used as SRC1 @@ -486,7 +505,6 @@ public class GLCanvasImpl implements GLCanvas { setTextureColor(((toColor >>> 16) & 0xff) * colorScale, ((toColor >>> 8) & 0xff) * colorScale, (toColor & 0xff) * colorScale, combo); - GL11 gl = mGL; gl.glTexEnvfv(GL11.GL_TEXTURE_ENV, GL11.GL_TEXTURE_ENV_COLOR, mTextureColor, 0); gl.glTexEnvf(GL11.GL_TEXTURE_ENV, GL11.GL_COMBINE_RGB, GL11.GL_INTERPOLATE); @@ -504,64 +522,6 @@ public class GLCanvasImpl implements GLCanvas { gl.glTexEnvf(GL11.GL_TEXTURE_ENV, GL11.GL_SRC2_ALPHA, GL11.GL_CONSTANT); gl.glTexEnvf(GL11.GL_TEXTURE_ENV, GL11.GL_OPERAND2_ALPHA, GL11.GL_SRC_ALPHA); - } - - @Override - public void drawMixed(BasicTexture from, int toColor, float ratio, - RectF source, RectF target) { - if (target.width() <= 0 || target.height() <= 0) return; - - if (ratio <= 0.01f) { - drawTexture(from, source, target); - return; - } else if (ratio >= 1) { - fillRect(target.left, target.top, target.width(), target.height(), toColor); - return; - } - - float alpha = mAlpha; - - // Copy the input to avoid changing it. - mDrawTextureSourceRect.set(source); - mDrawTextureTargetRect.set(target); - source = mDrawTextureSourceRect; - target = mDrawTextureTargetRect; - - mGLState.setBlendEnabled(mBlendEnabled && (!from.isOpaque() - || !Utils.isOpaque(toColor) || alpha < OPAQUE_ALPHA)); - - if (!bindTexture(from)) return; - - // Interpolate the RGB and alpha values between both textures. - mGLState.setTexEnvMode(GL11.GL_COMBINE); - setMixedColor(toColor, ratio, alpha); - convertCoordinate(source, target, from); - setTextureCoords(source); - textureRect(target.left, target.top, target.width(), target.height()); - mGLState.setTexEnvMode(GL11.GL_REPLACE); - } - - private void drawMixed(BasicTexture from, int toColor, - float ratio, int x, int y, int width, int height, float alpha) { - // change from 0 to 0.01f to prevent getting divided by zero below - if (ratio <= 0.01f) { - drawTexture(from, x, y, width, height, alpha); - return; - } else if (ratio >= 1) { - fillRect(x, y, width, height, toColor); - return; - } - - mGLState.setBlendEnabled(mBlendEnabled && (!from.isOpaque() - || !Utils.isOpaque(toColor) || alpha < OPAQUE_ALPHA)); - - final GL11 gl = mGL; - if (!bindTexture(from)) return; - - // Interpolate the RGB and alpha values between both textures. - mGLState.setTexEnvMode(GL11.GL_COMBINE); - setMixedColor(toColor, ratio, alpha); - drawBoundTexture(from, x, y, width, height); mGLState.setTexEnvMode(GL11.GL_REPLACE); } |