Qt 4.8
Public Types | Public Functions | Static Public Functions | Public Variables | List of all members
QGL2PaintEngineExPrivate Class Reference

#include <qpaintengineex_opengl2_p.h>

Inheritance diagram for QGL2PaintEngineExPrivate:
QPaintEngineExPrivate QPaintEnginePrivate

Public Types

enum  StencilFillMode { OddEvenFillMode, WindingFillMode, TriStripStrokeFillMode }
 

Public Functions

void clearClip (uint value)
 
void composite (const QGLRect &boundingRect)
 
void drawCachedGlyphs (QFontEngineGlyphCache::Type glyphType, QStaticTextItem *staticTextItem)
 
void drawPixmapFragments (const QPainter::PixmapFragment *fragments, int fragmentCount, const QPixmap &pixmap, const QSize &size, QPainter::PixmapFragmentHints hints)
 
void drawPixmapFragments (const QRectF *targetRects, const QRectF *sourceRects, int fragmentCount, const QPixmap &pixmap, const QSize &size, QPainter::PixmapFragmentHints hints)
 
void drawTexture (const QGLRect &dest, const QGLRect &src, const QSize &textureSize, bool opaque, bool pattern=false)
 
void drawVertexArrays (const float *data, int *stops, int stopCount, GLenum primitive)
 
void drawVertexArrays (QGL2PEXVertexArray &vertexArray, GLenum primitive)
 
void fill (const QVectorPath &path)
 
void fillStencilWithVertexArray (const float *data, int count, int *stops, int stopCount, const QGLRect &bounds, StencilFillMode mode)
 
void fillStencilWithVertexArray (QGL2PEXVertexArray &vertexArray, bool useWindingFill)
 
GLuint location (const QGLEngineShaderManager::Uniform uniform)
 
bool prepareForDraw (bool srcPixelsAreOpaque)
 
 QGL2PaintEngineExPrivate (QGL2PaintEngineEx *q_ptr)
 
void regenerateClip ()
 
void resetClipIfNeeded ()
 
void resetGLState ()
 
void setBrush (const QBrush &brush)
 
void setScissor (const QRect &rect)
 
void setVertexAttributePointer (unsigned int arrayIndex, const GLfloat *pointer)
 
void stroke (const QVectorPath &path, const QPen &pen)
 
void systemStateChanged ()
 
void transferMode (EngineMode newMode)
 
void updateBrushTexture ()
 
void updateBrushUniforms ()
 
void updateClipScissorTest ()
 
void updateCompositionMode ()
 
void updateMatrix ()
 
void updateTextureFilter (GLenum target, GLenum wrapMode, bool smoothPixmapTransform, GLuint id=-1)
 
void useSimpleShader ()
 
void writeClip (const QVectorPath &path, uint value)
 
 ~QGL2PaintEngineExPrivate ()
 
- Public Functions inherited from QPaintEngineExPrivate
bool hasClipOperations () const
 
 QPaintEngineExPrivate ()
 
void replayClipOperations ()
 
 ~QPaintEngineExPrivate ()
 
- Public Functions inherited from QPaintEnginePrivate
void drawBoxTextItem (const QPointF &p, const QTextItemInt &ti)
 
 QPaintEnginePrivate ()
 
void setSystemTransform (const QTransform &xform)
 
void setSystemViewport (const QRegion &region)
 
void transformSystemClip ()
 
virtual ~QPaintEnginePrivate ()
 

Static Public Functions

static void cleanupVectorPath (QPaintEngineEx *engine, void *data)
 
static QGL2PaintEngineExPrivategetData (QGL2PaintEngineEx *engine)
 
static QGLEngineShaderManagershaderManagerForEngine (QGL2PaintEngineEx *engine)
 

Public Variables

QScopedPointer< QPixmapFilterblurFilter
 
bool brushTextureDirty
 
bool brushUniformsDirty
 
QScopedPointer< QPixmapFiltercolorizeFilter
 
bool compositionModeDirty
 
QScopedPointer< QPixmapFilterconvolutionFilter
 
QGLContextctx
 
QBrush currentBrush
 
QPixmap currentBrushPixmap
 
QRect currentScissorBounds
 
QDashedStrokeProcessor dasher
 
GLfloat depthRange [2]
 
QGLPaintDevicedevice
 
QRegion dirtyStencilRegion
 
QScopedPointer< QPixmapFilterdropShadowFilter
 
QVector< GLushort > elementIndices
 
GLuint elementIndicesVBOId
 
QFontEngineGlyphCache::Type glyphCacheType
 
bool hasCompatibilityExtension
 
int height
 
bool imageDrawingMode
 
GLfloat inverseScale
 
GLuint lastMaskTextureUsed
 
GLuint lastTextureUsed
 
bool matrixDirty
 
bool matrixUniformDirty
 
uint maxClip
 
EngineMode mode
 
bool multisamplingAlwaysEnabled
 
bool nativePaintingActive
 
bool needsSync
 
const QBrush noBrush
 
QDataBuffer< GLfloat > opacityArray
 
bool opacityUniformDirty
 
QSet< QVectorPath::CacheEntry * > pathCaches
 
GLfloat pmvMatrix [3][3]
 
QGL2PaintEngineExq
 
QGLEngineShaderManagershaderManager
 
bool snapToPixelGrid
 
GLfloat staticTextureCoordinateArray [8]
 
GLfloat staticVertexCoordinateArray [8]
 
bool stencilClean
 
QTriangulatingStroker stroker
 
QGL2PEXVertexArray textureCoordinateArray
 
float textureInvertedY
 
QVector< GLuint > unusedIBOSToClean
 
QVector< GLuint > unusedVBOSToClean
 
bool useSystemClip
 
const GLfloat * vertexAttribPointers [3]
 
QGL2PEXVertexArray vertexCoordinateArray
 
int width
 
- Public Variables inherited from QPaintEngineExPrivate
QStrokerOpsactiveStroker
 
QDashStroker dasher
 
QRect exDeviceRect
 
StrokeHandlerstrokeHandler
 
QStroker stroker
 
QPen strokerPen
 
- Public Variables inherited from QPaintEnginePrivate
QWidgetcurrentClipWidget
 
uint hasSystemTransform: 1
 
uint hasSystemViewport: 1
 
QPaintDevicepdev
 
QPaintEngineq_ptr
 
QRegion systemClip
 
QRect systemRect
 
QTransform systemTransform
 
QRegion systemViewport
 

Detailed Description

Definition at line 169 of file qpaintengineex_opengl2_p.h.

Enumerations

◆ StencilFillMode

Constructors and Destructors

◆ QGL2PaintEngineExPrivate()

QGL2PaintEngineExPrivate::QGL2PaintEngineExPrivate ( QGL2PaintEngineEx q_ptr)
inline

Definition at line 179 of file qpaintengineex_opengl2_p.h.

179  :
180  q(q_ptr),
181  shaderManager(0),
182  width(0), height(0),
183  ctx(0),
184  useSystemClip(true),
186  opacityArray(0),
187  snapToPixelGrid(false),
188  nativePaintingActive(false),
189  inverseScale(1),
192  { }
QGLEngineShaderManager * shaderManager
QDataBuffer< GLfloat > opacityArray

◆ ~QGL2PaintEngineExPrivate()

QGL2PaintEngineExPrivate::~QGL2PaintEngineExPrivate ( )

Definition at line 114 of file qpaintengineex_opengl2.cpp.

115 {
116  delete shaderManager;
117 
118  while (pathCaches.size()) {
120  e->cleanup(e->engine, e->data);
121  e->data = 0;
122  e->engine = 0;
123  }
124 
125  if (elementIndicesVBOId != 0) {
128  }
129 }
QSet< QVectorPath::CacheEntry * > pathCaches
QGLEngineShaderManager * shaderManager
int size() const
Definition: qset.h:75
QPaintEngineEx * engine
#define glDeleteBuffers
qvectorpath_cache_cleanup cleanup
const_iterator constBegin() const
Definition: qset.h:168

Functions

◆ cleanupVectorPath()

void QGL2PaintEngineExPrivate::cleanupVectorPath ( QPaintEngineEx engine,
void *  data 
)
static

Definition at line 705 of file qpaintengineex_opengl2.cpp.

Referenced by fill().

706 {
708 #ifdef QT_OPENGL_CACHE_AS_VBOS
709  Q_ASSERT(engine->type() == QPaintEngine::OpenGL2);
710  static_cast<QGL2PaintEngineEx *>(engine)->d_func()->unusedVBOSToClean << c->vbo;
711  if (c->ibo)
712  d->unusedIBOSToClean << c->ibo;
713 #else
714  Q_UNUSED(engine);
715  qFree(c->vertices);
716  qFree(c->indices);
717 #endif
718  delete c;
719 }
double d
Definition: qnumeric_p.h:62
unsigned char c[8]
Definition: qnumeric_p.h:62
Q_CORE_EXPORT void qFree(void *ptr)
Definition: qmalloc.cpp:58
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
virtual Type type() const =0
Reimplement this function to return the paint engine Type.
static const char * data(const QByteArray &arr)
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
Definition: qglobal.h:1729

◆ clearClip()

void QGL2PaintEngineExPrivate::clearClip ( uint  value)

Definition at line 2317 of file qpaintengineex_opengl2.cpp.

2318 {
2320 
2321  glStencilMask(0xff);
2322  glClearStencil(value);
2323  glClear(GL_STENCIL_BUFFER_BIT);
2324  glStencilMask(0x0);
2325 
2326  q->state()->needsClipBufferClear = false;
2327 }
#define GL_STENCIL_BUFFER_BIT
QOpenGL2PaintEngineState * state()

◆ composite()

void QGL2PaintEngineExPrivate::composite ( const QGLRect boundingRect)

Definition at line 1169 of file qpaintengineex_opengl2.cpp.

Referenced by fill(), fillStencilWithVertexArray(), and resetClipIfNeeded().

1170 {
1171  setCoords(staticVertexCoordinateArray, boundingRect);
1173  glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
1174 }
void setVertexAttributePointer(unsigned int arrayIndex, const GLfloat *pointer)
static void setCoords(GLfloat *coords, const QGLRect &rect)
#define GL_TRIANGLE_FAN
static const GLuint QT_VERTEX_COORDS_ATTR

◆ drawCachedGlyphs()

void QGL2PaintEngineExPrivate::drawCachedGlyphs ( QFontEngineGlyphCache::Type  glyphType,
QStaticTextItem staticTextItem 
)

Definition at line 1592 of file qpaintengineex_opengl2.cpp.

