Changeset 561 for trunk/src/gui/painting/qpaintengine_x11.cpp
- Timestamp:
- Feb 11, 2010, 11:19:06 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
-
Property svn:mergeinfo
set to (toggle deleted branches)
/branches/vendor/nokia/qt/4.6.1 merged eligible /branches/vendor/nokia/qt/current merged eligible /branches/vendor/trolltech/qt/current 3-149
-
Property svn:mergeinfo
set to (toggle deleted branches)
-
trunk/src/gui/painting/qpaintengine_x11.cpp
r2 r561 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information (qt-info@nokia.com) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation (qt-info@nokia.com) 5 6 ** 6 7 ** This file is part of the QtGui module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 23 ** In addition, as a special exception, Nokia gives you certain 24 ** additional rights. These rights are described in the Nokia Qt LGPL 25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 ** package. 24 ** In addition, as a special exception, Nokia gives you certain additional 25 ** rights. These rights are described in the Nokia Qt LGPL Exception 26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you have questions regarding the use of this file, please contact 37 ** Nokia at qt-info@nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** … … 147 147 // hack, so we don't have to make QRegion::clipRectangles() public or include 148 148 // X11 headers in qregion.h 149 Q_ AUTOTEST_EXPORT void *qt_getClipRects(const QRegion &r, int &num)149 Q_GUI_EXPORT void *qt_getClipRects(const QRegion &r, int &num) 150 150 { 151 151 return r.clipRectangles(num); … … 272 272 if (size == allocated) { 273 273 allocated = qMax(2*allocated, 64); 274 traps = (XTrapezoid *)realloc(traps, allocated * sizeof(XTrapezoid));274 traps = q_check_ptr((XTrapezoid *)realloc(traps, allocated * sizeof(XTrapezoid))); 275 275 } 276 276 traps[size].top = Q27Dot5ToXFixed(trap.top); … … 483 483 } else if (pdev->devType() == QInternal::Pixmap) { 484 484 const QPixmap *pm = static_cast<const QPixmap *>(pdev); 485 QX11PixmapData *data = static_cast<QX11PixmapData*>(pm->data );485 QX11PixmapData *data = static_cast<QX11PixmapData*>(pm->data.data()); 486 486 if (X11->use_xrender && data->depth() != 32 && data->x11_mask) 487 487 data->convertToARGB32(); … … 1366 1366 attrs.repeat = true; 1367 1367 XRenderChangePicture(d->dpy, d->brush_pm.x11PictureHandle(), CPRepeat, &attrs); 1368 QX11PixmapData *data = static_cast<QX11PixmapData*>(d->brush_pm.data );1368 QX11PixmapData *data = static_cast<QX11PixmapData*>(d->brush_pm.data.data()); 1369 1369 if (data->mask_picture) 1370 1370 XRenderChangePicture(d->dpy, data->mask_picture, CPRepeat, &attrs); … … 1403 1403 #ifndef QT_NO_XRENDER 1404 1404 if (d->pdev_depth == 32 && d->brush_pm.depth() != 32) { 1405 QX11PixmapData *brushData = static_cast<QX11PixmapData*>(d->brush_pm.data); 1405 d->brush_pm.detach(); 1406 QX11PixmapData *brushData = static_cast<QX11PixmapData*>(d->brush_pm.data.data()); 1406 1407 brushData->convertToARGB32(); 1407 1408 } … … 1409 1410 vals.tile = (d->brush_pm.depth() == d->pdev_depth 1410 1411 ? d->brush_pm.handle() 1411 : static_cast<QX11PixmapData*>(d->brush_pm.data )->x11ConvertToDefaultDepth());1412 : static_cast<QX11PixmapData*>(d->brush_pm.data.data())->x11ConvertToDefaultDepth()); 1412 1413 s = FillTiled; 1413 1414 #if !defined(QT_NO_XRENDER) … … 1544 1545 QPaintEngine::PolygonDrawMode mode) 1545 1546 { 1547 Q_Q(QX11PaintEngine); 1548 1546 1549 int clippedCount = 0; 1547 1550 qt_float_point *clippedPoints = 0; … … 1618 1621 #endif 1619 1622 if (fill.style() != Qt::NoBrush) { 1620 if (clippedCount > 0) { 1623 if (clippedCount > 200000) { 1624 QPolygon poly; 1625 for (int i = 0; i < clippedCount; ++i) 1626 poly << QPoint(qFloor(clippedPoints[i].x), qFloor(clippedPoints[i].y)); 1627 1628 const QRect bounds = poly.boundingRect(); 1629 const QRect aligned = bounds 1630 & QRect(QPoint(), QSize(pdev->width(), pdev->height())); 1631 1632 QImage img(aligned.size(), QImage::Format_ARGB32_Premultiplied); 1633 img.fill(0); 1634 1635 QPainter painter(&img); 1636 painter.translate(-aligned.x(), -aligned.y()); 1637 painter.setPen(Qt::NoPen); 1638 painter.setBrush(fill); 1639 if (gcMode == BrushGC) 1640 painter.setBrushOrigin(q->painter()->brushOrigin()); 1641 painter.drawPolygon(poly); 1642 painter.end(); 1643 1644 q->drawImage(aligned, img, img.rect(), Qt::AutoColor); 1645 } else if (clippedCount > 0) { 1621 1646 QVarLengthArray<XPoint> xpoints(clippedCount); 1622 1647 for (int i = 0; i < clippedCount; ++i) { … … 1803 1828 1804 1829 QImage im; 1805 if ((QSysInfo::ByteOrder == QSysInfo::BigEndian 1806 && ((ImageByteOrder(X11->display) == LSBFirst) || bgr_layout)) 1807 || (ImageByteOrder(X11->display) == MSBFirst && QSysInfo::ByteOrder == QSysInfo::LittleEndian)) 1830 int image_byte_order = ImageByteOrder(X11->display); 1831 if ((QSysInfo::ByteOrder == QSysInfo::BigEndian && ((image_byte_order == LSBFirst) || bgr_layout)) 1832 || (image_byte_order == MSBFirst && QSysInfo::ByteOrder == QSysInfo::LittleEndian) 1833 || (image_byte_order == LSBFirst && bgr_layout)) 1808 1834 { 1809 1835 im = image.copy(rect); … … 1813 1839 uint *p = data; 1814 1840 uint *end = p + w; 1815 if (bgr_layout && ImageByteOrder(X11->display)== MSBFirst && QSysInfo::ByteOrder == QSysInfo::LittleEndian) {1841 if (bgr_layout && image_byte_order == MSBFirst && QSysInfo::ByteOrder == QSysInfo::LittleEndian) { 1816 1842 while (p < end) { 1817 1843 *p = ((*p << 8) & 0xffffff00) | ((*p >> 24) & 0x000000ff); 1818 1844 p++; 1819 1845 } 1820 } else if (( ImageByteOrder(X11->display)== LSBFirst && QSysInfo::ByteOrder == QSysInfo::BigEndian)1821 || ( ImageByteOrder(X11->display)== MSBFirst && QSysInfo::ByteOrder == QSysInfo::LittleEndian)) {1846 } else if ((image_byte_order == LSBFirst && QSysInfo::ByteOrder == QSysInfo::BigEndian) 1847 || (image_byte_order == MSBFirst && QSysInfo::ByteOrder == QSysInfo::LittleEndian)) { 1822 1848 while (p < end) { 1823 1849 *p = ((*p << 24) & 0xff000000) | ((*p << 8) & 0x00ff0000) … … 1825 1851 p++; 1826 1852 } 1827 } else if (ImageByteOrder(X11->display) == MSBFirst && QSysInfo::ByteOrder == QSysInfo::BigEndian) { 1853 } else if ((image_byte_order == MSBFirst && QSysInfo::ByteOrder == QSysInfo::BigEndian) 1854 || (image_byte_order == LSBFirst && bgr_layout)) 1855 { 1828 1856 while (p < end) { 1829 1857 *p = ((*p << 16) & 0x00ff0000) | ((*p >> 16) & 0x000000ff) … … 1889 1917 1890 1918 #ifndef QT_NO_XRENDER 1891 ::Picture src_pict = static_cast<QX11PixmapData*>(pixmap.data )->picture;1919 ::Picture src_pict = static_cast<QX11PixmapData*>(pixmap.data.data())->picture; 1892 1920 if (src_pict && d->picture) { 1893 1921 const int pDepth = pixmap.depth(); … … 1908 1936 bool restore_clip = false; 1909 1937 1910 if (static_cast<QX11PixmapData*>(pixmap.data )->x11_mask) { // pixmap has a mask1938 if (static_cast<QX11PixmapData*>(pixmap.data.data())->x11_mask) { // pixmap has a mask 1911 1939 QBitmap comb(sw, sh); 1912 1940 GC cgc = XCreateGC(d->dpy, comb.handle(), 0, 0); … … 1925 1953 XSetTSOrigin(d->dpy, cgc, -sx, -sy); 1926 1954 XSetStipple(d->dpy, cgc, 1927 static_cast<QX11PixmapData*>(pixmap.data )->x11_mask);1955 static_cast<QX11PixmapData*>(pixmap.data.data())->x11_mask); 1928 1956 XFillRectangle(d->dpy, comb.handle(), cgc, 0, 0, sw, sh); 1929 1957 XFreeGC(d->dpy, cgc); … … 1968 1996 if (d->pdev->devType() == QInternal::Pixmap) { 1969 1997 const QPixmap *px = static_cast<const QPixmap*>(d->pdev); 1970 Pixmap src_mask = static_cast<QX11PixmapData*>(pixmap.data )->x11_mask;1971 Pixmap dst_mask = static_cast<QX11PixmapData*>(px->data )->x11_mask;1998 Pixmap src_mask = static_cast<QX11PixmapData*>(pixmap.data.data())->x11_mask; 1999 Pixmap dst_mask = static_cast<QX11PixmapData*>(px->data.data())->x11_mask; 1972 2000 if (dst_mask) { 1973 2001 GC cgc = XCreateGC(d->dpy, dst_mask, 0, 0); … … 2188 2216 } else 2189 2217 #endif // !QT_NO_XRENDER 2190 if (pixmap.depth() > 1 && !static_cast<QX11PixmapData*>(pixmap.data )->x11_mask) {2218 if (pixmap.depth() > 1 && !static_cast<QX11PixmapData*>(pixmap.data.data())->x11_mask) { 2191 2219 XSetTile(d->dpy, d->gc, pixmap.handle()); 2192 2220 XSetFillStyle(d->dpy, d->gc, FillTiled); … … 2353 2381 const QColor &pen = d->cpen.color(); 2354 2382 ::Picture src = X11->getSolidFill(d->scrn, pen); 2355 XRenderPictFormat *maskFormat = XRenderFindStandardFormat(X11->display, ft->xglyph_format); 2383 XRenderPictFormat *maskFormat = 0; 2384 if (ft->xglyph_format != PictStandardA1) 2385 maskFormat = XRenderFindStandardFormat(X11->display, ft->xglyph_format); 2356 2386 2357 2387 enum { t_min = SHRT_MIN, t_max = SHRT_MAX }; … … 2431 2461 int num_rects = 0; 2432 2462 2463 QPoint delta(qRound(d->matrix.dx()), qRound(d->matrix.dy())); 2464 QRect clip(d->polygonClipper.boundingRect()); 2433 2465 for (int i=0; i < path.elementCount(); i+=5) { 2434 2466 int x = qRound(path.elementAt(i).x); … … 2436 2468 int w = qRound(path.elementAt(i+1).x) - x; 2437 2469 int h = qRound(path.elementAt(i+2).y) - y; 2438 rects[num_rects].x = x + qRound(d->matrix.dx()); 2439 rects[num_rects].y = y + qRound(d->matrix.dy()); 2440 rects[num_rects].width = w; 2441 rects[num_rects].height = h; 2470 2471 QRect rect = QRect(x + delta.x(), y + delta.y(), w, h); 2472 rect = rect.intersected(clip); 2473 if (rect.isEmpty()) 2474 continue; 2475 2476 rects[num_rects].x = short(rect.x()); 2477 rects[num_rects].y = short(rect.y()); 2478 rects[num_rects].width = ushort(rect.width()); 2479 rects[num_rects].height = ushort(rect.height()); 2442 2480 ++num_rects; 2443 2481 if (num_rects == rectcount) {
Note:
See TracChangeset
for help on using the changeset viewer.