| 1 |
// Copyright (C) 2018 The Qt Company Ltd. |
| 2 |
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
| 3 |
|
| 4 |
#ifndef QPAINTENGINE_X11_H |
| 5 |
#define QPAINTENGINE_X11_H |
| 6 |
|
| 7 |
#include <QtGui/QPaintEngine> |
| 8 |
|
| 9 |
typedef unsigned long XID; |
| 10 |
typedef XID Drawable; |
| 11 |
typedef struct _XGC *GC; |
| 12 |
|
| 13 |
QT_BEGIN_NAMESPACE |
| 14 |
|
| 15 |
extern "C" { |
| 16 |
Drawable qt_x11Handle(const QPaintDevice *pd); |
| 17 |
GC qt_x11_get_pen_gc(QPainter *); |
| 18 |
GC qt_x11_get_brush_gc(QPainter *); |
| 19 |
} |
| 20 |
|
| 21 |
class QX11PaintEnginePrivate; |
| 22 |
class QX11PaintEngine : public QPaintEngine |
| 23 |
{ |
| 24 |
Q_DECLARE_PRIVATE(QX11PaintEngine) |
| 25 |
public: |
| 26 |
QX11PaintEngine(); |
| 27 |
~QX11PaintEngine(); |
| 28 |
|
| 29 |
bool begin(QPaintDevice *pdev) override; |
| 30 |
bool end() override; |
| 31 |
|
| 32 |
void updateState(const QPaintEngineState &state) override; |
| 33 |
|
| 34 |
void updatePen(const QPen &pen); |
| 35 |
void updateBrush(const QBrush &brush, const QPointF &pt); |
| 36 |
void updateRenderHints(QPainter::RenderHints hints); |
| 37 |
void updateFont(const QFont &font); |
| 38 |
void updateMatrix(const QTransform &matrix); |
| 39 |
void updateClipRegion_dev(const QRegion ®ion, Qt::ClipOperation op); |
| 40 |
|
| 41 |
void drawLines(const QLine *lines, int lineCount) override; |
| 42 |
void drawLines(const QLineF *lines, int lineCount) override; |
| 43 |
|
| 44 |
void drawRects(const QRect *rects, int rectCount) override; |
| 45 |
void drawRects(const QRectF *rects, int rectCount) override; |
| 46 |
|
| 47 |
void drawPoints(const QPoint *points, int pointCount) override; |
| 48 |
void drawPoints(const QPointF *points, int pointCount) override; |
| 49 |
|
| 50 |
void drawEllipse(const QRect &r) override; |
| 51 |
void drawEllipse(const QRectF &r) override; |
| 52 |
|
| 53 |
virtual void drawPolygon(const QPointF *points, int pointCount, PolygonDrawMode mode) override; |
| 54 |
inline void drawPolygon(const QPoint *points, int pointCount, PolygonDrawMode mode) override |
| 55 |
{ QPaintEngine::drawPolygon(points, pointCount, mode); } |
| 56 |
|
| 57 |
void drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr) override; |
| 58 |
void drawTiledPixmap(const QRectF &r, const QPixmap &pixmap, const QPointF &s) override; |
| 59 |
void drawPath(const QPainterPath &path) override; |
| 60 |
void drawTextItem(const QPointF &p, const QTextItem &textItem) override; |
| 61 |
void drawImage(const QRectF &r, const QImage &img, const QRectF &sr, |
| 62 |
Qt::ImageConversionFlags flags = Qt::AutoColor) override; |
| 63 |
|
| 64 |
virtual Drawable handle() const; |
| 65 |
inline Type type() const override { return QPaintEngine::X11; } |
| 66 |
|
| 67 |
QPainter::RenderHints supportedRenderHints() const; |
| 68 |
|
| 69 |
protected: |
| 70 |
QX11PaintEngine(QX11PaintEnginePrivate &dptr); |
| 71 |
|
| 72 |
#if QT_CONFIG(fontconfig) |
| 73 |
void drawFreetype(const QPointF &p, const QTextItemInt &ti); |
| 74 |
bool drawCachedGlyphs(const QTransform &transform, const QTextItemInt &ti); |
| 75 |
#endif // QT_CONFIG(fontconfig) |
| 76 |
|
| 77 |
friend class QPixmap; |
| 78 |
friend class QFontEngineBox; |
| 79 |
friend GC qt_x11_get_pen_gc(QPainter *); |
| 80 |
friend GC qt_x11_get_brush_gc(QPainter *); |
| 81 |
|
| 82 |
private: |
| 83 |
Q_DISABLE_COPY_MOVE(QX11PaintEngine) |
| 84 |
}; |
| 85 |
|
| 86 |
QT_END_NAMESPACE |
| 87 |
|
| 88 |
#endif // QPAINTENGINE_X11_H |