1594 {
1596 
1598 
1599  void *cacheKey = const_cast<QGLContext *>(QGLContextPrivate::contextGroup(ctx)->context());
1600  bool recreateVertexArrays = false;
1601 
1602  QGLTextureGlyphCache *cache =
1603  (QGLTextureGlyphCache *) staticTextItem->fontEngine()->glyphCache(cacheKey, glyphType, QTransform());
1604  if (!cache || cache->cacheType() != glyphType || cache->context() == 0) {
1605  cache = new QGLTextureGlyphCache(ctx, glyphType, QTransform());
1606  staticTextItem->fontEngine()->setGlyphCache(cacheKey, cache);
1607  cache->insert(ctx, cache);
1608  recreateVertexArrays = true;
1609  }
1610 
1611  if (staticTextItem->userDataNeedsUpdate) {
1612  recreateVertexArrays = true;
1613  } else if (staticTextItem->userData() == 0) {
1614  recreateVertexArrays = true;
1615  } else if (staticTextItem->userData()->type != QStaticTextUserData::OpenGLUserData) {
1616  recreateVertexArrays = true;
1617  } else {
1618  QOpenGLStaticTextUserData *userData = static_cast<QOpenGLStaticTextUserData *>(staticTextItem->userData());
1619  if (userData->glyphType != glyphType) {
1620  recreateVertexArrays = true;
1621  } else if (userData->cacheSerialNumber != cache->serialNumber()) {
1622  recreateVertexArrays = true;
1623  }
1624  }
1625 
1626  // We only need to update the cache with new glyphs if we are actually going to recreate the vertex arrays.
1627  // If the cache size has changed, we do need to regenerate the vertices, but we don't need to repopulate the
1628  // cache so this text is performed before we test if the cache size has changed.
1629  if (recreateVertexArrays) {
1630  cache->setPaintEnginePrivate(this);
1631  if (!cache->populate(staticTextItem->fontEngine(), staticTextItem->numGlyphs,
1632  staticTextItem->glyphs, staticTextItem->glyphPositions)) {
1633  // No space for glyphs in cache. We need to reset it and try again.
1634  cache->clear();
1635  cache->populate(staticTextItem->fontEngine(), staticTextItem->numGlyphs,
1636  staticTextItem->glyphs, staticTextItem->glyphPositions);
1637  }
1638  cache->fillInPendingGlyphs();
1639  }
1640 
1641  if (cache->width() == 0 || cache->height() == 0)
1642  return;
1643 
1645 
1646  int margin = cache->glyphMargin();
1647 
1648  GLfloat dx = 1.0 / cache->width();
1649  GLfloat dy = 1.0 / cache->height();
1650 
1651  // Use global arrays by default
1652  QGL2PEXVertexArray *vertexCoordinates = &vertexCoordinateArray;
1653  QGL2PEXVertexArray *textureCoordinates = &textureCoordinateArray;
1654 
1655  if (staticTextItem->useBackendOptimizations) {
1656  QOpenGLStaticTextUserData *userData = 0;
1657 
1658  if (staticTextItem->userData() == 0
1659  || staticTextItem->userData()->type != QStaticTextUserData::OpenGLUserData) {
1660 
1661  userData = new QOpenGLStaticTextUserData();
1662  staticTextItem->setUserData(userData);
1663 
1664  } else {
1665  userData = static_cast<QOpenGLStaticTextUserData*>(staticTextItem->userData());
1666  }
1667 
1668  userData->glyphType = glyphType;
1669  userData->cacheSerialNumber = cache->serialNumber();
1670 
1671  // Use cache if backend optimizations is turned on
1672  vertexCoordinates = &userData->vertexCoordinateArray;
1673  textureCoordinates = &userData->textureCoordinateArray;
1674 
1675  QSize size(cache->width(), cache->height());
1676  if (userData->cacheSize != size) {
1677  recreateVertexArrays = true;
1678  userData->cacheSize = size;
1679  }
1680  }
1681 
1682  if (recreateVertexArrays) {
1683  vertexCoordinates->clear();
1684  textureCoordinates->clear();
1685 
1686  bool supportsSubPixelPositions = staticTextItem->fontEngine()->supportsSubPixelPositions();
1687  for (int i=0; i<staticTextItem->numGlyphs; ++i) {
1688  QFixed subPixelPosition;
1689  if (supportsSubPixelPositions)
1690  subPixelPosition = cache->subPixelPositionForX(staticTextItem->glyphPositions[i].x);
1691 
1692  QTextureGlyphCache::GlyphAndSubPixelPosition glyph(staticTextItem->glyphs[i], subPixelPosition);
1693 
1694  const QTextureGlyphCache::Coord &c = cache->coords[glyph];
1695  if (c.isNull())
1696  continue;
1697 
1698  int x = qFloor(staticTextItem->glyphPositions[i].x) + c.baseLineX - margin;
1699  int y = qFloor(staticTextItem->glyphPositions[i].y) - c.baseLineY - margin;
1700 
1701  vertexCoordinates->addQuad(QRectF(x, y, c.w, c.h));
1702  textureCoordinates->addQuad(QRectF(c.x*dx, c.y*dy, c.w * dx, c.h * dy));
1703  }
1704 
1705  staticTextItem->userDataNeedsUpdate = false;
1706  }
1707 
1708  int numGlyphs = vertexCoordinates->vertexCount() / 4;
1709  if (numGlyphs == 0)
1710  return;
1711 
1712  if (elementIndices.size() < numGlyphs*6) {
1713  Q_ASSERT(elementIndices.size() % 6 == 0);
1714  int j = elementIndices.size() / 6 * 4;
1715  while (j < numGlyphs*4) {
1716  elementIndices.append(j + 0);
1717  elementIndices.append(j + 0);
1718  elementIndices.append(j + 1);
1719  elementIndices.append(j + 2);
1720  elementIndices.append(j + 3);
1721  elementIndices.append(j + 3);
1722 
1723  j += 4;
1724  }
1725 
1726 #if defined(QT_OPENGL_DRAWCACHEDGLYPHS_INDEX_ARRAY_VBO)
1727  if (elementIndicesVBOId == 0)
1729 
1733 #endif
1734  } else {
1735 #if defined(QT_OPENGL_DRAWCACHEDGLYPHS_INDEX_ARRAY_VBO)
1737 #endif
1738  }
1739 
1740  setVertexAttributePointer(QT_VERTEX_COORDS_ATTR, (GLfloat*)vertexCoordinates->data());
1741  setVertexAttributePointer(QT_TEXTURE_COORDS_ATTR, (GLfloat*)textureCoordinates->data());
1742 
1743  if (!snapToPixelGrid) {
1744  snapToPixelGrid = true;
1745  matrixDirty = true;
1746  }
1747 
1748  QBrush pensBrush = q->state()->pen.brush();
1749 
1750  bool srgbFrameBufferEnabled = false;
1751  if (pensBrush.style() == Qt::SolidPattern &&
1753 #if defined(Q_WS_MAC)
1754  if (glyphType == QFontEngineGlyphCache::Raster_RGBMask)
1755 #elif defined(Q_WS_WIN)
1757 #else
1758  if (false)
1759 #endif
1760  {
1761  QColor c = pensBrush.color();
1765  c = QColor::fromRgbF(red, green, blue, c.alphaF());
1766  pensBrush.setColor(c);
1767 
1768  glEnable(FRAMEBUFFER_SRGB_EXT);
1769  srgbFrameBufferEnabled = true;
1770  }
1771  }
1772 
1773  setBrush(pensBrush);
1774 
1775  if (glyphType == QFontEngineGlyphCache::Raster_RGBMask) {
1776  // Subpixel antialiasing with gamma correction
1779  || compMode == QPainter::CompositionMode_SourceOver);
1780 
1782 
1783  if (pensBrush.style() == Qt::SolidPattern) {
1784  // Solid patterns can get away with only one pass.
1785  QColor c = pensBrush.color();
1786  qreal oldOpacity = q->state()->opacity;
1787  if (compMode == QPainter::CompositionMode_Source) {
1788  c = qt_premultiplyColor(c, q->state()->opacity);
1789  q->state()->opacity = 1;
1790  opacityUniformDirty = true;
1791  }
1792 
1793  compositionModeDirty = false; // I can handle this myself, thank you very much
1794  prepareForDraw(false); // Text always causes src pixels to be transparent
1795 
1796  // prepareForDraw() have set the opacity on the current shader, so the opacity state can now be reset.
1797  if (compMode == QPainter::CompositionMode_Source) {
1798  q->state()->opacity = oldOpacity;
1799  opacityUniformDirty = true;
1800  }
1801 
1802  glEnable(GL_BLEND);
1804  glBlendColor(c.redF(), c.greenF(), c.blueF(), c.alphaF());
1805  } else {
1806  // Other brush styles need two passes.
1807 
1808  qreal oldOpacity = q->state()->opacity;
1809  if (compMode == QPainter::CompositionMode_Source) {
1810  q->state()->opacity = 1;
1811  opacityUniformDirty = true;
1812  pensBrush = Qt::white;
1813  setBrush(pensBrush);
1814  }
1815 
1816  compositionModeDirty = false; // I can handle this myself, thank you very much
1817  prepareForDraw(false); // Text always causes src pixels to be transparent
1818  glEnable(GL_BLEND);
1819  glBlendFunc(GL_ZERO, GL_ONE_MINUS_SRC_COLOR);
1820 
1822  glBindTexture(GL_TEXTURE_2D, cache->texture());
1823 #if !defined(QT_NO_DEBUG) && defined(QT_OPENGL_ES_2)
1825  bool npotSupported = funcs.hasOpenGLFeature(QGLFunctions::NPOTTextures);
1826  bool isNpot = !isPowerOfTwo(cache->width())
1827  || !isPowerOfTwo(cache->height());
1828  if (isNpot && !npotSupported) {
1829  qWarning("GL2 Paint Engine: This system does not support the REPEAT wrap mode for non-power-of-two textures.");
1830  }
1831 #endif
1833 
1834 #if defined(QT_OPENGL_DRAWCACHEDGLYPHS_INDEX_ARRAY_VBO)
1835  glDrawElements(GL_TRIANGLE_STRIP, 6 * numGlyphs, GL_UNSIGNED_SHORT, 0);
1836 #else
1837  glDrawElements(GL_TRIANGLE_STRIP, 6 * numGlyphs, GL_UNSIGNED_SHORT, elementIndices.data());
1838 #endif
1839 
1841 
1842  if (compMode == QPainter::CompositionMode_Source) {
1843  q->state()->opacity = oldOpacity;
1844  opacityUniformDirty = true;
1845  pensBrush = q->state()->pen.brush();
1846  setBrush(pensBrush);
1847  }
1848 
1849  compositionModeDirty = false;
1850  prepareForDraw(false); // Text always causes src pixels to be transparent
1851  glEnable(GL_BLEND);
1852  glBlendFunc(GL_ONE, GL_ONE);
1853  }
1854  compositionModeDirty = true;
1855  } else {
1856  // Greyscale/mono glyphs
1857 
1859  prepareForDraw(false); // Text always causes src pixels to be transparent
1860  }
1861 
1863  if (lastMaskTextureUsed != cache->texture() || cache->filterMode() != filterMode) {
1864 
1866  if (lastMaskTextureUsed != cache->texture()) {
1867  glBindTexture(GL_TEXTURE_2D, cache->texture());
1868  lastMaskTextureUsed = cache->texture();
1869  }
1870 
1871  if (cache->filterMode() != filterMode) {
1872  if (filterMode == QGLTextureGlyphCache::Linear) {
1873  glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
1874  glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
1875  } else {
1876  glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
1877  glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
1878  }
1879  cache->setFilterMode(filterMode);
1880  }
1881  }
1882 
1883 #if defined(QT_OPENGL_DRAWCACHEDGLYPHS_INDEX_ARRAY_VBO)
1884  glDrawElements(GL_TRIANGLE_STRIP, 6 * numGlyphs, GL_UNSIGNED_SHORT, 0);
1886 #else
1887  glDrawElements(GL_TRIANGLE_STRIP, 6 * numGlyphs, GL_UNSIGNED_SHORT, elementIndices.data());
1888 #endif
1889 
1890  if (srgbFrameBufferEnabled)
1891  glDisable(FRAMEBUFFER_SRGB_EXT);
1892 
1893 }
#define GL_ELEMENT_ARRAY_BUFFER
The QColor class provides colors based on RGB, HSV or CMYK values.
Definition: qcolor.h:67
QScopedPointer< QGLContextPrivate > d_ptr
Definition: qgl.h:430
void setUserData(QStaticTextUserData *newUserData)
void setVertexAttributePointer(unsigned int arrayIndex, const GLfloat *pointer)
qreal alphaF() const
Returns the alpha color component of this color.
Definition: qcolor.cpp:1106
#define GL_TEXTURE_MIN_FILTER
double qreal
Definition: qglobal.h:1193
unsigned char c[8]
Definition: qnumeric_p.h:62
const QColor & color() const
Returns the brush color.
Definition: qbrush.h:183
QHash< GlyphAndSubPixelPosition, Coord > coords
QFontEngine * fontEngine() const
CompositionMode
Defines the modes supported for digital image compositing.
Definition: qpainter.h:138
#define GL_CONSTANT_COLOR
void updateTextureFilter(GLenum target, GLenum wrapMode, bool smoothPixmapTransform, GLuint id=-1)
qreal greenF() const
Returns the green color component of this color.
Definition: qcolor.cpp:1241
QGLEngineShaderManager * shaderManager
QPainter::CompositionMode composition_mode
Definition: qpainter_p.h:174
QFixedPoint * glyphPositions
QFixed subPixelPositionForX(QFixed x) const
int qFloor(qreal v)
Definition: qmath.h:73
#define GL_ONE_MINUS_SRC_COLOR
QGL2PEXVertexArray textureCoordinateArray
void setFilterMode(FilterMode m)
QTransform matrix
Definition: qpainter_p.h:161
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
TransformationType type() const
Returns the transformation type of this matrix.
#define GL_TEXTURE_2D
static qreal qt_sRGB_to_linear_RGB(qreal f)
static const QGLContext * currentContext()
Returns the current context, i.e.
Definition: qgl.cpp:3545
#define Q_Q(Class)
Definition: qglobal.h:2483
The QGLFunctions class provides cross-platform access to the OpenGL/ES 2.0 API.
Definition: qglfunctions.h:178
#define GL_REPEAT
const QGLContext * context() const
void setBrush(const QBrush &brush)
#define GL_TEXTURE0
Definition: glfunctions.h:61
#define FRAMEBUFFER_SRGB_EXT
FilterMode filterMode() const
#define glGenBuffers
The QRectF class defines a rectangle in the plane using floating point precision. ...
Definition: qrect.h:511
QFixed y
Definition: qfixed_p.h:191
#define GL_TRIANGLE_STRIP
char useBackendOptimizations
The QGLContext class encapsulates an OpenGL rendering context.
Definition: qgl.h:310
QGLExtensions::Extensions extension_flags
Definition: qgl_p.h:451
void insert(const QGLContext *context, void *value)
Definition: qgl.cpp:5910
QColor qt_premultiplyColor(QColor c, GLfloat opacity)
QGL2PEXVertexArray vertexCoordinateArray
#define GL_UNSIGNED_SHORT
void append(const T &t)
Inserts value at the end of the vector.
Definition: qvector.h:573
Q_CORE_EXPORT void qWarning(const char *,...)
void setPaintEnginePrivate(QGL2PaintEngineExPrivate *p)
#define glBlendColor
QBrush brush() const
Returns the brush used to fill strokes generated with this pen.
Definition: qpen.cpp:797
Qt::BrushStyle style() const
Returns the brush style.
Definition: qbrush.h:182
static QColor fromRgbF(qreal r, qreal g, qreal b, qreal a=1.0)
Static convenience function that returns a QColor constructed from the RGB color values, r (red), g (green), b (blue), and a (alpha-channel, i.e.
Definition: qcolor.cpp:2017
#define GL_ZERO
QOpenGL2PaintEngineState * state()
#define glActiveTexture
Definition: glfunctions.h:69
static bool fontSmoothingApproximately(qreal target)
#define GL_BLEND
void setColor(const QColor &color)
Sets the brush color to the given color.
Definition: qbrush.cpp:725
The QBrush class defines the fill pattern of shapes drawn by QPainter.
Definition: qbrush.h:76
QFixed x
Definition: qfixed_p.h:190
#define GL_LINEAR
static QGLContextGroup * contextGroup(const QGLContext *ctx)
Definition: qgl_p.h:464
virtual int glyphMargin() const
void setGlyphCache(void *key, QFontEngineGlyphCache *data)
qreal redF() const
Returns the red color component of this color.
Definition: qcolor.cpp:1213
bool populate(QFontEngine *fontEngine, int numGlyphs, const glyph_t *glyphs, const QFixedPoint *positions)
static const GLuint QT_TEXTURE_COORDS_ATTR
qreal blueF() const
Returns the blue color component of this color.
Definition: qcolor.cpp:1269
void transferMode(EngineMode newMode)
static bool isPowerOfTwo(uint x)
The QSize class defines the size of a two-dimensional object using integer point precision.
Definition: qsize.h:53
T * data()
Returns a pointer to the data stored in the vector.
Definition: qvector.h:152
QStaticTextUserData * userData() const
#define QT_MASK_TEXTURE_UNIT
const T * constData() const
Returns a const pointer to the data stored in the vector.
Definition: qvector.h:154
QFontEngineGlyphCache * glyphCache(void *key, QFontEngineGlyphCache::Type type, const QTransform &transform) const
#define GL_TEXTURE_MAG_FILTER
static const GLuint QT_VERTEX_COORDS_ATTR
#define GL_STATIC_DRAW
#define glBindBuffer
bool prepareForDraw(bool srcPixelsAreOpaque)
int size() const
Returns the number of items in the vector.
Definition: qvector.h:137
void addQuad(const QRectF &rect)
#define GL_ONE
#define glBufferData
const QGLContext * context() const
Definition: qgl_p.h:252
virtual bool supportsSubPixelPositions() const
The QTransform class specifies 2D transformations of a coordinate system.
Definition: qtransform.h:65
#define GL_NEAREST
glyph_t * glyphs

◆ drawPixmapFragments() [1/2]

void QGL2PaintEngineExPrivate::drawPixmapFragments ( const QPainter::PixmapFragment fragments,
int  fragmentCount,
const QPixmap pixmap,
const QSize size,
QPainter::PixmapFragmentHints  hints 
)

Definition at line 1939 of file qpaintengineex_opengl2.cpp.

1942 {
1943  GLfloat dx = 1.0f / size.width();
1944  GLfloat dy = 1.0f / size.height();
1945 
1948  opacityArray.reset();
1949 
1950  if (snapToPixelGrid) {
1951  snapToPixelGrid = false;
1952  matrixDirty = true;
1953  }
1954 
1955  bool allOpaque = true;
1956 
1957  for (int i = 0; i < fragmentCount; ++i) {
1958  qreal s = 0;
1959  qreal c = 1;
1960  if (fragments[i].rotation != 0) {
1961  s = qFastSin(fragments[i].rotation * Q_PI / 180);
1962  c = qFastCos(fragments[i].rotation * Q_PI / 180);
1963  }
1964 
1965  qreal right = 0.5 * fragments[i].scaleX * fragments[i].width;
1966  qreal bottom = 0.5 * fragments[i].scaleY * fragments[i].height;
1967  QGLPoint bottomRight(right * c - bottom * s, right * s + bottom * c);
1968  QGLPoint bottomLeft(-right * c - bottom * s, -right * s + bottom * c);
1969 
1970  vertexCoordinateArray.addVertex(bottomRight.x + fragments[i].x, bottomRight.y + fragments[i].y);
1971  vertexCoordinateArray.addVertex(-bottomLeft.x + fragments[i].x, -bottomLeft.y + fragments[i].y);
1972  vertexCoordinateArray.addVertex(-bottomRight.x + fragments[i].x, -bottomRight.y + fragments[i].y);
1973  vertexCoordinateArray.addVertex(-bottomRight.x + fragments[i].x, -bottomRight.y + fragments[i].y);
1974  vertexCoordinateArray.addVertex(bottomLeft.x + fragments[i].x, bottomLeft.y + fragments[i].y);
1975  vertexCoordinateArray.addVertex(bottomRight.x + fragments[i].x, bottomRight.y + fragments[i].y);
1976 
1977  QGLRect src(fragments[i].sourceLeft * dx, fragments[i].sourceTop * dy,
1978  (fragments[i].sourceLeft + fragments[i].width) * dx,
1979  (fragments[i].sourceTop + fragments[i].height) * dy);
1980 
1981  textureCoordinateArray.addVertex(src.right, src.bottom);
1982  textureCoordinateArray.addVertex(src.right, src.top);
1983  textureCoordinateArray.addVertex(src.left, src.top);
1984  textureCoordinateArray.addVertex(src.left, src.top);
1985  textureCoordinateArray.addVertex(src.left, src.bottom);
1986  textureCoordinateArray.addVertex(src.right, src.bottom);
1987 
1988  qreal opacity = fragments[i].opacity * q->state()->opacity;
1989  opacityArray << opacity << opacity << opacity << opacity << opacity << opacity;
1990  allOpaque &= (opacity >= 0.99f);
1991  }
1992 
1994  QGLTexture *texture = ctx->d_func()->bindTexture(pixmap, GL_TEXTURE_2D, GL_RGBA,
1997 
1998  if (texture->options & QGLContext::InvertedYBindOption) {
1999  // Flip texture y-coordinate.
2001  for (int i = 0; i < 6 * fragmentCount; ++i)
2002  data[i].y = 1 - data[i].y;
2003  }
2004 
2006 
2007  bool isBitmap = pixmap.isQBitmap();
2008  bool isOpaque = !isBitmap && (!pixmap.hasAlpha() || (hints & QPainter::OpaqueHint)) && allOpaque;
2009 
2012 
2013  // Setup for texture drawing
2017  if (prepareForDraw(isOpaque))
2019 
2020  if (isBitmap) {
2021  QColor col = qt_premultiplyColor(q->state()->pen.color(), (GLfloat)q->state()->opacity);
2023  }
2024 
2025  glDrawArrays(GL_TRIANGLES, 0, 6 * fragmentCount);
2026 }
The QColor class provides colors based on RGB, HSV or CMYK values.
Definition: qcolor.h:67
void addVertex(const GLfloat x, const GLfloat y)
qreal scaleY
the vertical scale of the target rectangle.
Definition: qpainter.h:112
#define GL_CLAMP_TO_EDGE
Definition: glfunctions.h:62
qreal width
the width of the source rectangle and is used to calculate the width of the target rectangle...
Definition: qpainter.h:109
double qreal
Definition: qglobal.h:1193
unsigned char c[8]
Definition: qnumeric_p.h:62
void updateTextureFilter(GLenum target, GLenum wrapMode, bool smoothPixmapTransform, GLuint id=-1)
QPainter::RenderHints renderHints
Definition: qpainter_p.h:158
QGLEngineShaderManager * shaderManager
#define QT_IMAGE_TEXTURE_UNIT
QGL2PEXVertexArray textureCoordinateArray
void setSrcPixelType(Qt::BrushStyle)
QColor color() const
Returns the color of this pen&#39;s brush.
Definition: qpen.cpp:771
qreal qFastSin(qreal x)
Definition: qmath.h:264
qreal opacity
the opacity of the target rectangle, where 0.0 is fully transparent and 1.0 is fully opaque...
Definition: qpainter.h:114
GLuint bindTexture(const QImage &image, GLenum target, GLint format, BindOptions options)
Generates and binds a 2D GL texture to the current context, based on image.
Definition: qgl.cpp:2854
QGLContext::BindOptions options
Definition: qgl_p.h:611
#define GL_TEXTURE_2D
Q_CORE_EXPORT QTextStream & right(QTextStream &s)
GLuint location(const QGLEngineShaderManager::Uniform uniform)
#define GL_TEXTURE0
Definition: glfunctions.h:61
int width() const
Returns the width.
Definition: qsize.h:126
qreal y
the y coordinate of the center point in the target rectangle.
Definition: qpainter.h:106
QDataBuffer< GLfloat > opacityArray
GLuint id
Definition: qgl_p.h:608
QColor qt_premultiplyColor(QColor c, GLfloat opacity)
qreal x
the x coordinate of center point in the target rectangle.
Definition: qpainter.h:105
QGL2PEXVertexArray vertexCoordinateArray
static const char * data(const QByteArray &arr)
bool isQBitmap() const
Returns true if this is a QBitmap; otherwise returns false.
Definition: qpixmap.cpp:599
QOpenGL2PaintEngineState * state()
#define glActiveTexture
Definition: glfunctions.h:69
#define GL_TRIANGLES
void setUniformValue(int location, GLfloat value)
Sets the uniform variable at location in the current context to value.
bool hasAlpha() const
Returns true if this pixmap has an alpha channel, or has a mask, otherwise returns false...
Definition: qpixmap.cpp:1938
qreal scaleX
the horizontal scale of the target rectangle.
Definition: qpainter.h:111
qreal qFastCos(qreal x)
Definition: qmath.h:274
int height() const
Returns the height.
Definition: qsize.h:129
QGLShaderProgram * currentProgram()
#define GL_RGBA
void transferMode(EngineMode newMode)
bool prepareForDraw(bool srcPixelsAreOpaque)
qreal height
the height of the source rectangle and is used to calculate the height of the target rectangle...
Definition: qpainter.h:110
void reset()
Definition: qdatabuffer_p.h:79
static const qreal Q_PI
Definition: qmath_p.h:61

◆ drawPixmapFragments() [2/2]

void QGL2PaintEngineExPrivate::drawPixmapFragments ( const QRectF targetRects,
const QRectF sourceRects,
int  fragmentCount,
const QPixmap pixmap,
const QSize size,
QPainter::PixmapFragmentHints  hints 
)

Definition at line 2028 of file qpaintengineex_opengl2.cpp.

2031 {
2032  GLfloat dx = 1.0f / size.width();
2033  GLfloat dy = 1.0f / size.height();
2034 
2037 
2038  if (snapToPixelGrid) {
2039  snapToPixelGrid = false;
2040  matrixDirty = true;
2041  }
2042 
2043  for (int i = 0; i < fragmentCount; ++i) {
2044  vertexCoordinateArray.addVertex(targetRects[i].right(), targetRects[i].bottom());
2045  vertexCoordinateArray.addVertex(targetRects[i].right(), targetRects[i].top());
2046  vertexCoordinateArray.addVertex(targetRects[i].left(), targetRects[i].top());
2047  vertexCoordinateArray.addVertex(targetRects[i].left(), targetRects[i].top());
2048  vertexCoordinateArray.addVertex(targetRects[i].left(), targetRects[i].bottom());
2049  vertexCoordinateArray.addVertex(targetRects[i].right(), targetRects[i].bottom());
2050 
2051  QRectF sourceRect = sourceRects ? sourceRects[i] : QRectF(0, 0, size.width(), size.height());
2052 
2053  QGLRect src(sourceRect.left() * dx, sourceRect.top() * dy,
2054  sourceRect.right() * dx, sourceRect.bottom() * dy);
2055 
2056  textureCoordinateArray.addVertex(src.right, src.bottom);
2057  textureCoordinateArray.addVertex(src.right, src.top);
2058  textureCoordinateArray.addVertex(src.left, src.top);
2059  textureCoordinateArray.addVertex(src.left, src.top);
2060  textureCoordinateArray.addVertex(src.left, src.bottom);
2061  textureCoordinateArray.addVertex(src.right, src.bottom);
2062  }
2063 
2065  QGLTexture *texture = ctx->d_func()->bindTexture(pixmap, GL_TEXTURE_2D, GL_RGBA,
2068 
2069  if (texture->options & QGLContext::InvertedYBindOption) {
2070  // Flip texture y-coordinate.
2072  for (int i = 0; i < 6 * fragmentCount; ++i)
2073  data[i].y = 1 - data[i].y;
2074  }
2075 
2077 
2078  bool isBitmap = pixmap.isQBitmap();
2079  bool isOpaque = !isBitmap && (!pixmap.hasAlpha() || (hints & QPainter::OpaqueHint));
2080 
2083 
2084  // Setup for texture drawing
2088  if (prepareForDraw(isOpaque))
2090 
2091  if (isBitmap) {
2092  QColor col = qt_premultiplyColor(q->state()->pen.color(), (GLfloat)q->state()->opacity);
2094  }
2095 
2096  glDrawArrays(GL_TRIANGLES, 0, 6 * fragmentCount);
2097 }
The QColor class provides colors based on RGB, HSV or CMYK values.
Definition: qcolor.h:67
void addVertex(const GLfloat x, const GLfloat y)
qreal right() const
Returns the x-coordinate of the rectangle&#39;s right edge.
Definition: qrect.h:527
#define GL_CLAMP_TO_EDGE
Definition: glfunctions.h:62
void updateTextureFilter(GLenum target, GLenum wrapMode, bool smoothPixmapTransform, GLuint id=-1)
QPainter::RenderHints renderHints
Definition: qpainter_p.h:158
QGLEngineShaderManager * shaderManager
#define QT_IMAGE_TEXTURE_UNIT
QGL2PEXVertexArray textureCoordinateArray
qreal left() const
Returns the x-coordinate of the rectangle&#39;s left edge.
Definition: qrect.h:525
void setSrcPixelType(Qt::BrushStyle)
QColor color() const
Returns the color of this pen&#39;s brush.
Definition: qpen.cpp:771
GLuint bindTexture(const QImage &image, GLenum target, GLint format, BindOptions options)
Generates and binds a 2D GL texture to the current context, based on image.
Definition: qgl.cpp:2854
QGLContext::BindOptions options
Definition: qgl_p.h:611
#define GL_TEXTURE_2D
Q_CORE_EXPORT QTextStream & right(QTextStream &s)
GLuint location(const QGLEngineShaderManager::Uniform uniform)
#define GL_TEXTURE0
Definition: glfunctions.h:61
int width() const
Returns the width.
Definition: qsize.h:126
The QRectF class defines a rectangle in the plane using floating point precision. ...
Definition: qrect.h:511
GLuint id
Definition: qgl_p.h:608
QColor qt_premultiplyColor(QColor c, GLfloat opacity)
QGL2PEXVertexArray vertexCoordinateArray
static const char * data(const QByteArray &arr)
bool isQBitmap() const
Returns true if this is a QBitmap; otherwise returns false.
Definition: qpixmap.cpp:599
QOpenGL2PaintEngineState * state()
#define glActiveTexture
Definition: glfunctions.h:69
#define GL_TRIANGLES
void setUniformValue(int location, GLfloat value)
Sets the uniform variable at location in the current context to value.
bool hasAlpha() const
Returns true if this pixmap has an alpha channel, or has a mask, otherwise returns false...
Definition: qpixmap.cpp:1938
int height() const
Returns the height.
Definition: qsize.h:129
QGLShaderProgram * currentProgram()
#define GL_RGBA
qreal top() const
Returns the y-coordinate of the rectangle&#39;s top edge.
Definition: qrect.h:526
void transferMode(EngineMode newMode)
qreal bottom() const
Returns the y-coordinate of the rectangle&#39;s bottom edge.
Definition: qrect.h:528
bool prepareForDraw(bool srcPixelsAreOpaque)
Q_CORE_EXPORT QTextStream & left(QTextStream &s)

◆ drawTexture()

void QGL2PaintEngineExPrivate::drawTexture ( const QGLRect dest,
const QGLRect src,
const QSize textureSize,
bool  opaque,
bool  pattern = false 
)

Definition at line 523 of file qpaintengineex_opengl2.cpp.

524 {
525  // Setup for texture drawing
528 
529  if (snapToPixelGrid) {
530  snapToPixelGrid = false;
531  matrixDirty = true;
532  }
533 
534  if (prepareForDraw(opaque))
536 
537  if (pattern) {
538  QColor col = qt_premultiplyColor(q->state()->pen.color(), (GLfloat)q->state()->opacity);
540  }
541 
542  GLfloat dx = 1.0 / textureSize.width();
543  GLfloat dy = 1.0 / textureSize.height();
544 
545  QGLRect srcTextureRect(src.left*dx, src.top*dy, src.right*dx, src.bottom*dy);
546 
548  setCoords(staticTextureCoordinateArray, srcTextureRect);
549 
550  glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
551 }
The QColor class provides colors based on RGB, HSV or CMYK values.
Definition: qcolor.h:67
QGLEngineShaderManager * shaderManager
#define QT_IMAGE_TEXTURE_UNIT
void setSrcPixelType(Qt::BrushStyle)
QColor color() const
Returns the color of this pen&#39;s brush.
Definition: qpen.cpp:771
GLuint location(const QGLEngineShaderManager::Uniform uniform)
int width() const
Returns the width.
Definition: qsize.h:126
static void setCoords(GLfloat *coords, const QGLRect &rect)
QColor qt_premultiplyColor(QColor c, GLfloat opacity)
#define GL_TRIANGLE_FAN
QOpenGL2PaintEngineState * state()
void setUniformValue(int location, GLfloat value)
Sets the uniform variable at location in the current context to value.
int height() const
Returns the height.
Definition: qsize.h:129
QGLShaderProgram * currentProgram()
bool prepareForDraw(bool srcPixelsAreOpaque)

◆ drawVertexArrays() [1/2]

void QGL2PaintEngineExPrivate::drawVertexArrays ( const float *  data,
int *  stops,
int  stopCount,
GLenum  primitive 
)

Definition at line 1177 of file qpaintengineex_opengl2.cpp.

Referenced by fill(), and fillStencilWithVertexArray().

1179 {
1180  // Now setup the pointer to the vertex array:
1182 
1183  int previousStop = 0;
1184  for (int i=0; i<stopCount; ++i) {
1185  int stop = stops[i];
1186 /*
1187  qDebug("Drawing triangle fan for vertecies %d -> %d:", previousStop, stop-1);
1188  for (int i=previousStop; i<stop; ++i)
1189  qDebug(" %02d: [%.2f, %.2f]", i, vertexArray.data()[i].x, vertexArray.data()[i].y);
1190 */
1191  glDrawArrays(primitive, previousStop, stop - previousStop);
1192  previousStop = stop;
1193  }
1194 }
void setVertexAttributePointer(unsigned int arrayIndex, const GLfloat *pointer)
static const char * data(const QByteArray &arr)
static const GLuint QT_VERTEX_COORDS_ATTR

◆ drawVertexArrays() [2/2]

void QGL2PaintEngineExPrivate::drawVertexArrays ( QGL2PEXVertexArray vertexArray,
GLenum  primitive 
)
inline

Definition at line 220 of file qpaintengineex_opengl2_p.h.

220  {
221  drawVertexArrays((const float *) vertexArray.data(), vertexArray.stops(), vertexArray.stopCount(), primitive);
222  }
void drawVertexArrays(const float *data, int *stops, int stopCount, GLenum primitive)

◆ fill()

void QGL2PaintEngineExPrivate::fill ( const QVectorPath path)

Definition at line 722 of file qpaintengineex_opengl2.cpp.

723 {
725 
726  if (snapToPixelGrid) {
727  snapToPixelGrid = false;
728  matrixDirty = true;
729  }
730 
731  // Might need to call updateMatrix to re-calculate inverseScale
732  if (matrixDirty)
733  updateMatrix();
734 
735  const QPointF* const points = reinterpret_cast<const QPointF*>(path.points());
736 
737  // Check to see if there's any hints
738  if (path.shape() == QVectorPath::RectangleHint) {
739  QGLRect rect(points[0].x(), points[0].y(), points[2].x(), points[2].y());
741  composite(rect);
742  } else if (path.isConvex()) {
743 
744  if (path.isCacheable()) {
746  QGL2PEVectorPathCache *cache;
747 
748  bool updateCache = false;
749 
750  if (data) {
751  cache = (QGL2PEVectorPathCache *) data->data;
752  // Check if scale factor is exceeded for curved paths and generate curves if so...
753  if (path.isCurved()) {
754  qreal scaleFactor = cache->iscale / inverseScale;
755  if (scaleFactor < 0.5 || scaleFactor > 2.0) {
756 #ifdef QT_OPENGL_CACHE_AS_VBOS
757  glDeleteBuffers(1, &cache->vbo);
758  cache->vbo = 0;
759  Q_ASSERT(cache->ibo == 0);
760 #else
761  qFree(cache->vertices);
762  Q_ASSERT(cache->indices == 0);
763 #endif
764  updateCache = true;
765  }
766  }
767  } else {
768  cache = new QGL2PEVectorPathCache;
769  data = const_cast<QVectorPath &>(path).addCacheData(q, cache, cleanupVectorPath);
770  updateCache = true;
771  }
772 
773  // Flatten the path at the current scale factor and fill it into the cache struct.
774  if (updateCache) {
777  int vertexCount = vertexCoordinateArray.vertexCount();
778  int floatSizeInBytes = vertexCount * 2 * sizeof(float);
779  cache->vertexCount = vertexCount;
780  cache->indexCount = 0;
782  cache->iscale = inverseScale;
783 #ifdef QT_OPENGL_CACHE_AS_VBOS
784  glGenBuffers(1, &cache->vbo);
785  glBindBuffer(GL_ARRAY_BUFFER, cache->vbo);
787  cache->ibo = 0;
788 #else
789  cache->vertices = (float *) qMalloc(floatSizeInBytes);
790  memcpy(cache->vertices, vertexCoordinateArray.data(), floatSizeInBytes);
791  cache->indices = 0;
792 #endif
793  }
794 
796 #ifdef QT_OPENGL_CACHE_AS_VBOS
797  glBindBuffer(GL_ARRAY_BUFFER, cache->vbo);
799 #else
801 #endif
802  glDrawArrays(cache->primitiveType, 0, cache->vertexCount);
803 
804  } else {
805  // printf(" - Marking path as cachable...\n");
806  // Tag it for later so that if the same path is drawn twice, it is assumed to be static and thus cachable
807  path.makeCacheable();
812  }
813 
814  } else {
815  bool useCache = path.isCacheable();
816  if (useCache) {
817  QRectF bbox = path.controlPointRect();
818  // If the path doesn't fit within these limits, it is possible that the triangulation will fail.
819  useCache &= (bbox.left() > -0x8000 * inverseScale)
820  && (bbox.right() < 0x8000 * inverseScale)
821  && (bbox.top() > -0x8000 * inverseScale)
822  && (bbox.bottom() < 0x8000 * inverseScale);
823  }
824 
825  if (useCache) {
827  QGL2PEVectorPathCache *cache;
828 
829  bool updateCache = false;
830 
831  if (data) {
832  cache = (QGL2PEVectorPathCache *) data->data;
833  // Check if scale factor is exceeded for curved paths and generate curves if so...
834  if (path.isCurved()) {
835  qreal scaleFactor = cache->iscale / inverseScale;
836  if (scaleFactor < 0.5 || scaleFactor > 2.0) {
837 #ifdef QT_OPENGL_CACHE_AS_VBOS
838  glDeleteBuffers(1, &cache->vbo);
839  glDeleteBuffers(1, &cache->ibo);
840 #else
841  qFree(cache->vertices);
842  qFree(cache->indices);
843 #endif
844  updateCache = true;
845  }
846  }
847  } else {
848  cache = new QGL2PEVectorPathCache;
849  data = const_cast<QVectorPath &>(path).addCacheData(q, cache, cleanupVectorPath);
850  updateCache = true;
851  }
852 
853  // Flatten the path at the current scale factor and fill it into the cache struct.
854  if (updateCache) {
855  QTriangleSet polys = qTriangulate(path, QTransform().scale(1 / inverseScale, 1 / inverseScale));
856  cache->vertexCount = polys.vertices.size() / 2;
857  cache->indexCount = polys.indices.size();
858  cache->primitiveType = GL_TRIANGLES;
859  cache->iscale = inverseScale;
860 #ifdef QT_OPENGL_CACHE_AS_VBOS
861  glGenBuffers(1, &cache->vbo);
862  glGenBuffers(1, &cache->ibo);
863  glBindBuffer(GL_ARRAY_BUFFER, cache->vbo);
865 
868  else
870 
871  QVarLengthArray<float> vertices(polys.vertices.size());
872  for (int i = 0; i < polys.vertices.size(); ++i)
873  vertices[i] = float(inverseScale * polys.vertices.at(i));
874  glBufferData(GL_ARRAY_BUFFER, sizeof(float) * vertices.size(), vertices.data(), GL_STATIC_DRAW);
875 #else
876  cache->vertices = (float *) qMalloc(sizeof(float) * polys.vertices.size());
878  cache->indices = (quint32 *) qMalloc(sizeof(quint32) * polys.indices.size());
879  memcpy(cache->indices, polys.indices.data(), sizeof(quint32) * polys.indices.size());
880  } else {
881  cache->indices = (quint16 *) qMalloc(sizeof(quint16) * polys.indices.size());
882  memcpy(cache->indices, polys.indices.data(), sizeof(quint16) * polys.indices.size());
883  }
884  for (int i = 0; i < polys.vertices.size(); ++i)
885  cache->vertices[i] = float(inverseScale * polys.vertices.at(i));
886 #endif
887  }
888 
890 #ifdef QT_OPENGL_CACHE_AS_VBOS
891  glBindBuffer(GL_ARRAY_BUFFER, cache->vbo);
895  glDrawElements(cache->primitiveType, cache->indexCount, GL_UNSIGNED_INT, 0);
896  else
897  glDrawElements(cache->primitiveType, cache->indexCount, GL_UNSIGNED_SHORT, 0);
900 #else
903  glDrawElements(cache->primitiveType, cache->indexCount, GL_UNSIGNED_INT, (qint32 *)cache->indices);
904  else
905  glDrawElements(cache->primitiveType, cache->indexCount, GL_UNSIGNED_SHORT, (qint16 *)cache->indices);
906 #endif
907 
908  } else {
909  // printf(" - Marking path as cachable...\n");
910  // Tag it for later so that if the same path is drawn twice, it is assumed to be static and thus cachable
911  path.makeCacheable();
912 
913  if (!device->format().stencil()) {
914  // If there is no stencil buffer, triangulate the path instead.
915 
916  QRectF bbox = path.controlPointRect();
917  // If the path doesn't fit within these limits, it is possible that the triangulation will fail.
918  bool withinLimits = (bbox.left() > -0x8000 * inverseScale)
919  && (bbox.right() < 0x8000 * inverseScale)
920  && (bbox.top() > -0x8000 * inverseScale)
921  && (bbox.bottom() < 0x8000 * inverseScale);
922  if (withinLimits) {
923  QTriangleSet polys = qTriangulate(path, QTransform().scale(1 / inverseScale, 1 / inverseScale));
924 
925  QVarLengthArray<float> vertices(polys.vertices.size());
926  for (int i = 0; i < polys.vertices.size(); ++i)
927  vertices[i] = float(inverseScale * polys.vertices.at(i));
928 
930  setVertexAttributePointer(QT_VERTEX_COORDS_ATTR, vertices.constData());
932  glDrawElements(GL_TRIANGLES, polys.indices.size(), GL_UNSIGNED_INT, polys.indices.data());
933  else
934  glDrawElements(GL_TRIANGLES, polys.indices.size(), GL_UNSIGNED_SHORT, polys.indices.data());
935  } else {
936  // We can't handle big, concave painter paths with OpenGL without stencil buffer.
937  qWarning("Painter path exceeds +/-32767 pixels.");
938  }
939  return;
940  }
941 
942  // The path is too complicated & needs the stencil technique
945 
947 
948  glStencilMask(0xff);
949  glStencilOp(GL_KEEP, GL_REPLACE, GL_REPLACE);
950 
951  if (q->state()->clipTestEnabled) {
952  // Pass when high bit is set, replace stencil value with current clip
953  glStencilFunc(GL_NOTEQUAL, q->state()->currentClip, GL_STENCIL_HIGH_BIT);
954  } else if (path.hasWindingFill()) {
955  // Pass when any bit is set, replace stencil value with 0
956  glStencilFunc(GL_NOTEQUAL, 0, 0xff);
957  } else {
958  // Pass when high bit is set, replace stencil value with 0
959  glStencilFunc(GL_NOTEQUAL, 0, GL_STENCIL_HIGH_BIT);
960  }
962 
963  // Stencil the brush onto the dest buffer
965  glStencilMask(0);
967  }
968  }
969 }
virtual QGLFormat format() const
#define GL_ELEMENT_ARRAY_BUFFER
void setVertexAttributePointer(unsigned int arrayIndex, const GLfloat *pointer)
qreal right() const
Returns the x-coordinate of the rectangle&#39;s right edge.
Definition: qrect.h:527
double qreal
Definition: qglobal.h:1193
#define GL_UNSIGNED_INT
int qint32
Definition: qglobal.h:937
QVertexIndexVector indices
bool isCurved() const
Q_CORE_EXPORT void qFree(void *ptr)
Definition: qmalloc.cpp:58
The QPointF class defines a point in the plane using floating point precision.
Definition: qpoint.h:214
qreal left() const
Returns the x-coordinate of the rectangle&#39;s left edge.
Definition: qrect.h:525
#define GL_ARRAY_BUFFER
Q_CORE_EXPORT void * qMalloc(size_t size)
Definition: qmalloc.cpp:53
bool isCacheable() const
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
void makeCacheable() const
QRectF controlPointRect() const
#define glGenBuffers
The QRectF class defines a rectangle in the plane using floating point precision. ...
Definition: qrect.h:511
QVector< qreal > vertices
const void * data() const
QGLRect boundingRect() const
CacheEntry * lookupCacheData(QPaintEngineEx *engine) const
QGL2PEXVertexArray vertexCoordinateArray
short qint16
Definition: qglobal.h:935
#define GL_UNSIGNED_SHORT
bool stencil() const
Returns true if the stencil buffer is enabled; otherwise returns false.
Definition: qgl.h:638
unsigned short quint16
Definition: qglobal.h:936
Q_CORE_EXPORT void qWarning(const char *,...)
void composite(const QGLRect &boundingRect)
static const char * data(const QByteArray &arr)
#define GL_TRIANGLE_FAN
#define GL_NOTEQUAL
bool isOpaque() const
Returns true if the brush is fully opaque otherwise false.
Definition: qbrush.cpp:910
#define glDeleteBuffers
bool hasWindingFill() const
QOpenGL2PaintEngineState * state()
void addPath(const QVectorPath &path, GLfloat curveInverseScale, bool outline=true)
const T & at(int i) const
Returns the item at index position i in the vector.
Definition: qvector.h:350
#define GL_STENCIL_HIGH_BIT
#define GL_TRIANGLES
unsigned int quint32
Definition: qglobal.h:938
const qreal * points() const
if(void) toggleToolbarShown
bool isConvex() const
static Extensions glExtensions()
Definition: qgl.cpp:5781
QTriangleSet qTriangulate(const qreal *polygon, int count, uint hint, const QTransform &matrix)
qreal top() const
Returns the y-coordinate of the rectangle&#39;s top edge.
Definition: qrect.h:526
void transferMode(EngineMode newMode)
qreal bottom() const
Returns the y-coordinate of the rectangle&#39;s bottom edge.
Definition: qrect.h:528
static const GLuint QT_VERTEX_COORDS_ATTR
#define GL_STATIC_DRAW
#define glBindBuffer
bool prepareForDraw(bool srcPixelsAreOpaque)
static void cleanupVectorPath(QPaintEngineEx *engine, void *data)
int size() const
Returns the number of items in the vector.
Definition: qvector.h:137
#define GL_REPLACE
void drawVertexArrays(const float *data, int *stops, int stopCount, GLenum primitive)
void fillStencilWithVertexArray(const float *data, int count, int *stops, int stopCount, const QGLRect &bounds, StencilFillMode mode)
#define GL_KEEP
#define glBufferData
The QTransform class specifies 2D transformations of a coordinate system.
Definition: qtransform.h:65
Hint shape() const

◆ fillStencilWithVertexArray() [1/2]

void QGL2PaintEngineExPrivate::fillStencilWithVertexArray ( const float *  data,
int  count,
int *  stops,
int  stopCount,
const QGLRect bounds,
StencilFillMode  mode 
)

Definition at line 972 of file qpaintengineex_opengl2.cpp.

Referenced by fill().

978 {
979  Q_ASSERT(count || stops);
980 
981 // qDebug("QGL2PaintEngineExPrivate::fillStencilWithVertexArray()");
982  glStencilMask(0xff); // Enable stencil writes
983 
986  glClearStencil(0); // Clear to zero
987  for (int i = 0; i < clearRegion.size(); ++i) {
988 #ifndef QT_GL_NO_SCISSOR_TEST
989  setScissor(clearRegion.at(i));
990 #endif
991  glClear(GL_STENCIL_BUFFER_BIT);
992  }
993 
995 
996 #ifndef QT_GL_NO_SCISSOR_TEST
998 #endif
999  }
1000 
1001  glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE); // Disable color writes
1002  useSimpleShader();
1003  glEnable(GL_STENCIL_TEST); // For some reason, this has to happen _after_ the simple shader is use()'d
1004 
1005  if (mode == WindingFillMode) {
1006  Q_ASSERT(stops && !count);
1007  if (q->state()->clipTestEnabled) {
1008  // Flatten clip values higher than current clip, and set high bit to match current clip
1010  glStencilOp(GL_KEEP, GL_REPLACE, GL_REPLACE);
1011  composite(bounds);
1012 
1014  } else if (!stencilClean) {
1015  // Clear stencil buffer within bounding rect
1016  glStencilFunc(GL_ALWAYS, 0, 0xff);
1017  glStencilOp(GL_ZERO, GL_ZERO, GL_ZERO);
1018  composite(bounds);
1019  }
1020 
1021  // Inc. for front-facing triangle
1023  // Dec. for back-facing "holes"
1025  glStencilMask(~GL_STENCIL_HIGH_BIT);
1026  drawVertexArrays(data, stops, stopCount, GL_TRIANGLE_FAN);
1027 
1028  if (q->state()->clipTestEnabled) {
1029  // Clear high bit of stencil outside of path
1030  glStencilFunc(GL_EQUAL, q->state()->currentClip, ~GL_STENCIL_HIGH_BIT);
1031  glStencilOp(GL_KEEP, GL_REPLACE, GL_REPLACE);
1032  glStencilMask(GL_STENCIL_HIGH_BIT);
1033  composite(bounds);
1034  }
1035  } else if (mode == OddEvenFillMode) {
1036  glStencilMask(GL_STENCIL_HIGH_BIT);
1037  glStencilOp(GL_KEEP, GL_KEEP, GL_INVERT); // Simply invert the stencil bit
1038  drawVertexArrays(data, stops, stopCount, GL_TRIANGLE_FAN);
1039 
1040  } else { // TriStripStrokeFillMode
1041  Q_ASSERT(count && !stops); // tristrips generated directly, so no vertexArray or stops
1042  glStencilMask(GL_STENCIL_HIGH_BIT);
1043 #if 0
1044  glStencilOp(GL_KEEP, GL_KEEP, GL_INVERT); // Simply invert the stencil bit
1046  glDrawArrays(GL_TRIANGLE_STRIP, 0, count);
1047 #else
1048 
1049  glStencilOp(GL_KEEP, GL_KEEP, GL_REPLACE);
1050  if (q->state()->clipTestEnabled) {
1051  glStencilFunc(GL_LEQUAL, q->state()->currentClip | GL_STENCIL_HIGH_BIT,
1053  } else {
1054  glStencilFunc(GL_ALWAYS, GL_STENCIL_HIGH_BIT, 0xff);
1055  }
1057  glDrawArrays(GL_TRIANGLE_STRIP, 0, count);
1058 #endif
1059  }
1060 
1061  // Enable color writes & disable stencil writes
1062  glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
1063 }
void setVertexAttributePointer(unsigned int arrayIndex, const GLfloat *pointer)
QRegion intersected(const QRegion &r) const
Returns a region which is the intersection of this region and r.
Definition: qregion.h:112
#define GL_TRUE
#define glStencilOpSeparate
#define GL_DECR_WRAP
#define GL_INVERT
#define GL_STENCIL_BUFFER_BIT
#define GL_INCR_WRAP
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
#define GL_STENCIL_TEST
void setScissor(const QRect &rect)
#define GL_FALSE
#define GL_TRIANGLE_STRIP
void composite(const QGLRect &boundingRect)
static const char * data(const QByteArray &arr)
#define GL_TRIANGLE_FAN
#define GL_ZERO
#define GL_LEQUAL
#define GL_FRONT
QOpenGL2PaintEngineState * state()
const T & at(int i) const
Returns the item at index position i in the vector.
Definition: qvector.h:350
#define GL_STENCIL_HIGH_BIT
#define GL_BACK
QVector< QRect > rects() const
Returns an array of non-overlapping rectangles that make up the region.
Definition: qregion.cpp:4412
bool intersects(const QRegion &r) const
Returns true if this region intersects with region, otherwise returns false.
Definition: qregion.cpp:766
#define GL_EQUAL
static const GLuint QT_VERTEX_COORDS_ATTR
#define GL_ALWAYS
int size() const
Returns the number of items in the vector.
Definition: qvector.h:137
#define GL_REPLACE
void drawVertexArrays(const float *data, int *stops, int stopCount, GLenum primitive)
#define GL_KEEP

◆ fillStencilWithVertexArray() [2/2]

void QGL2PaintEngineExPrivate::fillStencilWithVertexArray ( QGL2PEXVertexArray vertexArray,
bool  useWindingFill 
)
inline

Definition at line 229 of file qpaintengineex_opengl2_p.h.

229  {
230  fillStencilWithVertexArray((const float *) vertexArray.data(), 0, vertexArray.stops(), vertexArray.stopCount(),
231  vertexArray.boundingRect(),
232  useWindingFill ? WindingFillMode : OddEvenFillMode);
233  }
QGLRect boundingRect() const
void fillStencilWithVertexArray(const float *data, int count, int *stops, int stopCount, const QGLRect &bounds, StencilFillMode mode)

◆ getData()

static QGL2PaintEngineExPrivate* QGL2PaintEngineExPrivate::getData ( QGL2PaintEngineEx engine)
inlinestatic

Definition at line 254 of file qpaintengineex_opengl2_p.h.

254 { return engine->d_func(); }

◆ location()

GLuint QGL2PaintEngineExPrivate::location ( const QGLEngineShaderManager::Uniform  uniform)
inline

Definition at line 239 of file qpaintengineex_opengl2_p.h.

Referenced by drawTexture(), prepareForDraw(), and updateBrushUniforms().

239  {
240  return shaderManager->getUniformLocation(uniform);
241  }
QGLEngineShaderManager * shaderManager
GLuint getUniformLocation(Uniform id)

◆ prepareForDraw()

bool QGL2PaintEngineExPrivate::prepareForDraw ( bool  srcPixelsAreOpaque)

Definition at line 1105 of file qpaintengineex_opengl2.cpp.

Referenced by drawTexture(), and fill().

1106 {
1109 
1112 
1113  if (matrixDirty)
1114  updateMatrix();
1115 
1116  const bool stateHasOpacity = q->state()->opacity < 0.99f;
1119  && srcPixelsAreOpaque && !stateHasOpacity))
1120  {
1121  glDisable(GL_BLEND);
1122  } else {
1123  glEnable(GL_BLEND);
1124  }
1125 
1129  } else {
1130  opacityMode = stateHasOpacity ? QGLEngineShaderManager::UniformOpacity
1132  if (stateHasOpacity && !imageDrawingMode) {
1133  // Using a brush
1134  bool brushIsPattern = (currentBrush.style() >= Qt::Dense1Pattern) &&
1136 
1137  if ((currentBrush.style() == Qt::SolidPattern) || brushIsPattern)
1138  opacityMode = QGLEngineShaderManager::NoOpacity; // Global opacity handled by srcPixel shader
1139  }
1140  }
1141  shaderManager->setOpacityMode(opacityMode);
1142 
1143  bool changed = shaderManager->useCorrectShaderProg();
1144  // If the shader program needs changing, we change it and mark all uniforms as dirty
1145  if (changed) {
1146  // The shader program has changed so mark all uniforms as dirty:
1147  brushUniformsDirty = true;
1148  opacityUniformDirty = true;
1149  matrixUniformDirty = true;
1150  }
1151 
1154 
1157  opacityUniformDirty = false;
1158  }
1159 
1162  pmvMatrix);
1163  matrixUniformDirty = false;
1164  }
1165 
1166  return changed;
1167 }
QGLEngineShaderManager * shaderManager
QPainter::CompositionMode composition_mode
Definition: qpainter_p.h:174
GLuint location(const QGLEngineShaderManager::Uniform uniform)
Qt::BrushStyle style() const
Returns the brush style.
Definition: qbrush.h:182
QOpenGL2PaintEngineState * state()
#define GL_BLEND
void setUniformValue(int location, GLfloat value)
Sets the uniform variable at location in the current context to value.
QGLShaderProgram * currentProgram()

