diff options
-rw-r--r-- | android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/LayerRenderer.java | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/LayerRenderer.java b/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/LayerRenderer.java index 5146b229bdf8..34c5c61b116d 100644 --- a/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/LayerRenderer.java +++ b/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/LayerRenderer.java @@ -99,6 +99,11 @@ public class LayerRenderer implements GLSurfaceView.Renderer { // The shaders run on the GPU directly, the vertex shader is only applying the // matrix transform detailed above + + // Note we flip the y-coordinate in the vertex shader from a + // coordinate system with (0,0) in the top left to one with (0,0) in + // the bottom left. + public static final String DEFAULT_VERTEX_SHADER = "uniform mat4 uTMatrix;\n" + "attribute vec4 vPosition;\n" + @@ -106,18 +111,21 @@ public class LayerRenderer implements GLSurfaceView.Renderer { "varying vec2 vTexCoord;\n" + "void main() {\n" + " gl_Position = uTMatrix * vPosition;\n" + - " vTexCoord = aTexCoord;\n" + + " vTexCoord.x = aTexCoord.x;\n" + + " vTexCoord.y = 1.0 - aTexCoord.y;\n" + "}\n"; - // Note we flip the y-coordinate in the fragment shader from a - // coordinate system with (0,0) in the top left to one with (0,0) in - // the bottom left. + // We use highp because the screenshot textures + // we use are large and we stretch them alot + // so we need all the precision we can get. + // Unfortunately, highp is not required by ES 2.0 + // so on GPU's like Mali we end up getting mediump public static final String DEFAULT_FRAGMENT_SHADER = - "precision mediump float;\n" + + "precision highp float;\n" + "varying vec2 vTexCoord;\n" + "uniform sampler2D sTexture;\n" + "void main() {\n" + - " gl_FragColor = texture2D(sTexture, vec2(vTexCoord.x, 1.0 - vTexCoord.y));\n" + + " gl_FragColor = texture2D(sTexture, vTexCoord);\n" + "}\n"; public void setCheckerboardBitmap(Bitmap bitmap, float pageWidth, float pageHeight) { |