Qt 4.8
qpaintengine_x11_p.h
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
4 ** Contact: http://www.qt-project.org/legal
5 **
6 ** This file is part of the QtGui module of the Qt Toolkit.
7 **
8 ** $QT_BEGIN_LICENSE:LGPL$
9 ** Commercial License Usage
10 ** Licensees holding valid commercial Qt licenses may use this file in
11 ** accordance with the commercial license agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and Digia. For licensing terms and
14 ** conditions see http://qt.digia.com/licensing. For further information
15 ** use the contact form at http://qt.digia.com/contact-us.
16 **
17 ** GNU Lesser General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 2.1 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL included in the
21 ** packaging of this file. Please review the following information to
22 ** ensure the GNU Lesser General Public License version 2.1 requirements
23 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24 **
25 ** In addition, as a special exception, Digia gives you certain additional
26 ** rights. These rights are described in the Digia Qt LGPL Exception
27 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28 **
29 ** GNU General Public License Usage
30 ** Alternatively, this file may be used under the terms of the GNU
31 ** General Public License version 3.0 as published by the Free Software
32 ** Foundation and appearing in the file LICENSE.GPL included in the
33 ** packaging of this file. Please review the following information to
34 ** ensure the GNU General Public License version 3.0 requirements will be
35 ** met: http://www.gnu.org/copyleft/gpl.html.
36 **
37 **
38 ** $QT_END_LICENSE$
39 **
40 ****************************************************************************/
41 
42 #ifndef QPAINTENGINE_X11_P_H
43 #define QPAINTENGINE_X11_P_H
44 
45 //
46 // W A R N I N G
47 // -------------
48 //
49 // This file is not part of the Qt API. It exists purely as an
50 // implementation detail. This header file may change from version to
51 // version without notice, or even be removed.
52 //
53 // We mean it.
54 //
55 
56 #include "QtGui/qpaintengine.h"
57 #include "QtGui/qregion.h"
58 #include "QtGui/qpen.h"
59 #include "QtCore/qpoint.h"
60 #include "private/qpaintengine_p.h"
61 #include "private/qpainter_p.h"
62 #include "private/qpolygonclipper_p.h"
63 
64 typedef unsigned long Picture;
65 
67 
69 class QFontEngineFT;
71 
73 {
74  qreal x, y;
75 };
76 
78 {
80 public:
82  ~QX11PaintEngine();
83 
84  bool begin(QPaintDevice *pdev);
85  bool end();
86 
87  void updateState(const QPaintEngineState &state);
88 
89  void updatePen(const QPen &pen);
90  void updateBrush(const QBrush &brush, const QPointF &pt);
91  void updateRenderHints(QPainter::RenderHints hints);
92  void updateFont(const QFont &font);
93  void updateMatrix(const QTransform &matrix);
94  void updateClipRegion_dev(const QRegion &region, Qt::ClipOperation op);
95 
96  void drawLines(const QLine *lines, int lineCount);
97  void drawLines(const QLineF *lines, int lineCount);
98 
99  void drawRects(const QRect *rects, int rectCount);
100  void drawRects(const QRectF *rects, int rectCount);
101 
102  void drawPoints(const QPoint *points, int pointCount);
103  void drawPoints(const QPointF *points, int pointCount);
104 
105  void drawEllipse(const QRect &r);
106  void drawEllipse(const QRectF &r);
107 
108  virtual void drawPolygon(const QPointF *points, int pointCount, PolygonDrawMode mode);
109  inline void drawPolygon(const QPoint *points, int pointCount, PolygonDrawMode mode)
110  { QPaintEngine::drawPolygon(points, pointCount, mode); }
111 
112  void drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr);
113  void drawTiledPixmap(const QRectF &r, const QPixmap &pixmap, const QPointF &s);
114  void drawPath(const QPainterPath &path);
115  void drawTextItem(const QPointF &p, const QTextItem &textItem);
116  void drawImage(const QRectF &r, const QImage &img, const QRectF &sr,
117  Qt::ImageConversionFlags flags = Qt::AutoColor);
118 
119  virtual Qt::HANDLE handle() const;
120  inline Type type() const { return QPaintEngine::X11; }
121 
122  QPainter::RenderHints supportedRenderHints() const;
123 
124 protected:
126 
127  void drawXLFD(const QPointF &p, const QTextItemInt &si);
128 #ifndef QT_NO_FONTCONFIG
129  void drawFreetype(const QPointF &p, const QTextItemInt &si);
130 #endif
131 
132  friend class QPixmap;
133  friend class QFontEngineBox;
136 
137 private:
139 };
140 
142 {
144 public:
146  {
147  scrn = -1;
148  hd = 0;
149  picture = 0;
150  gc = gc_brush = 0;
151  dpy = 0;
152  xinfo = 0;
153  txop = QTransform::TxNone;
154  has_clipping = false;
155  render_hints = 0;
156  xform_scale = 1;
157 #ifndef QT_NO_XRENDER
158  tessellator = 0;
159 #endif
160  }
161  enum GCMode {
163  BrushGC
164  };
165 
166  void init();
167  void fillPolygon_translated(const QPointF *points, int pointCount, GCMode gcMode,
169  void fillPolygon_dev(const QPointF *points, int pointCount, GCMode gcMode,
171  void fillPath(const QPainterPath &path, GCMode gcmode, bool transform);
172  void strokePolygon_dev(const QPointF *points, int pointCount, bool close);
173  void strokePolygon_translated(const QPointF *points, int pointCount, bool close);
174  void setupAdaptedOrigin(const QPoint &p);
175  void resetAdaptedOrigin();
177  use_path_fallback = has_alpha_brush
178  || has_alpha_pen
179  || has_custom_pen
180  || has_complex_xform
181  || (render_hints & QPainter::Antialiasing);
182  }
184  adjust_coords = !(render_hints & QPainter::Antialiasing)
185  && (has_alpha_pen
186  || (has_alpha_brush && has_pen && !has_alpha_pen)
187  || (cpen.style() > Qt::SolidLine));
188  }
189  void clipPolygon_dev(const QPolygonF &poly, QPolygonF *clipped_poly);
190  void systemStateChanged();
191 
193  int scrn;
197 #if !defined (QT_NO_XRENDER)
202 #else
203  Qt::HANDLE picture;
204 #endif
207 
213 
231 
232  const QX11Info *xinfo;
237 
239 #ifndef QT_NO_XRENDER
241 #endif
242 };
243 
245 
246 #endif // QPAINTENGINE_X11_P_H
The QPainter class performs low-level painting on widgets and other paint devices.
Definition: qpainter.h:86
QPolygonClipper< qt_float_point, qt_float_point, float > polygonClipper
double qreal
Definition: qglobal.h:1193
#define QT_END_NAMESPACE
This macro expands to.
Definition: qglobal.h:90
The QLine class provides a two-dimensional vector using integer precision.
Definition: qline.h:57
The QPainterPath class provides a container for painting operations, enabling graphical shapes to be ...
Definition: qpainterpath.h:67
#define Q_GUI_EXPORT
Definition: qglobal.h:1450
The QPointF class defines a point in the plane using floating point precision.
Definition: qpoint.h:214
Q_GUI_EXPORT GC qt_x11_get_brush_gc(QPainter *p)
Returns the X11 specific brush GC for the painter p.
#define Q_DISABLE_COPY(Class)
Disables the use of copy constructors and assignment operators for the given Class.
Definition: qglobal.h:2523
QTransform::TransformationType txop
The QPen class defines how a QPainter should draw lines and outlines of shapes.
Definition: qpen.h:64
Q_GUI_EXPORT GC qt_x11_get_pen_gc(QPainter *p)
Returns the X11 specific pen GC for the painter p.
The QLineF class provides a two-dimensional vector using floating point precision.
Definition: qline.h:212
void drawPolygon(const QPoint *points, int pointCount, PolygonDrawMode mode)
Reimplement this virtual function to draw the polygon defined by the pointCount first points in point...
TransformationType
Definition: qtransform.h:68
#define QT_BEGIN_NAMESPACE
This macro expands to.
Definition: qglobal.h:89
The QRectF class defines a rectangle in the plane using floating point precision. ...
Definition: qrect.h:511
static bool init
static void drawRects(const T *rects, int n, const QTransform &transform, IDirectFBSurface *surface)
QXRenderTessellator * tessellator
The QPolygonF class provides a vector of points using floating point precision.
Definition: qpolygon.h:134
Internal QTextItem.
The QImage class provides a hardware-independent image representation that allows direct access to th...
Definition: qimage.h:87
unsigned int uint
Definition: qglobal.h:996
virtual void drawPolygon(const QPointF *points, int pointCount, PolygonDrawMode mode)
Reimplement this virtual function to draw the polygon defined by the pointCount first points in point...
The QRegion class specifies a clip region for a painter.
Definition: qregion.h:68
void * HANDLE
Definition: qnamespace.h:1671
The QPaintEngine class provides an abstract definition of how QPainter draws to a given device on a g...
Definition: qpaintengine.h:90
unsigned long Picture
The QBrush class defines the fill pattern of shapes drawn by QPainter.
Definition: qbrush.h:76
struct _XDisplay Display
Definition: qwindowdefs.h:115
The QX11Info class provides information about the X display configuration.
Definition: qx11info_x11.h:63
#define Q_DECLARE_PUBLIC(Class)
Definition: qglobal.h:2477
The QFont class specifies a font used for drawing text.
Definition: qfont.h:64
Type type() const
Reimplement this function to return the paint engine Type.
The QPoint class defines a point in the plane using integer precision.
Definition: qpoint.h:53
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58
static void drawPoints(const T *points, int n, const QTransform &transform, IDirectFBSurface *surface)
The QPixmap class is an off-screen image representation that can be used as a paint device...
Definition: qpixmap.h:71
struct _XGC * GC
Definition: qwindowdefs.h:117
The QPaintEngineState class provides information about the active paint engine&#39;s current state...
Definition: qpaintengine.h:289
#define Q_DECLARE_PRIVATE(Class)
Definition: qglobal.h:2467
static void drawLines(const T *lines, int n, const QTransform &transform, IDirectFBSurface *surface)
The QTextItem class provides all the information required to draw text in a custom paint engine...
Definition: qpaintengine.h:68
static const KeyPair *const end
The QTransform class specifies 2D transformations of a coordinate system.
Definition: qtransform.h:65
ClipOperation
Definition: qnamespace.h:1495