diff options
author | Rohan McGovern <rohan.mcgovern@nokia.com> | 2009-04-22 23:18:24 (GMT) |
---|---|---|
committer | Rohan McGovern <rohan.mcgovern@nokia.com> | 2009-04-22 23:18:24 (GMT) |
commit | 5d695c4442107fb5a3fbd37acdaa1f5d1d3ca06f (patch) | |
tree | 6d6720837e14be7e65da4d8a08d44e6fea5a55cc /src | |
parent | 7fa8e95d1b87403aab14dd326520600bc028a195 (diff) | |
parent | d64d13102d3d53d0aa43597408d7abf3fecb57a3 (diff) | |
download | Qt-5d695c4442107fb5a3fbd37acdaa1f5d1d3ca06f.zip Qt-5d695c4442107fb5a3fbd37acdaa1f5d1d3ca06f.tar.gz Qt-5d695c4442107fb5a3fbd37acdaa1f5d1d3ca06f.tar.bz2 |
Merge branch '4.5' of git@scm.dev.nokia.troll.no:qt/qt into 4.5
Diffstat (limited to 'src')
-rw-r--r-- | src/corelib/global/qfeatures.h | 54 | ||||
-rw-r--r-- | src/corelib/kernel/qcoreevent.cpp | 1 | ||||
-rw-r--r-- | src/gui/dialogs/qsidebar.cpp | 4 | ||||
-rw-r--r-- | src/gui/embedded/qscreentransformed_qws.cpp | 4 | ||||
-rw-r--r-- | src/gui/kernel/qapplication.cpp | 7 | ||||
-rw-r--r-- | src/gui/painting/qmemrotate.cpp | 1 | ||||
-rw-r--r-- | src/gui/painting/qmemrotate_p.h | 1 | ||||
-rw-r--r-- | src/gui/painting/qpainter.cpp | 6 | ||||
-rw-r--r-- | src/gui/painting/qprintengine_win.cpp | 2 | ||||
-rw-r--r-- | src/gui/painting/qtransform.cpp | 4 | ||||
-rw-r--r-- | src/gui/styles/gtksymbols.cpp | 4 | ||||
-rw-r--r-- | src/gui/styles/qgtkstyle.cpp | 5 | ||||
-rw-r--r-- | src/opengl/qwindowsurface_gl.cpp | 2 | ||||
-rw-r--r-- | src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.cpp | 19 | ||||
-rw-r--r-- | src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp | 26 | ||||
-rw-r--r-- | src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp | 83 | ||||
-rw-r--r-- | src/plugins/gfxdrivers/directfb/qdirectfbscreen.h | 2 |
17 files changed, 125 insertions, 100 deletions
diff --git a/src/corelib/global/qfeatures.h b/src/corelib/global/qfeatures.h index 6d55f7c..2189723 100644 --- a/src/corelib/global/qfeatures.h +++ b/src/corelib/global/qfeatures.h @@ -120,6 +120,9 @@ // QMovie //#define QT_NO_MOVIE +// QNetworkInterface +//#define QT_NO_NETWORKINTERFACE + // QNetworkProxy //#define QT_NO_NETWORKPROXY @@ -198,12 +201,12 @@ // Qt Prerendered Font Format //#define QT_NO_QWS_QPF -// Raster Paint Engine callback functions -//#define QT_NO_RASTERCALLBACKS - // Qt Prerendered Font Format 2 //#define QT_NO_QWS_QPF2 +// Raster Paint Engine callback functions +//#define QT_NO_RASTERCALLBACKS + // Resize Handler //#define QT_NO_RESIZEHANDLER @@ -273,9 +276,6 @@ // HtmlParser //#define QT_NO_TEXTHTMLPARSER -// OdfWriter -//#define QT_NO_TEXTODFWRITER - // QTextStream //#define QT_NO_TEXTSTREAM @@ -316,6 +316,11 @@ #define QT_NO_BUTTONGROUP #endif +// QClipboard +#if !defined(QT_NO_CLIPBOARD) && (defined(QT_NO_QWS_PROPERTIES)) +#define QT_NO_CLIPBOARD +#endif + // Codecs #if !defined(QT_NO_CODECS) && (defined(QT_NO_TEXTCODEC)) #define QT_NO_CODECS @@ -376,11 +381,6 @@ #define QT_NO_PHONON_VOLUMESLIDER #endif -// QPrinter -#if !defined(QT_NO_PRINTER) && (defined(QT_NO_TEXTSTREAM)) -#define QT_NO_PRINTER -#endif - // QProcess #if !defined(QT_NO_PROCESS) && (defined(QT_NO_THREAD)) #define QT_NO_PROCESS @@ -481,11 +481,6 @@ #define QT_NO_XMLSTREAMWRITER #endif -// Odf Writer -#if !defined(QT_NO_TEXTODFWRITER) && (defined(QT_NO_XMLSTREAMWRITER)) -#define QT_NO_TEXTODFWRITER -#endif - // Context menu #if !defined(QT_NO_CONTEXTMENU) && (defined(QT_NO_MENU)) #define QT_NO_CONTEXTMENU @@ -511,11 +506,21 @@ #define QT_NO_LIBRARY #endif +// QPrinter +#if !defined(QT_NO_PRINTER) && (defined(QT_NO_TEXTSTREAM) || defined(QT_NO_PICTURE)) +#define QT_NO_PRINTER +#endif + // QScrollArea #if !defined(QT_NO_SCROLLAREA) && (defined(QT_NO_SCROLLBAR)) #define QT_NO_SCROLLAREA #endif +// OdfWriter +#if !defined(QT_NO_TEXTODFWRITER) && (defined(QT_NO_XMLSTREAMWRITER)) +#define QT_NO_TEXTODFWRITER +#endif + // QToolButton #if !defined(QT_NO_TOOLBUTTON) && (defined(QT_NO_ICON) || defined(QT_NO_ACTION)) #define QT_NO_TOOLBUTTON @@ -636,16 +641,6 @@ #define QT_NO_WHATSTHIS #endif -// QClipboard -#if !defined(QT_NO_CLIPBOARD) && (defined(QT_NO_QWS_PROPERTIES)) -#define QT_NO_CLIPBOARD -#endif - -// Common UNIX Printing System -#if !defined(QT_NO_CUPS) && (defined(QT_NO_PRINTER) || defined(QT_NO_LIBRARY)) -#define QT_NO_CUPS -#endif - // QDirModel #if !defined(QT_NO_DIRMODEL) && (defined(QT_NO_ITEMVIEWS)) #define QT_NO_DIRMODEL @@ -726,6 +721,11 @@ #define QT_NO_COMPLETER #endif +// Common UNIX Printing System +#if !defined(QT_NO_CUPS) && (defined(QT_NO_PRINTER) || defined(QT_NO_LIBRARY)) +#define QT_NO_CUPS +#endif + // QDataWidgetMapper #if !defined(QT_NO_DATAWIDGETMAPPER) && (defined(QT_NO_ITEMVIEWS) || defined(QT_NO_PROPERTIES)) #define QT_NO_DATAWIDGETMAPPER @@ -757,7 +757,7 @@ #endif // QPrintPreviewWidget -#if !defined(QT_NO_PRINTPREVIEWWIDGET) && (defined(QT_NO_GRAPHICSVIEW) || defined(QT_NO_PRINTER) || defined(QT_NO_PICTURE)) +#if !defined(QT_NO_PRINTPREVIEWWIDGET) && (defined(QT_NO_GRAPHICSVIEW) || defined(QT_NO_PRINTER)) #define QT_NO_PRINTPREVIEWWIDGET #endif diff --git a/src/corelib/kernel/qcoreevent.cpp b/src/corelib/kernel/qcoreevent.cpp index 3fcfc98..11a2d3c 100644 --- a/src/corelib/kernel/qcoreevent.cpp +++ b/src/corelib/kernel/qcoreevent.cpp @@ -260,6 +260,7 @@ QT_BEGIN_NAMESPACE \omitvalue ApplicationActivated \omitvalue ApplicationDeactivated \omitvalue MacGLWindowChange + \omitvalue MacGLClearDrawable \omitvalue NetworkReplyUpdated \omitvalue FutureCallOut \omitvalue CocoaRequestModal diff --git a/src/gui/dialogs/qsidebar.cpp b/src/gui/dialogs/qsidebar.cpp index bfdb37e..26108d7 100644 --- a/src/gui/dialogs/qsidebar.cpp +++ b/src/gui/dialogs/qsidebar.cpp @@ -248,7 +248,11 @@ void QUrlModel::addUrls(const QList<QUrl> &list, int row, bool move) if (!url.isValid() || url.scheme() != QLatin1String("file")) continue; for (int j = 0; move && j < rowCount(); ++j) { +#if defined(Q_OS_WIN) + if (index(j, 0).data(UrlRole).toUrl().toLocalFile().toLower() == url.toLocalFile().toLower()) { +#else if (index(j, 0).data(UrlRole) == url) { +#endif removeRow(j); if (j <= row) row--; diff --git a/src/gui/embedded/qscreentransformed_qws.cpp b/src/gui/embedded/qscreentransformed_qws.cpp index f988789..46ac1d1 100644 --- a/src/gui/embedded/qscreentransformed_qws.cpp +++ b/src/gui/embedded/qscreentransformed_qws.cpp @@ -410,7 +410,9 @@ void QTransformedScreen::blit(const QImage &image, const QPoint &topLeft, #endif #ifdef QT_QWS_DEPTH_8 case 8: - if (image.depth() == 16) + if (image.format() == QImage::Format_RGB444) + SET_BLIT_FUNC(quint8, qrgb444, trans, func); + else if (image.depth() == 16) SET_BLIT_FUNC(quint8, quint16, trans, func); else SET_BLIT_FUNC(quint8, quint32, trans, func); diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp index 09f0f91..d0b1790 100644 --- a/src/gui/kernel/qapplication.cpp +++ b/src/gui/kernel/qapplication.cpp @@ -832,12 +832,13 @@ QApplication::QApplication(Display *dpy, int &argc, char **argv, #endif // Q_WS_X11 +extern void qInitDrawhelperAsm(); /*! + \fn void QApplicationPrivate::initialize() + Initializes the QApplication object, called from the constructors. */ -extern void qInitDrawhelperAsm(); - void QApplicationPrivate::initialize() { QWidgetPrivate::mapper = new QWidgetMapper; @@ -2099,8 +2100,8 @@ void QApplicationPrivate::setFocusWidget(QWidget *focus, Qt::FocusReason reason) if (that) QApplication::sendEvent(that->style(), &in); } + emit qApp->focusChanged(prev, focus_widget); } - emit qApp->focusChanged(prev, focus_widget); } } diff --git a/src/gui/painting/qmemrotate.cpp b/src/gui/painting/qmemrotate.cpp index 7ad0e42..4058143 100644 --- a/src/gui/painting/qmemrotate.cpp +++ b/src/gui/painting/qmemrotate.cpp @@ -537,6 +537,7 @@ QT_IMPL_MEMROTATE(quint32, quint24) QT_IMPL_MEMROTATE(quint32, quint18) QT_IMPL_MEMROTATE(quint32, quint8) QT_IMPL_MEMROTATE(quint16, quint8) +QT_IMPL_MEMROTATE(qrgb444, quint8) QT_IMPL_MEMROTATE(quint8, quint8) #ifdef QT_QWS_DEPTH_GENERIC QT_IMPL_MEMROTATE(quint32, qrgb_generic16) diff --git a/src/gui/painting/qmemrotate_p.h b/src/gui/painting/qmemrotate_p.h index bd6006b..c1eb93e 100644 --- a/src/gui/painting/qmemrotate_p.h +++ b/src/gui/painting/qmemrotate_p.h @@ -90,6 +90,7 @@ QT_DECL_MEMROTATE(quint32, quint24); QT_DECL_MEMROTATE(quint32, quint18); QT_DECL_MEMROTATE(quint32, quint8); QT_DECL_MEMROTATE(quint16, quint8); +QT_DECL_MEMROTATE(qrgb444, quint8); QT_DECL_MEMROTATE(quint8, quint8); #ifdef QT_QWS_DEPTH_GENERIC QT_DECL_MEMROTATE(quint32, qrgb_generic16); diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp index ffb273e..65d87fa 100644 --- a/src/gui/painting/qpainter.cpp +++ b/src/gui/painting/qpainter.cpp @@ -5167,6 +5167,9 @@ void QPainter::drawPixmap(const QPointF &p, const QPixmap &pm) Q_D(QPainter); + if (!d->engine) + return; + #ifndef QT_NO_DEBUG qt_painter_thread_test(d->device->devType(), "drawPixmap()"); #endif @@ -5176,9 +5179,6 @@ void QPainter::drawPixmap(const QPointF &p, const QPixmap &pm) return; } - if (!d->engine) - return; - qreal x = p.x(); qreal y = p.y(); diff --git a/src/gui/painting/qprintengine_win.cpp b/src/gui/painting/qprintengine_win.cpp index c8674b7..7601beb 100644 --- a/src/gui/painting/qprintengine_win.cpp +++ b/src/gui/painting/qprintengine_win.cpp @@ -1532,7 +1532,7 @@ QVariant QWin32PrintEngine::property(PrintEnginePropertyKey key) const value = rect; } else { value = QTransform(1/d->stretch_x, 0, 0, 1/d->stretch_y, 0, 0) - .mapRect(d->fullPage ? d->devPaperRect : d->devPageRect); + .mapRect(d->fullPage ? d->devPhysicalPageRect : d->devPageRect); } break; diff --git a/src/gui/painting/qtransform.cpp b/src/gui/painting/qtransform.cpp index 39e429d..af27fd5 100644 --- a/src/gui/painting/qtransform.cpp +++ b/src/gui/painting/qtransform.cpp @@ -1880,7 +1880,7 @@ const QMatrix &QTransform::toAffine() const QTransform::TransformationType QTransform::type() const { if (m_dirty >= m_type) { - if (m_dirty > TxShear && (!qFuzzyCompare(m_13 + 1, 1) || !qFuzzyCompare(m_23 + 1, 1))) + if (m_dirty > TxShear && (!qFuzzyCompare(m_13 + 1, 1) || !qFuzzyCompare(m_23 + 1, 1) || !qFuzzyCompare(m_33, 1))) m_type = TxProject; else if (m_dirty > TxScale && (!qFuzzyCompare(affine._m12 + 1, 1) || !qFuzzyCompare(affine._m21 + 1, 1))) { const qreal dot = affine._m11 * affine._m12 + affine._m21 * affine._m22; @@ -1888,7 +1888,7 @@ QTransform::TransformationType QTransform::type() const m_type = TxRotate; else m_type = TxShear; - } else if (m_dirty > TxTranslate && (!qFuzzyCompare(affine._m11, 1) || !qFuzzyCompare(affine._m22, 1) || !qFuzzyCompare(m_33, 1))) + } else if (m_dirty > TxTranslate && (!qFuzzyCompare(affine._m11, 1) || !qFuzzyCompare(affine._m22, 1))) m_type = TxScale; else if (m_dirty > TxNone && (!qFuzzyCompare(affine._dx + 1, 1) || !qFuzzyCompare(affine._dy + 1, 1))) m_type = TxTranslate; diff --git a/src/gui/styles/gtksymbols.cpp b/src/gui/styles/gtksymbols.cpp index acb8437..0842ec7 100644 --- a/src/gui/styles/gtksymbols.cpp +++ b/src/gui/styles/gtksymbols.cpp @@ -746,9 +746,9 @@ static void setupGtkFileChooser(GtkWidget* gtkFileChooser, QWidget *parent, foreach (const QString &rawfilter, filters) { GtkFileFilter *gtkFilter = QGtk::gtk_file_filter_new (); QString name = rawfilter.left(rawfilter.indexOf(QLatin1Char('('))); - QGtk::gtk_file_filter_set_name(gtkFilter, qPrintable(name)); - QStringList extensions = extract_filter(rawfilter); + QGtk::gtk_file_filter_set_name(gtkFilter, qPrintable(name.isEmpty() ? extensions.join(QLS(", ")) : name)); + foreach (const QString &fileExtension, extensions) { QGtk::gtk_file_filter_add_pattern (gtkFilter, qPrintable(fileExtension)); } diff --git a/src/gui/styles/qgtkstyle.cpp b/src/gui/styles/qgtkstyle.cpp index b7fa575..ca71da2 100644 --- a/src/gui/styles/qgtkstyle.cpp +++ b/src/gui/styles/qgtkstyle.cpp @@ -951,14 +951,15 @@ void QGtkStyle::drawPrimitive(PrimitiveElement element, "interior-focus", &interior_focus, "focus-line-width", &focus_line_width, NULL); + // See https://bugzilla.mozilla.org/show_bug.cgi?id=405421 for info about this hack + g_object_set_data(G_OBJECT(gtkEntry), "transparent-bg-hint", GINT_TO_POINTER(TRUE)); + if (!interior_focus && option->state & State_HasFocus) rect.adjust(focus_line_width, focus_line_width, -focus_line_width, -focus_line_width); - gtkPainter.paintShadow(gtkEntry, "entry", rect, option->state & State_Enabled ? GTK_STATE_NORMAL : GTK_STATE_INSENSITIVE, GTK_SHADOW_IN, gtkEntry->style, option->state & State_HasFocus ? QLS("focus") : QString()); - if (!interior_focus && option->state & State_HasFocus) gtkPainter.paintShadow(gtkEntry, "entry", option->rect, option->state & State_Enabled ? GTK_STATE_ACTIVE : GTK_STATE_INSENSITIVE, diff --git a/src/opengl/qwindowsurface_gl.cpp b/src/opengl/qwindowsurface_gl.cpp index 837ccf2..b41adf9 100644 --- a/src/opengl/qwindowsurface_gl.cpp +++ b/src/opengl/qwindowsurface_gl.cpp @@ -86,7 +86,7 @@ QT_BEGIN_NAMESPACE // QGLGraphicsSystem // #ifdef Q_WS_WIN -Q_GUI_EXPORT bool qt_win_owndc_required; +extern Q_GUI_EXPORT bool qt_win_owndc_required; #endif QGLGraphicsSystem::QGLGraphicsSystem() : QGraphicsSystem() diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.cpp index 2a2ef5c..924090c 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.cpp @@ -56,23 +56,16 @@ IDirectFBSurface *QDirectFBPaintDevice::directFBSurface() const } -// Locks the dfb surface and creates a QImage (lockedImage) from the pointer -void QDirectFBPaintDevice::lockDirectFB() { - +void QDirectFBPaintDevice::lockDirectFB() +{ if (lockedImage) return; // Already locked - void *mem; - int w, h; - DFBResult result = dfbSurface->Lock(dfbSurface, DSLF_WRITE, &mem, &bpl); - if (result != DFB_OK || !mem) { - DirectFBError("QDirectFBPixmapData::buffer()", result); - return; + if (uchar *mem = QDirectFBScreen::lockSurface(dfbSurface, DSLF_WRITE, &bpl)) { + const QSize s = size(); + lockedImage = new QImage(mem, s.width(), s.height(), bpl, + QDirectFBScreen::getImageFormat(dfbSurface)); } - - dfbSurface->GetSize(dfbSurface, &w, &h); - lockedImage = new QImage(static_cast<uchar*>(mem), w, h, bpl, - QDirectFBScreen::getImageFormat(dfbSurface)); } diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp index 0a1696a..ea9bb3a 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp @@ -157,10 +157,13 @@ static bool checkForAlphaPixels(const QImage &img) return false; } -void QDirectFBPixmapData::fromImage(const QImage &img, +void QDirectFBPixmapData::fromImage(const QImage &i, Qt::ImageConversionFlags flags) { - Q_ASSERT(img.depth() != 1); // these should be handled by QRasterPixmapData +#ifdef QT_NO_DIRECTFB_OPAQUE_DETECTION + Q_UNUSED(flags); +#endif + const QImage img = (i.depth() == 1 ? i.convertToFormat(screen->alphaPixmapFormat()) : i); if (img.hasAlphaChannel() #ifndef QT_NO_DIRECTFB_OPAQUE_DETECTION && (flags & Qt::NoOpaqueDetection || ::checkForAlphaPixels(img)) @@ -267,16 +270,17 @@ void QDirectFBPixmapData::fill(const QColor &color) if (forceRaster) { // in DSPF_RGB32 all dfb drawing causes the Alpha byte to be // set to 0. This causes issues for the raster engine. - char *mem; - int bpl; - const int h = QPixmapData::height(); - dfbSurface->Lock(dfbSurface, DSLF_WRITE, (void**)&mem, &bpl); - const int c = color.rgba(); - for (int i = 0; i < h; ++i) { - memset(mem, c, bpl); - mem += bpl; + uchar *mem = QDirectFBScreen::lockSurface(dfbSurface, DSLF_WRITE, &bpl); + if (mem) { + const int h = QPixmapData::height(); + const int w = QPixmapData::width() * 4; // 4 bytes per 32 bit pixel + const int c = color.rgba(); + for (int i = 0; i < h; ++i) { + memset(mem, c, w); + mem += bpl; + } + dfbSurface->Unlock(dfbSurface); } - dfbSurface->Unlock(dfbSurface); } else { dfbSurface->Clear(dfbSurface, color.red(), color.green(), color.blue(), color.alpha()); diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp index 041d522..3e54e7f 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp @@ -159,15 +159,17 @@ IDirectFBSurface* QDirectFBScreen::createDFBSurface(const QImage &img, SurfaceCr IDirectFBSurface *surface = createDFBSurface(&desc, options); #ifdef QT_NO_DIRECTFB_PREALLOCATED if (surface) { - char *mem; int bpl; - surface->Lock(surface, DSLF_WRITE, (void**)&mem, &bpl); - const int h = img.height(); - for (int i = 0; i < h; ++i) { - memcpy(mem, img.scanLine(i), bpl); - mem += bpl; + uchar *mem = QDirectFBScreen::lockSurface(surface, DSLF_WRITE, &bpl); + if (mem) { + const int h = img.height(); + const int w = img.width() * img.depth() / 8; + for (int i = 0; i < h; ++i) { + memcpy(mem, img.scanLine(i), w); + mem += bpl; + } + surface->Unlock(surface); } - surface->Unlock(surface); } #endif #ifndef QT_NO_DIRECTFB_PALETTE @@ -317,15 +319,17 @@ IDirectFBSurface *QDirectFBScreen::copyToDFBSurface(const QImage &img, imgSurface->Release(imgSurface); #else // QT_NO_DIRECTFB_PREALLOCATED Q_ASSERT(image.format() == pixmapFormat); - char *mem; int bpl; - dfbSurface->Lock(dfbSurface, DSLF_WRITE, (void**)&mem, &bpl); - const int w = image.width() * image.depth() / 8; - for (int i = 0; i < image.height(); ++i) { - memcpy(mem, image.scanLine(i), w); - mem += bpl; + uchar *mem = QDirectFBScreen::lockSurface(dfbSurface, DSLF_WRITE, &bpl); + if (mem) { + const int h = image.height(); + const int w = image.width() * image.depth() / 8; + for (int i=0; i<h; ++i) { + memcpy(mem, image.scanLine(i), w); + mem += bpl; + } + dfbSurface->Unlock(dfbSurface); } - dfbSurface->Unlock(dfbSurface); #endif return dfbSurface; } @@ -833,15 +837,15 @@ bool QDirectFBScreen::connect(const QString &displaySpec) description.flags = DFBSurfaceDescriptionFlags(description.flags | DSDESC_WIDTH); if (::setIntOption(displayArgs, QLatin1String("height"), &description.height)) description.flags = DFBSurfaceDescriptionFlags(description.flags | DSDESC_HEIGHT); - description.caps = DFBSurfaceCapabilities(DSCAPS_PRIMARY - | DSCAPS_DOUBLE - | DSCAPS_STATIC_ALLOC); - if (displayArgs.contains(QLatin1String("forcepremultiplied"), - Qt::CaseInsensitive)) { - description.caps = DFBSurfaceCapabilities(description.caps - | DSCAPS_PREMULTIPLIED); + uint caps = DSCAPS_PRIMARY|DSCAPS_DOUBLE; + if (displayArgs.contains(QLatin1String("static_alloc"))) + caps |= DSCAPS_STATIC_ALLOC; + + if (displayArgs.contains(QLatin1String("forcepremultiplied"), Qt::CaseInsensitive)) { + caps |= DSCAPS_PREMULTIPLIED; } + description.caps = DFBSurfaceCapabilities(caps); // We don't track the primary surface as it's released in disconnect d_ptr->dfbSurface = createDFBSurface(&description, DontTrackSurface); if (!d_ptr->dfbSurface) { @@ -952,16 +956,15 @@ void QDirectFBScreen::disconnect() bool QDirectFBScreen::initDevice() { - QWSServer *server = QWSServer::instance(); #ifndef QT_NO_DIRECTFB_MOUSE if (qgetenv("QWS_MOUSE_PROTO").isEmpty()) { - server->setDefaultMouse("None"); + QWSServer::instance()->setDefaultMouse("None"); d_ptr->mouse = new QDirectFBMouseHandler; } #endif #ifndef QT_NO_DIRECTFB_KEYBOARD if (qgetenv("QWS_KEYBOARD").isEmpty()) { - server->setDefaultKeyboard("None"); + QWSServer::instance()->setDefaultKeyboard("None"); d_ptr->keyboard = new QDirectFBKeyboardHandler(QString()); } #endif @@ -1188,23 +1191,23 @@ void QDirectFBScreen::blit(IDirectFBSurface *src, const QPoint &topLeft, points.data(), n); } +// This function is only ever called by QScreen::drawBackground which +// is only ever called by QScreen::compose which is never called with +// DirectFB so it's really a noop. void QDirectFBScreen::solidFill(const QColor &color, const QRegion ®ion) { if (region.isEmpty()) return; if (QDirectFBScreen::getImageFormat(d_ptr->dfbSurface) == QImage::Format_RGB32) { - uchar *mem; - int bpl; - d_ptr->dfbSurface->Lock(d_ptr->dfbSurface, DSLF_WRITE, (void**)&mem, &bpl); - QImage img(mem, w, h, bpl, QImage::Format_RGB32); - QPainter p(&img); - p.setBrush(color); - p.setPen(Qt::NoPen); - const QVector<QRect> rects = region.rects(); - p.drawRects(rects.constData(), rects.size()); - p.end(); + data = QDirectFBScreen::lockSurface(d_ptr->dfbSurface, DSLF_WRITE, &lstep); + if (!data) + return; + + QScreen::solidFill(color, region); d_ptr->dfbSurface->Unlock(d_ptr->dfbSurface); + data = 0; + lstep = 0; } else { d_ptr->dfbSurface->SetColor(d_ptr->dfbSurface, color.red(), color.green(), color.blue(), @@ -1241,3 +1244,15 @@ bool QDirectFBScreen::initSurfaceDescriptionPixelFormat(DFBSurfaceDescription *d } return true; } + +uchar *QDirectFBScreen::lockSurface(IDirectFBSurface *surface, DFBSurfaceLockFlags flags, int *bpl) +{ + void *mem; + const DFBResult result = surface->Lock(surface, flags, static_cast<void**>(&mem), bpl); + if (result != DFB_OK) { + DirectFBError("QDirectFBPixmapData::lockSurface()", result); + } + + return reinterpret_cast<uchar*>(mem); +} + diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h index f394ac1..8dd38dc 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h +++ b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h @@ -127,6 +127,8 @@ public: const QImage &image); #endif + static uchar *lockSurface(IDirectFBSurface *surface, DFBSurfaceLockFlags flags, int *bpl = 0); + private: void compose(const QRegion &r); void blit(IDirectFBSurface *src, const QPoint &topLeft, |