android / platform / cts / a132af6f95074f34298384b7b217afc42d76b30b / . / suite / cts / deviceTests / opengl / assets / fragment / blur

/* | |

* Copyright (C) 2013 The Android Open Source Project | |

* | |

* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except | |

* in compliance with the License. You may obtain a copy of the License at | |

* | |

* http://www.apache.org/licenses/LICENSE-2.0 | |

* | |

* Unless required by applicable law or agreed to in writing, software distributed under the License | |

* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express | |

* or implied. See the License for the specific language governing permissions and limitations under | |

* the License. | |

*/ | |

precision mediump float; | |

uniform sampler2D u_Texture; | |

uniform vec2 u_Scale; | |

varying vec2 v_TexCoordinate; | |

void main() { | |

float weights[11]; | |

weights[0] = 0.047748641153356156; | |

weights[1] = 0.05979670798364139; | |

weights[2] = 0.07123260215138659; | |

weights[3] = 0.08071711293576822; | |

weights[4] = 0.08700369673862933; | |

weights[5] = 0.08920620580763855; | |

weights[6] = 0.08700369673862933; | |

weights[7] = 0.08071711293576822; | |

weights[8] = 0.07123260215138659; | |

weights[9] = 0.05979670798364139; | |

weights[10] = 0.047748641153356156; | |

vec4 color = vec4(0.0, 0.0, 0.0, 0.0); | |

for (int i = 0; i < 11; i++) { | |

vec2 coords = v_TexCoordinate.xy + ((float(i) - 5.0) * u_Scale); | |

color += texture2D(u_Texture, coords) * weights[i]; | |

} | |

gl_FragColor = color; | |

} |