Changeset 561 for trunk/src/gui/painting/qwindowsurface_raster.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/qwindowsurface_raster.cpp
r437 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 ** … … 44 44 #include <qglobal.h> // for Q_WS_WIN define (non-PCH) 45 45 #ifdef Q_WS_WIN 46 #include <qlibrary.h> 46 47 #include <qt_windows.h> 47 48 #endif … … 80 81 QT_BEGIN_NAMESPACE 81 82 82 #ifdef Q_WS_WIN83 PtrUpdateLayeredWindowIndirect ptrUpdateLayeredWindowIndirect;84 #endif85 86 83 #if defined(Q_WS_PM) && defined(QT_LOG_BLITSPEED) 87 84 unsigned long long qt_total_blit_ms = 0; … … 99 96 uint translucentBackground : 1; 100 97 #endif 101 #endif102 #if defined(Q_WS_WIN) && !defined(Q_OS_WINCE)103 uint canUseLayeredWindow : 1;104 98 #endif 105 99 uint inSetGeometry : 1; … … 116 110 #endif 117 111 #endif 118 #if defined(Q_WS_WIN) && !defined(Q_OS_WINCE)119 d_ptr->canUseLayeredWindow = ptrUpdateLayeredWindowIndirect120 && (qt_widget_private(window)->data.window_flags & Qt::FramelessWindowHint);121 #endif122 112 d_ptr->image = 0; 123 113 d_ptr->inSetGeometry = false; … … 133 123 if (d_ptr->image) 134 124 delete d_ptr->image; 135 136 delete d_ptr;137 125 } 138 126 … … 145 133 void QRasterWindowSurface::beginPaint(const QRegion &rgn) 146 134 { 147 #if (defined(Q_WS_X11) && !defined(QT_NO_XRENDER)) || (defined(Q_WS_WIN) && !defined(Q_OS_WINCE)) 148 if (!qt_widget_private(window())->isOpaque) { 149 #if defined(Q_WS_WIN) && !defined(Q_OS_WINCE) 150 if (d_ptr->image->image.format() != QImage::Format_ARGB32_Premultiplied 151 && d_ptr->canUseLayeredWindow) 135 #if (defined(Q_WS_X11) && !defined(QT_NO_XRENDER)) || (defined(Q_WS_WIN) && !defined(Q_WS_WINCE)) 136 if (!qt_widget_private(window())->isOpaque && window()->testAttribute(Qt::WA_TranslucentBackground)) { 137 #if defined(Q_WS_WIN) && !defined(Q_WS_WINCE) 138 if (d_ptr->image->image.format() != QImage::Format_ARGB32_Premultiplied) 152 139 prepareBuffer(QImage::Format_ARGB32_Premultiplied, window()); 153 140 #endif … … 160 147 } 161 148 } 162 #endif 163 #if defined(Q_OS_WINCE) 149 #else 164 150 Q_UNUSED(rgn); 165 151 #endif … … 172 158 // Not ready for painting yet, bail out. This can happen in 173 159 // QWidget::create_sys() 174 if (!d->image )160 if (!d->image || rgn.rectCount() == 0) 175 161 return; 176 162 … … 178 164 QRect br = rgn.boundingRect(); 179 165 180 #ifndef Q_OS_WINCE 181 if (!qt_widget_private(window())->isOpaque && d->canUseLayeredWindow) { 166 #ifndef Q_WS_WINCE 167 if (!qt_widget_private(window())->isOpaque 168 && window()->testAttribute(Qt::WA_TranslucentBackground) 169 && (qt_widget_private(window())->data.window_flags & Qt::FramelessWindowHint)) 170 { 182 171 QRect r = window()->frameGeometry(); 183 172 QPoint frameOffset = qt_widget_private(window())->frameStrut().topLeft(); … … 187 176 POINT ptDst = {r.x(), r.y()}; 188 177 POINT ptSrc = {0, 0}; 189 Q_BLENDFUNCTION blend = {AC_SRC_OVER, 0, (int)(255.0 * window()->windowOpacity()), Q_AC_SRC_ALPHA};178 BLENDFUNCTION blend = {AC_SRC_OVER, 0, (int)(255.0 * window()->windowOpacity()), Q_AC_SRC_ALPHA}; 190 179 RECT dirty = {dirtyRect.x(), dirtyRect.y(), 191 180 dirtyRect.x() + dirtyRect.width(), dirtyRect.y() + dirtyRect.height()}; 192 181 Q_UPDATELAYEREDWINDOWINFO info = {sizeof(info), NULL, &ptDst, &size, d->image->hdc, &ptSrc, 0, &blend, Q_ULW_ALPHA, &dirty}; 193 194 (*ptrUpdateLayeredWindowIndirect)(window()->internalWinId(), &info); 182 ptrUpdateLayeredWindowIndirect(window()->internalWinId(), &info); 195 183 } else 196 184 #endif … … 395 383 QRect wbr = wrgn.boundingRect(); 396 384 397 int num; 398 XRectangle *rects = (XRectangle *)qt_getClipRects(wrgn, num); 399 XSetClipRectangles(X11->display, d_ptr->gc, 0, 0, rects, num, YXBanded); 385 if (wrgn.rectCount() != 1) { 386 int num; 387 XRectangle *rects = (XRectangle *)qt_getClipRects(wrgn, num); 388 XSetClipRectangles(X11->display, d_ptr->gc, 0, 0, rects, num, YXBanded); 389 } 400 390 401 391 QRect br = rgn.boundingRect().translated(offset); … … 405 395 br.x(), br.y(), br.width(), br.height(), wbr.x(), wbr.y()); 406 396 XSync(X11->display, False); 397 } else if (d_ptr->image->xshmimg) { 398 const QImage &src = d->image->image; 399 br = br.intersected(src.rect()); 400 XShmPutImage(X11->display, widget->handle(), d_ptr->gc, d_ptr->image->xshmimg, 401 br.x(), br.y(), wbr.x(), wbr.y(), br.width(), br.height(), False); 402 XSync(X11->display, False); 407 403 } else 408 404 #endif … … 410 406 const QImage &src = d->image->image; 411 407 br = br.intersected(src.rect()); 412 if (src.format() != QImage::Format_RGB32) { 408 if (src.format() != QImage::Format_RGB32 || widget->x11Info().depth() < 24) { 409 Q_ASSERT(src.depth() >= 16); 410 const QImage sub_src(src.scanLine(br.y()) + br.x() * (uint(src.depth()) / 8), 411 br.width(), br.height(), src.bytesPerLine(), src.format()); 413 412 QX11PixmapData *data = new QX11PixmapData(QPixmapData::PixmapType); 414 413 data->xinfo = widget->x11Info(); 415 data->fromImage(s rc, Qt::AutoColor);414 data->fromImage(sub_src, Qt::NoOpaqueDetection); 416 415 QPixmap pm = QPixmap(data); 417 XCopyArea(X11->display, pm.handle(), widget->handle(), d_ptr->gc, br.x() , br.y(), br.width(), br.height(), wbr.x(), wbr.y());416 XCopyArea(X11->display, pm.handle(), widget->handle(), d_ptr->gc, 0 , 0 , br.width(), br.height(), wbr.x(), wbr.y()); 418 417 } else { 419 418 // qpaintengine_x11.cpp … … 422 421 } 423 422 } 423 424 if (wrgn.rectCount() != 1) 425 XSetClipMask(X11->display, d_ptr->gc, XNone); 424 426 #endif // FALCON 425 427 … … 430 432 // d->image->image.save("flush.png"); 431 433 434 Q_UNUSED(offset); 432 435 // Get a context for the widget. 433 436 #ifndef QT_MAC_USE_COCOA … … 476 479 #endif 477 480 #endif 481 482 #ifdef Q_OS_SYMBIAN 483 Q_UNUSED(widget); 484 Q_UNUSED(rgn); 485 Q_UNUSED(offset); 486 #endif 478 487 } 479 488 … … 484 493 d->inSetGeometry = true; 485 494 if (d->image == 0 || d->image->width() < rect.width() || d->image->height() < rect.height()) { 486 #if (defined(Q_WS_X11) && !defined(QT_NO_XRENDER)) || (defined(Q_WS_WIN) && !defined(Q_ OS_WINCE))495 #if (defined(Q_WS_X11) && !defined(QT_NO_XRENDER)) || (defined(Q_WS_WIN) && !defined(Q_WS_WINCE)) 487 496 #ifndef Q_WS_WIN 488 497 if (d_ptr->translucentBackground) 489 498 #else 490 if (!qt_widget_private(window())->isOpaque && d->canUseLayeredWindow)499 if (!qt_widget_private(window())->isOpaque) 491 500 #endif 492 501 prepareBuffer(QImage::Format_ARGB32_Premultiplied, window());
Note:
See TracChangeset
for help on using the changeset viewer.