LCOV - code coverage report
Current view: top level - gfx/skia/skia/src/gpu/glsl - GrGLSLGeometryProcessor.h (source / functions) Hit Total Coverage
Test: output.info Lines: 0 14 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 8 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /*
       2             :  * Copyright 2013 Google Inc.
       3             :  *
       4             :  * Use of this source code is governed by a BSD-style license that can be
       5             :  * found in the LICENSE file.
       6             :  */
       7             : 
       8             : #ifndef GrGLSLGeometryProcessor_DEFINED
       9             : #define GrGLSLGeometryProcessor_DEFINED
      10             : 
      11             : #include "GrGLSLPrimitiveProcessor.h"
      12             : 
      13             : class GrGLSLGPBuilder;
      14             : 
      15             : /**
      16             :  * If a GL effect needs a GrGLFullShaderBuilder* object to emit vertex code, then it must inherit
      17             :  * from this class. Since paths don't have vertices, this class is only meant to be used internally
      18             :  * by skia, for special cases.
      19             :  */
      20           0 : class GrGLSLGeometryProcessor : public GrGLSLPrimitiveProcessor {
      21             : public:
      22             :     /* Any general emit code goes in the base class emitCode.  Subclasses override onEmitCode */
      23             :     void emitCode(EmitArgs&) override;
      24             : 
      25             : protected:
      26             :     // A helper which subclasses can use if needed and used above in the default setTransformData().
      27             :     void setTransformDataHelper(const SkMatrix& localMatrix,
      28             :                                 const GrGLSLProgramDataManager& pdman,
      29             :                                 FPCoordTransformIter*);
      30             : 
      31             :     // Emit a uniform matrix for each coord transform.
      32           0 :     void emitTransforms(GrGLSLVertexBuilder* vb,
      33             :                         GrGLSLVaryingHandler* varyingHandler,
      34             :                         GrGLSLUniformHandler* uniformHandler,
      35             :                         const GrShaderVar& posVar,
      36             :                         const char* localCoords,
      37             :                         FPCoordTransformHandler* handler) {
      38           0 :         this->emitTransforms(vb, varyingHandler, uniformHandler,
      39           0 :                              posVar, localCoords, SkMatrix::I(), handler);
      40           0 :     }
      41             : 
      42             :     // Emit pre-transformed coords as a vertex attribute per coord-transform.
      43             :     void emitTransforms(GrGLSLVertexBuilder*,
      44             :                         GrGLSLVaryingHandler*,
      45             :                         GrGLSLUniformHandler*,
      46             :                         const GrShaderVar& posVar,
      47             :                         const char* localCoords,
      48             :                         const SkMatrix& localMatrix,
      49             :                         FPCoordTransformHandler*);
      50             : 
      51           0 :     struct GrGPArgs {
      52             :         // The variable used by a GP to store its position. It can be
      53             :         // either a vec2 or a vec3 depending on the presence of perspective.
      54             :         GrShaderVar fPositionVar;
      55             :     };
      56             : 
      57             :     // Create the correct type of position variable given the CTM
      58             :     void setupPosition(GrGLSLVertexBuilder*, GrGPArgs*, const char* posName);
      59             :     void setupPosition(GrGLSLVertexBuilder*,
      60             :                        GrGLSLUniformHandler* uniformHandler,
      61             :                        GrGPArgs*,
      62             :                        const char* posName,
      63             :                        const SkMatrix& mat,
      64             :                        UniformHandle* viewMatrixUniform);
      65             : 
      66           0 :     static uint32_t ComputePosKey(const SkMatrix& mat) {
      67           0 :         if (mat.isIdentity()) {
      68           0 :             return 0x0;
      69           0 :         } else if (!mat.hasPerspective()) {
      70           0 :             return 0x01;
      71             :         } else {
      72           0 :             return 0x02;
      73             :         }
      74             :     }
      75             : 
      76             : private:
      77             :     virtual void onEmitCode(EmitArgs&, GrGPArgs*) = 0;
      78             : 
      79           0 :     struct TransformUniform {
      80             :         UniformHandle  fHandle;
      81           0 :         SkMatrix       fCurrentValue = SkMatrix::InvalidMatrix();
      82             :     };
      83             : 
      84             :     SkTArray<TransformUniform, true> fInstalledTransforms;
      85             : 
      86             :     typedef GrGLSLPrimitiveProcessor INHERITED;
      87             : };
      88             : 
      89             : #endif

Generated by: LCOV version 1.13