src/gui/painting/qwindowsurface_raster.cpp
changeset 3 41300fa6a67c
parent 0 1918ee327afb
child 4 3b1da2848fc7
equal deleted inserted replaced
2:56cd8111b7f7 3:41300fa6a67c
   138 {
   138 {
   139     Q_D(QRasterWindowSurface);
   139     Q_D(QRasterWindowSurface);
   140 
   140 
   141     // Not ready for painting yet, bail out. This can happen in
   141     // Not ready for painting yet, bail out. This can happen in
   142     // QWidget::create_sys()
   142     // QWidget::create_sys()
   143     if (!d->image || rgn.numRects() == 0)
   143     if (!d->image || rgn.rectCount() == 0)
   144         return;
   144         return;
   145 
   145 
   146 #ifdef Q_WS_WIN
   146 #ifdef Q_WS_WIN
   147     QRect br = rgn.boundingRect();
   147     QRect br = rgn.boundingRect();
   148 
   148 
   201     QRegion wrgn(rgn);
   201     QRegion wrgn(rgn);
   202     if (!wOffset.isNull())
   202     if (!wOffset.isNull())
   203         wrgn.translate(-wOffset);
   203         wrgn.translate(-wOffset);
   204     QRect wbr = wrgn.boundingRect();
   204     QRect wbr = wrgn.boundingRect();
   205 
   205 
   206     if (wrgn.numRects() != 1) {
   206     if (wrgn.rectCount() != 1) {
   207         int num;
   207         int num;
   208         XRectangle *rects = (XRectangle *)qt_getClipRects(wrgn, num);
   208         XRectangle *rects = (XRectangle *)qt_getClipRects(wrgn, num);
   209         XSetClipRectangles(X11->display, d_ptr->gc, 0, 0, rects, num, YXBanded);
   209         XSetClipRectangles(X11->display, d_ptr->gc, 0, 0, rects, num, YXBanded);
   210     }
   210     }
   211 
   211 
   212     QRect br = rgn.boundingRect().translated(offset);
   212     QRect br = rgn.boundingRect().translated(offset);
   213 #ifndef QT_NO_MITSHM
   213 #ifndef QT_NO_MITSHM
   214     if (d_ptr->image->xshmpm) {
   214     if (d_ptr->image->xshmpm) {
   215         XCopyArea(X11->display, d_ptr->image->xshmpm, widget->handle(), d_ptr->gc,
   215         XCopyArea(X11->display, d_ptr->image->xshmpm, widget->handle(), d_ptr->gc,
   216                   br.x(), br.y(), br.width(), br.height(), wbr.x(), wbr.y());
   216                   br.x(), br.y(), br.width(), br.height(), wbr.x(), wbr.y());
       
   217         XSync(X11->display, False);
       
   218     } else if (d_ptr->image->xshmimg) {
       
   219         const QImage &src = d->image->image;
       
   220         br = br.intersected(src.rect());
       
   221         XShmPutImage(X11->display, widget->handle(), d_ptr->gc, d_ptr->image->xshmimg,
       
   222                      br.x(), br.y(), wbr.x(), wbr.y(), br.width(), br.height(), False);
   217         XSync(X11->display, False);
   223         XSync(X11->display, False);
   218     } else
   224     } else
   219 #endif
   225 #endif
   220     {
   226     {
   221         const QImage &src = d->image->image;
   227         const QImage &src = d->image->image;
   234             extern void qt_x11_drawImage(const QRect &rect, const QPoint &pos, const QImage &image, Drawable hd, GC gc, Display *dpy, Visual *visual, int depth);
   240             extern void qt_x11_drawImage(const QRect &rect, const QPoint &pos, const QImage &image, Drawable hd, GC gc, Display *dpy, Visual *visual, int depth);
   235             qt_x11_drawImage(br, wbr.topLeft(), src, widget->handle(), d_ptr->gc, X11->display, (Visual *)widget->x11Info().visual(), widget->x11Info().depth());
   241             qt_x11_drawImage(br, wbr.topLeft(), src, widget->handle(), d_ptr->gc, X11->display, (Visual *)widget->x11Info().visual(), widget->x11Info().depth());
   236         }
   242         }
   237     }
   243     }
   238 
   244 
   239     if (wrgn.numRects() != 1)
   245     if (wrgn.rectCount() != 1)
   240         XSetClipMask(X11->display, d_ptr->gc, XNone);
   246         XSetClipMask(X11->display, d_ptr->gc, XNone);
   241 #endif // FALCON
   247 #endif // FALCON
   242 
   248 
   243 #ifdef Q_WS_MAC
   249 #ifdef Q_WS_MAC
   244 
   250