4#include <QtCore/qrandom.h>
6#include <private/qpixmapcache_p.h>
7#include <private/qpaintengine_p.h>
8#include <private/qpainterpath_p.h>
9#include <private/qdrawhelper_p.h>
10#include <private/qfontengineglyphcache_p.h>
12#if QT_CONFIG(fontconfig)
13#include <private/qfontengine_ft_p.h>
34 QXRenderTessellator() : traps(0), allocated(0),
size(0) {}
35 ~QXRenderTessellator() { free(traps); }
39 void addTrap(
const Trapezoid &trap)
override;
54void QXRenderTessellator::addTrap(
const Trapezoid &trap)
56 if (
size == allocated) {
57 allocated =
qMax(2*allocated, 64);
58 traps = q_check_ptr((XTrapezoid *)realloc(traps, allocated *
sizeof(XTrapezoid)));
132#if QT_CONFIG(xrender)
134 unsigned long current_brush;
136 int composition_mode;
180#if QT_CONFIG(xrender)
181 QXRenderTessellator *tessellator;
185#if QT_CONFIG(xrender)
190 ~QXRenderGlyphCache();
197 inline GlyphSet glyphSet();
201 inline const XRenderPictFormat *renderPictFormat()
const;
204 static inline Glyph glyphId(
glyph_t glyph,
QFixed subPixelPosition);
260 if (
p &&
p->paintEngine()
261 &&
p->paintEngine()->isActive()
275 if (
p &&
p->paintEngine()
276 &&
p->paintEngine()->isActive()
278 return static_cast<QX11PaintEngine *
>(
p->paintEngine())->d_func()->gc_brush;
283#define X11 qt_x11Data
295 const ushort hexChars[] = {
'0',
'1',
'2',
'3',
'4',
'5',
'6',
'7',
'8',
'9',
'a',
'b',
'c',
'd',
'e',
'f' };
296 const char *
c =
reinterpret_cast<const char *
>(&
val);
297 for (
uint i = 0;
i <
sizeof(T); ++
i) {
298 *dest++ = hexChars[*
c & 0xf];
299 *dest++ = hexChars[(*
c & 0xf0) >> 4];
311 enum { ExactSize =
true };
317#if QT_CONFIG(xrender)
336 return compositionModeToRenderOp[
mode];
339static inline bool complexPictOp(
int op)
341 return op != PictOpOver && op != PictOpSrc;
359 XSetClipRectangles( dpy, gc, 0, 0, rects.
data(),
num, Unsorted );
361 XSetClipRectangles( dpy, gc2, 0, 0, rects.
data(),
num, Unsorted );
363#if QT_CONFIG(xrender)
365 XRenderSetPictureClipRectangles(dpy,
picture, 0, 0, rects.
data(),
num);
381 XSetClipMask(dpy, gc,
XNone);
383 XSetClipMask(dpy, gc2,
XNone);
385#if QT_CONFIG(xrender)
387 XRenderPictureAttributes
attrs;
389 XRenderChangePicture (dpy,
picture, CPClipMask, &
attrs);
397#define DITHER_SIZE 16
399 { 0,192, 48,240, 12,204, 60,252, 3,195, 51,243, 15,207, 63,255 },
400 { 128, 64,176,112,140, 76,188,124,131, 67,179,115,143, 79,191,127 },
401 { 32,224, 16,208, 44,236, 28,220, 35,227, 19,211, 47,239, 31,223 },
402 { 160, 96,144, 80,172,108,156, 92,163, 99,147, 83,175,111,159, 95 },
403 { 8,200, 56,248, 4,196, 52,244, 11,203, 59,251, 7,199, 55,247 },
404 { 136, 72,184,120,132, 68,180,116,139, 75,187,123,135, 71,183,119 },
405 { 40,232, 24,216, 36,228, 20,212, 43,235, 27,219, 39,231, 23,215 },
406 { 168,104,152, 88,164,100,148, 84,171,107,155, 91,167,103,151, 87 },
407 { 2,194, 50,242, 14,206, 62,254, 1,193, 49,241, 13,205, 61,253 },
408 { 130, 66,178,114,142, 78,190,126,129, 65,177,113,141, 77,189,125 },
409 { 34,226, 18,210, 46,238, 30,222, 33,225, 17,209, 45,237, 29,221 },
410 { 162, 98,146, 82,174,110,158, 94,161, 97,145, 81,173,109,157, 93 },
411 { 10,202, 58,250, 6,198, 54,246, 9,201, 57,249, 5,197, 53,245 },
412 { 138, 74,186,122,134, 70,182,118,137, 73,185,121,133, 69,181,117 },
413 { 42,234, 26,218, 38,230, 22,214, 41,233, 25,217, 37,229, 21,213 },
414 { 170,106,154, 90,166,102,150, 86,169,105,153, 89,165,101,149, 85 }
443#if QT_CONFIG(xrender)
446 if (!
X11->use_xrender)
449 XRenderColor
color =
X11->preMultiply(
b.color());
450 XRenderColor bg_color;
452 bg_color =
X11->preMultiply(
QColor(0, 0, 0, 0));
454 for (
int i = 0;
i <
X11->pattern_fill_count; ++
i) {
456 &&
X11->pattern_fills[
i].opaque ==
false
457 &&
X11->pattern_fills[
i].style ==
b.style()
458 &&
X11->pattern_fills[
i].color.alpha ==
color.alpha
459 &&
X11->pattern_fills[
i].color.red ==
color.red
460 &&
X11->pattern_fills[
i].color.green ==
color.green
461 &&
X11->pattern_fills[
i].color.blue ==
color.blue
462 &&
X11->pattern_fills[
i].bg_color.alpha == bg_color.alpha
463 &&
X11->pattern_fills[
i].bg_color.red == bg_color.red
464 &&
X11->pattern_fills[
i].bg_color.green == bg_color.green
465 &&
X11->pattern_fills[
i].bg_color.blue == bg_color.blue)
466 return X11->pattern_fills[
i].picture;
471 if (
X11->pattern_fills[
i].screen !=
screen &&
X11->pattern_fills[
i].picture) {
473 X11->pattern_fills[
i].picture = 0;
476 if (!
X11->pattern_fills[
i].picture) {
478 XRenderPictureAttributes
attrs;
488 X11->pattern_fills[
i].bg_color = bg_color;
489 X11->pattern_fills[
i].opaque =
false;
490 X11->pattern_fills[
i].style =
b.style();
495 XRenderPictureAttributes
attrs;
501 X11->pattern_fills[
i].picture,
502 0, 0, 0, 0, 0, 0, 8, 8);
504 return X11->pattern_fills[
i].picture;
508 int sx,
int sy,
int x,
int y,
int sw,
int sh,
512 XRenderComposite(dpy, PictOpOver,
513 fill_fg,
src,
dst, sx, sy, sx, sy,
x,
y, sw, sh);
524#if QT_CONFIG(xrender)
526 composition_mode = PictOpOver;
527 tessellator =
new QXRenderTessellator;
534 XSetTSOrigin(
dpy,
gc,
p.x(),
p.y());
542 XSetTSOrigin(
dpy,
gc, 0, 0);
549 int clipped_count = 0;
552 &clipped_points, &clipped_count);
553 clipped_poly->
resize(clipped_count);
554 for (
int i=0;
i<clipped_count; ++
i)
555 (*clipped_poly)[
i] = *((
QPointF *)(&clipped_points[
i]));
564 q->updateMatrix(
q->state->transform());
576 QPaintEngine::PaintEngineFeatures features =
583 if (
X11->use_xrender) {
588 if (
X11->xrender_version > 10) {
618#if QT_CONFIG(xrender)
620 delete d->tessellator;
628#if QT_CONFIG(xrender)
632 if (
X11->use_xrender &&
data->depth() != 32 &&
data->x11_mask)
633 data->convertToARGB32();
642 d->dpy =
d->xinfo->display();
643 d->scrn =
d->xinfo->screen();
646 d->gc = XCreateGC(
d->dpy,
d->hd, 0, 0);
647 d->gc_brush = XCreateGC(
d->dpy,
d->hd, 0, 0);
648 d->has_alpha_brush =
false;
649 d->has_alpha_pen =
false;
650 d->has_clipping =
false;
651 d->has_complex_xform =
false;
652 d->has_scaling_xform =
false;
653 d->has_non_scaling_xform =
true;
655 d->has_custom_pen =
false;
657 d->pdev_depth =
d->pdev->depth();
660 d->use_path_fallback =
false;
661#if QT_CONFIG(xrender)
662 d->composition_mode = PictOpOver;
664 d->xlibMaxLinePoints = 32762;
673 const int BUFFERZONE = 1000;
674 QRect devClipRect(-BUFFERZONE, -BUFFERZONE,
675 pdev->
width() + 2*BUFFERZONE, pdev->
height() + 2*BUFFERZONE);
676 d->polygonClipper.setBoundingRect(devClipRect);
679 d->systemStateChanged();
699#if QT_CONFIG(xrender)
702 XRenderPictureAttributes
attrs;
703 attrs.subwindow_mode = ClipByChildren;
705 XRenderChangePicture(
d->dpy,
d->picture, CPClipMask|CPSubwindowMode, &
attrs);
709 if (
d->gc_brush &&
d->pdev->painters < 2) {
710 XFreeGC(
d->dpy,
d->gc_brush);
714 if (
d->gc &&
d->pdev->painters < 2) {
715 XFreeGC(
d->dpy,
d->gc);
721 d->currentClipDevice =
nullptr;
806 if (
d->has_alpha_brush
809 || (
d->cpen.widthF() > 0 &&
d->has_complex_xform
810 && !
d->has_non_scaling_xform)
812 for (
int i = 0;
i < lineCount; ++
i) {
821 for (
int i = 0;
i < lineCount; ++
i) {
826 linef =
d->matrix.map(
QLineF(lines[
i]));
828 if (
clipLine(&linef,
d->polygonClipper.boundingRect())) {
846 if (
d->has_alpha_brush
849 || (
d->cpen.widthF() > 0 &&
d->has_complex_xform
850 && !
d->has_non_scaling_xform)
852 for (
int i = 0;
i < lineCount; ++
i) {
861 for (
int i = 0;
i < lineCount; ++
i) {
862 QLineF linef =
d->matrix.map(lines[
i]);
863 if (
clipLine(&linef,
d->polygonClipper.boundingRect())) {
877 if (l.
p1().
x() == l.
p2().
x()) {
902 ||
d->has_alpha_brush
903 ||
d->has_complex_xform
907 || complexPictOp(
d->composition_mode)
918 alignedOffset =
offset.toPoint();
933 QRect clip(
d->polygonClipper.boundingRect());
948 XFillRectangles(
d->dpy,
d->hd,
d->gc_brush, &xrect, 1);
958 ||
d->has_complex_xform
962 for (
int i = 0;
i < rectCount; ++
i) {
964 path.addRect(rects[
i]);
970 QRect clip(
d->polygonClipper.boundingRect());
972#if QT_CONFIG(xrender)
975 if (
X11->use_xrender && pict &&
d->has_brush &&
d->pdev_depth != 1
976 && (
d->has_texture ||
d->has_alpha_brush || complexPictOp(
d->composition_mode)))
979 if (!
d->has_texture && !
d->has_pattern)
980 xc =
X11->preMultiply(
d->cbrush.color());
982 for (
int i = 0;
i < rectCount; ++
i) {
987 if (
r.width() == 0 ||
r.height() == 0) {
990 XDrawLine(
d->dpy,
d->hd,
d->gc, l.
p1().
x(), l.
p1().
y(), l.
p2().
x(), l.
p2().
y());
995 r =
r.intersected(clip);
998 if (
d->has_texture ||
d->has_pattern) {
999 XRenderComposite(
d->dpy,
d->composition_mode,
d->current_brush, 0, pict,
1001 0, 0,
r.x(),
r.y(),
r.width(),
r.height());
1003 XRenderFillRectangle(
d->dpy,
d->composition_mode, pict, &xc,
r.x(),
r.y(),
r.width(),
r.height());
1006 XDrawRectangle(
d->dpy,
d->hd,
d->gc,
r.x(),
r.y(),
r.width(),
r.height());
1011 if (
d->has_brush &&
d->has_pen) {
1012 for (
int i = 0;
i < rectCount; ++
i) {
1017 if (
r.width() == 0 ||
r.height() == 0) {
1019 XDrawLine(
d->dpy,
d->hd,
d->gc, l.
p1().
x(), l.
p1().
y(), l.
p2().
x(), l.
p2().
y());
1023 r =
r.intersected(clip);
1026 d->setupAdaptedOrigin(
r.topLeft());
1027 XFillRectangle(
d->dpy,
d->hd,
d->gc_brush,
r.x(),
r.y(),
r.width(),
r.height());
1028 XDrawRectangle(
d->dpy,
d->hd,
d->gc,
r.x(),
r.y(),
r.width(),
r.height());
1030 d->resetAdaptedOrigin();
1033 int numClipped = rectCount;
1034 for (
int i = 0;
i < rectCount; ++
i) {
1039 if (
r.width() == 0 ||
r.height() == 0) {
1043 XDrawLine(
d->dpy,
d->hd,
d->gc, l.
p1().
x(), l.
p1().
y(), l.
p2().
x(), l.
p2().
y());
1048 r =
r.intersected(clip);
1053 xrects[
i].x = short(
r.x());
1054 xrects[
i].y = short(
r.y());
1055 xrects[
i].width =
ushort(
r.width());
1056 xrects[
i].height =
ushort(
r.height());
1059 d->setupAdaptedOrigin(rects[0].topLeft());
1061 XFillRectangles(
d->dpy,
d->hd,
d->gc_brush, xrects.
data(), numClipped);
1062 else if (
d->has_pen)
1063 XDrawRectangles(
d->dpy,
d->hd,
d->gc, xrects.
data(), numClipped);
1064 d->resetAdaptedOrigin();
1074 vals.cap_style = cap_style;
1089 if (
d->cpen.widthF() > 1.0f
1109 d->cpen.setCapStyle(capStyle);
1114 static const int BUF_SIZE = 1024;
1115 XPoint xPoints[BUF_SIZE];
1117 while (
i < pointCount) {
1118 while (
i < pointCount &&
j < BUF_SIZE) {
1120 int x = xformed.
x();
1121 int y = xformed.
y();
1122 if (
x >= SHRT_MIN &&
y >= SHRT_MIN &&
x < SHRT_MAX &&
y < SHRT_MAX) {
1130 XDrawPoints(
d->dpy,
d->hd,
d->gc, xPoints,
j, CoordModeOrigin);
1147 if (
d->cpen.widthF() > 1.0f
1167 d->cpen.setCapStyle(capStyle);
1172 static const int BUF_SIZE = 1024;
1173 XPoint xPoints[BUF_SIZE];
1175 while (
i < pointCount) {
1176 while (
i < pointCount &&
j < BUF_SIZE) {
1181 if (
x >= SHRT_MIN &&
y >= SHRT_MIN &&
x < SHRT_MAX &&
y < SHRT_MAX) {
1189 XDrawPoints(
d->dpy,
d->hd,
d->gc, xPoints,
j, CoordModeOrigin);
1197#if QT_CONFIG(xrender)
1198 if (
X11->use_xrender)
1226 d->clipPolygon_dev(clip_poly_dev, &clipped_poly_dev);
1236 d->clipPolygon_dev(clip_poly_dev, &clipped_poly_dev);
1244 d->clipPolygon_dev(clip_poly_dev, &clipped_poly_dev);
1283#if QT_CONFIG(xrender)
1285 d->composition_mode =
1292 d->decidePathFallback();
1293 d->decideCoordAdjust();
1299 d->render_hints = hints;
1301#if QT_CONFIG(xrender)
1302 if (
X11->use_xrender &&
d->picture) {
1303 XRenderPictureAttributes
attrs;
1305 XRenderChangePicture(
d->dpy,
d->picture, CPPolyEdge, &
attrs);
1316 int ps = pen.
style();
1318 if (
d->opacity < 1.0) {
1320 c.setAlpha(
qRound(
c.alpha()*
d->opacity));
1321 d->cpen.setColor(
c);
1352 d->adapted_pen_origin =
false;
1356 int xStyle = LineSolid;
1364 int scale =
qRound(pen_width < 1 ? 1 : pen_width);
1365 int space = (pen_width < 1 && pen_width > 0 ? 1 : (2 *
scale));
1367 int dash = 4 *
scale;
1369 d->has_custom_pen =
false;
1380 xStyle = LineOnOffDash;
1386 xStyle = LineOnOffDash;
1394 xStyle = LineOnOffDash;
1404 xStyle = LineOnOffDash;
1407 d->has_custom_pen =
true;
1411 ulong mask = GCForeground | GCBackground | GCGraphicsExposures | GCLineWidth
1412 | GCCapStyle | GCJoinStyle | GCLineStyle;
1414 vals.graphics_exposures =
false;
1415 if (
d->pdev_depth == 1) {
1419 &&
X11->use_xrender) {
1430 vals.cap_style = cp;
1431 vals.join_style = jn;
1432 vals.line_style = xStyle;
1434 XChangeGC(
d->dpy,
d->gc,
mask, &vals);
1437 XSetDashes(
d->dpy,
d->gc, 0, dashes, dash_len);
1440 if (!
d->has_clipping) {
1453 d->bg_origin = origin;
1454 d->adapted_brush_origin =
false;
1455#if QT_CONFIG(xrender)
1456 d->current_brush = 0;
1458 if (
d->opacity < 1.0) {
1460 c.setAlpha(
qRound(
c.alpha()*
d->opacity));
1461 d->cbrush.setColor(
c);
1465 int bs =
d->cbrush.style();
1469 d->has_alpha_brush =
brush.color().alpha() != 255;
1470 d->has_alpha_texture =
d->has_texture &&
d->cbrush.texture().hasAlphaChannel();
1472 ulong mask = GCForeground | GCBackground | GCGraphicsExposures
1473 | GCLineStyle | GCCapStyle | GCJoinStyle | GCFillStyle;
1475 vals.graphics_exposures =
false;
1476 if (
d->pdev_depth == 1) {
1477 vals.foreground =
qGray(
d->cbrush.color().rgb()) > 127 ? 0 : 1;
1480 &&
d->pdev_depth == 32) {
1481 vals.foreground =
d->cbrush.color().rgba();
1485 vals.foreground = cmap.
pixel(
d->cbrush.color());
1488 if (!
X11->use_xrender &&
d->has_brush && !
d->has_pattern && !
brush.isOpaque()) {
1493 d->adapted_brush_origin =
true;
1496 vals.cap_style = CapButt;
1497 vals.join_style = JoinMiter;
1498 vals.line_style = LineSolid;
1500 if (
d->has_pattern ||
d->has_texture) {
1503#if QT_CONFIG(xrender)
1504 if (
X11->use_xrender) {
1505 XRenderPictureAttributes
attrs;
1506 attrs.repeat =
true;
1509 if (
data->mask_picture)
1510 XRenderChangePicture(
d->dpy,
data->mask_picture, CPRepeat, &
attrs);
1517 if (
d->brush_pm.depth() == 1) {
1521#if QT_CONFIG(xrender)
1522 if (
X11->use_xrender) {
1523 d->bitmap_texture =
QPixmap(
d->brush_pm.size());
1531 0, 0,
d->brush_pm.width(),
d->brush_pm.height(),
1532 0, 0,
d->brush_pm.width(),
d->brush_pm.height());
1534 XRenderPictureAttributes
attrs;
1535 attrs.repeat =
true;
1543#if QT_CONFIG(xrender)
1544 if (
d->pdev_depth == 32 &&
d->brush_pm.depth() != 32) {
1545 d->brush_pm.detach();
1547 brushData->convertToARGB32();
1550 vals.tile = (
d->brush_pm.depth() ==
d->pdev_depth
1554#if QT_CONFIG(xrender)
1559 mask |= GCTileStipXOrigin | GCTileStipYOrigin;
1560 vals.ts_x_origin =
qRound(origin.
x());
1561 vals.ts_y_origin =
qRound(origin.
y());
1563#if QT_CONFIG(xrender)
1564 else if (
d->has_alpha_brush) {
1565 d->current_brush =
X11->getSolidFill(
d->scrn,
d->cbrush.color());
1569 vals.fill_style =
s;
1570 XChangeGC(
d->dpy,
d->gc_brush,
mask, &vals);
1571 if (!
d->has_clipping) {
1591 if (
rect.isEmpty()) {
1597 QRect devclip(SHRT_MIN, SHRT_MIN, SHRT_MAX*2 - 1, SHRT_MAX*2 - 1);
1600 r =
d->matrix.mapRect(
rect);
1604 r =
d->matrix.map(
path).boundingRect().toRect();
1609 || (
d->has_complex_xform
1610 && !(
d->has_non_scaling_xform &&
rect.width() ==
rect.height())))
1624 if (
w == 1 &&
h == 1) {
1625 XDrawPoint(
d->dpy,
d->hd,
d->has_pen ?
d->gc :
d->gc_brush,
x,
y);
1628 d->setupAdaptedOrigin(
rect.topLeft());
1630 XFillArc(
d->dpy,
d->hd,
d->gc_brush,
x,
y,
w,
h, 0, 360*64);
1632 XDrawArc(
d->dpy,
d->hd,
d->gc_brush,
x,
y,
w-1,
h-1, 0, 360*64);
1635 XDrawArc(
d->dpy,
d->hd,
d->gc,
x,
y,
w,
h, 0, 360*64);
1636 d->resetAdaptedOrigin();
1653 for (
int i = 0;
i < pointCount; ++
i) {
1654 translated_points[
i] = polygonPoints[
i] +
offset;
1656 translated_points[
i].rx() =
qRound(translated_points[
i].
x()) + offs;
1657 translated_points[
i].ry() =
qRound(translated_points[
i].
y()) + offs;
1663#if QT_CONFIG(xrender)
1664static void qt_XRenderCompositeTrapezoids(
Display *dpy,
1668 _Xconst XRenderPictFormat *maskFormat,
1671 const XTrapezoid *traps,
int size)
1673 const int MAX_TRAPS = 50000;
1676 if (to_draw > MAX_TRAPS)
1677 to_draw = MAX_TRAPS;
1678 XRenderCompositeTrapezoids(dpy, op,
src,
dst,
1694 int clippedCount = 0;
1697#if QT_CONFIG(xrender)
1708#if QT_CONFIG(xrender)
1710 src = current_brush;
1717#if QT_CONFIG(xrender)
1721 if (has_fill_texture)
1723 else if (has_fill_pattern)
1731 &clippedPoints, &clippedCount);
1733#if QT_CONFIG(xrender)
1734 bool solid_fill =
fill.color().alpha() == 255;
1735 if (has_fill_texture &&
fill.texture().depth() == 1 && solid_fill) {
1736 has_fill_texture =
false;
1737 has_fill_pattern =
true;
1742 if (
X11->use_xrender
1744 && !has_fill_pattern
1745 && (clippedCount > 0)
1749 tessellator->tessellate((
QPointF *)clippedPoints, clippedCount,
1751 if (tessellator->size > 0) {
1752 XRenderPictureAttributes
attrs;
1753 attrs.poly_edge = antialias ? PolyEdgeSmooth : PolyEdgeSharp;
1755 int x_offset = int(XFixedToDouble(tessellator->traps[0].left.p1.x) -
bg_origin.
x());
1756 int y_offset = int(XFixedToDouble(tessellator->traps[0].left.p1.y) -
bg_origin.
y());
1757 qt_XRenderCompositeTrapezoids(
dpy, composition_mode,
src,
picture,
1759 ? XRenderFindStandardFormat(
dpy, PictStandardA8)
1760 : XRenderFindStandardFormat(
dpy, PictStandardA1),
1762 tessellator->traps, tessellator->size);
1763 tessellator->done();
1768 if (clippedCount > 200000) {
1770 for (
int i = 0;
i < clippedCount; ++
i)
1790 }
else if (clippedCount > 0) {
1792 for (
int i = 0;
i < clippedCount; ++
i) {
1793 xpoints[
i].x =
qFloor(clippedPoints[
i].
x);
1794 xpoints[
i].y =
qFloor(clippedPoints[
i].
y);
1797 XSetFillRule(
dpy, fill_gc, WindingRule);
1799 XFillPolygon(
dpy,
hd, fill_gc,
1800 xpoints.
data(), clippedCount,
1804 XSetFillRule(
dpy, fill_gc, EvenOddRule);
1813 for (
int i = 0;
i < pointCount; ++
i)
1814 translated_points[
i] = polygonPoints[
i] +
offset;
1820 int clippedCount = 0;
1823 &clippedPoints, &clippedCount, close);
1825 if (clippedCount > 0) {
1827 for (
int i = 0;
i < clippedCount; ++
i) {
1832 XPoint *pts = xpoints.
data();
1833 XDrawLines(
dpy,
hd,
gc, pts, numberPoints, CoordModeOrigin);
1834 pts += numberPoints;
1835 clippedCount -= numberPoints;
1837 while (clippedCount) {
1838 XDrawLines(
dpy,
hd,
gc, pts-1, numberPoints+1, CoordModeOrigin);
1839 pts += numberPoints;
1840 clippedCount -= numberPoints;
1850 if (
d->use_path_fallback) {
1852 for (
int i = 1;
i < pointCount; ++
i)
1853 path.lineTo(polygonPoints[
i]);
1859 d->cbrush = oldBrush;
1862 path.closeSubpath();
1884 clippedPath = (
path*
matrix).intersected(clipPath);
1889 for (
int i = 0;
i < polys.
size(); ++
i) {
1892 for (
int j = 0;
j < polys.
at(
i).
size(); ++
j) {
1893 translated_points[
j] = polys.
at(
i).at(
j);
1916 && !
d->has_non_scaling_xform)
1932 if (
d->isCosmeticPen() ||
d->has_scaling_xform) {
1933 if (
d->isCosmeticPen())
1952 }
else if (
d->has_pen) {
1955 for (
int i = 0;
i < polys.
size(); ++
i)
1956 d->strokePolygon_dev(polys.
at(
i).data(), polys.
at(
i).size(),
false);
1968 const uint red_mask = (
uint) visual->red_mask;
1969 bool bgr_layout = (red_mask == 0xff);
1971 const int w =
rect.width();
1972 const int h =
rect.height();
1978 || (image_byte_order == LSBFirst && bgr_layout))
1983 for (
int i=0;
i <
h;
i++) {
1988 *
p = ((*
p << 8) & 0xffffff00) | ((*
p >> 24) & 0x000000ff);
1994 *
p = ((*
p << 24) & 0xff000000) | ((*
p << 8) & 0x00ff0000)
1995 | ((*
p >> 8) & 0x0000ff00) | ((*
p >> 24) & 0x000000ff);
1999 || (image_byte_order == LSBFirst && bgr_layout))
2002 *
p = ((*
p << 16) & 0x00ff0000) | ((*
p >> 16) & 0x000000ff)
2003 | ((*p ) & 0xff00ff00);
2009 xi = XCreateImage(dpy, visual,
depth, ZPixmap,
2012 xi = XCreateImage(dpy, visual,
depth, ZPixmap,
2015 XPutImage(dpy, hd, gc, xi, 0, 0,
pos.x(),
pos.y(),
w,
h);
2025 &&
d->pdev_depth >= 24 &&
image.depth() == 32
2026 &&
r.size() == sr.
size())
2035 qt_x11_drawImage(
QRect(sx, sy,
w,
h),
QPoint(
x,
y),
image,
d->hd,
d->gc,
d->dpy,
2036 (Visual *)
d->xinfo->visual(),
d->pdev_depth);
2064#if QT_CONFIG(xrender)
2066 if (src_pict &&
d->picture) {
2067 const int pDepth =
pixmap.depth();
2068 if (pDepth == 1 && (
d->has_alpha_pen)) {
2069 qt_render_bitmap(
d->dpy,
d->scrn, src_pict,
d->picture,
2070 sx, sy,
x,
y, sw, sh,
d->cpen);
2072 }
else if (pDepth != 1 && (pDepth == 32 || pDepth !=
d->pdev_depth)) {
2073 XRenderComposite(
d->dpy,
d->composition_mode,
2074 src_pict, 0,
d->picture, sx, sy, 0, 0,
x,
y, sw, sh);
2080 bool mono_src =
pixmap.depth() == 1;
2081 bool mono_dst =
d->pdev_depth == 1;
2082 bool restore_clip =
false;
2087 XSetForeground(
d->dpy, cgc, 0);
2089 XSetBackground(
d->dpy, cgc, 0);
2090 XSetForeground(
d->dpy, cgc, 1);
2091 if (!
d->crgn.isEmpty()) {
2093 XSetClipRectangles(
d->dpy, cgc, -
x, -
y, rects.
data(), rects.
size(), Unsorted);
2094 }
else if (
d->has_clipping) {
2095 XSetClipRectangles(
d->dpy, cgc, 0, 0, 0, 0, Unsorted);
2097 XSetFillStyle(
d->dpy, cgc, FillOpaqueStippled);
2098 XSetTSOrigin(
d->dpy, cgc, -sx, -sy);
2099 XSetStipple(
d->dpy, cgc,
2102 XFreeGC(
d->dpy, cgc);
2104 XSetClipOrigin(
d->dpy,
d->gc,
x,
y);
2106 restore_clip =
true;
2110 if (!
d->crgn.isEmpty()) {
2111 Pixmap comb = XCreatePixmap(
d->dpy,
d->hd, sw, sh, 1);
2112 GC cgc = XCreateGC(
d->dpy, comb, 0, 0);
2113 XSetForeground(
d->dpy, cgc, 0);
2114 XFillRectangle(
d->dpy, comb, cgc, 0, 0, sw, sh);
2116 XSetClipRectangles(
d->dpy, cgc, -
x, -
y, rects.
data(), rects.
size(), Unsorted);
2118 XFreeGC(
d->dpy, cgc);
2120 XSetClipMask(
d->dpy,
d->gc, comb);
2121 XSetClipOrigin(
d->dpy,
d->gc,
x,
y);
2122 XFreePixmap(
d->dpy, comb);
2125 XSetClipOrigin(
d->dpy,
d->gc,
x - sx,
y - sy);
2129 XSetForeground(
d->dpy,
d->gc,
qGray(
d->cpen.color().rgb()) > 127 ? 0 : 1);
2132 XSetForeground(
d->dpy,
d->gc, cmap.
pixel(
d->cpen.color()));
2134 XFillRectangle(
d->dpy,
d->hd,
d->gc,
x,
y, sw, sh);
2135 restore_clip =
true;
2136 }
else if (mono_dst && !mono_src) {
2148 GC cgc = XCreateGC(
d->dpy, dst_mask, 0, 0);
2149 XSetClipOrigin(
d->dpy, cgc,
x,
y);
2150 XSetClipMask(
d->dpy, cgc, src_mask);
2152 XCopyArea(
d->dpy, src_mask, dst_mask, cgc, sx, sy, sw, sh,
x,
y);
2154 XSetBackground(
d->dpy, cgc, 0);
2155 XSetForeground(
d->dpy, cgc, 1);
2156 XFillRectangle(
d->dpy, dst_mask, cgc,
x,
y, sw, sh);
2158 XFreeGC(
d->dpy, cgc);
2163 XSetClipOrigin(
d->dpy,
d->gc, 0, 0);
2166 XSetClipMask(
d->dpy,
d->gc,
XNone);
2168 XSetClipRectangles(
d->dpy,
d->gc, 0, 0, rects.
data(), rects.
size(), Unsorted);
2175 d->txop = mtx.
type();
2182 d->has_scaling_xform = scaling &&
d->xform_scale != 1.0;
2183 d->has_non_scaling_xform = scaling &&
d->xform_scale == 1.0;
2194 d->has_clipping =
false;
2206 if (
d->has_clipping) {
2207 d->crgn &= clipRegion;
2215 d->crgn = clipRegion;
2225 d->has_clipping =
true;
2253 bool mono_src =
pixmap.depth() == 1;
2264#if QT_CONFIG(xrender)
2266 const int numTiles = (
w /
pixmap.width()) * (
h /
pixmap.height());
2267 if (numTiles < 100) {
2270 int yPos, xPos, drawH, drawW, yOff, xOff;
2273 while (yPos <
y +
h) {
2274 drawH =
pixmap.height() - yOff;
2275 if (yPos + drawH >
y +
h)
2276 drawH =
y +
h - yPos;
2279 while (xPos <
x +
w) {
2280 drawW =
pixmap.width() - xOff;
2281 if (xPos + drawW >
x +
w)
2282 drawW =
x +
w - xPos;
2285 xOff, yOff, xPos, yPos, drawW, drawH,
d->cpen);
2287 XRenderComposite(
d->dpy,
d->composition_mode,
2289 xOff, yOff, 0, 0, xPos, yPos, drawW, drawH);
2299 h =
qMin(
h,
d->pdev->height() -
y);
2300 if (
w <= 0 ||
h <= 0)
2303 const int pw =
w + sx;
2304 const int ph =
h + sy;
2306 if (
pixmap.hasAlpha() || mono_src)
2309 const int mode =
pixmap.hasAlpha() ? PictOpOver : PictOpSrc;
2313 XRenderComposite(
d->dpy,
mode,
2318 int xPos =
pixmap.width();
2321 const int sw =
qMin(xPos, pw - xPos);
2322 XRenderComposite(
d->dpy,
mode,
2323 pmPicture,
XNone, pmPicture,
2324 0, 0, 0, 0, xPos, 0, sw, sh);
2329 int yPos =
pixmap.height();
2332 const int sh =
qMin(yPos, ph - yPos);
2333 XRenderComposite(
d->dpy,
mode,
2334 pmPicture,
XNone, pmPicture,
2335 0, 0, 0, 0, 0, yPos, sw, sh);
2341 qt_render_bitmap(
d->dpy,
d->scrn, pmPicture,
d->picture,
2342 sx, sy,
x,
y,
w,
h,
d->cpen);
2344 XRenderComposite(
d->dpy,
d->composition_mode,
2345 pmPicture,
XNone,
d->picture,
2346 sx, sy, 0, 0,
x,
y,
w,
h);
2352 XSetFillStyle(
d->dpy,
d->gc, FillTiled);
2353 XSetTSOrigin(
d->dpy,
d->gc,
x-sx,
y-sy);
2354 XFillRectangle(
d->dpy,
d->hd,
d->gc,
x,
y,
w,
h);
2355 XSetTSOrigin(
d->dpy,
d->gc, 0, 0);
2356 XSetFillStyle(
d->dpy,
d->gc, FillSolid);
2364#if QT_CONFIG(xrender)
2368 if (!
X11->use_xrender)
2374 if (!
set ||
set->outline_drawing)
2399 d->drawBoxTextItem(
p, ti);
2401#if QT_CONFIG(fontconfig)
2403 drawFreetype(
p, ti);
2411#if QT_CONFIG(fontconfig)
2422 while (
i < glyphs.
size()) {
2436 yp += -glyph->
y + glyph->
height;
2437 int pitch = ((glyph->
width + 31) & ~31) >> 3;
2441 for (
int x = 0;
x < glyph->
width; ++
x) {
2442 bool set =
src[
x >> 3] & (0x80 >> (
x & 7));
2445 while (
x+1 < glyph->
width &&
src[(
x+1) >> 3] & (0x80 >> ((
x+1) & 7))) {
2447 r.setRight(
r.right()+1);
2469 if (!
d->cpen.isSolid()) {
2474 const bool xrenderPath = (
X11->use_xrender
2493 if (glyphs.
count() == 0)
2505 if (
path.elementCount() <= 1)
2518 const int rectcount = 256;
2519 XRectangle rects[rectcount];
2523 QRect clip(
d->polygonClipper.boundingRect());
2524 for (
int i=0;
i <
path.elementCount();
i+=5) {
2535 rects[num_rects].x = short(
rect.x());
2536 rects[num_rects].y = short(
rect.y());
2537 rects[num_rects].width =
ushort(
rect.width());
2538 rects[num_rects].height =
ushort(
rect.height());
2540 if (num_rects == rectcount) {
2541 XFillRectangles(
d->dpy,
d->hd,
d->gc, rects, num_rects);
2546 XFillRectangles(
d->dpy,
d->hd,
d->gc, rects, num_rects);
2550#if QT_CONFIG(xrender)
2557QXRenderGlyphCache::~QXRenderGlyphCache()
2560 XRenderFreeGlyphSet(xinfo.display(), gset);
2563bool QXRenderGlyphCache::addGlyphs(
const QTextItemInt &ti,
2572 XGlyphInfo xglyphinfo;
2574 for (
int i = 0;
i < glyphs.
size(); ++
i) {
2580 if (glyph && glyph->
format == glyphFormat()) {
2581 if (cachedGlyphs.contains(xglyphid)) {
2584 set->setGlyph(glyphs[
i], spp,
nullptr);
2592 if (glyph == 0 || glyph->
format != glyphFormat())
2599 memcpy(glyph->
data,
img.constBits(),
static_cast<size_t>(
img.sizeInBytes()));
2602 set->setGlyph(glyphs[
i], spp, glyph);
2605 xglyphinfo.width = glyph->
width;
2606 xglyphinfo.height = glyph->
height;
2607 xglyphinfo.x = -glyph->
x;
2608 xglyphinfo.y = glyph->
y;
2609 xglyphinfo.xOff = glyph->
advance;
2610 xglyphinfo.yOff = 0;
2612 XRenderAddGlyphs(xinfo.display(), glyphSet(), &xglyphid, &xglyphinfo, 1, (
const char *) glyph->
data, glyphBufferSize(*glyph));
2613 cachedGlyphs.insert(xglyphid);
2641 for (
int i = 0;
i < glyphs.
size(); ++
i)
2648 if (
i >= glyphs.
size())
2656 elt.glyphset = gset;
2657 elt.chars = &chars[
i];
2659 elt.xOff =
qRound(xp + offs);
2660 elt.yOff =
qRound(yp + offs);
2664 for (;
i < glyphs.
size(); ++
i) {
2684 XRenderCompositeText32(xinfo.display(), PictOpOver,
src,
dst,
2685 renderPictFormat(), 0, 0, 0, 0,
2687 elt.chars = &chars[
i];
2689 elt.xOff =
qRound(xp + offs);
2690 elt.yOff =
qRound(yp + offs);
2694 XRenderCompositeText32(xinfo.display(), PictOpOver,
src,
dst,
2695 renderPictFormat(), 0, 0, 0, 0, &elt, 1);
2700GlyphSet QXRenderGlyphCache::glyphSet()
2703 gset = XRenderCreateGlyphSet(xinfo.display(), renderPictFormat());
2713 switch (glyphFormat()) {
2715 pitch = ((glyph.
width + 31) & ~31) >> 3;
2718 pitch = (glyph.
width + 3) & ~3;
2721 pitch = glyph.
width * 4;
2725 return pitch * glyph.
height;
2730 switch (glyphFormat()) {
2749const XRenderPictFormat *QXRenderGlyphCache::renderPictFormat()
const
2751 switch (glyphFormat()) {
2756 return XRenderFindStandardFormat(xinfo.display(), PictStandardA1);
2759 return XRenderFindStandardFormat(xinfo.display(), PictStandardA8);
2763 return XRenderFindStandardFormat(xinfo.display(), PictStandardARGB32);
2794Glyph QXRenderGlyphCache::glyphId(
glyph_t glyph,
QFixed subPixelPosition)
2799bool QXRenderGlyphCache::isValidCoordinate(
const QFixedPoint &
fp)
2801 enum { t_min = SHRT_MIN, t_max = SHRT_MAX };
2802 return (
fp.x < t_min ||
fp.x > t_max ||
fp.y < t_min ||
fp.y > t_max) ?
false :
true;
static QBitmap fromImage(const QImage &image, Qt::ImageConversionFlags flags=Qt::AutoColor)
Returns a copy of the given image converted to a bitmap using the specified image conversion flags.
The QColor class provides colors based on RGB, HSV or CMYK values.
QRgb rgb() const noexcept
Returns the RGB value of the color.
QRgb rgba() const noexcept
Returns the RGB value of the color, including its alpha.
int alpha() const noexcept
Returns the alpha color component of this color.
QGlyphSet * loadGlyphSet(const QTransform &matrix)
Glyph * loadGlyphFor(glyph_t g, const QFixedPoint &subPixelPosition, GlyphFormat format, const QTransform &t, bool fetchBoundingBox=false, bool disableOutlineDrawing=false)
Glyph * loadGlyph(uint glyph, const QFixedPoint &subPixelPosition, GlyphFormat format=Format_None, bool fetchMetricsOnly=false, bool disableOutlineDrawing=false) const
FT_Face lockFace(Scaling scale=Scaled) const
void setGlyphCache(const void *key, QFontEngineGlyphCache *data)
void getGlyphPositions(const QGlyphLayout &glyphs, const QTransform &matrix, QTextItem::RenderFlags flags, QVarLengthArray< glyph_t > &glyphs_out, QVarLengthArray< QFixedPoint > &positions)
QFixed subPixelPositionForX(QFixed x) const
QFontEngineGlyphCache * glyphCache(const void *key, GlyphFormat format, const QTransform &transform, const QColor &color=QColor()) const
qsizetype bytesPerLine() const
Returns the number of bytes per image scanline.
uchar * bits()
Returns a pointer to the first pixel data.
Format
The following image formats are available in Qt.
@ Format_ARGB32_Premultiplied
constexpr qreal x1() const
Returns the x-coordinate of the line's start point.
constexpr qreal y2() const
Returns the y-coordinate of the line's end point.
constexpr qreal x2() const
Returns the x-coordinate of the line's end point.
constexpr qreal y1() const
Returns the y-coordinate of the line's start point.
constexpr QPoint p1() const
Returns the line's start point.
constexpr QPoint p2() const
Returns the line's end point.
qsizetype size() const noexcept
bool isEmpty() const noexcept
const_reference at(qsizetype i) const noexcept
void resize(qsizetype size)
virtual int devType() const
The QPaintEngineState class provides information about the active paint engine's current state....
QTransform transform() const
QPainterPath clipPath() const
Returns the clip path in the current paint engine state.
Qt::ClipOperation clipOperation() const
Returns the clip operation in the current paint engine state.
QPointF brushOrigin() const
Returns the brush origin in the current paint engine state.
bool isClipEnabled() const
Returns whether clipping is enabled or not in the current paint engine state.
QBrush brush() const
Returns the brush in the current paint engine state.
QRegion clipRegion() const
Returns the clip region in the current paint engine state.
QPainter::RenderHints renderHints() const
Returns the render hints in the current paint engine state.
QFont font() const
Returns the font in the current paint engine state.
QPen pen() const
Returns the pen in the current paint engine state.
QPaintEngine::DirtyFlags state() const
Returns a combination of flags identifying the set of properties that need to be updated when updatin...
QPainter::CompositionMode compositionMode() const
Returns the composition mode in the current paint engine state.
void setActive(bool newState)
Sets the active state of the paint engine to state.
virtual void drawRects(const QRect *rects, int rectCount)
This is an overloaded member function, provided for convenience. It differs from the above function o...
virtual void drawTextItem(const QPointF &p, const QTextItem &textItem)
This function draws the text item textItem at position p.
PolygonDrawMode
\value OddEvenMode The polygon should be drawn using OddEven fill rule.
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...
QPainter * painter() const
Returns the paint engine's painter.
void setDirty(DirtyFlags df)
void setSystemClip(const QRegion &baseClip)
QPaintEngineState * state
bool isActive() const
Returns true if the paint engine is actively drawing; otherwise returns false.
virtual void drawEllipse(const QRectF &r)
Reimplement this function to draw the largest ellipse that can be contained within rectangle rect.
QRegion systemClip() const
QPaintDevice * paintDevice() const
Returns the device that this engine is painting on, if painting is active; otherwise returns \nullptr...
The QPainterPathStroker class is used to generate fillable outlines for a given painter path.
void setDashPattern(Qt::PenStyle)
Sets the dash pattern for the generated outlines to style.
void setDashOffset(qreal offset)
Sets the dash offset for the generated outlines to offset.
void setCapStyle(Qt::PenCapStyle style)
Sets the cap style of the generated outlines to style.
void setWidth(qreal width)
Sets the width of the generated outline painter path to width.
QPainterPath createStroke(const QPainterPath &path) const
Generates a new path that is a fillable area representing the outline of the given path.
void setJoinStyle(Qt::PenJoinStyle style)
Sets the join style of the generated outlines to style.
void addRect(const QRectF &rect)
Adds the given rectangle to this path as a closed subpath.
void setFillRule(Qt::FillRule fillRule)
Sets the fill rule of the painter path to the given fillRule.
QPolygonF toFillPolygon(const QTransform &matrix=QTransform()) const
Converts the path into a polygon using the QTransform matrix, and returns the polygon.
QList< QPolygonF > toFillPolygons(const QTransform &matrix=QTransform()) const
Converts the path into a list of polygons using the QTransform matrix, and returns the list.
Qt::FillRule fillRule() const
Returns the painter path's currently set fill rule.
bool isEmpty() const
Returns true if either there are no elements in this path, or if the only element is a MoveToElement;...
QPainterPath intersected(const QPainterPath &r) const
The QPainter class performs low-level painting on widgets and other paint devices.
void drawPath(const QPainterPath &path)
Draws the given painter path using the current pen for outline and the current brush for filling.
void setPen(const QColor &color)
This is an overloaded member function, provided for convenience. It differs from the above function o...
void setBrushOrigin(int x, int y)
This is an overloaded member function, provided for convenience. It differs from the above function o...
void restore()
Restores the current painter state (pops a saved state off the stack).
void save()
Saves the current painter state (pushes the state onto a stack).
QPainterPath clipPath() const
Returns the current clip path in logical coordinates.
void setBrush(const QBrush &brush)
Sets the painter's brush to the given brush.
CompositionMode
Defines the modes supported for digital image compositing.
@ RasterOp_SourceAndNotDestination
@ RasterOp_NotSourceAndNotDestination
@ RasterOp_NotSourceOrNotDestination
@ RasterOp_SourceXorDestination
@ RasterOp_NotSourceAndDestination
@ RasterOp_SourceOrDestination
@ RasterOp_NotSourceXorDestination
@ RasterOp_SourceAndDestination
void drawPolygon(const QPointF *points, int pointCount, Qt::FillRule fillRule=Qt::OddEvenFill)
Draws the polygon defined by the first pointCount points in the array points using the current pen an...
void translate(const QPointF &offset)
Translates the coordinate system by the given offset; i.e.
bool hasClipping() const
Returns true if clipping has been set; otherwise returns false.
qreal widthF() const
Returns the pen width with floating point precision.
bool isCosmetic() const
Returns true if the pen is cosmetic; otherwise returns false.
QColor color() const
Returns the color of this pen's brush.
Qt::PenCapStyle capStyle() const
Returns the pen's cap style.
Qt::PenJoinStyle joinStyle() const
Returns the pen's join style.
QBrush brush() const
Returns the brush used to fill strokes generated with this pen.
Qt::PenStyle style() const
Returns the pen style.
static bool find(const QString &key, QPixmap *pixmap)
Looks for a cached pixmap associated with the given key in the cache.
static bool insert(const QString &key, const QPixmap &pixmap)
Inserts a copy of the pixmap pixmap associated with the key into the cache.
Returns a copy of the pixmap that is transformed using the given transformation transform and transfo...
QPlatformPixmap * handle() const
void fill(const QColor &fillColor=Qt::white)
Fills the pixmap with the given color.
\inmodule QtCore\reentrant
constexpr qreal x() const noexcept
Returns the x coordinate of this point.
constexpr qreal y() const noexcept
Returns the y coordinate of this point.
\inmodule QtCore\reentrant
constexpr int x() const noexcept
Returns the x coordinate of this point.
constexpr int y() const noexcept
Returns the y coordinate of this point.
The QPolygonF class provides a list of points using floating point precision.
QPolygon Q_GUI_EXPORT toPolygon() const
Creates and returns a QPolygon by converting each QPointF to a QPoint.
The QPolygon class provides a list of points using integer precision.
Q_GUI_EXPORT QRect boundingRect() const
Returns the bounding rectangle of the polygon, or QRect(0, 0, 0, 0) if the polygon is empty.
quint32 generate()
Generates a 32-bit random quantity and returns it.
static Q_DECL_CONST_FUNCTION QRandomGenerator * global()
\threadsafe
\inmodule QtCore\reentrant
constexpr bool isEmpty() const noexcept
Returns true if the rectangle is empty, otherwise returns false.
QRect toAlignedRect() const noexcept
constexpr qreal y() const noexcept
Returns the y-coordinate of the rectangle's top edge.
constexpr qreal height() const noexcept
Returns the height of the rectangle.
constexpr qreal width() const noexcept
Returns the width of the rectangle.
constexpr qreal x() const noexcept
Returns the x-coordinate of the rectangle's left edge.
constexpr QSizeF size() const noexcept
Returns the size of the rectangle.
constexpr QRect toRect() const noexcept
Returns a QRect based on the values of this rectangle.
constexpr void translate(qreal dx, qreal dy) noexcept
Moves the rectangle dx along the x-axis and dy along the y-axis, relative to the current position.
QRectF intersected(const QRectF &other) const noexcept
\inmodule QtCore\reentrant
QRect intersected(const QRect &other) const noexcept
constexpr int bottom() const noexcept
Returns the y-coordinate of the rectangle's bottom edge.
constexpr int top() const noexcept
Returns the y-coordinate of the rectangle's top edge.
constexpr int left() const noexcept
Returns the x-coordinate of the rectangle's left edge.
constexpr int right() const noexcept
Returns the x-coordinate of the rectangle's right edge.
The QRegion class specifies a clip region for a painter.
bool isEmpty() const
Returns true if the region is empty; otherwise returns false.
QRegion intersected(const QRegion &r) const
\macro QT_RESTRICTED_CAST_FROM_ASCII
void setClipRect(const QRectF &clip)
QRectF tessellate(const QPointF *points, int nPoints)
virtual void addTrap(const Trapezoid &trap)=0
constexpr size_type size() const noexcept
void systemStateChanged() override
void resetAdaptedOrigin()
void setupAdaptedOrigin(const QPoint &p)
void fillPolygon_translated(const QPointF *points, int pointCount, GCMode gcMode, QPaintEngine::PolygonDrawMode mode)
void clipPolygon_dev(const QPolygonF &poly, QPolygonF *clipped_poly)
const QXcbX11Info * xinfo
bool isCosmeticPen() const
uint adapted_brush_origin
QTransform::TransformationType txop
QPolygonClipper< qt_float_point, qt_float_point, float > polygonClipper
void strokePolygon_dev(const QPointF *points, int pointCount, bool close)
void decidePathFallback()
void fillPath(const QPainterPath &path, GCMode gcmode, bool transform)
void strokePolygon_translated(const QPointF *points, int pointCount, bool close)
uint has_non_scaling_xform
void fillPolygon_dev(const QPointF *points, int pointCount, GCMode gcMode, QPaintEngine::PolygonDrawMode mode)
void updateState(const QPaintEngineState &state) override
Reimplement this function to update the state of a paint engine.
void drawTextItem(const QPointF &p, const QTextItem &textItem) override
This function draws the text item textItem at position p.
void drawLines(const QLine *lines, int lineCount) override
This is an overloaded member function, provided for convenience. It differs from the above function o...
bool begin(QPaintDevice *pdev) override
Reimplement this function to initialise your paint engine when painting is to start on the paint devi...
void updateBrush(const QBrush &brush, const QPointF &pt)
void updateClipRegion_dev(const QRegion ®ion, Qt::ClipOperation op)
void updateFont(const QFont &font)
virtual Drawable handle() const
void drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr) override
Reimplement this function to draw the part of the pm specified by the sr rectangle in the given r.
void drawRects(const QRect *rects, int rectCount) override
This is an overloaded member function, provided for convenience. It differs from the above function o...
void updateMatrix(const QTransform &matrix)
QPainter::RenderHints supportedRenderHints() const
void updateRenderHints(QPainter::RenderHints hints)
void drawPath(const QPainterPath &path) override
The default implementation ignores the path and does nothing.
void drawPoints(const QPoint *points, int pointCount) override
Draws the first pointCount points in the buffer points.
virtual void drawPolygon(const QPointF *points, int pointCount, PolygonDrawMode mode) override
Reimplement this virtual function to draw the polygon defined by the pointCount first points in point...
void drawTiledPixmap(const QRectF &r, const QPixmap &pixmap, const QPointF &s) override
Reimplement this function to draw the pixmap in the given rect, starting at the given p.
void updatePen(const QPen &pen)
void drawImage(const QRectF &r, const QImage &img, const QRectF &sr, Qt::ImageConversionFlags flags=Qt::AutoColor) override
Reimplement this function to draw the part of the image specified by the sr rectangle in the given re...
bool end() override
Reimplement this function to finish painting on the current paint device.
void drawEllipse(const QRect &r) override
The default implementation of this function calls the floating point version of this function.
static QXcbColormap instance(int screen=-1)
uint pixel(const QColor &color) const
static Display * display()
QCache< int, Employee > cache
[0]
Combined button and popup list for selecting options.
Q_GUI_EXPORT QPixmap qt_pixmapForBrush(int brushStyle, bool invert)
static const QCssKnownValue positions[NumKnownPositionModes - 1]
DBusConnection const char DBusError DBusBusType DBusError return DBusConnection DBusHandleMessageFunction function
static struct AttrInfo attrs[]
size_t qHash(const QFileSystemWatcherPathKey &key, size_t seed=0)
int qRound(qfloat16 d) noexcept
constexpr const T & qMin(const T &a, const T &b)
constexpr const T & qBound(const T &min, const T &val, const T &max)
constexpr const T & qMax(const T &a, const T &b)
GLboolean GLboolean GLboolean b
GLint GLint GLint GLint GLint x
[0]
GLint GLenum GLsizei GLsizei GLsizei depth
GLfloat GLfloat GLfloat w
[0]
GLuint GLfloat GLfloat GLfloat GLfloat y1
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLuint GLfloat GLfloat GLfloat x1
GLdouble GLdouble GLdouble GLdouble top
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLenum GLuint GLintptr offset
GLint GLint GLint GLint GLint GLint GLint GLbitfield mask
GLint GLsizei GLsizei GLenum format
GLfloat GLfloat GLfloat GLfloat h
GLuint GLenum GLenum transform
GLfixed GLfixed GLint GLint GLfixed points
GLfixed GLfixed GLfixed y2
GLsizei GLfixed GLfixed GLfixed GLfixed const GLubyte * bitmap
GLdouble GLdouble GLdouble GLdouble q
GLsizei const GLchar *const * path
GLfloat GLfloat GLfloat alpha
GLenum GLenum GLenum GLenum GLenum scale
Q_GUI_EXPORT bool qt_scaleForTransform(const QTransform &transform, qreal *scale)
Q_GUI_EXPORT void qt_draw_tile(QPaintEngine *gc, qreal x, qreal y, qreal w, qreal h, const QPixmap &pixmap, qreal xOffset, qreal yOffset)
static void setCapStyle(int cap_style, GC gc)
static void x11SetClipRegion(Display *dpy, GC gc, GC gc2, Qt::HANDLE picture, const QRegion &r)
static QPaintEngine::PaintEngineFeatures qt_decide_features()
QPixmap qt_pixmapForBrush(int brushStyle, bool invert)
Q_GUI_EXPORT void qt_x11_drawImage(const QRect &rect, const QPoint &pos, const QImage &image, Drawable hd, GC gc, Display *dpy, Visual *visual, int depth)
static QLine clipStraightLine(const QRect &clip, const QLine &l)
static const qreal aliasedCoordinateDelta
Q_XCB_EXPORT Drawable qt_x11Handle(const QPaintDevice *pd)
GC Q_XCB_EXPORT qt_x11_get_brush_gc(QPainter *p)
Returns the X11 specific brush GC for the painter p.
QPixmap qt_toX11Pixmap(const QPixmap &pixmap)
static void x11ClearClipRegion(Display *dpy, GC gc, GC gc2, Qt::HANDLE picture)
static const QXcbX11Info * qt_x11Info(const QPaintDevice *pd)
void qt_draw_tile(QPaintEngine *, qreal, qreal, qreal, qreal, const QPixmap &, qreal, qreal)
GC Q_XCB_EXPORT qt_x11_get_pen_gc(QPainter *p)
Returns the X11 specific pen GC for the painter p.
static QPixmap qt_patternForAlpha(uchar alpha, int screen)
static const uchar base_dither_matrix[DITHER_SIZE][DITHER_SIZE]
static bool clipLine(QLineF *line, const QRect &rect)
QT_BEGIN_NAMESPACE Drawable qt_x11Handle(const QPaintDevice *pd)
QPainterPath qt_regionToPath(const QRegion ®ion)
static qreal dot(const QPointF &a, const QPointF &b)
void qt_x11SetScreen(QPixmap &pixmap, int screen)
int qt_x11SetDefaultScreen(int screen)
Pixmap qt_x11PixmapHandle(const QPixmap &pixmap)
Picture qt_x11PictureHandle(const QPixmap &pixmap)
QX11PlatformPixmap * qt_x11Pixmap(const QPixmap &pixmap)
static QRectF alignedRect(bool mirrored, Qt::Alignment alignment, const QSizeF &size, const QRectF &rectangle)
constexpr int qGray(int r, int g, int b)
Int aligned(Int v, Int byteAlign)
#define QT_CONFIG(feature)
#define Q27Dot5ToXFixed(i)
QList< XRectangle > qt_region_to_xrectangles(const QRegion &r)
QFuture< QSet< QChar > > set
[10]
QTextStream out(stdout)
[7]
myFilter draw(painter, QPoint(0, 0), originalPixmap)
void write(QChar *&dest) const
static int size(const HexString< T > &)
static void appendTo(const HexString< T > &str, QChar *&out)
static constexpr QFixed fromReal(qreal r)