src/opengl/gl2paintengineex/qgl2pexvertexarray_p.h
changeset 30 5dc02b23752f
parent 18 2f34d5167611
equal deleted inserted replaced
29:b72c6db6890b 30:5dc02b23752f
    98 
    98 
    99 class QGL2PEXVertexArray
    99 class QGL2PEXVertexArray
   100 {
   100 {
   101 public:
   101 public:
   102     QGL2PEXVertexArray() :
   102     QGL2PEXVertexArray() :
       
   103         vertexArray(0), vertexArrayStops(0),
   103         maxX(-2e10), maxY(-2e10), minX(2e10), minY(2e10),
   104         maxX(-2e10), maxY(-2e10), minX(2e10), minY(2e10),
   104         boundingRectDirty(true) {}
   105         boundingRectDirty(true)
       
   106     { }
       
   107     
       
   108     inline void addRect(const QRectF &rect)
       
   109     {
       
   110         qreal top = rect.top();
       
   111         qreal left = rect.left();
       
   112         qreal bottom = rect.bottom();
       
   113         qreal right = rect.right();
       
   114     
       
   115         vertexArray << QGLPoint(left, top)
       
   116                     << QGLPoint(right, top)
       
   117                     << QGLPoint(right, bottom)
       
   118                     << QGLPoint(right, bottom)
       
   119                     << QGLPoint(left, bottom)
       
   120                     << QGLPoint(left, top);        
       
   121     }
   105 
   122 
   106     void addRect(const QRectF &rect);
   123     inline void addQuad(const QRectF &rect)
       
   124     {
       
   125         qreal top = rect.top();
       
   126         qreal left = rect.left();
       
   127         qreal bottom = rect.bottom();
       
   128         qreal right = rect.right();
       
   129 
       
   130         vertexArray << QGLPoint(left, top)
       
   131                     << QGLPoint(right, top)
       
   132                     << QGLPoint(left, bottom)
       
   133                     << QGLPoint(right, bottom);
       
   134 
       
   135     }
       
   136 
       
   137     inline void addVertex(const GLfloat x, const GLfloat y)
       
   138     {
       
   139         vertexArray.add(QGLPoint(x, y));
       
   140     }
       
   141 
   107     void addPath(const QVectorPath &path, GLfloat curveInverseScale, bool outline = true);
   142     void addPath(const QVectorPath &path, GLfloat curveInverseScale, bool outline = true);
   108     void clear();
   143     void clear();
   109 
   144 
   110     QGLPoint*        data() {return vertexArray.data();}
   145     QGLPoint*        data() {return vertexArray.data();}
   111     int *stops() const { return vertexArrayStops.data(); }
   146     int *stops() const { return vertexArrayStops.data(); }