◆ regenerateClip()

void QGL2PaintEngineExPrivate::regenerateClip ( )

Definition at line 2500 of file qpaintengineex_opengl2.cpp.

◆ resetClipIfNeeded()

void QGL2PaintEngineExPrivate::resetClipIfNeeded ( )

Definition at line 1070 of file qpaintengineex_opengl2.cpp.

1071 {
1072  if (maxClip != (GL_STENCIL_HIGH_BIT - 1))
1073  return;
1074 
1076 
1077  useSimpleShader();
1078  glEnable(GL_STENCIL_TEST);
1079  glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
1080 
1081  QRectF bounds = q->state()->matrix.inverted().mapRect(QRectF(0, 0, width, height));
1082  QGLRect rect(bounds.left(), bounds.top(), bounds.right(), bounds.bottom());
1083 
1084  // Set high bit on clip region
1085  glStencilFunc(GL_LEQUAL, q->state()->currentClip, 0xff);
1086  glStencilOp(GL_KEEP, GL_INVERT, GL_INVERT);
1087  glStencilMask(GL_STENCIL_HIGH_BIT);
1088  composite(rect);
1089 
1090  // Reset clipping to 1 and everything else to zero
1091  glStencilFunc(GL_NOTEQUAL, 0x01, GL_STENCIL_HIGH_BIT);
1092  glStencilOp(GL_ZERO, GL_REPLACE, GL_REPLACE);
1093  glStencilMask(0xff);
1094  composite(rect);
1095 
1096  q->state()->currentClip = 1;
1097  q->state()->canRestoreClip = false;
1098 
1099  maxClip = 1;
1100 
1101  glStencilMask(0x0);
1102  glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
1103 }
qreal right() const
Returns the x-coordinate of the rectangle&#39;s right edge.
Definition: qrect.h:527
#define GL_TRUE
#define GL_INVERT
qreal left() const
Returns the x-coordinate of the rectangle&#39;s left edge.
Definition: qrect.h:525
QTransform matrix
Definition: qpainter_p.h:161
#define GL_STENCIL_TEST
QTransform inverted(bool *invertible=0) const
Returns an inverted copy of this matrix.
Definition: qtransform.cpp:364
#define Q_Q(Class)
Definition: qglobal.h:2483
#define GL_FALSE
QRect mapRect(const QRect &) const
Creates and returns a QRect object that is a copy of the given rectangle, mapped into the coordinate ...
The QRectF class defines a rectangle in the plane using floating point precision. ...
Definition: qrect.h:511
void composite(const QGLRect &boundingRect)
#define GL_NOTEQUAL
#define GL_ZERO
#define GL_LEQUAL
QOpenGL2PaintEngineState * state()
#define GL_STENCIL_HIGH_BIT
qreal top() const
Returns the y-coordinate of the rectangle&#39;s top edge.
Definition: qrect.h:526
qreal bottom() const
Returns the y-coordinate of the rectangle&#39;s bottom edge.
Definition: qrect.h:528
#define GL_REPLACE
#define GL_KEEP

