Home | History | Annotate | Download | only in fragment
      1 /*
      2  * Copyright (C) 2013 The Android Open Source Project
      3  *
      4  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
      5  * in compliance with the License. You may obtain a copy of the License at
      6  *
      7  * http://www.apache.org/licenses/LICENSE-2.0
      8  *
      9  * Unless required by applicable law or agreed to in writing, software distributed under the License
     10  * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
     11  * or implied. See the License for the specific language governing permissions and limitations under
     12  * the License.
     13  */
     14 precision mediump float;
     15 uniform sampler2D u_Texture;
     16 uniform vec2 u_Scale;
     17 varying vec2 v_TexCoordinate;
     18 void main() {
     19   float weights[11];
     20   weights[0] = 0.047748641153356156;
     21   weights[1] = 0.05979670798364139;
     22   weights[2] = 0.07123260215138659;
     23   weights[3] = 0.08071711293576822;
     24   weights[4] = 0.08700369673862933;
     25   weights[5] = 0.08920620580763855;
     26   weights[6] = 0.08700369673862933;
     27   weights[7] = 0.08071711293576822;
     28   weights[8] = 0.07123260215138659;
     29   weights[9] = 0.05979670798364139;
     30   weights[10] = 0.047748641153356156;
     31   vec4 color = vec4(0.0, 0.0, 0.0, 0.0);
     32   for (int i = 0; i < 11; i++) {
     33     vec2 coords = v_TexCoordinate.xy + ((float(i) - 5.0) * u_Scale);
     34     color += texture2D(u_Texture, coords) * weights[i];
     35   }
     36   gl_FragColor = color;
     37 }