# Code coverage report for ol/render/webgl/webglimagecolorshader.js

## Statements: 53.57% (15 / 28) Branches: 7.69% (2 / 26) Functions: 0% (0 / 3) Lines: 53.57% (15 / 28) Ignored: none

All files » ol/render/webgl/ » webglimagecolorshader.js

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    1

    1

    1

    1
    1

    1

    1

    1

    1

    1
    1

    1

    1

    1

    1

     // This file is automatically generated, do not edit
    goog.provide('ol.render.webgl.imagereplay.shader.Color');

    goog.require('ol.webgl.shader');

    /**
     * @constructor
     * @extends {ol.webgl.shader.Fragment}
     * @struct
     */
    ol.render.webgl.imagereplay.shader.ColorFragment = function() {
      goog.base(this, ol.render.webgl.imagereplay.shader.ColorFragment.SOURCE);
    };
    goog.inherits(ol.render.webgl.imagereplay.shader.ColorFragment, ol.webgl.shader.Fragment);
    goog.addSingletonGetter(ol.render.webgl.imagereplay.shader.ColorFragment);

    /**
     * @const
     * @type {string}
     */
    ol.render.webgl.imagereplay.shader.ColorFragment.DEBUG_SOURCE = 'precision mediump float;\nvarying vec2 v_texCoord;\nvarying float v_opacity;\n\n// @see https://svn.webkit.org/repository/webkit/trunk/Source/WebCore/platform/graphics/filters/skia/SkiaImageFilterBuilder.cpp\nuniform mat4 u_colorMatrix;\nuniform float u_opacity;\nuniform sampler2D u_image;\n\nvoid main(void) {\n  vec4 texColor = texture2D(u_image, v_texCoord);\n  float alpha = texColor.a * v_opacity * u_opacity;\n  if (alpha == 0.0) {\n    discard;\n  }\n  gl_FragColor.a = alpha;\n  gl_FragColor.rgb = (u_colorMatrix * vec4(texColor.rgb, 1.)).rgb;\n}\n';

    /**
     * @const
     * @type {string}
     */
    ol.render.webgl.imagereplay.shader.ColorFragment.OPTIMIZED_SOURCE = 'precision mediump float;varying vec2 a;varying float b;uniform mat4 k;uniform float l;uniform sampler2D m;void main(void){vec4 texColor=texture2D(m,a);float alpha=texColor.a*b*l;if(alpha==0.0){discard;}gl_FragColor.a=alpha;gl_FragColor.rgb=(k*vec4(texColor.rgb,1.)).rgb;}';

    /**
     * @const
     * @type {string}
     */
    ol.render.webgl.imagereplay.shader.ColorFragment.SOURCE = goog.DEBUG ?
        ol.render.webgl.imagereplay.shader.ColorFragment.DEBUG_SOURCE :
        ol.render.webgl.imagereplay.shader.ColorFragment.OPTIMIZED_SOURCE;

    /**
     * @constructor
     * @extends {ol.webgl.shader.Vertex}
     * @struct
     */
    ol.render.webgl.imagereplay.shader.ColorVertex = function() {
      goog.base(this, ol.render.webgl.imagereplay.shader.ColorVertex.SOURCE);
    };
    goog.inherits(ol.render.webgl.imagereplay.shader.ColorVertex, ol.webgl.shader.Vertex);
    goog.addSingletonGetter(ol.render.webgl.imagereplay.shader.ColorVertex);

    /**
     * @const
     * @type {string}
     */
    ol.render.webgl.imagereplay.shader.ColorVertex.DEBUG_SOURCE = 'varying vec2 v_texCoord;\nvarying float v_opacity;\n\nattribute vec2 a_position;\nattribute vec2 a_texCoord;\nattribute vec2 a_offsets;\nattribute float a_opacity;\nattribute float a_rotateWithView;\n\nuniform mat4 u_projectionMatrix;\nuniform mat4 u_offsetScaleMatrix;\nuniform mat4 u_offsetRotateMatrix;\n\nvoid main(void) {\n  mat4 offsetMatrix = u_offsetScaleMatrix;\n  if (a_rotateWithView == 1.0) {\n    offsetMatrix = u_offsetScaleMatrix * u_offsetRotateMatrix;\n  }\n  vec4 offsets = offsetMatrix * vec4(a_offsets, 0., 0.);\n  gl_Position = u_projectionMatrix * vec4(a_position, 0., 1.) + offsets;\n  v_texCoord = a_texCoord;\n  v_opacity = a_opacity;\n}\n\n\n';

    /**
     * @const
     * @type {string}
     */
    ol.render.webgl.imagereplay.shader.ColorVertex.OPTIMIZED_SOURCE = 'varying vec2 a;varying float b;attribute vec2 c;attribute vec2 d;attribute vec2 e;attribute float f;attribute float g;uniform mat4 h;uniform mat4 i;uniform mat4 j;void main(void){mat4 offsetMatrix=i;if(g==1.0){offsetMatrix=i*j;}vec4 offsets=offsetMatrix*vec4(e,0.,0.);gl_Position=h*vec4(c,0.,1.)+offsets;a=d;b=f;}';

    /**
     * @const
     * @type {string}
     */
    ol.render.webgl.imagereplay.shader.ColorVertex.SOURCE = goog.DEBUG ?
        ol.render.webgl.imagereplay.shader.ColorVertex.DEBUG_SOURCE :
        ol.render.webgl.imagereplay.shader.ColorVertex.OPTIMIZED_SOURCE;

    /**
     * @constructor
     * @param {WebGLRenderingContext} gl GL.
     * @param {WebGLProgram} program Program.
     * @struct
     */
    ol.render.webgl.imagereplay.shader.Color.Locations = function(gl, program) {

      /**
       * @type {WebGLUniformLocation}
       */
      this.u_colorMatrix = gl.getUniformLocation(
          program, goog.DEBUG ? 'u_colorMatrix' : 'k');

      /**
       * @type {WebGLUniformLocation}
       */
      this.u_image = gl.getUniformLocation(
          program, goog.DEBUG ? 'u_image' : 'm');

      /**
       * @type {WebGLUniformLocation}
       */
      this.u_offsetRotateMatrix = gl.getUniformLocation(
          program, goog.DEBUG ? 'u_offsetRotateMatrix' : 'j');

      /**
       * @type {WebGLUniformLocation}
       */
      this.u_offsetScaleMatrix = gl.getUniformLocation(
          program, goog.DEBUG ? 'u_offsetScaleMatrix' : 'i');

      /**
       * @type {WebGLUniformLocation}
       */
      this.u_opacity = gl.getUniformLocation(
          program, goog.DEBUG ? 'u_opacity' : 'l');

      /**
       * @type {WebGLUniformLocation}
       */
      this.u_projectionMatrix = gl.getUniformLocation(
          program, goog.DEBUG ? 'u_projectionMatrix' : 'h');

      /**
       * @type {number}
       */
      this.a_offsets = gl.getAttribLocation(
          program, goog.DEBUG ? 'a_offsets' : 'e');

      /**
       * @type {number}
       */
      this.a_opacity = gl.getAttribLocation(
          program, goog.DEBUG ? 'a_opacity' : 'f');

      /**
       * @type {number}
       */
      this.a_position = gl.getAttribLocation(
          program, goog.DEBUG ? 'a_position' : 'c');

      /**
       * @type {number}
       */
      this.a_rotateWithView = gl.getAttribLocation(
          program, goog.DEBUG ? 'a_rotateWithView' : 'g');

      /**
       * @type {number}
       */
      this.a_texCoord = gl.getAttribLocation(
          program, goog.DEBUG ? 'a_texCoord' : 'd');
    };