◆ resetGLState()

void QGL2PaintEngineExPrivate::resetGLState ( )

Definition at line 609 of file qpaintengineex_opengl2.cpp.

610 {
611  glDisable(GL_BLEND);
613  glDisable(GL_STENCIL_TEST);
614  glDisable(GL_DEPTH_TEST);
615  glDisable(GL_SCISSOR_TEST);
616  glDepthMask(true);
617  glDepthFunc(GL_LESS);
618  glClearDepth(1);
619  glStencilMask(0xff);
620  glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP);
621  glStencilFunc(GL_ALWAYS, 0, 0xff);
622  ctx->d_func()->setVertexAttribArrayEnabled(QT_TEXTURE_COORDS_ATTR, false);
623  ctx->d_func()->setVertexAttribArrayEnabled(QT_VERTEX_COORDS_ATTR, false);
624  ctx->d_func()->setVertexAttribArrayEnabled(QT_OPACITY_ATTR, false);
625 #ifndef QT_OPENGL_ES_2
626  // gl_Color, corresponding to vertex attribute 3, may have been changed
627  float color[] = { 1.0f, 1.0f, 1.0f, 1.0f };
628  glVertexAttrib4fv(3, color);
629 #endif
630 }
#define GL_DEPTH_TEST
#define GL_STENCIL_TEST
#define glVertexAttrib4fv
#define GL_SCISSOR_TEST
static const GLuint QT_OPACITY_ATTR
#define GL_TEXTURE0
Definition: glfunctions.h:61
#define glActiveTexture
Definition: glfunctions.h:69
#define GL_BLEND
static const GLuint QT_TEXTURE_COORDS_ATTR
static const GLuint QT_VERTEX_COORDS_ATTR
#define GL_ALWAYS
#define GL_LESS
#define GL_KEEP

