73 #include <private/qgl_p.h> 74 #include <private/qmath_p.h> 75 #include <private/qpaintengineex_p.h> 76 #include <QPaintEngine> 77 #include <private/qpainter_p.h> 78 #include <private/qfontengine_p.h> 79 #include <private/qpixmapdata_gl_p.h> 80 #include <private/qdatabuffer_p.h> 81 #include <private/qstatictext_p.h> 82 #include <private/qtriangulator_p.h> 95 return x && !(x & (x - 1));
106 #if !defined(QT_MAX_CACHED_GLYPH_SIZE) 107 # define QT_MAX_CACHED_GLYPH_SIZE 64 139 if (smoothPixmapTransform) {
209 #if !defined(QT_NO_DEBUG) && defined(QT_OPENGL_ES_2) 214 if (isNpot && !npotSupported) {
215 qWarning(
"GL2 Paint Engine: This system does not support the REPEAT wrap mode for non-power-of-two textures.");
242 int max_texture_size =
ctx->d_func()->maxTextureSize();
251 #ifdef QT_OPENGL_ES_2 294 translationPoint = realStart;
301 1.0f / (l.
x() * l.
x() + l.
y() * l.
y())
311 translationPoint = g->
center();
325 translationPoint = realFocal;
327 QPointF fmp = realCenter - realFocal;
330 GLfloat fmp2_m_radius2 = -fmp.
x() * fmp.
x() - fmp.
y() * fmp.
y() + realRadius*realRadius;
333 GLfloat(1.0 / (2.0*fmp2_m_radius2)));
359 qWarning(
"QGL2PaintEngineEx: Unimplemented fill style");
363 matrix.
translate(brushOrigin.
x(), brushOrigin.
y());
365 QTransform translate(1, 0, 0, 1, -translationPoint.
x(), -translationPoint.
y());
377 inv_matrix = gl_to_qt * (brushQTransform * matrix).inverted() * translate;
410 const GLfloat wfactor = 2.0f /
width;
411 GLfloat hfactor = -2.0f /
height;
413 GLfloat dx = transform.
dx();
414 GLfloat dy = transform.
dy();
425 dx = ceilf(dx - 0.5f);
426 dy = ceilf(dy - 0.5f);
504 qWarning(
"Unsupported composition mode");
513 coords[0] = rect.
left;
514 coords[1] = rect.
top;
515 coords[2] = rect.
right;
516 coords[3] = rect.
top;
517 coords[4] = rect.
right;
519 coords[6] = rect.
left;
542 GLfloat dx = 1.0 / textureSize.
width();
543 GLfloat dy = 1.0 / textureSize.
height();
559 d->nativePaintingActive =
true;
568 #ifndef QT_OPENGL_ES_2 579 float mv_matrix[4][4] =
581 { float(mtx.
m11()),
float(mtx.
m12()), 0,
float(mtx.
m13()) },
582 { float(mtx.
m21()),
float(mtx.
m22()), 0,
float(mtx.
m23()) },
584 { float(mtx.
dx()),
float(mtx.
dy()), 0,
float(mtx.
m33()) }
587 const QSize sz =
d->device->size();
589 glMatrixMode(GL_PROJECTION);
591 glOrtho(0, sz.width(), sz.height(), 0, -999999, 999999);
593 glMatrixMode(GL_MODELVIEW);
594 glLoadMatrixf(&mv_matrix[0][0]);
600 d->lastTextureUsed = GLuint(-1);
601 d->dirtyStencilRegion =
QRect(0, 0,
d->width,
d->height);
604 d->shaderManager->setDirty();
625 #ifndef QT_OPENGL_ES_2 627 float color[] = { 1.0f, 1.0f, 1.0f, 1.0f };
636 d->nativePaintingActive =
false;
647 return d->nativePaintingActive;
692 #ifdef QT_OPENGL_CACHE_AS_VBOS 708 #ifdef QT_OPENGL_CACHE_AS_VBOS 712 d->unusedIBOSToClean << c->ibo;
739 QGLRect rect(points[0].x(), points[0].y(), points[2].x(), points[2].y());
748 bool updateCache =
false;
755 if (scaleFactor < 0.5 || scaleFactor > 2.0) {
756 #ifdef QT_OPENGL_CACHE_AS_VBOS 778 int floatSizeInBytes = vertexCount * 2 *
sizeof(float);
783 #ifdef QT_OPENGL_CACHE_AS_VBOS 796 #ifdef QT_OPENGL_CACHE_AS_VBOS 829 bool updateCache =
false;
836 if (scaleFactor < 0.5 || scaleFactor > 2.0) {
837 #ifdef QT_OPENGL_CACHE_AS_VBOS 860 #ifdef QT_OPENGL_CACHE_AS_VBOS 890 #ifdef QT_OPENGL_CACHE_AS_VBOS 937 qWarning(
"Painter path exceeds +/-32767 pixels.");
987 for (
int i = 0; i < clearRegion.
size(); ++i) {
988 #ifndef QT_GL_NO_SCISSOR_TEST 996 #ifndef QT_GL_NO_SCISSOR_TEST 1093 glStencilMask(0xff);
1119 && srcPixelsAreOpaque && !stateHasOpacity))
1183 int previousStop = 0;
1184 for (
int i=0; i<stopCount; ++i) {
1185 int stop = stops[i];
1191 glDrawArrays(primitive, previousStop, stop - previousStop);
1192 previousStop = stop;
1237 d->setBrush(penBrush);
1238 d->stroke(path, pen);
1244 if (snapToPixelGrid) {
1245 snapToPixelGrid =
false;
1260 QRectF clip = q->state()->matrix.inverted().mapRect(q->state()->clipEnabled
1261 ? q->state()->rectangleClip
1262 :
QRectF(0, 0, width, height));
1265 stroker.process(path, pen, clip);
1268 dasher.process(path, pen, clip);
1271 dasher.elementCount(),
1272 dasher.elementTypes());
1273 stroker.process(dashStroke, pen, clip);
1276 if (!stroker.vertexCount())
1280 prepareForDraw(opaque);
1298 extra = extra * inverseScale;
1302 fillStencilWithVertexArray(stroker.vertices(), stroker.vertexCount() / 2,
1309 prepareForDraw(
false);
1316 updateClipScissorTest();
1331 d->brushUniformsDirty =
true;
1332 d->opacityUniformDirty =
true;
1340 d->compositionModeDirty =
true;
1347 #if !defined(QT_OPENGL_ES_2) 1356 d->lastTextureUsed = GLuint(-1);
1357 d->brushTextureDirty =
true;
1364 d->matrixDirty =
true;
1379 int max_texture_size = ctx->d_func()->maxTextureSize();
1380 if (pixmap.
width() > max_texture_size || pixmap.
height() > max_texture_size) {
1404 bool isOpaque = !isBitmap && !pixmap.
hasAlpha();
1408 d->drawTexture(dest, srcRect, pixmap.
size(), isOpaque, isBitmap);
1412 Qt::ImageConversionFlags)
1417 int max_texture_size = ctx->d_func()->maxTextureSize();
1418 if (image.
width() > max_texture_size || image.
height() > max_texture_size) {
1434 GLuint
id = texture->
id;
1456 :
d->glyphCacheType;
1467 d->drawCachedGlyphs(glyphType, textItem);
1476 if (!
d->shaderManager)
1482 #ifndef QT_OPENGL_ES_2 1492 d->drawTexture(dest, srcRect, size,
false);
1513 det < 0.25f || det > 4.f)
1518 :
d->glyphCacheType;
1546 d->drawCachedGlyphs(glyphType, &staticTextItem);
1559 QOpenGLStaticTextUserData()
1564 ~QOpenGLStaticTextUserData()
1572 int cacheSerialNumber;
1577 #if defined(Q_WS_WIN) 1581 return (
qAbs(qt_fontsmoothing_gamma - target) < 0.2);
1587 return f > 0.04045 ?
qPow((f + 0.055) / 1.055, 2.4) : f / 12.92;
1600 bool recreateVertexArrays =
false;
1608 recreateVertexArrays =
true;
1612 recreateVertexArrays =
true;
1613 }
else if (staticTextItem->
userData() == 0) {
1614 recreateVertexArrays =
true;
1616 recreateVertexArrays =
true;
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;
1629 if (recreateVertexArrays) {
1648 GLfloat dx = 1.0 / cache->
width();
1649 GLfloat dy = 1.0 / cache->
height();
1656 QOpenGLStaticTextUserData *userData = 0;
1658 if (staticTextItem->
userData() == 0
1661 userData =
new QOpenGLStaticTextUserData();
1665 userData =
static_cast<QOpenGLStaticTextUserData*
>(staticTextItem->
userData());
1668 userData->glyphType = glyphType;
1672 vertexCoordinates = &userData->vertexCoordinateArray;
1673 textureCoordinates = &userData->textureCoordinateArray;
1676 if (userData->cacheSize != size) {
1677 recreateVertexArrays =
true;
1678 userData->cacheSize = size;
1682 if (recreateVertexArrays) {
1683 vertexCoordinates->
clear();
1684 textureCoordinates->
clear();
1687 for (
int i=0; i<staticTextItem->
numGlyphs; ++i) {
1689 if (supportsSubPixelPositions)
1708 int numGlyphs = vertexCoordinates->
vertexCount() / 4;
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);
1726 #if defined(QT_OPENGL_DRAWCACHEDGLYPHS_INDEX_ARRAY_VBO) 1727 if (elementIndicesVBOId == 0)
1735 #if defined(QT_OPENGL_DRAWCACHEDGLYPHS_INDEX_ARRAY_VBO) 1743 if (!snapToPixelGrid) {
1744 snapToPixelGrid =
true;
1748 QBrush pensBrush = q->state()->pen.brush();
1750 bool srgbFrameBufferEnabled =
false;
1753 #if defined(Q_WS_MAC) 1755 #elif defined(Q_WS_WIN) 1769 srgbFrameBufferEnabled =
true;
1773 setBrush(pensBrush);
1786 qreal oldOpacity = q->state()->opacity;
1789 q->state()->opacity = 1;
1790 opacityUniformDirty =
true;
1793 compositionModeDirty =
false;
1794 prepareForDraw(
false);
1798 q->state()->opacity = oldOpacity;
1799 opacityUniformDirty =
true;
1808 qreal oldOpacity = q->state()->opacity;
1810 q->state()->opacity = 1;
1811 opacityUniformDirty =
true;
1813 setBrush(pensBrush);
1816 compositionModeDirty =
false;
1817 prepareForDraw(
false);
1823 #if !defined(QT_NO_DEBUG) && defined(QT_OPENGL_ES_2) 1828 if (isNpot && !npotSupported) {
1829 qWarning(
"GL2 Paint Engine: This system does not support the REPEAT wrap mode for non-power-of-two textures.");
1834 #if defined(QT_OPENGL_DRAWCACHEDGLYPHS_INDEX_ARRAY_VBO) 1843 q->state()->opacity = oldOpacity;
1844 opacityUniformDirty =
true;
1845 pensBrush = q->state()->pen.brush();
1846 setBrush(pensBrush);
1849 compositionModeDirty =
false;
1850 prepareForDraw(
false);
1854 compositionModeDirty =
true;
1859 prepareForDraw(
false);
1863 if (lastMaskTextureUsed != cache->
texture() || cache->
filterMode() != filterMode) {
1866 if (lastMaskTextureUsed != cache->
texture()) {
1868 lastMaskTextureUsed = cache->
texture();
1883 #if defined(QT_OPENGL_DRAWCACHEDGLYPHS_INDEX_ARRAY_VBO) 1890 if (srgbFrameBufferEnabled)
1896 QPainter::PixmapFragmentHints hints)
1908 int max_texture_size =
d->ctx->d_func()->maxTextureSize();
1909 if (size.
width() > max_texture_size || size.
height() > max_texture_size) {
1911 d->drawPixmapFragments(fragments, fragmentCount, scaled, size, hints);
1913 d->drawPixmapFragments(fragments, fragmentCount, pixmap, size, hints);
1918 QPainter::PixmapFragmentHints hints)
1930 int max_texture_size =
d->ctx->d_func()->maxTextureSize();
1931 if (size.
width() > max_texture_size || size.
height() > max_texture_size) {
1933 d->drawPixmapFragments(targetRects, sourceRects, fragmentCount, scaled, size, hints);
1935 d->drawPixmapFragments(targetRects, sourceRects, fragmentCount, pixmap, size, hints);
1940 int fragmentCount,
const QPixmap &pixmap,
1941 const QSize &size, QPainter::PixmapFragmentHints hints)
1943 GLfloat dx = 1.0f / size.
width();
1944 GLfloat dy = 1.0f / size.
height();
1946 vertexCoordinateArray.clear();
1947 textureCoordinateArray.clear();
1948 opacityArray.reset();
1950 if (snapToPixelGrid) {
1951 snapToPixelGrid =
false;
1955 bool allOpaque =
true;
1957 for (
int i = 0; i < fragmentCount; ++i) {
1960 if (fragments[i].rotation != 0) {
1967 QGLPoint bottomRight(right * c - bottom * s, right * s + bottom * c);
1968 QGLPoint bottomLeft(-right * c - bottom * s, -right * s + bottom * c);
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);
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);
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);
1988 qreal opacity = fragments[i].
opacity * q->state()->opacity;
1989 opacityArray << opacity << opacity << opacity << opacity << opacity << opacity;
1990 allOpaque &= (opacity >= 0.99f);
2001 for (
int i = 0; i < 6 * fragmentCount; ++i)
2002 data[i].y = 1 - data[i].y;
2014 currentBrush = noBrush;
2017 if (prepareForDraw(isOpaque))
2030 QPainter::PixmapFragmentHints hints)
2032 GLfloat dx = 1.0f / size.
width();
2033 GLfloat dy = 1.0f / size.
height();
2035 vertexCoordinateArray.clear();
2036 textureCoordinateArray.clear();
2038 if (snapToPixelGrid) {
2039 snapToPixelGrid =
false;
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());
2054 sourceRect.
right() * dx, sourceRect.
bottom() * dy);
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);
2072 for (
int i = 0; i < 6 * fragmentCount; ++i)
2073 data[i].y = 1 - data[i].y;
2085 currentBrush = noBrush;
2088 if (prepareForDraw(isOpaque))
2105 d->device = static_cast<QGLPaintDevice*>(pdev);
2112 d->ctx =
d->device->context();
2117 d->ctx->d_ptr->active_engine =
this;
2119 const QSize sz =
d->device->size();
2123 d->imageDrawingMode =
false;
2124 d->brushTextureDirty =
true;
2125 d->brushUniformsDirty =
true;
2126 d->matrixUniformDirty =
true;
2127 d->matrixDirty =
true;
2128 d->compositionModeDirty =
true;
2129 d->opacityUniformDirty =
true;
2130 d->needsSync =
true;
2134 d->dirtyStencilRegion =
QRect(0, 0,
d->width,
d->height);
2135 d->stencilClean =
true;
2140 d->device->beginPaint();
2142 #if !defined(QT_OPENGL_ES_2) 2144 d->hasCompatibilityExtension = extensions.
match(
"GL_ARB_compatibility");
2160 #if !defined(QT_OPENGL_ES_2) 2166 #if !defined(QT_OPENGL_ES_2) 2167 #if defined(Q_WS_WIN) 2171 #if defined(Q_WS_MAC) 2177 #if defined(QT_OPENGL_ES_2) 2180 d->multisamplingAlwaysEnabled =
d->device->format().sampleBuffers();
2182 d->multisamplingAlwaysEnabled =
false;
2195 d->device->endPaint();
2197 #if defined(Q_WS_X11) 2203 ctx->d_func()->boundPixmaps.clear();
2205 d->ctx->d_ptr->active_engine = 0;
2209 delete d->shaderManager;
2210 d->shaderManager = 0;
2213 #ifdef QT_OPENGL_CACHE_AS_VBOS 2214 if (!
d->unusedVBOSToClean.isEmpty()) {
2216 d->unusedVBOSToClean.clear();
2218 if (!
d->unusedIBOSToClean.isEmpty()) {
2220 d->unusedIBOSToClean.clear();
2234 d->needsSync =
true;
2237 d->device->ensureActiveTarget();
2241 glViewport(0, 0,
d->width,
d->height);
2242 d->needsSync =
false;
2243 d->lastMaskTextureUsed = 0;
2244 d->shaderManager->setDirty();
2245 d->ctx->d_func()->syncGlState();
2246 for (
int i = 0; i < 3; ++i)
2247 d->vertexAttribPointers[i] = (GLfloat*)-1;
2255 if (q->state()->clipTestEnabled) {
2263 #ifdef QT_GL_NO_SCISSOR_TEST 2264 currentScissorBounds =
QRect(0, 0, width, height);
2266 QRect bounds = q->state()->rectangleClip;
2267 if (!q->state()->clipEnabled) {
2271 bounds =
QRect(0, 0, width, height);
2279 currentScissorBounds = bounds;
2281 if (bounds ==
QRect(0, 0, width, height)) {
2282 if (
ctx->d_func()->workaround_brokenScissor)
2295 const int width = rect.
width();
2296 int bottom = height - (rect.
top() + rect.
height());
2297 if (device->isFlipped()) {
2298 bottom = rect.
top();
2300 const int height = rect.
height();
2302 glScissor(left, bottom, width, height);
2312 d->regenerateClip();
2314 d->systemStateChanged();
2319 dirtyStencilRegion -= currentScissorBounds;
2321 glStencilMask(0xff);
2322 glClearStencil(value);
2326 q->state()->needsClipBufferClear =
false;
2333 if (snapToPixelGrid) {
2334 snapToPixelGrid =
false;
2341 stencilClean =
false;
2344 && (((q->state()->currentClip == maxClip - 1) && q->state()->clipTestEnabled)
2345 || q->state()->needsClipBufferClear);
2346 const uint referenceClipValue = q->state()->needsClipBufferClear ? 1 : q->state()->currentClip;
2348 if (q->state()->needsClipBufferClear)
2357 if (q->state()->clipTestEnabled)
2362 vertexCoordinateArray.clear();
2363 vertexCoordinateArray.addPath(path, inverseScale,
false);
2366 fillStencilWithVertexArray(vertexCoordinateArray, path.
hasWindingFill());
2368 glColorMask(
false,
false,
false,
false);
2378 glStencilMask(value ^ referenceClipValue);
2383 glStencilMask(0xff);
2388 composite(vertexCoordinateArray.boundingRect());
2394 composite(vertexCoordinateArray.boundingRect());
2400 glColorMask(
true,
true,
true,
true);
2414 if (
d->hasClipOperations()) {
2415 d->systemStateChanged();
2420 #ifndef QT_GL_NO_SCISSOR_TEST 2423 QRectF rect(points[0], points[2]);
2431 d->updateClipScissorTest();
2441 if (
d->useSystemClip) {
2449 d->updateClipScissorTest();
2453 d->updateClipScissorTest();
2454 d->resetClipIfNeeded();
2456 d->writeClip(path,
d->maxClip);
2461 d->resetClipIfNeeded();
2463 if (
state()->rectangleClip.isValid()) {
2472 #ifndef QT_GL_NO_SCISSOR_TEST 2476 d->updateClipScissorTest();
2480 if (!extendRegion.
isEmpty()) {
2489 d->writeClip(path,
d->maxClip);
2502 systemStateChanged();
2503 replayClipOperations();
2510 q->state()->clipChanged =
true;
2513 useSystemClip =
false;
2519 useSystemClip =
true;
2523 q->state()->clipTestEnabled =
false;
2524 q->state()->needsClipBufferClear =
true;
2526 q->state()->currentClip = 1;
2530 updateClipScissorTest();
2534 useSystemClip =
false;
2535 #ifndef QT_GL_NO_SCISSOR_TEST 2541 if (useSystemClip) {
2547 q->state()->currentClip = 0;
2549 q->state()->currentClip = 1;
2550 q->state()->clipTestEnabled =
true;
2579 d->matrixDirty =
true;
2582 d->compositionModeDirty =
true;
2585 d->opacityUniformDirty =
true;
2589 d->updateClipScissorTest();
2592 d->regenerateClip();
virtual QGLFormat format() const
qreal focalRadius() const
Returns the focal radius of this radial gradient in logical coordinates.
#define GL_ELEMENT_ARRAY_BUFFER
#define GL_ONE_MINUS_SRC_ALPHA
The QColor class provides colors based on RGB, HSV or CMYK values.
QPointF focalPoint() const
Returns the focal point of this radial gradient in logical coordinates.
static bool hasOpenGLFramebufferObjects()
Returns true if the OpenGL GL_EXT_framebuffer_object extension is present on this system; otherwise r...
QPaintEngine::DirtyFlags state() const
Returns a combination of flags identifying the set of properties that need to be updated when updatin...
QSet< QVectorPath::CacheEntry * > pathCaches
qreal scaleY
the vertical scale of the target rectangle.
qreal y() const
Returns the y-coordinate of the rectangle's top edge.
QScopedPointer< QGLContextPrivate > d_ptr
void setUserData(QStaticTextUserData *newUserData)
void setVertexAttributePointer(unsigned int arrayIndex, const GLfloat *pointer)
qreal right() const
Returns the x-coordinate of the rectangle's right edge.
qreal alphaF() const
Returns the alpha color component of this color.
The QVector3D class represents a vector or vertex in 3D space.
static const GLuint QT_PMV_MATRIX_3_ATTR
QRegion intersected(const QRegion &r) const
Returns a region which is the intersection of this region and r.
qreal width
the width of the source rectangle and is used to calculate the width of the target rectangle...
#define GL_TEXTURE_MIN_FILTER
virtual void drawPixmapFragments(const QPainter::PixmapFragment *fragments, int fragmentCount, const QPixmap &pixmap, QPainter::PixmapFragmentHints hints)
#define QT_END_NAMESPACE
This macro expands to.
const QColor & color() const
Returns the brush color.
void addRegion(const QRegion ®ion)
Adds the given region to the path by adding each rectangle in the region as a separate closed subpath...
QHash< GlyphAndSubPixelPosition, Coord > coords
QFontEngine * fontEngine() const
int width() const
Returns the width of the pixmap.
QSize size() const
Returns the size of the pixmap.
bool isNativePaintingActive() const
virtual void stroke(const QVectorPath &path, const QPen &pen)
#define glStencilOpSeparate
CompositionMode
Defines the modes supported for digital image compositing.
#define GL_CONSTANT_COLOR
QVertexIndexVector indices
void updateTextureFilter(GLenum target, GLenum wrapMode, bool smoothPixmapTransform, GLuint id=-1)
QPainter::RenderHints renderHints
qreal greenF() const
Returns the green color component of this color.
QGLEngineShaderManager * shaderManager
const QGradient * gradient() const
Returns the gradient describing this brush.
QPainter::CompositionMode composition_mode
#define QT_IMAGE_TEXTURE_UNIT
uint compositionModeChanged
Qt::BrushStyle qbrush_style(const QBrush &b)
QFixedPoint * glyphPositions
The QPainterPath class provides a container for painting operations, enabling graphical shapes to be ...
QFixed subPixelPositionForX(QFixed x) const
bool qbrush_fast_equals(const QBrush &a, const QBrush &b)
void updateBrushTexture()
#define GL_ONE_MINUS_SRC_COLOR
Q_CORE_EXPORT void qFree(void *ptr)
#define GL_STENCIL_BUFFER_BIT
void setMaskType(MaskType)
QGL2PEXVertexArray textureCoordinateArray
QRect united(const QRect &other) const
Returns the bounding rectangle of this rectangle and the given rectangle.
The QConicalGradient class is used in combination with QBrush to specify a conical gradient brush...
QTransform transform() const
Returns the matrix in the current paint engine state.
virtual void drawPixmapFragments(const QPainter::PixmapFragment *fragments, int fragmentCount, const QPixmap &pixmap, QPainter::PixmapFragmentHints hints)
virtual void penChanged()
The QPointF class defines a point in the plane using floating point precision.
qreal left() const
Returns the x-coordinate of the rectangle's left edge.
void setSrcPixelType(Qt::BrushStyle)
QRect currentScissorBounds
int left() const
Returns the x-coordinate of the rectangle's left edge.
QPixmap scaled(int w, int h, Qt::AspectRatioMode aspectMode=Qt::IgnoreAspectRatio, Qt::TransformationMode mode=Qt::FastTransformation) const
QColor color() const
Returns the color of this pen's brush.
int width() const
Returns the width of the rectangle.
bool qt_resolve_framebufferobject_extensions(QGLContext *ctx)
virtual void drawImage(const QRectF &r, const QImage &pm, const QRectF &sr, Qt::ImageConversionFlags flags=Qt::AutoColor)
Reimplement this function to draw the part of the image specified by the sr rectangle in the given re...
#define GL_TEXTURE_WRAP_S
GLfloat staticVertexCoordinateArray[8]
bool hasAlphaChannel() const
Returns true if the image has a format that respects the alpha channel, otherwise returns false...
void setFilterMode(FilterMode m)
#define glVertexAttrib3fv
Q_CORE_EXPORT void * qMalloc(size_t size)
QRect intersected(const QRect &other) const
Returns the intersection of this rectangle and the given rectangle.
QRect boundingRect() const
Returns the bounding rectangle of this region.
const QVectorPath & qtVectorPathForPath(const QPainterPath &path)
void drawCachedGlyphs(QFontEngineGlyphCache::Type glyphType, QStaticTextItem *staticTextItem)
void setGreenF(qreal green)
Sets the green color component of this color to green.
int height() const
Returns the height of the rectangle.
The QRadialGradient class is used in combination with QBrush to specify a radial gradient brush...
GLuint elementIndicesVBOId
qreal opacity
the opacity of the target rectangle, where 0.0 is fully transparent and 1.0 is fully opaque...
Q_DECL_CONSTEXPR T qAbs(const T &t)
void setRedF(qreal red)
Sets the red color component of this color to red.
void updateClipScissorTest()
Q_GUI_EXPORT QString extensions()
QTransform transform() const
Returns the current transformation matrix for the brush.
qreal angle() const
Returns the start angle of the conical gradient in logical coordinates.
The QPen class defines how a QPainter should draw lines and outlines of shapes.
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.
static const QRectF scaleRect(const QRectF &r, qreal sx, qreal sy)
virtual int devType() const
The QSizeF class defines the size of a two-dimensional object using floating point precision...
virtual void clip(const QVectorPath &path, Qt::ClipOperation op)
QGLContext::BindOptions options
void setScissor(const QRect &rect)
The QChar class provides a 16-bit Unicode character.
void fillInPendingGlyphs()
int rectCount() const
Returns the number of rectangles that will be returned in rects().
Q_CORE_EXPORT QTextStream & right(QTextStream &s)
void setFontEngine(QFontEngine *fe)
QDashedStrokeProcessor dasher
static qreal qt_sRGB_to_linear_RGB(qreal f)
Q_DECL_CONSTEXPR const T & qMax(const T &a, const T &b)
virtual void brushOriginChanged()
#define glVertexAttrib4fv
GLuint location(const QGLEngineShaderManager::Uniform uniform)
qreal x() const
Returns the x-coordinate of this point.
void makeCacheable() const
QPointF center() const
Returns the center of the conical gradient in logical coordinates.
void clearClip(uint value)
static const QGLContext * currentContext()
Returns the current context, i.e.
void updateCompositionMode()
static const GLuint QT_OPACITY_ATTR
The QGLFunctions class provides cross-platform access to the OpenGL/ES 2.0 API.
bool qt_resolve_buffer_extensions(QGLContext *ctx)
bool hasOpenGLFeature(QGLFunctions::OpenGLFeature feature) const
Returns true if feature is present on this system's OpenGL implementation; false otherwise.
const QGLContext * context() const
static const QRectF boundingRect(const QPointF *points, int pointCount)
#define GL_ONE_MINUS_DST_ALPHA
void stroke(const QVectorPath &path, const QPen &pen)
QRectF controlPointRect() const
virtual void stroke(const QVectorPath &path, const QPen &pen)
void setBrush(const QBrush &brush)
int width() const
Returns the width.
#define FRAMEBUFFER_SRGB_EXT
bool hasComplexGeometry() const
FilterMode filterMode() const
QPainter * painter() const
Returns the paint engine's painter.
#define QT_BEGIN_NAMESPACE
This macro expands to.
static void setCoords(GLfloat *coords, const QGLRect &rect)
void fill(const QVectorPath &path)
#define GL_MIRRORED_REPEAT_IBM
bool isActive() const
Returns true if the paint engine is actively drawing; otherwise returns false.
The QRectF class defines a rectangle in the plane using floating point precision. ...
#define GL_TRIANGLE_STRIP
bool end()
Reimplement this function to finish painting on the current paint device.
#define QT_GL_VERTEX_ARRAY_TRACKED_COUNT
qreal y
the y coordinate of the center point in the target rectangle.
bool Q_GUI_EXPORT qHasPixmapTexture(const QBrush &brush)
QDataBuffer< GLfloat > opacityArray
static float pixelSize(const QFontDef &request, int dpi)
QVector< qreal > vertices
char useBackendOptimizations
QBrush qpen_brush(const QPen &p)
bool isCosmetic() const
Returns true if the pen is cosmetic; otherwise returns false.
The QGLContext class encapsulates an OpenGL rendering context.
const void * data() const
bool isEmpty() const
Returns true if the region is empty; otherwise returns false.
QRegion dirtyStencilRegion
void insert(const QGLContext *context, void *value)
static const QCssKnownValue positions[NumKnownPositionModes - 1]
QGLRect boundingRect() const
Qt::PenJoinStyle joinStyle() const
Returns the pen's join style.
void systemStateChanged()
QColor qt_premultiplyColor(QColor c, GLfloat opacity)
void drawPixmapFragments(const QPainter::PixmapFragment *fragments, int fragmentCount, const QPixmap &pixmap, const QSize &size, QPainter::PixmapFragmentHints hints)
CacheEntry * lookupCacheData(QPaintEngineEx *engine) const
void setBlueF(qreal blue)
Sets the blue color component of this color to blue.
qreal height() const
Returns the height of the rectangle.
qreal x
the x coordinate of center point in the target rectangle.
QGL2PEXVertexArray vertexCoordinateArray
virtual Type type() const =0
Reimplement this function to return the paint engine Type.
qreal qpen_widthf(const QPen &p)
static const GLuint QT_PMV_MATRIX_2_ATTR
#define GL_UNSIGNED_SHORT
bool qt_resolve_version_2_0_functions(QGLContext *ctx)
void getGlyphPositions(const QGlyphLayout &glyphs, const QTransform &matrix, QTextItem::RenderFlags flags, QVarLengthArray< glyph_t > &glyphs_out, QVarLengthArray< QFixedPoint > &positions)
Q_CORE_EXPORT void qWarning(const char *,...)
Q_GUI_EXPORT bool qt_cleartype_enabled
The QImage class provides a hardware-independent image representation that allows direct access to th...
void setPaintEnginePrivate(QGL2PaintEngineExPrivate *p)
void composite(const QGLRect &boundingRect)
The QVector2D class represents a vector or vertex in 2D space.
static const char * data(const QByteArray &arr)
bool isQBitmap() const
Returns true if this is a QBitmap; otherwise returns false.
Q_GUI_EXPORT bool qt_scaleForTransform(const QTransform &transform, qreal *scale)
void addRect(const QRectF &rect)
Adds the given rectangle to this path as a closed subpath.
Q_GUI_EXPORT qreal qt_fontsmoothing_gamma
qreal width() const
Returns the width of the rectangle.
~QGL2PaintEngineExPrivate()
The QRegion class specifies a clip region for a painter.
void setInvScale(qreal invScale)
virtual void setState(QPainterState *s)
#define QT_MAX_CACHED_GLYPH_SIZE
Qt::BrushStyle style() const
Returns the brush style.
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 ...
QOpenGL2PaintEngineState()
QPixmap texture() const
Returns the custom brush pattern, or a null pixmap if no custom brush pattern has been set...
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.
bool isOpaque() const
Returns true if the brush is fully opaque otherwise false.
QTriangulatingStroker stroker
virtual void transformChanged()
virtual void setState(QPainterState *s)
virtual void drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr)
Reimplement this function to draw the part of the pm specified by the sr rectangle in the given r...
qreal qPow(qreal x, qreal y)
QPointF start() const
Returns the start point of this linear gradient in logical coordinates.
void drawTexture(const QGLRect &dest, const QGLRect &src, const QSize &textureSize, bool opaque, bool pattern=false)
bool hasWindingFill() const
QOpenGL2PaintEngineState * state()
GLuint getBuffer(const QGradient &gradient, qreal opacity)
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.
static bool fontSmoothingApproximately(qreal target)
#define GL_STENCIL_HIGH_BIT
QSize size() const
Returns the size of the image, i.
void setHasComplexGeometry(bool hasComplexGeometry)
void updateBrushUniforms()
void setColor(const QColor &color)
Sets the brush color to the given color.
virtual bool isFlipped() const
qvectorpath_cache_cleanup cleanup
The QBrush class defines the fill pattern of shapes drawn by QPainter.
#define GL_TEXTURE_WRAP_T
virtual void clipEnabledChanged()
static QGLContextGroup * contextGroup(const QGLContext *ctx)
int top() const
Returns the y-coordinate of the rectangle's top edge.
qreal angle(const QPointF &p1, const QPointF &p2)
int width() const
Returns the width of the image.
bool drawTexture(const QRectF &r, GLuint textureId, const QSize &size, const QRectF &sr)
virtual void drawTextItem(const QPointF &p, const QTextItem &textItem)
This function draws the text item textItem at position p.
Q_GUI_EXPORT QImage qt_imageForBrush(int brushStyle, bool invert)
void setUniformValue(int location, GLfloat value)
Sets the uniform variable at location in the current context to value.
virtual int glyphMargin() const
void setGlyphCache(void *key, QFontEngineGlyphCache *data)
void setAlphaF(qreal alpha)
Sets the alpha of this color to alpha.
Type type() const
Returns the type of gradient.
static QGL2GradientCache * cacheForContext(const QGLContext *context)
The QLinearGradient class is used in combination with QBrush to specify a linear gradient brush...
void writeClip(const QVectorPath &path, uint value)
The QGradient class is used in combination with QBrush to specify gradient fills. ...
bool hasAlpha() const
Returns true if this pixmap has an alpha channel, or has a mask, otherwise returns false...
qreal x() const
Returns the x-coordinate of the rectangle's left edge.
This class is used in conjunction with the QPainter::drawPixmapFragments() function to specify how a ...
static const GLuint QT_PMV_MATRIX_1_ATTR
qreal scaleX
the horizontal scale of the target rectangle.
#define glDisableVertexAttribArray
qreal miterLimit() const
Returns the miter limit of the pen.
void beginNativePainting()
static void updateTextureFilter(GLenum target, GLenum wrapMode, bool smoothPixmapTransform)
qreal redF() const
Returns the red color component of this color.
bool populate(QFontEngine *fontEngine, int numGlyphs, const glyph_t *glyphs, const QFixedPoint *positions)
static QTestResult::TestLocation location
virtual void drawStaticTextItem(QStaticTextItem *)
QVector< QRect > rects() const
Returns an array of non-overlapping rectangles that make up the region.
bool compositionModeDirty
#define QT_BRUSH_TEXTURE_UNIT
const qreal * points() const
virtual QPainterState * createState(QPainterState *orig) const
int height() const
Returns the height.
static const GLuint QT_TEXTURE_COORDS_ATTR
if(void) toggleToolbarShown
qreal blueF() const
Returns the blue color component of this color.
The QRect class defines a rectangle in the plane using integer precision.
QGLShaderProgram * currentProgram()
const_iterator constBegin() const
Spread spread() const
Returns the spread method use by this gradient.
bool match(const char *str) const
int height() const
Returns the height of the image.
virtual void fill(const QVectorPath &path, const QBrush &brush)
virtual void brushChanged()
bool useCorrectShaderProg()
virtual void opacityChanged()
virtual void drawStaticTextItem(QStaticTextItem *textItem)
static Extensions glExtensions()
QPixmap currentBrushPixmap
QTriangleSet qTriangulate(const qreal *polygon, int count, uint hint, const QTransform &matrix)
qreal y() const
Returns the y-coordinate of this point.
QPointF center() const
Returns the center of this radial gradient in logical coordinates.
The QPixmap class is an off-screen image representation that can be used as a paint device...
bool intersects(const QRegion &r) const
Returns true if this region intersects with region, otherwise returns false.
~QOpenGL2PaintEngineState()
qreal top() const
Returns the y-coordinate of the rectangle's top edge.
void transferMode(EngineMode newMode)
int height() const
Returns the height of the pixmap.
static bool isPowerOfTwo(uint x)
static Q_DECL_CONSTEXPR bool qFuzzyIsNull(double d)
uint needsClipBufferClear
void optimiseForBrushTransform(QTransform::TransformationType transformType)
bool begin(QPaintDevice *device)
Reimplement this function to initialise your paint engine when painting is to start on the paint devi...
The QSize class defines the size of a two-dimensional object using integer point precision.
static QGLPaintDevice * getDevice(QPaintDevice *)
QStaticTextUserData * userData() const
#define QT_MASK_TEXTURE_UNIT
QFontEngineGlyphCache * glyphCache(void *key, QFontEngineGlyphCache::Type type, const QTransform &transform) const
virtual void renderHintsChanged()
qreal bottom() const
Returns the y-coordinate of the rectangle's bottom edge.
#define GL_TEXTURE_MAG_FILTER
static const GLuint QT_VERTEX_COORDS_ATTR
bool isNull() const
Returns true if this is a null pixmap; otherwise returns false.
The QTextItem class provides all the information required to draw text in a custom paint engine...
QImage scaled(int w, int h, Qt::AspectRatioMode aspectMode=Qt::IgnoreAspectRatio, Qt::TransformationMode mode=Qt::FastTransformation) const
virtual void compositionModeChanged()
qreal centerRadius() const
Returns the center radius of this radial gradient in logical coordinates.
void setOpacityMode(OpacityMode)
QPaintEngine * active_engine
Qt::PenStyle qpen_style(const QPen &p)
bool prepareForDraw(bool srcPixelsAreOpaque)
Q_CORE_EXPORT QTextStream & left(QTextStream &s)
qreal height
the height of the source rectangle and is used to calculate the height of the target rectangle...
static void cleanupVectorPath(QPaintEngineEx *engine, void *data)
QRegion systemClip() const
Returns the system clip.
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
int size() const
Returns the number of items in the vector.
bool qt_applefontsmoothing_enabled
void setInvScale(qreal invScale)
GLfloat staticTextureCoordinateArray[8]
void drawVertexArrays(const float *data, int *stops, int stopCount, GLenum primitive)
void addQuad(const QRectF &rect)
void fillStencilWithVertexArray(const float *data, int count, int *stops, int stopCount, const QGLRect &bounds, StencilFillMode mode)
const QGLContext * context() const
virtual bool supportsSubPixelPositions() const
QPointF finalStop() const
Returns the final stop point of this linear gradient in logical coordinates.
virtual void drawTextItem(const QPointF &p, const QTextItem &textItem)
This function draws the text item textItem at position p.