Qt 4.8
qwindowsurface_raster.cpp
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 #include <qdebug.h>
43 
44 #include <qglobal.h> // for Q_WS_WIN define (non-PCH)
45 #ifdef Q_WS_WIN
46 #include <qlibrary.h>
47 #include <qt_windows.h>
48 #endif
49 
50 #include <QtGui/qpaintdevice.h>
51 #include <QtGui/qwidget.h>
52 
53 #include "private/qwindowsurface_raster_p.h"
54 #include "private/qnativeimage_p.h"
55 #include "private/qwidget_p.h"
56 
57 #ifdef Q_WS_X11
58 #include "private/qpixmap_x11_p.h"
59 #include "private/qt_x11_p.h"
60 #include "private/qwidget_p.h"
61 #include "qx11info_x11.h"
62 #endif
63 #include "private/qdrawhelper_p.h"
64 
65 #ifdef Q_WS_MAC
66 #include <private/qt_cocoa_helpers_mac_p.h>
67 #include <QMainWindow>
68 #include <private/qmainwindowlayout_p.h>
69 #include <QToolBar>
70 #endif
71 
73 
75 {
76 public:
78 
79 #ifdef Q_WS_X11
80  GC gc;
81 #ifndef QT_NO_MITSHM
83 #endif
84 #ifndef QT_NO_XRENDER
86 #endif
87 #endif
89 };
90 
92  : QWindowSurface(window, setDefaultSurface), d_ptr(new QRasterWindowSurfacePrivate)
93 {
94 #ifdef Q_WS_X11
95  d_ptr->gc = XCreateGC(X11->display, window->handle(), 0, 0);
96 #ifndef QT_NO_XRENDER
97  d_ptr->translucentBackground = X11->use_xrender
98  && window->x11Info().depth() == 32;
99 #endif
100 #ifndef QT_NO_MITSHM
101  d_ptr->needsSync = false;
102 #endif
103 #endif
104  d_ptr->image = 0;
105  d_ptr->inSetGeometry = false;
106 
107 #ifdef QT_MAC_USE_COCOA
108  needsFlush = false;
109  regionToFlush = QRegion();
110 #endif // QT_MAC_USE_COCOA
111 }
112 
113 
115 {
116 #ifdef Q_WS_X11
117  XFreeGC(X11->display, d_ptr->gc);
118 #endif
119  if (d_ptr->image)
120  delete d_ptr->image;
121 }
122 
123 
125 {
126  return &d_ptr->image->image;
127 }
128 
129 #if defined(Q_WS_X11) && !defined(QT_NO_MITSHM)
131 {
132  // delay writing to the backbuffer until we know for sure X is done reading from it
133  if (d_ptr->needsSync) {
134  XSync(X11->display, false);
135  d_ptr->needsSync = false;
136  }
137 }
138 #endif
139 
141 {
142 #if defined(Q_WS_X11) && !defined(QT_NO_MITSHM)
143  syncX();
144 #endif
145 
146 #if (defined(Q_WS_X11) && !defined(QT_NO_XRENDER)) || (defined(Q_WS_WIN) && !defined(Q_WS_WINCE))
147  if (!qt_widget_private(window())->isOpaque && window()->testAttribute(Qt::WA_TranslucentBackground)) {
148 #if defined(Q_WS_WIN) && !defined(Q_WS_WINCE)
151 #endif
152  QPainter p(&d_ptr->image->image);
154  const QVector<QRect> rects = rgn.rects();
155  const QColor blank = Qt::transparent;
156  for (QVector<QRect>::const_iterator it = rects.begin(); it != rects.end(); ++it) {
157  p.fillRect(*it, blank);
158  }
159  }
160 #else
161  Q_UNUSED(rgn);
162 #endif
163 }
164 
166 {
168 
169  // Not ready for painting yet, bail out. This can happen in
170  // QWidget::create_sys()
171  if (!d->image || rgn.rectCount() == 0)
172  return;
173 
174 #ifdef Q_WS_WIN
175  QRect br = rgn.boundingRect();
176 
177 #ifndef Q_WS_WINCE
178  if (!qt_widget_private(window())->isOpaque
179  && window()->testAttribute(Qt::WA_TranslucentBackground)
180  && (qt_widget_private(window())->data.window_flags & Qt::FramelessWindowHint))
181  {
182  QRect r = window()->frameGeometry();
183  QPoint frameOffset = qt_widget_private(window())->frameStrut().topLeft();
184  QRect dirtyRect = br.translated(offset + frameOffset);
185 
186  SIZE size = {r.width(), r.height()};
187  POINT ptDst = {r.x(), r.y()};
188  POINT ptSrc = {0, 0};
189  BLENDFUNCTION blend = {AC_SRC_OVER, 0, (BYTE)(255.0 * window()->windowOpacity()), Q_AC_SRC_ALPHA};
190  RECT dirty = {dirtyRect.x(), dirtyRect.y(),
191  dirtyRect.x() + dirtyRect.width(), dirtyRect.y() + dirtyRect.height()};
192  Q_UPDATELAYEREDWINDOWINFO info = {sizeof(info), NULL, &ptDst, &size, d->image->hdc, &ptSrc, 0, &blend, Q_ULW_ALPHA, &dirty};
193  ptrUpdateLayeredWindowIndirect(window()->internalWinId(), &info);
194  } else
195 #endif
196  {
197  QPoint wOffset = qt_qwidget_data(widget)->wrect.topLeft();
198 
199  HDC widget_dc = widget->getDC();
200 
201  QRect wbr = br.translated(-wOffset);
202  BitBlt(widget_dc, wbr.x(), wbr.y(), wbr.width(), wbr.height(),
203  d->image->hdc, br.x() + offset.x(), br.y() + offset.y(), SRCCOPY);
204  widget->releaseDC(widget_dc);
205  }
206 
207 #ifndef QT_NO_DEBUG
208  static bool flush = !qgetenv("QT_FLUSH_WINDOWSURFACE").isEmpty();
209  if (flush) {
210  SelectObject(qt_win_display_dc(), GetStockObject(BLACK_BRUSH));
211  Rectangle(qt_win_display_dc(), 0, 0, d->image->width() + 2, d->image->height() + 2);
212  BitBlt(qt_win_display_dc(), 1, 1, d->image->width(), d->image->height(),
213  d->image->hdc, 0, 0, SRCCOPY);
214  }
215 #endif
216 
217 #endif
218 
219 #ifdef Q_WS_X11
220  extern void *qt_getClipRects(const QRegion &r, int &num); // in qpaintengine_x11.cpp
221  extern QWidgetData* qt_widget_data(QWidget *);
222  QPoint wOffset = qt_qwidget_data(widget)->wrect.topLeft();
223 
224  if (widget->window() != window()) {
225  XFreeGC(X11->display, d_ptr->gc);
226  d_ptr->gc = XCreateGC(X11->display, widget->handle(), 0, 0);
227  }
228 
229  QRegion wrgn(rgn);
230  if (!wOffset.isNull())
231  wrgn.translate(-wOffset);
232 
233  if (wrgn.rectCount() != 1) {
234  int num;
235  XRectangle *rects = (XRectangle *)qt_getClipRects(wrgn, num);
236  XSetClipRectangles(X11->display, d_ptr->gc, 0, 0, rects, num, YXBanded);
237  }
238 
239  QPoint widgetOffset = offset + wOffset;
240  QRect clipRect = widget->rect().translated(widgetOffset).intersected(d_ptr->image->image.rect());
241 
242  QRect br = rgn.boundingRect().translated(offset).intersected(clipRect);
243  QPoint wpos = br.topLeft() - widgetOffset;
244 
245 #ifndef QT_NO_MITSHM
246  if (d_ptr->image->xshmpm) {
247  XCopyArea(X11->display, d_ptr->image->xshmpm, widget->handle(), d_ptr->gc,
248  br.x(), br.y(), br.width(), br.height(), wpos.x(), wpos.y());
249  d_ptr->needsSync = true;
250  } else if (d_ptr->image->xshmimg) {
251  XShmPutImage(X11->display, widget->handle(), d_ptr->gc, d_ptr->image->xshmimg,
252  br.x(), br.y(), wpos.x(), wpos.y(), br.width(), br.height(), False);
253  d_ptr->needsSync = true;
254  } else
255 #endif
256  {
257  int depth = widget->x11Info().depth();
258  const QImage &src = d->image->image;
259  if (src.format() != QImage::Format_RGB32 || depth < 24 || X11->bppForDepth.value(depth) != 32) {
260  Q_ASSERT(src.depth() >= 16);
261  const QImage sub_src(src.scanLine(br.y()) + br.x() * (uint(src.depth()) / 8),
262  br.width(), br.height(), src.bytesPerLine(), src.format());
264  data->xinfo = widget->x11Info();
265  data->fromImage(sub_src, Qt::NoOpaqueDetection);
266  QPixmap pm = QPixmap(data);
267  XCopyArea(X11->display, pm.handle(), widget->handle(), d_ptr->gc, 0 , 0 , br.width(), br.height(), wpos.x(), wpos.y());
268  } else {
269  // qpaintengine_x11.cpp
270  extern void qt_x11_drawImage(const QRect &rect, const QPoint &pos, const QImage &image, Drawable hd, GC gc, Display *dpy, Visual *visual, int depth);
271  qt_x11_drawImage(br, wpos, src, widget->handle(), d_ptr->gc, X11->display, (Visual *)widget->x11Info().visual(), depth);
272  }
273  }
274 
275  if (wrgn.rectCount() != 1)
276  XSetClipMask(X11->display, d_ptr->gc, XNone);
277 #endif // FALCON
278 
279 #ifdef Q_WS_MAC
280 
281  Q_UNUSED(offset);
282 
283  // This is mainly done for native components like native "open file" dialog.
284  if (widget->testAttribute(Qt::WA_DontShowOnScreen)) {
285  return;
286  }
287 
288 #ifdef QT_MAC_USE_COCOA
289 
290  this->needsFlush = true;
291  this->regionToFlush += rgn;
292 
293  // The actual flushing will be processed in [view drawRect:rect]
294  qt_mac_setNeedsDisplay(widget);
295 
296 #else
297  // Get a context for the widget.
298  CGContextRef context;
299  CGrafPtr port = GetWindowPort(qt_mac_window_for(widget));
300  QDBeginCGContext(port, &context);
301  CGContextRetain(context);
302  CGContextSaveGState(context);
303 
304  // Flip context.
305  CGContextTranslateCTM(context, 0, widget->height());
306  CGContextScaleCTM(context, 1, -1);
307 
308  // Clip to region.
309  const QVector<QRect> &rects = rgn.rects();
310  for (int i = 0; i < rects.size(); ++i) {
311  const QRect &rect = rects.at(i);
312  CGContextAddRect(context, CGRectMake(rect.x(), rect.y(), rect.width(), rect.height()));
313  }
314  CGContextClip(context);
315 
316  QRect r = rgn.boundingRect().intersected(d->image->image.rect());
317  const CGRect area = CGRectMake(r.x(), r.y(), r.width(), r.height());
318  CGImageRef image = CGBitmapContextCreateImage(d->image->cg);
319  CGImageRef subImage = CGImageCreateWithImageInRect(image, area);
320 
321  qt_mac_drawCGImage(context, &area, subImage);
322 
323  CGImageRelease(subImage);
324  CGImageRelease(image);
325 
326  QDEndCGContext(port, &context);
327 
328  // Restore context.
329  CGContextRestoreGState(context);
330  CGContextRelease(context);
331 #endif // QT_MAC_USE_COCOA
332 
333 #endif // Q_WS_MAC
334 
335 #ifdef Q_OS_SYMBIAN
336  Q_UNUSED(widget);
337  Q_UNUSED(rgn);
338  Q_UNUSED(offset);
339 #endif
340 }
341 
343 {
346  d->inSetGeometry = true;
347  if (d->image == 0 || d->image->width() < rect.width() || d->image->height() < rect.height()) {
348 #if (defined(Q_WS_X11) && !defined(QT_NO_XRENDER)) || (defined(Q_WS_WIN) && !defined(Q_WS_WINCE))
349 #ifndef Q_WS_WIN
351 #else
353 #endif
355  else
356 #endif
358  }
359  d->inSetGeometry = false;
360 
361 #if defined(Q_WS_MAC) && defined(QT_MAC_USE_COCOA)
362  QMainWindow* mWindow = qobject_cast<QMainWindow*>(window());
363  if (mWindow) {
364  QMainWindowLayout *mLayout = qobject_cast<QMainWindowLayout*>(mWindow->layout());
365  QList<QToolBar *> toolbarList = mLayout->qtoolbarsInUnifiedToolbarList;
366 
367  for (int i = 0; i < toolbarList.size(); ++i) {
368  QToolBar* toolbar = toolbarList.at(i);
369  if (mLayout->toolBarArea(toolbar) == Qt::TopToolBarArea) {
370  QWidget* tbWidget = (QWidget*) toolbar;
371  if (tbWidget->d_func()->unifiedSurface) {
372  tbWidget->d_func()->unifiedSurface->setGeometry(rect);
373  }
374  }
375  }
376  }
377 #endif // Q_WS_MAC && QT_MAC_USE_COCOA
378 
379 }
380 
381 // from qwindowsurface.cpp
382 extern void qt_scrollRectInImage(QImage &img, const QRect &rect, const QPoint &offset);
383 
384 bool QRasterWindowSurface::scroll(const QRegion &area, int dx, int dy)
385 {
386 #ifdef Q_WS_WIN
388 
389  if (!d->image || !d->image->hdc)
390  return false;
391 
392  QRect rect = area.boundingRect();
393  BitBlt(d->image->hdc, rect.x()+dx, rect.y()+dy, rect.width(), rect.height(),
394  d->image->hdc, rect.x(), rect.y(), SRCCOPY);
395 
396  return true;
397 #else
399 
400  if (!d->image || d->image->image.isNull())
401  return false;
402 
403 #if defined(Q_WS_X11) && !defined(QT_NO_MITSHM)
404  syncX();
405 #endif
406 
407  const QVector<QRect> rects = area.rects();
408  for (int i = 0; i < rects.size(); ++i)
409  qt_scrollRectInImage(d->image->image, rects.at(i), QPoint(dx, dy));
410 
411  return true;
412 #endif
413 }
414 
415 QWindowSurface::WindowSurfaceFeatures QRasterWindowSurface::features() const
416 {
418 }
419 
421 {
423 
424  int width = window()->width();
425  int height = window()->height();
426  if (d->image) {
427  width = qMax(d->image->width(), width);
428  height = qMax(d->image->height(), height);
429  }
430 
431  if (width == 0 || height == 0) {
432  delete d->image;
433  d->image = 0;
434  return;
435  }
436 
437  QNativeImage *oldImage = d->image;
438 
439  d->image = new QNativeImage(width, height, format, false, widget);
440 
441  if (oldImage && d->inSetGeometry && hasStaticContents()) {
442  // Make sure we use the const version of bits() (no detach).
443  const uchar *src = const_cast<const QImage &>(oldImage->image).bits();
444  uchar *dst = d->image->image.bits();
445 
446  const int srcBytesPerLine = oldImage->image.bytesPerLine();
447  const int dstBytesPerLine = d->image->image.bytesPerLine();
448  const int bytesPerPixel = oldImage->image.depth() >> 3;
449 
450  QRegion staticRegion(staticContents());
451  // Make sure we're inside the boundaries of the old image.
452  staticRegion &= QRect(0, 0, oldImage->image.width(), oldImage->image.height());
453  const QVector<QRect> &rects = staticRegion.rects();
454  const QRect *srcRect = rects.constData();
455 
456  // Copy the static content of the old image into the new one.
457  int numRectsLeft = rects.size();
458  do {
459  const int bytesOffset = srcRect->x() * bytesPerPixel;
460  const int dy = srcRect->y();
461 
462  // Adjust src and dst to point to the right offset.
463  const uchar *s = src + dy * srcBytesPerLine + bytesOffset;
464  uchar *d = dst + dy * dstBytesPerLine + bytesOffset;
465  const int numBytes = srcRect->width() * bytesPerPixel;
466 
467  int numScanLinesLeft = srcRect->height();
468  do {
469  ::memcpy(d, s, numBytes);
470  d += dstBytesPerLine;
471  s += srcBytesPerLine;
472  } while (--numScanLinesLeft);
473 
474  ++srcRect;
475  } while (--numRectsLeft);
476  }
477 
478  delete oldImage;
479 }
480 
481 #ifdef QT_MAC_USE_COCOA
482 CGContextRef QRasterWindowSurface::imageContext()
483 {
485  return d->image->cg;
486 }
487 #endif // QT_MAC_USE_COCOA
488 
T qobject_cast(QObject *object)
Definition: qobject.h:375
The QPainter class performs low-level painting on widgets and other paint devices.
Definition: qpainter.h:86
The QColor class provides colors based on RGB, HSV or CMYK values.
Definition: qcolor.h:67
double d
Definition: qnumeric_p.h:62
int depth() const
Returns the color depth (bits per pixel) of the X display.
Format
The following image formats are available in Qt.
Definition: qimage.h:91
Qt::ToolBarArea toolBarArea(QToolBar *toolbar) const
Q_CORE_EXPORT QByteArray qgetenv(const char *varName)
double windowOpacity
The level of opacity for the window.
Definition: qwidget.h:201
PtrUpdateLayeredWindowIndirect ptrUpdateLayeredWindowIndirect
static mach_timebase_info_data_t info
#define QT_END_NAMESPACE
This macro expands to.
Definition: qglobal.h:90
QPointer< QWidget > widget
#define BYTE
int width
the width of the widget excluding any window frame
Definition: qwidget.h:166
QRect rect(const QWidget *widget) const
Returns the rectangle for widget in the coordinates of this window surface.
#define it(className, varName)
void releaseDC(HDC) const
Releases the HDC hdc acquired by a previous call to getDC().
Definition: qwidget.cpp:11862
void qt_scrollRectInImage(QImage &img, const QRect &rect, const QPoint &offset)
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
QRect frameGeometry
geometry of the widget relative to its parent including any window frame
Definition: qwidget.h:159
const QX11Info & x11Info() const
Returns information about the configuration of the X display used to display the widget.
void setGeometry(const QRect &rect)
Sets the currently allocated area to be the given rect.
static int bytesPerPixel(QImage::Format format)
QRect translated(int dx, int dy) const
Returns a copy of the rectangle that is translated dx along the x axis and dy along the y axis...
Definition: qrect.h:328
virtual void setGeometry(const QRect &rect)
Sets the currently allocated area to be the given rect.
int width() const
Returns the width of the rectangle.
Definition: qrect.h:303
Q_GUI_EXPORT void * qt_getClipRects(const QRegion &r, int &num)
void prepareBuffer(QImage::Format format, QWidget *widget)
struct CGImage * CGImageRef
virtual QPoint offset(const QWidget *widget) const
Returns the offset of widget in the coordinates of this window surface.
Qt::HANDLE handle() const
Returns the pixmap&#39;s handle to the device context.
Definition: qpixmap.cpp:1299
int bytesPerLine() const
Returns the number of bytes per image scanline.
Definition: qimage.cpp:1812
static QImage::Format systemFormat()
QRect intersected(const QRect &other) const
Returns the intersection of this rectangle and the given rectangle.
Definition: qrect.h:481
QRect boundingRect() const
Returns the bounding rectangle of this region.
Definition: qregion.cpp:4363
void setGeometry(int x, int y, int w, int h)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: qwidget.h:1017
int height() const
Returns the height of the rectangle.
Definition: qrect.h:306
QRect rect() const
Returns the enclosing rectangle (0, 0, width(), height()) of the image.
Definition: qimage.cpp:1603
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
#define X11
Definition: qt_x11_p.h:724
#define Q_D(Class)
Definition: qglobal.h:2482
#define Q_AC_SRC_ALPHA
#define SIZE(large, small, mini)
NSToolbar * toolbar
int rectCount() const
Returns the number of rectangles that will be returned in rects().
Definition: qregion.cpp:4461
Format format() const
Returns the format of the image.
Definition: qimage.cpp:2305
Q_DECL_CONSTEXPR const T & qMax(const T &a, const T &b)
Definition: qglobal.h:1217
iterator end()
Returns an STL-style iterator pointing to the imaginary item after the last item in the vector...
Definition: qvector.h:250
OSWindowRef qt_mac_window_for(const QWidget *)
Definition: qwidget_mac.mm:484
unsigned char uchar
Definition: qglobal.h:994
NSWindow * window
#define QT_BEGIN_NAMESPACE
This macro expands to.
Definition: qglobal.h:89
bool hasStaticContents() const
int height
the height of the widget excluding any window frame
Definition: qwidget.h:167
bool testAttribute(Qt::WidgetAttribute) const
Returns true if attribute attribute is set on this widget; otherwise returns false.
Definition: qwidget.h:1041
QScopedPointer< QRasterWindowSurfacePrivate > d_ptr
The Rectangle item provides a filled rectangle with an optional border.
QRect frameStrut() const
Definition: qwidget.cpp:12607
The QToolBar class provides a movable panel that contains a set of controls.
Definition: qtoolbar.h:62
QSize size() const
Returns the size of the rectangle.
Definition: qrect.h:309
void flush(QWidget *widget, const QRegion &region, const QPoint &offset)
Flushes the given region from the specified widget onto the screen.
bool isNull() const
Returns true if both the x and y coordinates are set to 0, otherwise returns false.
Definition: qpoint.h:125
The QImage class provides a hardware-independent image representation that allows direct access to th...
Definition: qimage.h:87
static const char * data(const QByteArray &arr)
unsigned int uint
Definition: qglobal.h:996
QList< QToolBar * > qtoolbarsInUnifiedToolbarList
bool scroll(const QRegion &area, int dx, int dy)
Scrolls the given area dx pixels to the right and dy downward; both dx and dy may be negative...
The QRegion class specifies a clip region for a painter.
Definition: qregion.h:68
QRasterWindowSurface(QWidget *widget, bool setDefaultSurface=true)
int depth() const
Returns the depth of the image.
Definition: qimage.cpp:1620
QRect wrect
Definition: qwidget.h:145
void * visual() const
Returns the current visual.
Q_GUI_EXPORT HDC qt_win_display_dc()
The QWindowSurface class provides the drawing area for top-level windows.
QRegion staticContents() const
const T & at(int i) const
Returns the item at index position i in the vector.
Definition: qvector.h:350
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)
struct CGRect CGRect
struct _XDisplay Display
Definition: qwindowdefs.h:115
int width() const
Returns the width of the image.
Definition: qimage.cpp:1557
WindowSurfaceFeatures features() const
void setCompositionMode(CompositionMode mode)
Sets the composition mode to the given mode.
Definition: qpainter.cpp:2422
iterator begin()
Returns an STL-style iterator pointing to the first item in the vector.
Definition: qvector.h:247
QRect rect
the internal geometry of the widget excluding any window frame
Definition: qwidget.h:168
int y() const
Returns the y-coordinate of the rectangle&#39;s top edge.
Definition: qrect.h:255
void beginPaint(const QRegion &rgn)
This function is called before painting onto the surface begins, with the region in which the paintin...
int x() const
Returns the x-coordinate of the rectangle&#39;s left edge.
Definition: qrect.h:252
QPaintDevice * paintDevice()
Implement this function to return the appropriate paint device.
The QPoint class defines a point in the plane using integer precision.
Definition: qpoint.h:53
QVector< QRect > rects() const
Returns an array of non-overlapping rectangles that make up the region.
Definition: qregion.cpp:4412
The QMainWindow class provides a main application window.
Definition: qmainwindow.h:63
OSStatus qt_mac_drawCGImage(CGContextRef inContext, const CGRect *inBounds, CGImageRef inImage)
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58
int height() const
Returns the height of the image.
Definition: qimage.cpp:1572
int y() const
Returns the y coordinate of this point.
Definition: qpoint.h:131
QWidget * window() const
Returns the window for this widget, i.e.
Definition: qwidget.cpp:4492
The QPixmap class is an off-screen image representation that can be used as a paint device...
Definition: qpixmap.h:71
#define Q_ULW_ALPHA
struct _XGC * GC
Definition: qwindowdefs.h:117
QLayout * layout() const
Returns the layout manager that is installed on this widget, or 0 if no layout manager is installed...
Definition: qwidget.cpp:10073
HDC getDC() const
Returns the window system handle of the widget, for low-level access.
Definition: qwidget.cpp:11849
bool isEmpty() const
Returns true if the byte array has size 0; otherwise returns false.
Definition: qbytearray.h:421
int x() const
Returns the x coordinate of this point.
Definition: qpoint.h:128
struct CGContext * CGContextRef
Q_GUI_EXPORT QWidgetPrivate * qt_widget_private(QWidget *widget)
Definition: qwidget.cpp:12920
Q_GUI_EXPORT QWidgetData * qt_qwidget_data(QWidget *widget)
Definition: qwidget.cpp:12915
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
Definition: qglobal.h:1729
int size() const
Returns the number of items in the vector.
Definition: qvector.h:137
QWidget * window() const
Returns a pointer to the top-level window associated with this surface.
uchar * scanLine(int)
Returns a pointer to the pixel data at the scanline with index i.
Definition: qimage.cpp:1886
void fillRect(const QRectF &, const QBrush &)
Fills the given rectangle with the brush specified.
Definition: qpainter.cpp:7420
The QList class is a template class that provides lists.
Definition: qdatastream.h:62
static int area(const QSize &s)
Definition: qicon.cpp:155
QPoint topLeft() const
Returns the position of the rectangle&#39;s top-left corner.
Definition: qrect.h:288