◆ setBrush()

void QGL2PaintEngineExPrivate::setBrush ( const QBrush brush)

Definition at line 162 of file qpaintengineex_opengl2.cpp.

163 {
164  if (qbrush_fast_equals(currentBrush, brush))
165  return;
166 
167  const Qt::BrushStyle newStyle = qbrush_style(brush);
168  Q_ASSERT(newStyle != Qt::NoBrush);
169 
170  currentBrush = brush;
171  if (!currentBrushPixmap.isNull())
173  brushUniformsDirty = true; // All brushes have at least one uniform
174 
175  if (newStyle > Qt::SolidPattern)
176  brushTextureDirty = true;
177 
179  && qHasPixmapTexture(brush) && brush.texture().isQBitmap())
180  {
182  } else {
183  shaderManager->setSrcPixelType(newStyle);
184  }
186 }
BrushStyle
Definition: qnamespace.h:1162
QGLEngineShaderManager * shaderManager
Qt::BrushStyle qbrush_style(const QBrush &b)
Definition: qpainter_p.h:96
bool qbrush_fast_equals(const QBrush &a, const QBrush &b)
Definition: qpainter_p.h:95
void setSrcPixelType(Qt::BrushStyle)
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
TransformationType type() const
Returns the transformation type of this matrix.
QTransform transform() const
Returns the current transformation matrix for the brush.
Definition: qbrush.h:185
bool Q_GUI_EXPORT qHasPixmapTexture(const QBrush &brush)
Definition: qbrush.cpp:223
bool isQBitmap() const
Returns true if this is a QBitmap; otherwise returns false.
Definition: qpixmap.cpp:599
Qt::BrushStyle style() const
Returns the brush style.
Definition: qbrush.h:182
QPixmap texture() const
Returns the custom brush pattern, or a null pixmap if no custom brush pattern has been set...
Definition: qbrush.cpp:785
The QPixmap class is an off-screen image representation that can be used as a paint device...
Definition: qpixmap.h:71
void optimiseForBrushTransform(QTransform::TransformationType transformType)
bool isNull() const
Returns true if this is a null pixmap; otherwise returns false.
Definition: qpixmap.cpp:615

◆ setScissor()

void QGL2PaintEngineExPrivate::setScissor ( const QRect rect)

Definition at line 2292 of file qpaintengineex_opengl2.cpp.

Referenced by fillStencilWithVertexArray().

2293 {
2294  const int left = rect.left();
2295  const int width = rect.width();
2296  int bottom = height - (rect.top() + rect.height());
2297  if (device->isFlipped()) {
2298  bottom = rect.top();
2299  }
2300  const int height = rect.height();
2301 
2302  glScissor(left, bottom, width, height);
2303 }
int left() const
Returns the x-coordinate of the rectangle&#39;s left edge.
Definition: qrect.h:240
int width() const
Returns the width of the rectangle.
Definition: qrect.h:303
int height() const
Returns the height of the rectangle.
Definition: qrect.h:306
virtual bool isFlipped() const
int top() const
Returns the y-coordinate of the rectangle&#39;s top edge.
Definition: qrect.h:243
Q_CORE_EXPORT QTextStream & left(QTextStream &s)

◆ setVertexAttributePointer()

void QGL2PaintEngineExPrivate::setVertexAttributePointer ( unsigned int  arrayIndex,
const GLfloat *  pointer 
)
inline

Definition at line 327 of file qpaintengineex_opengl2_p.h.

Referenced by composite(), drawVertexArrays(), fill(), fillStencilWithVertexArray(), QGLTextureGlyphCache::resizeTextureData(), and transferMode().

328 {
329  Q_ASSERT(arrayIndex < 3);
330  if (pointer == vertexAttribPointers[arrayIndex])
331  return;
332 
333  vertexAttribPointers[arrayIndex] = pointer;
334  if (arrayIndex == QT_OPACITY_ATTR)
335  glVertexAttribPointer(arrayIndex, 1, GL_FLOAT, GL_FALSE, 0, pointer);
336  else
337  glVertexAttribPointer(arrayIndex, 2, GL_FLOAT, GL_FALSE, 0, pointer);
338 }
#define glVertexAttribPointer
Definition: glfunctions.h:71
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
static const GLuint QT_OPACITY_ATTR
#define GL_FALSE
#define GL_FLOAT
const GLfloat * vertexAttribPointers[3]

◆ shaderManagerForEngine()

static QGLEngineShaderManager* QGL2PaintEngineExPrivate::shaderManagerForEngine ( QGL2PaintEngineEx engine)
inlinestatic

Definition at line 253 of file qpaintengineex_opengl2_p.h.

Referenced by QGLCustomShaderStage::removeFromPainter(), and QGLCustomShaderStage::setOnPainter().

253 { return engine->d_func()->shaderManager; }

◆ stroke()

void QGL2PaintEngineExPrivate::stroke ( const QVectorPath path,
const QPen pen 
)

Definition at line 1241 of file qpaintengineex_opengl2.cpp.

1242 {
1243  const QOpenGL2PaintEngineState *s = q->state();
1244  if (snapToPixelGrid) {
1245  snapToPixelGrid = false;
1246  matrixDirty = true;
1247  }
1248 
1249  const Qt::PenStyle penStyle = qpen_style(pen);
1250  const QBrush &penBrush = qpen_brush(pen);
1251  const bool opaque = penBrush.isOpaque() && s->opacity > 0.99;
1252 
1254 
1255  // updateMatrix() is responsible for setting the inverse scale on
1256  // the strokers, so we need to call it here and not wait for
1257  // prepareForDraw() down below.
1258  updateMatrix();
1259 
1261  ? q->state()->rectangleClip
1262  : QRectF(0, 0, width, height));
1263 
1264  if (penStyle == Qt::SolidLine) {
1265  stroker.process(path, pen, clip);
1266 
1267  } else { // Some sort of dash
1268  dasher.process(path, pen, clip);
1269 
1270  QVectorPath dashStroke(dasher.points(),
1271  dasher.elementCount(),
1272  dasher.elementTypes());
1273  stroker.process(dashStroke, pen, clip);
1274  }
1275 
1276  if (!stroker.vertexCount())
1277  return;
1278 
1279  if (opaque) {
1280  prepareForDraw(opaque);
1282  glDrawArrays(GL_TRIANGLE_STRIP, 0, stroker.vertexCount() / 2);
1283 
1284 // QBrush b(Qt::green);
1285 // d->setBrush(&b);
1286 // d->prepareForDraw(true);
1287 // glDrawArrays(GL_LINE_STRIP, 0, d->stroker.vertexCount() / 2);
1288 
1289  } else {
1290  qreal width = qpen_widthf(pen) / 2;
1291  if (width == 0)
1292  width = 0.5;
1293  qreal extra = pen.joinStyle() == Qt::MiterJoin
1294  ? qMax(pen.miterLimit() * width, width)
1295  : width;
1296 
1297  if (pen.isCosmetic())
1298  extra = extra * inverseScale;
1299 
1300  QRectF bounds = path.controlPointRect().adjusted(-extra, -extra, extra, extra);
1301 
1304 
1305  glStencilOp(GL_KEEP, GL_REPLACE, GL_REPLACE);
1306 
1307  // Pass when any bit is set, replace stencil value with 0
1308  glStencilFunc(GL_NOTEQUAL, 0, GL_STENCIL_HIGH_BIT);
1309  prepareForDraw(false);
1310 
1311  // Stencil the brush onto the dest buffer
1312  composite(bounds);
1313 
1314  glStencilMask(0);
1315 
1317  }
1318 }
void setVertexAttributePointer(unsigned int arrayIndex, const GLfloat *pointer)
double qreal
Definition: qglobal.h:1193
void process(const QVectorPath &path, const QPen &pen, const QRectF &clip)
QTransform matrix
Definition: qpainter_p.h:161
PenStyle
Definition: qnamespace.h:1134
Q_DECL_CONSTEXPR const T & qMax(const T &a, const T &b)
Definition: qglobal.h:1217
QTransform inverted(bool *invertible=0) const
Returns an inverted copy of this matrix.
Definition: qtransform.cpp:364
QRectF controlPointRect() const
QRect mapRect(const QRect &) const
Creates and returns a QRect object that is a copy of the given rectangle, mapped into the coordinate ...
The QRectF class defines a rectangle in the plane using floating point precision. ...
Definition: qrect.h:511
#define GL_TRIANGLE_STRIP
QBrush qpen_brush(const QPen &p)
Definition: qpainter_p.h:87
bool isCosmetic() const
Returns true if the pen is cosmetic; otherwise returns false.
Definition: qpen.cpp:840
Qt::PenJoinStyle joinStyle() const
Returns the pen&#39;s join style.
Definition: qpen.cpp:736
qreal qpen_widthf(const QPen &p)
Definition: qpainter_p.h:88
void composite(const QGLRect &boundingRect)
#define GL_NOTEQUAL
QRectF adjusted(qreal x1, qreal y1, qreal x2, qreal y2) const
Returns a new rectangle with dx1, dy1, dx2 and dy2 added respectively to the existing coordinates of ...
Definition: qrect.h:781
bool isOpaque() const
Returns true if the brush is fully opaque otherwise false.
Definition: qbrush.cpp:910
void process(const QVectorPath &path, const QPen &pen, const QRectF &clip)
QOpenGL2PaintEngineState * state()
#define GL_STENCIL_HIGH_BIT
The QBrush class defines the fill pattern of shapes drawn by QPainter.
Definition: qbrush.h:76
QPainterPath::ElementType * elementTypes() const
uint clipEnabled
Definition: qpainter_p.h:169
qreal miterLimit() const
Returns the miter limit of the pen.
Definition: qpen.cpp:589
const float * vertices() const
void transferMode(EngineMode newMode)
static const GLuint QT_VERTEX_COORDS_ATTR
Qt::PenStyle qpen_style(const QPen &p)
Definition: qpainter_p.h:89
bool prepareForDraw(bool srcPixelsAreOpaque)
#define GL_REPLACE
void fillStencilWithVertexArray(const float *data, int count, int *stops, int stopCount, const QGLRect &bounds, StencilFillMode mode)
#define GL_KEEP

◆ systemStateChanged()

void QGL2PaintEngineExPrivate::systemStateChanged ( )
virtual

Reimplemented from QPaintEnginePrivate.

Definition at line 2506 of file qpaintengineex_opengl2.cpp.

2507 {
2509 
2510  q->state()->clipChanged = true;
2511 
2512  if (systemClip.isEmpty()) {
2513  useSystemClip = false;
2514  } else {
2517  useSystemClip = widgetPrivate->extra && widgetPrivate->extra->inRenderWithPainter;
2518  } else {
2519  useSystemClip = true;
2520  }
2521  }
2522 
2523  q->state()->clipTestEnabled = false;
2524  q->state()->needsClipBufferClear = true;
2525 
2526  q->state()->currentClip = 1;
2527  maxClip = 1;
2528 
2531 
2532  if (systemClip.rectCount() == 1) {
2533  if (systemClip.boundingRect() == QRect(0, 0, width, height))
2534  useSystemClip = false;
2535 #ifndef QT_GL_NO_SCISSOR_TEST
2536  // scissoring takes care of the system clip
2537  return;
2538 #endif
2539  }
2540 
2541  if (useSystemClip) {
2542  clearClip(0);
2543 
2544  QPainterPath path;
2545  path.addRegion(systemClip);
2546 
2547  q->state()->currentClip = 0;
2549  q->state()->currentClip = 1;
2550  q->state()->clipTestEnabled = true;
2551  }
2552 }
void addRegion(const QRegion &region)
Adds the given region to the path by adding each rectangle in the region as a separate closed subpath...
QPaintDevice * paintDevice() const
Returns the device that this engine is painting on, if painting is active; otherwise returns 0...
The QPainterPath class provides a container for painting operations, enabling graphical shapes to be ...
Definition: qpainterpath.h:67
QRect boundingRect() const
Returns the bounding rectangle of this region.
Definition: qregion.cpp:4363
const QVectorPath & qtVectorPathForPath(const QPainterPath &path)
QTransform matrix
Definition: qpainter_p.h:161
virtual int devType() const
Definition: qpaintdevice.h:167
int rectCount() const
Returns the number of rectangles that will be returned in rects().
Definition: qregion.cpp:4461
QTransform inverted(bool *invertible=0) const
Returns an inverted copy of this matrix.
Definition: qtransform.cpp:364
#define Q_Q(Class)
Definition: qglobal.h:2483
bool isEmpty() const
Returns true if the region is empty; otherwise returns false.
Definition: qregion.cpp:4098
QPoint map(const QPoint &p) const
Creates and returns a QPoint object that is a copy of the given point, mapped into the coordinate sys...
uint inRenderWithPainter
Definition: qwidget_p.h:277
QOpenGL2PaintEngineState * state()
void writeClip(const QVectorPath &path, uint value)
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58
QWExtra * extra
Definition: qwidget_p.h:700
QWidget * window() const
Returns the window for this widget, i.e.
Definition: qwidget.cpp:4492
Q_GUI_EXPORT QWidgetPrivate * qt_widget_private(QWidget *widget)
Definition: qwidget.cpp:12920
QWidget * currentClipWidget

◆ transferMode()

void QGL2PaintEngineExPrivate::transferMode ( EngineMode  newMode)

Definition at line 650 of file qpaintengineex_opengl2.cpp.

Referenced by fill(), and QGLTextureGlyphCache::resizeTextureData().

651 {
652  if (newMode == mode)
653  return;
654 
656  lastTextureUsed = GLuint(-1);
657  }
658 
659  if (newMode == TextDrawingMode) {
661  } else {
663  }
664 
665  imageDrawingMode = false;
666 
667  if (newMode == ImageDrawingMode) {
670  imageDrawingMode = true;
671  }
672 
673  if (newMode == ImageArrayDrawingMode || newMode == ImageArrayWithOpacityDrawingMode) {
676  imageDrawingMode = true;
677  }
678 
679  if (newMode == ImageArrayWithOpacityDrawingMode) {
681  }
682 
683  // This needs to change when we implement high-quality anti-aliasing...
684  if (newMode != TextDrawingMode)
686 
687  mode = newMode;
688 }
void setVertexAttributePointer(unsigned int arrayIndex, const GLfloat *pointer)
QGLEngineShaderManager * shaderManager
Type * data() const
Definition: qdatabuffer_p.h:84
QGL2PEXVertexArray textureCoordinateArray
static const GLuint QT_OPACITY_ATTR
QDataBuffer< GLfloat > opacityArray
QGL2PEXVertexArray vertexCoordinateArray
void setHasComplexGeometry(bool hasComplexGeometry)
static const GLuint QT_TEXTURE_COORDS_ATTR
static const GLuint QT_VERTEX_COORDS_ATTR

◆ updateBrushTexture()

void QGL2PaintEngineExPrivate::updateBrushTexture ( )

Definition at line 197 of file qpaintengineex_opengl2.cpp.

Referenced by prepareForDraw().

198 {
200 // qDebug("QGL2PaintEngineExPrivate::updateBrushTexture()");
202 
203  if ( (style >= Qt::Dense1Pattern) && (style <= Qt::DiagCrossPattern) ) {
204  // Get the image data for the pattern
205  QImage texImage = qt_imageForBrush(style, false);
206 
209 #if !defined(QT_NO_DEBUG) && defined(QT_OPENGL_ES_2)
211  bool npotSupported = funcs.hasOpenGLFeature(QGLFunctions::NPOTTextures);
212  bool isNpot = !isPowerOfTwo(texImage.size().width())
213  || !isPowerOfTwo(texImage.size().height());
214  if (isNpot && !npotSupported) {
215  qWarning("GL2 Paint Engine: This system does not support the REPEAT wrap mode for non-power-of-two textures.");
216  }
217 #endif
219  }
220  else if (style >= Qt::LinearGradientPattern && style <= Qt::ConicalGradientPattern) {
221  // Gradiant brush: All the gradiants use the same texture
222 
223  const QGradient* g = currentBrush.gradient();
224 
225  // We apply global opacity in the fragment shaders, so we always pass 1.0
226  // for opacity to the cache.
227  GLuint texId = QGL2GradientCache::cacheForContext(ctx)->getBuffer(*g, 1.0);
228 
230  glBindTexture(GL_TEXTURE_2D, texId);
231 
234  else if (g->spread() == QGradient::ReflectSpread)
236  else
238  }
239  else if (style == Qt::TexturePattern) {
241 
242  int max_texture_size = ctx->d_func()->maxTextureSize();
243  if (currentBrushPixmap.width() > max_texture_size || currentBrushPixmap.height() > max_texture_size)
244  currentBrushPixmap = currentBrushPixmap.scaled(max_texture_size, max_texture_size, Qt::KeepAspectRatio);
245 
250  GLenum wrapMode = GL_REPEAT;
251 #ifdef QT_OPENGL_ES_2
252  // should check for GL_OES_texture_npot or GL_IMG_texture_npot extension
254  wrapMode = GL_CLAMP_TO_EDGE;
255 #endif
258  }
259  brushTextureDirty = false;
260 }
BrushStyle
Definition: qnamespace.h:1162
#define GL_CLAMP_TO_EDGE
Definition: glfunctions.h:62
int width() const
Returns the width of the pixmap.
Definition: qpixmap.cpp:630
void updateTextureFilter(GLenum target, GLenum wrapMode, bool smoothPixmapTransform, GLuint id=-1)
QPainter::RenderHints renderHints
Definition: qpainter_p.h:158
const QGradient * gradient() const
Returns the gradient describing this brush.
Definition: qbrush.cpp:871
QPixmap scaled(int w, int h, Qt::AspectRatioMode aspectMode=Qt::IgnoreAspectRatio, Qt::TransformationMode mode=Qt::FastTransformation) const
Definition: qpixmap.h:132
GLuint bindTexture(const QImage &image, GLenum target, GLint format, BindOptions options)
Generates and binds a 2D GL texture to the current context, based on image.
Definition: qgl.cpp:2854
QGLContext::BindOptions options
Definition: qgl_p.h:611
#define GL_TEXTURE_2D
static const QGLContext * currentContext()
Returns the current context, i.e.
Definition: qgl.cpp:3545
#define Q_Q(Class)
Definition: qglobal.h:2483
The QGLFunctions class provides cross-platform access to the OpenGL/ES 2.0 API.
Definition: qglfunctions.h:178
#define GL_REPEAT
#define GL_TEXTURE0
Definition: glfunctions.h:61
int width() const
Returns the width.
Definition: qsize.h:126
#define GL_MIRRORED_REPEAT_IBM
Q_CORE_EXPORT void qWarning(const char *,...)
The QImage class provides a hardware-independent image representation that allows direct access to th...
Definition: qimage.h:87
Qt::BrushStyle style() const
Returns the brush style.
Definition: qbrush.h:182
QPixmap texture() const
Returns the custom brush pattern, or a null pixmap if no custom brush pattern has been set...
Definition: qbrush.cpp:785
QOpenGL2PaintEngineState * state()
GLuint getBuffer(const QGradient &gradient, qreal opacity)
#define glActiveTexture
Definition: glfunctions.h:69
QSize size() const
Returns the size of the image, i.
Definition: qimage.cpp:1587
Q_GUI_EXPORT QImage qt_imageForBrush(int brushStyle, bool invert)
Definition: qbrush.cpp:167
unsigned int GLenum
Definition: main.cpp:50
Type type() const
Returns the type of gradient.
Definition: qbrush.h:232
static QGL2GradientCache * cacheForContext(const QGLContext *context)
The QGradient class is used in combination with QBrush to specify gradient fills. ...
Definition: qbrush.h:201
#define QT_BRUSH_TEXTURE_UNIT
int height() const
Returns the height.
Definition: qsize.h:129
Spread spread() const
Returns the spread method use by this gradient.
Definition: qbrush.h:235
#define GL_RGBA
int height() const
Returns the height of the pixmap.
Definition: qpixmap.cpp:645
static bool isPowerOfTwo(uint x)

◆ updateBrushUniforms()

void QGL2PaintEngineExPrivate::updateBrushUniforms ( )

Definition at line 263 of file qpaintengineex_opengl2.cpp.

Referenced by prepareForDraw().

264 {
265 // qDebug("QGL2PaintEngineExPrivate::updateBrushUniforms()");
267 
268  if (style == Qt::NoBrush)
269  return;
270 
271  QTransform brushQTransform = currentBrush.transform();
272 
273  if (style == Qt::SolidPattern) {
274  QColor col = qt_premultiplyColor(currentBrush.color(), (GLfloat)q->state()->opacity);
276  }
277  else {
278  // All other brushes have a transform and thus need the translation point:
279  QPointF translationPoint;
280 
281  if (style <= Qt::DiagCrossPattern) {
282  QColor col = qt_premultiplyColor(currentBrush.color(), (GLfloat)q->state()->opacity);
283 
285 
286  QVector2D halfViewportSize(width*0.5, height*0.5);
288  }
289  else if (style == Qt::LinearGradientPattern) {
290  const QLinearGradient *g = static_cast<const QLinearGradient *>(currentBrush.gradient());
291 
292  QPointF realStart = g->start();
293  QPointF realFinal = g->finalStop();
294  translationPoint = realStart;
295 
296  QPointF l = realFinal - realStart;
297 
298  QVector3D linearData(
299  l.x(),
300  l.y(),
301  1.0f / (l.x() * l.x() + l.y() * l.y())
302  );
303 
305 
306  QVector2D halfViewportSize(width*0.5, height*0.5);
308  }
309  else if (style == Qt::ConicalGradientPattern) {
310  const QConicalGradient *g = static_cast<const QConicalGradient *>(currentBrush.gradient());
311  translationPoint = g->center();
312 
313  GLfloat angle = -(g->angle() * 2 * Q_PI) / 360.0;
314 
316 
317  QVector2D halfViewportSize(width*0.5, height*0.5);
319  }
320  else if (style == Qt::RadialGradientPattern) {
321  const QRadialGradient *g = static_cast<const QRadialGradient *>(currentBrush.gradient());
322  QPointF realCenter = g->center();
323  QPointF realFocal = g->focalPoint();
324  qreal realRadius = g->centerRadius() - g->focalRadius();
325  translationPoint = realFocal;
326 
327  QPointF fmp = realCenter - realFocal;
329 
330  GLfloat fmp2_m_radius2 = -fmp.x() * fmp.x() - fmp.y() * fmp.y() + realRadius*realRadius;
333  GLfloat(1.0 / (2.0*fmp2_m_radius2)));
335  GLfloat(g->focalRadius() * g->focalRadius()));
337  GLfloat(2 * (g->centerRadius() - g->focalRadius()) * g->focalRadius()),
338  g->focalRadius(),
339  g->centerRadius() - g->focalRadius());
340 
341  QVector2D halfViewportSize(width*0.5, height*0.5);
343  }
344  else if (style == Qt::TexturePattern) {
345  const QPixmap& texPixmap = currentBrush.texture();
346 
348  QColor col = qt_premultiplyColor(currentBrush.color(), (GLfloat)q->state()->opacity);
350  }
351 
352  QSizeF invertedTextureSize(1.0 / texPixmap.width(), 1.0 / texPixmap.height());
354 
355  QVector2D halfViewportSize(width*0.5, height*0.5);
357  }
358  else
359  qWarning("QGL2PaintEngineEx: Unimplemented fill style");
360 
361  const QPointF &brushOrigin = q->state()->brushOrigin;
362  QTransform matrix = q->state()->matrix;
363  matrix.translate(brushOrigin.x(), brushOrigin.y());
364 
365  QTransform translate(1, 0, 0, 1, -translationPoint.x(), -translationPoint.y());
366  qreal m22 = -1;
367  qreal dy = height;
368  if (device->isFlipped()) {
369  m22 = 1;
370  dy = 0;
371  }
372  QTransform gl_to_qt(1, 0, 0, m22, 0, dy);
373  QTransform inv_matrix;
374  if (style == Qt::TexturePattern && textureInvertedY == -1)
375  inv_matrix = gl_to_qt * (QTransform(1, 0, 0, -1, 0, currentBrush.texture().height()) * brushQTransform * matrix).inverted() * translate;
376  else
377  inv_matrix = gl_to_qt * (brushQTransform * matrix).inverted() * translate;
378 
381  }
382  brushUniformsDirty = false;
383 }
qreal focalRadius() const
Returns the focal radius of this radial gradient in logical coordinates.
Definition: qbrush.cpp:2211
The QColor class provides colors based on RGB, HSV or CMYK values.
Definition: qcolor.h:67
QPointF focalPoint() const
Returns the focal point of this radial gradient in logical coordinates.
Definition: qbrush.cpp:2251
The QVector3D class represents a vector or vertex in 3D space.
Definition: qvector3d.h:60
BrushStyle
Definition: qnamespace.h:1162
double qreal
Definition: qglobal.h:1193
const QColor & color() const
Returns the brush color.
Definition: qbrush.h:183
int width() const
Returns the width of the pixmap.
Definition: qpixmap.cpp:630
QGLEngineShaderManager * shaderManager
const QGradient * gradient() const
Returns the gradient describing this brush.
Definition: qbrush.cpp:871
The QConicalGradient class is used in combination with QBrush to specify a conical gradient brush...
Definition: qbrush.h:329
The QPointF class defines a point in the plane using floating point precision.
Definition: qpoint.h:214
QTransform matrix
Definition: qpainter_p.h:161
QTransform & translate(qreal dx, qreal dy)
Moves the coordinate system dx along the x axis and dy along the y axis, and returns a reference to t...
Definition: qtransform.cpp:417
The QRadialGradient class is used in combination with QBrush to specify a radial gradient brush...
Definition: qbrush.h:297
QTransform transform() const
Returns the current transformation matrix for the brush.
Definition: qbrush.h:185
qreal angle() const
Returns the start angle of the conical gradient in logical coordinates.
Definition: qbrush.cpp:2433
The QSizeF class defines the size of a two-dimensional object using floating point precision...
Definition: qsize.h:202
QTransform inverted(bool *invertible=0) const
Returns an inverted copy of this matrix.
Definition: qtransform.cpp:364
GLuint location(const QGLEngineShaderManager::Uniform uniform)
qreal x() const
Returns the x-coordinate of this point.
Definition: qpoint.h:282
QPointF center() const
Returns the center of the conical gradient in logical coordinates.
Definition: qbrush.cpp:2391
bool Q_GUI_EXPORT qHasPixmapTexture(const QBrush &brush)
Definition: qbrush.cpp:223
QColor qt_premultiplyColor(QColor c, GLfloat opacity)
Q_CORE_EXPORT void qWarning(const char *,...)
The QVector2D class represents a vector or vertex in 2D space.
Definition: qvector2d.h:60
bool isQBitmap() const
Returns true if this is a QBitmap; otherwise returns false.
Definition: qpixmap.cpp:599
Qt::BrushStyle style() const
Returns the brush style.
Definition: qbrush.h:182
QPixmap texture() const
Returns the custom brush pattern, or a null pixmap if no custom brush pattern has been set...
Definition: qbrush.cpp:785
QPointF start() const
Returns the start point of this linear gradient in logical coordinates.
Definition: qbrush.cpp:1796
QOpenGL2PaintEngineState * state()
virtual bool isFlipped() const
qreal angle(const QPointF &p1, const QPointF &p2)
void setUniformValue(int location, GLfloat value)
Sets the uniform variable at location in the current context to value.
The QLinearGradient class is used in combination with QBrush to specify a linear gradient brush...
Definition: qbrush.h:280
#define QT_BRUSH_TEXTURE_UNIT
QPointF brushOrigin
Definition: qpainter_p.h:149
QFactoryLoader * l
QGLShaderProgram * currentProgram()
qreal y() const
Returns the y-coordinate of this point.
Definition: qpoint.h:287
QPointF center() const
Returns the center of this radial gradient in logical coordinates.
Definition: qbrush.cpp:2102
The QPixmap class is an off-screen image representation that can be used as a paint device...
Definition: qpixmap.h:71
int height() const
Returns the height of the pixmap.
Definition: qpixmap.cpp:645
qreal centerRadius() const
Returns the center radius of this radial gradient in logical coordinates.
Definition: qbrush.cpp:2182
QPointF finalStop() const
Returns the final stop point of this linear gradient in logical coordinates.
Definition: qbrush.cpp:1856
The QTransform class specifies 2D transformations of a coordinate system.
Definition: qtransform.h:65
static const qreal Q_PI
Definition: qmath_p.h:61

◆ updateClipScissorTest()

void QGL2PaintEngineExPrivate::updateClipScissorTest ( )

Definition at line 2252 of file qpaintengineex_opengl2.cpp.

Referenced by fill(), fillStencilWithVertexArray(), and QGLTextureGlyphCache::resizeTextureData().

2253 {
2255  if (q->state()->clipTestEnabled) {
2256  glEnable(GL_STENCIL_TEST);
2257  glStencilFunc(GL_LEQUAL, q->state()->currentClip, ~GL_STENCIL_HIGH_BIT);
2258  } else {
2259  glDisable(GL_STENCIL_TEST);
2260  glStencilFunc(GL_ALWAYS, 0, 0xff);
2261  }
2262 
2263 #ifdef QT_GL_NO_SCISSOR_TEST
2265 #else
2266  QRect bounds = q->state()->rectangleClip;
2267  if (!q->state()->clipEnabled) {
2268  if (useSystemClip)
2269  bounds = systemClip.boundingRect();
2270  else
2271  bounds = QRect(0, 0, width, height);
2272  } else {
2273  if (useSystemClip)
2274  bounds = bounds.intersected(systemClip.boundingRect());
2275  else
2276  bounds = bounds.intersected(QRect(0, 0, width, height));
2277  }
2278 
2279  currentScissorBounds = bounds;
2280 
2281  if (bounds == QRect(0, 0, width, height)) {
2282  if (ctx->d_func()->workaround_brokenScissor)
2283  clearClip(0);
2284  glDisable(GL_SCISSOR_TEST);
2285  } else {
2286  glEnable(GL_SCISSOR_TEST);
2287  setScissor(bounds);
2288  }
2289 #endif
2290 }
QRect intersected(const QRect &other) const
Returns the intersection of this rectangle and the given rectangle.
Definition: qrect.h:481
QRect boundingRect() const
Returns the bounding rectangle of this region.
Definition: qregion.cpp:4363
#define GL_STENCIL_TEST
void setScissor(const QRect &rect)
#define GL_SCISSOR_TEST
#define Q_Q(Class)
Definition: qglobal.h:2483
#define GL_LEQUAL
QOpenGL2PaintEngineState * state()
#define GL_STENCIL_HIGH_BIT
uint clipEnabled
Definition: qpainter_p.h:169
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58
#define GL_ALWAYS

◆ updateCompositionMode()

void QGL2PaintEngineExPrivate::updateCompositionMode ( )

Definition at line 458 of file qpaintengineex_opengl2.cpp.

Referenced by prepareForDraw().

459 {
460  // NOTE: The entire paint engine works on pre-multiplied data - which is why some of these
461  // composition modes look odd.
462 // qDebug() << "QGL2PaintEngineExPrivate::updateCompositionMode() - Setting GL composition mode for " << q->state()->composition_mode;
463  switch(q->state()->composition_mode) {
465  glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
466  break;
468  glBlendFunc(GL_ONE_MINUS_DST_ALPHA, GL_ONE);
469  break;
471  glBlendFunc(GL_ZERO, GL_ZERO);
472  break;
474  glBlendFunc(GL_ONE, GL_ZERO);
475  break;
477  glBlendFunc(GL_ZERO, GL_ONE);
478  break;
480  glBlendFunc(GL_DST_ALPHA, GL_ZERO);
481  break;
483  glBlendFunc(GL_ZERO, GL_SRC_ALPHA);
484  break;
486  glBlendFunc(GL_ONE_MINUS_DST_ALPHA, GL_ZERO);
487  break;
489  glBlendFunc(GL_ZERO, GL_ONE_MINUS_SRC_ALPHA);
490  break;
492  glBlendFunc(GL_DST_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
493  break;
495  glBlendFunc(GL_ONE_MINUS_DST_ALPHA, GL_SRC_ALPHA);
496  break;
499  break;
501  glBlendFunc(GL_ONE, GL_ONE);
502  break;
503  default:
504  qWarning("Unsupported composition mode");
505  break;
506  }
507 
508  compositionModeDirty = false;
509 }
#define GL_ONE_MINUS_SRC_ALPHA
QPainter::CompositionMode composition_mode
Definition: qpainter_p.h:174
#define GL_SRC_ALPHA
#define GL_ONE_MINUS_DST_ALPHA
Q_CORE_EXPORT void qWarning(const char *,...)
#define GL_ZERO
QOpenGL2PaintEngineState * state()
#define GL_DST_ALPHA
#define GL_ONE

◆ updateMatrix()

void QGL2PaintEngineExPrivate::updateMatrix ( )

Definition at line 387 of file qpaintengineex_opengl2.cpp.

Referenced by fill(), prepareForDraw(), and useSimpleShader().

388 {
389 // qDebug("QGL2PaintEngineExPrivate::updateMatrix()");
390 
391  const QTransform& transform = q->state()->matrix;
392 
393  // The projection matrix converts from Qt's coordinate system to GL's coordinate system
394  // * GL's viewport is 2x2, Qt's is width x height
395  // * GL has +y -> -y going from bottom -> top, Qt is the other way round
396  // * GL has [0,0] in the center, Qt has it in the top-left
397  //
398  // This results in the Projection matrix below, which is multiplied by the painter's
399  // transformation matrix, as shown below:
400  //
401  // Projection Matrix Painter Transform
402  // ------------------------------------------------ ------------------------
403  // | 2.0 / width | 0.0 | -1.0 | | m11 | m21 | dx |
404  // | 0.0 | -2.0 / height | 1.0 | * | m12 | m22 | dy |
405  // | 0.0 | 0.0 | 1.0 | | m13 | m23 | m33 |
406  // ------------------------------------------------ ------------------------
407  //
408  // NOTE: The resultant matrix is also transposed, as GL expects column-major matracies
409 
410  const GLfloat wfactor = 2.0f / width;
411  GLfloat hfactor = -2.0f / height;
412 
413  GLfloat dx = transform.dx();
414  GLfloat dy = transform.dy();
415 
416  if (device->isFlipped()) {
417  hfactor *= -1;
418  dy -= height;
419  }
420 
421  // Non-integer translates can have strange effects for some rendering operations such as
422  // anti-aliased text rendering. In such cases, we snap the translate to the pixel grid.
423  if (snapToPixelGrid && transform.type() == QTransform::TxTranslate) {
424  // 0.50 needs to rounded down to 0.0 for consistency with raster engine:
425  dx = ceilf(dx - 0.5f);
426  dy = ceilf(dy - 0.5f);
427  }
428  pmvMatrix[0][0] = (wfactor * transform.m11()) - transform.m13();
429  pmvMatrix[1][0] = (wfactor * transform.m21()) - transform.m23();
430  pmvMatrix[2][0] = (wfactor * dx) - transform.m33();
431  pmvMatrix[0][1] = (hfactor * transform.m12()) + transform.m13();
432  pmvMatrix[1][1] = (hfactor * transform.m22()) + transform.m23();
433  pmvMatrix[2][1] = (hfactor * dy) + transform.m33();
434  pmvMatrix[0][2] = transform.m13();
435  pmvMatrix[1][2] = transform.m23();
436  pmvMatrix[2][2] = transform.m33();
437 
438  // 1/10000 == 0.0001, so we have good enough res to cover curves
439  // that span the entire widget...
440  inverseScale = qMax(1 / qMax( qMax(qAbs(transform.m11()), qAbs(transform.m22())),
441  qMax(qAbs(transform.m12()), qAbs(transform.m21())) ),
442  qreal(0.0001));
443 
444  matrixDirty = false;
445  matrixUniformDirty = true;
446 
447  // Set the PMV matrix attribute. As we use an attributes rather than uniforms, we only
448  // need to do this once for every matrix change and persists across all shader programs.
452 
455 }
qreal dy() const
Returns the vertical translation factor.
Definition: qtransform.h:277
static const GLuint QT_PMV_MATRIX_3_ATTR
double qreal
Definition: qglobal.h:1193
qreal m21() const
Returns the horizontal shearing factor.
Definition: qtransform.h:249
qreal m22() const
Returns the vertical scaling factor.
Definition: qtransform.h:253
#define glVertexAttrib3fv
QTransform matrix
Definition: qpainter_p.h:161
Q_DECL_CONSTEXPR T qAbs(const T &t)
Definition: qglobal.h:1201
TransformationType type() const
Returns the transformation type of this matrix.
Q_DECL_CONSTEXPR const T & qMax(const T &a, const T &b)
Definition: qglobal.h:1217
qreal m12() const
Returns the vertical shearing factor.
Definition: qtransform.h:241
static const GLuint QT_PMV_MATRIX_2_ATTR
void setInvScale(qreal invScale)
QOpenGL2PaintEngineState * state()
virtual bool isFlipped() const
static const GLuint QT_PMV_MATRIX_1_ATTR
qreal m23() const
Returns the vertical projection factor.
Definition: qtransform.h:257
qreal dx() const
Returns the horizontal translation factor.
Definition: qtransform.h:273
qreal m13() const
Returns the horizontal projection factor.
Definition: qtransform.h:245
void setInvScale(qreal invScale)
qreal m11() const
Returns the horizontal scaling factor.
Definition: qtransform.h:237
qreal m33() const
Returns the division factor.
Definition: qtransform.h:269
The QTransform class specifies 2D transformations of a coordinate system.
Definition: qtransform.h:65

◆ updateTextureFilter()

void QGL2PaintEngineExPrivate::updateTextureFilter ( GLenum  target,
GLenum  wrapMode,
bool  smoothPixmapTransform,
GLuint  id = -1 
)

Definition at line 131 of file qpaintengineex_opengl2.cpp.

Referenced by updateBrushTexture().

132 {
133 // glActiveTexture(GL_TEXTURE0 + QT_BRUSH_TEXTURE_UNIT); //### Is it always this texture unit?
134  if (id != GLuint(-1) && id == lastTextureUsed)
135  return;
136 
137  lastTextureUsed = id;
138 
139  if (smoothPixmapTransform) {
140  glTexParameterf(target, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
141  glTexParameterf(target, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
142  } else {
143  glTexParameterf(target, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
144  glTexParameterf(target, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
145  }
146  glTexParameterf(target, GL_TEXTURE_WRAP_S, wrapMode);
147  glTexParameterf(target, GL_TEXTURE_WRAP_T, wrapMode);
148 }
#define GL_TEXTURE_MIN_FILTER
#define GL_TEXTURE_WRAP_S
#define GL_TEXTURE_WRAP_T
#define GL_LINEAR
#define GL_TEXTURE_MAG_FILTER
#define GL_NEAREST

◆ useSimpleShader()

void QGL2PaintEngineExPrivate::useSimpleShader ( )
inline

◆ writeClip()

void QGL2PaintEngineExPrivate::writeClip ( const QVectorPath path,
uint  value 
)

Definition at line 2329 of file qpaintengineex_opengl2.cpp.

2330 {
2332 
2333  if (snapToPixelGrid) {
2334  snapToPixelGrid = false;
2335  matrixDirty = true;
2336  }
2337 
2338  if (matrixDirty)
2339  updateMatrix();
2340 
2341  stencilClean = false;
2342 
2343  const bool singlePass = !path.hasWindingFill()
2344  && (((q->state()->currentClip == maxClip - 1) && q->state()->clipTestEnabled)
2345  || q->state()->needsClipBufferClear);
2346  const uint referenceClipValue = q->state()->needsClipBufferClear ? 1 : q->state()->currentClip;
2347 
2348  if (q->state()->needsClipBufferClear)
2349  clearClip(1);
2350 
2351  if (path.isEmpty()) {
2352  glEnable(GL_STENCIL_TEST);
2353  glStencilFunc(GL_LEQUAL, value, ~GL_STENCIL_HIGH_BIT);
2354  return;
2355  }
2356 
2357  if (q->state()->clipTestEnabled)
2358  glStencilFunc(GL_LEQUAL, q->state()->currentClip, ~GL_STENCIL_HIGH_BIT);
2359  else
2360  glStencilFunc(GL_ALWAYS, 0, 0xff);
2361 
2364 
2365  if (!singlePass)
2367 
2368  glColorMask(false, false, false, false);
2369  glEnable(GL_STENCIL_TEST);
2370  useSimpleShader();
2371 
2372  if (singlePass) {
2373  // Under these conditions we can set the new stencil value in a single
2374  // pass, by using the current value and the "new value" as the toggles
2375 
2376  glStencilFunc(GL_LEQUAL, referenceClipValue, ~GL_STENCIL_HIGH_BIT);
2377  glStencilOp(GL_KEEP, GL_INVERT, GL_INVERT);
2378  glStencilMask(value ^ referenceClipValue);
2379 
2381  } else {
2382  glStencilOp(GL_KEEP, GL_REPLACE, GL_REPLACE);
2383  glStencilMask(0xff);
2384 
2385  if (!q->state()->clipTestEnabled && path.hasWindingFill()) {
2386  // Pass when any clip bit is set, set high bit
2389  }
2390 
2391  // Pass when high bit is set, replace stencil value with new clip value
2392  glStencilFunc(GL_NOTEQUAL, value, GL_STENCIL_HIGH_BIT);
2393 
2395  }
2396 
2397  glStencilFunc(GL_LEQUAL, value, ~GL_STENCIL_HIGH_BIT);
2398  glStencilMask(0);
2399 
2400  glColorMask(true, true, true, true);
2401 }
bool isEmpty() const
#define GL_INVERT
#define GL_STENCIL_TEST
QGLRect boundingRect() const
QGL2PEXVertexArray vertexCoordinateArray
void composite(const QGLRect &boundingRect)
unsigned int uint
Definition: qglobal.h:996
#define GL_TRIANGLE_FAN
#define GL_NOTEQUAL
#define GL_LEQUAL
bool hasWindingFill() const
QOpenGL2PaintEngineState * state()
void addPath(const QVectorPath &path, GLfloat curveInverseScale, bool outline=true)
#define GL_STENCIL_HIGH_BIT
void transferMode(EngineMode newMode)
#define GL_ALWAYS
#define GL_REPLACE
void drawVertexArrays(const float *data, int *stops, int stopCount, GLenum primitive)
void fillStencilWithVertexArray(const float *data, int count, int *stops, int stopCount, const QGLRect &bounds, StencilFillMode mode)
#define GL_KEEP

Properties

◆ blurFilter

QScopedPointer<QPixmapFilter> QGL2PaintEngineExPrivate::blurFilter

Definition at line 314 of file qpaintengineex_opengl2_p.h.

◆ brushTextureDirty

bool QGL2PaintEngineExPrivate::brushTextureDirty

Definition at line 270 of file qpaintengineex_opengl2_p.h.

Referenced by prepareForDraw(), setBrush(), and updateBrushTexture().

◆ brushUniformsDirty

bool QGL2PaintEngineExPrivate::brushUniformsDirty

Definition at line 271 of file qpaintengineex_opengl2_p.h.

Referenced by prepareForDraw(), setBrush(), and updateBrushUniforms().

◆ colorizeFilter

QScopedPointer<QPixmapFilter> QGL2PaintEngineExPrivate::colorizeFilter

Definition at line 313 of file qpaintengineex_opengl2_p.h.

◆ compositionModeDirty

bool QGL2PaintEngineExPrivate::compositionModeDirty

Definition at line 269 of file qpaintengineex_opengl2_p.h.

Referenced by prepareForDraw(), and updateCompositionMode().

◆ convolutionFilter

QScopedPointer<QPixmapFilter> QGL2PaintEngineExPrivate::convolutionFilter

Definition at line 312 of file qpaintengineex_opengl2_p.h.

◆ ctx

QGLContext* QGL2PaintEngineExPrivate::ctx

◆ currentBrush

QBrush QGL2PaintEngineExPrivate::currentBrush

◆ currentBrushPixmap

QPixmap QGL2PaintEngineExPrivate::currentBrushPixmap

Definition at line 284 of file qpaintengineex_opengl2_p.h.

Referenced by setBrush(), and updateBrushTexture().

◆ currentScissorBounds

QRect QGL2PaintEngineExPrivate::currentScissorBounds

Definition at line 278 of file qpaintengineex_opengl2_p.h.

Referenced by fillStencilWithVertexArray().

◆ dasher

QDashedStrokeProcessor QGL2PaintEngineExPrivate::dasher

Definition at line 310 of file qpaintengineex_opengl2_p.h.

Referenced by updateMatrix().

◆ depthRange

GLfloat QGL2PaintEngineExPrivate::depthRange[2]

Definition at line 305 of file qpaintengineex_opengl2_p.h.

◆ device

QGLPaintDevice* QGL2PaintEngineExPrivate::device

Definition at line 260 of file qpaintengineex_opengl2_p.h.

Referenced by fill(), updateBrushUniforms(), and updateMatrix().

◆ dirtyStencilRegion

QRegion QGL2PaintEngineExPrivate::dirtyStencilRegion

Definition at line 277 of file qpaintengineex_opengl2_p.h.

Referenced by fillStencilWithVertexArray().

◆ dropShadowFilter

QScopedPointer<QPixmapFilter> QGL2PaintEngineExPrivate::dropShadowFilter

Definition at line 315 of file qpaintengineex_opengl2_p.h.

◆ elementIndices

QVector<GLushort> QGL2PaintEngineExPrivate::elementIndices

Definition at line 288 of file qpaintengineex_opengl2_p.h.

◆ elementIndicesVBOId

GLuint QGL2PaintEngineExPrivate::elementIndicesVBOId

Definition at line 289 of file qpaintengineex_opengl2_p.h.

Referenced by ~QGL2PaintEngineExPrivate().

◆ glyphCacheType

QFontEngineGlyphCache::Type QGL2PaintEngineExPrivate::glyphCacheType

Definition at line 265 of file qpaintengineex_opengl2_p.h.

◆ hasCompatibilityExtension

bool QGL2PaintEngineExPrivate::hasCompatibilityExtension

Definition at line 323 of file qpaintengineex_opengl2_p.h.

◆ height

int QGL2PaintEngineExPrivate::height

◆ imageDrawingMode

bool QGL2PaintEngineExPrivate::imageDrawingMode

Definition at line 264 of file qpaintengineex_opengl2_p.h.

Referenced by prepareForDraw(), and transferMode().

◆ inverseScale

GLfloat QGL2PaintEngineExPrivate::inverseScale

Definition at line 297 of file qpaintengineex_opengl2_p.h.

Referenced by fill(), and updateMatrix().

◆ lastMaskTextureUsed

GLuint QGL2PaintEngineExPrivate::lastMaskTextureUsed

Definition at line 300 of file qpaintengineex_opengl2_p.h.

◆ lastTextureUsed

GLuint QGL2PaintEngineExPrivate::lastTextureUsed

Definition at line 299 of file qpaintengineex_opengl2_p.h.

Referenced by transferMode(), and updateTextureFilter().

◆ matrixDirty

bool QGL2PaintEngineExPrivate::matrixDirty

◆ matrixUniformDirty

bool QGL2PaintEngineExPrivate::matrixUniformDirty

Definition at line 273 of file qpaintengineex_opengl2_p.h.

Referenced by prepareForDraw(), and updateMatrix().

◆ maxClip

uint QGL2PaintEngineExPrivate::maxClip

Definition at line 279 of file qpaintengineex_opengl2_p.h.

Referenced by resetClipIfNeeded().

◆ mode

EngineMode QGL2PaintEngineExPrivate::mode

Definition at line 263 of file qpaintengineex_opengl2_p.h.

Referenced by prepareForDraw(), and transferMode().

◆ multisamplingAlwaysEnabled

bool QGL2PaintEngineExPrivate::multisamplingAlwaysEnabled

Definition at line 303 of file qpaintengineex_opengl2_p.h.

◆ nativePaintingActive

bool QGL2PaintEngineExPrivate::nativePaintingActive

Definition at line 295 of file qpaintengineex_opengl2_p.h.

◆ needsSync

bool QGL2PaintEngineExPrivate::needsSync

Definition at line 302 of file qpaintengineex_opengl2_p.h.

◆ noBrush

const QBrush QGL2PaintEngineExPrivate::noBrush

Definition at line 282 of file qpaintengineex_opengl2_p.h.

Referenced by drawTexture().

◆ opacityArray

QDataBuffer<GLfloat> QGL2PaintEngineExPrivate::opacityArray

Definition at line 290 of file qpaintengineex_opengl2_p.h.

Referenced by transferMode().

◆ opacityUniformDirty

bool QGL2PaintEngineExPrivate::opacityUniformDirty

Definition at line 272 of file qpaintengineex_opengl2_p.h.

Referenced by prepareForDraw().

◆ pathCaches

QSet<QVectorPath::CacheEntry *> QGL2PaintEngineExPrivate::pathCaches

Definition at line 317 of file qpaintengineex_opengl2_p.h.

Referenced by ~QGL2PaintEngineExPrivate().

◆ pmvMatrix

GLfloat QGL2PaintEngineExPrivate::pmvMatrix[3][3]

Definition at line 296 of file qpaintengineex_opengl2_p.h.

Referenced by prepareForDraw(), and updateMatrix().

◆ q

QGL2PaintEngineEx* QGL2PaintEngineExPrivate::q

◆ shaderManager

QGLEngineShaderManager* QGL2PaintEngineExPrivate::shaderManager

◆ snapToPixelGrid

bool QGL2PaintEngineExPrivate::snapToPixelGrid

Definition at line 294 of file qpaintengineex_opengl2_p.h.

Referenced by drawTexture(), fill(), and updateMatrix().

◆ staticTextureCoordinateArray

GLfloat QGL2PaintEngineExPrivate::staticTextureCoordinateArray[8]

Definition at line 292 of file qpaintengineex_opengl2_p.h.

Referenced by drawTexture(), and transferMode().

◆ staticVertexCoordinateArray

GLfloat QGL2PaintEngineExPrivate::staticVertexCoordinateArray[8]

Definition at line 291 of file qpaintengineex_opengl2_p.h.

Referenced by composite(), drawTexture(), and transferMode().

◆ stencilClean

bool QGL2PaintEngineExPrivate::stencilClean

Definition at line 275 of file qpaintengineex_opengl2_p.h.

Referenced by fillStencilWithVertexArray().

◆ stroker

QTriangulatingStroker QGL2PaintEngineExPrivate::stroker

Definition at line 309 of file qpaintengineex_opengl2_p.h.

Referenced by updateMatrix().

◆ textureCoordinateArray

QGL2PEXVertexArray QGL2PaintEngineExPrivate::textureCoordinateArray

Definition at line 287 of file qpaintengineex_opengl2_p.h.

Referenced by transferMode().

◆ textureInvertedY

float QGL2PaintEngineExPrivate::textureInvertedY

Definition at line 307 of file qpaintengineex_opengl2_p.h.

Referenced by updateBrushTexture(), and updateBrushUniforms().

◆ unusedIBOSToClean

QVector<GLuint> QGL2PaintEngineExPrivate::unusedIBOSToClean

Definition at line 319 of file qpaintengineex_opengl2_p.h.

◆ unusedVBOSToClean

QVector<GLuint> QGL2PaintEngineExPrivate::unusedVBOSToClean

Definition at line 318 of file qpaintengineex_opengl2_p.h.

◆ useSystemClip

bool QGL2PaintEngineExPrivate::useSystemClip

Definition at line 276 of file qpaintengineex_opengl2_p.h.

◆ vertexAttribPointers

const GLfloat* QGL2PaintEngineExPrivate::vertexAttribPointers[3]

Definition at line 321 of file qpaintengineex_opengl2_p.h.

◆ vertexCoordinateArray

QGL2PEXVertexArray QGL2PaintEngineExPrivate::vertexCoordinateArray

Definition at line 286 of file qpaintengineex_opengl2_p.h.

Referenced by fill(), and transferMode().

◆ width

int QGL2PaintEngineExPrivate::width

The documentation for this class was generated from the following files: