From 8545436476497cf8aa9e7af46000f283cbbfb3d9 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Sun, 12 Sep 2010 23:22:20 +0200 Subject: Updated WebKit to 715b53069911a31a559aa0b3d94ffc6a5ac20988 Sync with qtwebkit-2.0 branch * Includes Thiago's intel compiler fixes * Girish' Maemo5 local rendering fixes --- src/3rdparty/webkit/.tag | 2 +- src/3rdparty/webkit/JavaScriptCore/ChangeLog | 57 +++++++++++ .../webkit/JavaScriptCore/bytecode/Opcode.h | 2 +- .../webkit/JavaScriptCore/jit/JITStubs.cpp | 97 +++++++++--------- src/3rdparty/webkit/JavaScriptCore/wtf/Platform.h | 5 +- src/3rdparty/webkit/JavaScriptCore/wtf/Vector.h | 2 +- src/3rdparty/webkit/VERSION | 2 +- src/3rdparty/webkit/WebCore/ChangeLog | 102 +++++++++++++++++++ src/3rdparty/webkit/WebCore/WebCore.pro | 11 ++- src/3rdparty/webkit/WebCore/bridge/npapi.h | 31 ++++++ .../webkit/WebCore/plugins/PluginPackage.cpp | 2 +- src/3rdparty/webkit/WebCore/plugins/PluginView.cpp | 10 ++ src/3rdparty/webkit/WebCore/plugins/PluginView.h | 10 ++ .../webkit/WebCore/plugins/qt/PluginViewQt.cpp | 109 +++++++++++++++++++-- src/3rdparty/webkit/WebKit/qt/Api/qwebkitglobal.h | 4 +- src/3rdparty/webkit/WebKit/qt/ChangeLog | 77 +++++++++++++++ .../qt/WebCoreSupport/FrameLoaderClientQt.cpp | 17 +++- .../webkit/WebKit/qt/qt_webkit_version.pri | 4 +- 18 files changed, 473 insertions(+), 71 deletions(-) diff --git a/src/3rdparty/webkit/.tag b/src/3rdparty/webkit/.tag index 1148320..ae33228 100644 --- a/src/3rdparty/webkit/.tag +++ b/src/3rdparty/webkit/.tag @@ -1 +1 @@ -460b651cbe4f6994b492ff08614e57b0e31a24c8 +715b53069911a31a559aa0b3d94ffc6a5ac20988 diff --git a/src/3rdparty/webkit/JavaScriptCore/ChangeLog b/src/3rdparty/webkit/JavaScriptCore/ChangeLog index 2be6f5a..9922da6 100644 --- a/src/3rdparty/webkit/JavaScriptCore/ChangeLog +++ b/src/3rdparty/webkit/JavaScriptCore/ChangeLog @@ -1,3 +1,60 @@ +2010-06-16 Thiago Macieira + + Reviewed by NOBODY (OOPS!). + + Reindent the asm code I've moved to inside the function + (previous commit) + + * jit/JITStubs.cpp: + +2010-06-16 Thiago Macieira + + Reviewed by NOBODY (OOPS!). + + Fix the JIT compilation with the Intel 32-bit C++ compiler. + + ICC doesn't understand the use of "asm" statements outside of + function bodies, so move the assembly code inside a dummy + function (and mark it so that the compiler doesn't remove it + altogether). + + Also removed the ".text" entry that I had added because now + the assembly code is properly inside a code section (fixes + compilation with -ffunction-sections). + + * jit/JITStubs.cpp: + +2010-06-16 Thiago Macieira + + Reviewed by NOBODY (OOPS!). + + Don't use __attribute__((may_alias)) with the Intel compiler, + as it doesn't understand it. + + * wtf/Vector.h: + +2010-06-16 Thiago Macieira + + Reviewed by NOBODY (OOPS!). + + Fix compilation with the Intel C++ compiler (11.1.072). + + Like RVCT, label pointers must be void*, not const void*. + + * bytecode/Opcode.h: + +2010-06-16 Thiago Macieira + + Reviewed by NOBODY (OOPS!). + + Add the WTF_COMPILER_INTEL for when the Intel compiler is used + for building. Usually, the Intel compiler masquerades as + another compiler in the system and gets away with it, but some + times specific fixes are required (such as when using language + extensions). + + * wtf/Platform.h: + 2010-07-08 Andreas Kling Reviewed by Oliver Hunt. diff --git a/src/3rdparty/webkit/JavaScriptCore/bytecode/Opcode.h b/src/3rdparty/webkit/JavaScriptCore/bytecode/Opcode.h index 509daeb..f7f53fd 100644 --- a/src/3rdparty/webkit/JavaScriptCore/bytecode/Opcode.h +++ b/src/3rdparty/webkit/JavaScriptCore/bytecode/Opcode.h @@ -206,7 +206,7 @@ namespace JSC { #undef VERIFY_OPCODE_ID #if HAVE(COMPUTED_GOTO) -#if COMPILER(RVCT) +#if COMPILER(RVCT) || COMPILER(INTEL) typedef void* Opcode; #else typedef const void* Opcode; diff --git a/src/3rdparty/webkit/JavaScriptCore/jit/JITStubs.cpp b/src/3rdparty/webkit/JavaScriptCore/jit/JITStubs.cpp index e5fcdc4..23fcb96 100644 --- a/src/3rdparty/webkit/JavaScriptCore/jit/JITStubs.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/jit/JITStubs.cpp @@ -113,56 +113,59 @@ COMPILE_ASSERT(offsetof(struct JITStackFrame, savedEBX) == 0x3c, JITStackFrame_s COMPILE_ASSERT(offsetof(struct JITStackFrame, callFrame) == 0x58, JITStackFrame_callFrame_offset_matches_ctiTrampoline); COMPILE_ASSERT(offsetof(struct JITStackFrame, code) == 0x50, JITStackFrame_code_offset_matches_ctiTrampoline); -asm volatile ( -".text\n" -".globl " SYMBOL_STRING(ctiTrampoline) "\n" -HIDE_SYMBOL(ctiTrampoline) "\n" -SYMBOL_STRING(ctiTrampoline) ":" "\n" - "pushl %ebp" "\n" - "movl %esp, %ebp" "\n" - "pushl %esi" "\n" - "pushl %edi" "\n" - "pushl %ebx" "\n" - "subl $0x3c, %esp" "\n" - "movl $512, %esi" "\n" - "movl 0x58(%esp), %edi" "\n" - "call *0x50(%esp)" "\n" - "addl $0x3c, %esp" "\n" - "popl %ebx" "\n" - "popl %edi" "\n" - "popl %esi" "\n" - "popl %ebp" "\n" - "ret" "\n" -); - -asm volatile ( -".globl " SYMBOL_STRING(ctiVMThrowTrampoline) "\n" -HIDE_SYMBOL(ctiVMThrowTrampoline) "\n" -SYMBOL_STRING(ctiVMThrowTrampoline) ":" "\n" +static void __attribute__((used)) asm_wrapper() +{ + asm volatile ( + ".text\n" + ".globl " SYMBOL_STRING(ctiTrampoline) "\n" + HIDE_SYMBOL(ctiTrampoline) "\n" + SYMBOL_STRING(ctiTrampoline) ":" "\n" + "pushl %ebp" "\n" + "movl %esp, %ebp" "\n" + "pushl %esi" "\n" + "pushl %edi" "\n" + "pushl %ebx" "\n" + "subl $0x3c, %esp" "\n" + "movl $512, %esi" "\n" + "movl 0x58(%esp), %edi" "\n" + "call *0x50(%esp)" "\n" + "addl $0x3c, %esp" "\n" + "popl %ebx" "\n" + "popl %edi" "\n" + "popl %esi" "\n" + "popl %ebp" "\n" + "ret" "\n" + ); + + asm volatile ( + ".globl " SYMBOL_STRING(ctiVMThrowTrampoline) "\n" + HIDE_SYMBOL(ctiVMThrowTrampoline) "\n" + SYMBOL_STRING(ctiVMThrowTrampoline) ":" "\n" #if !USE(JIT_STUB_ARGUMENT_VA_LIST) - "movl %esp, %ecx" "\n" + "movl %esp, %ecx" "\n" #endif - "call " SYMBOL_STRING_RELOCATION(cti_vm_throw) "\n" - "addl $0x3c, %esp" "\n" - "popl %ebx" "\n" - "popl %edi" "\n" - "popl %esi" "\n" - "popl %ebp" "\n" - "ret" "\n" -); - -asm volatile ( -".globl " SYMBOL_STRING(ctiOpThrowNotCaught) "\n" -HIDE_SYMBOL(ctiOpThrowNotCaught) "\n" -SYMBOL_STRING(ctiOpThrowNotCaught) ":" "\n" - "addl $0x3c, %esp" "\n" - "popl %ebx" "\n" - "popl %edi" "\n" - "popl %esi" "\n" - "popl %ebp" "\n" - "ret" "\n" -); + "call " SYMBOL_STRING_RELOCATION(cti_vm_throw) "\n" + "addl $0x3c, %esp" "\n" + "popl %ebx" "\n" + "popl %edi" "\n" + "popl %esi" "\n" + "popl %ebp" "\n" + "ret" "\n" + ); + asm volatile ( + ".globl " SYMBOL_STRING(ctiOpThrowNotCaught) "\n" + HIDE_SYMBOL(ctiOpThrowNotCaught) "\n" + SYMBOL_STRING(ctiOpThrowNotCaught) ":" "\n" + "addl $0x3c, %esp" "\n" + "popl %ebx" "\n" + "popl %edi" "\n" + "popl %esi" "\n" + "popl %ebp" "\n" + "ret" "\n" + ); +} + #elif COMPILER(GCC) && CPU(X86_64) #if USE(JIT_STUB_ARGUMENT_VA_LIST) diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/Platform.h b/src/3rdparty/webkit/JavaScriptCore/wtf/Platform.h index 84b6153..15f0ffc 100644 --- a/src/3rdparty/webkit/JavaScriptCore/wtf/Platform.h +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/Platform.h @@ -99,7 +99,10 @@ #undef _WIN32 #endif - +/* COMPILER(INTEL) - Intel C++ Compiler */ +#if defined(__INTEL_COMPILER) +#define WTF_COMPILER_INTEL 1 +#endif /* ==== CPU() - the target CPU architecture ==== */ diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/Vector.h b/src/3rdparty/webkit/JavaScriptCore/wtf/Vector.h index 4d9ea61..c267050 100644 --- a/src/3rdparty/webkit/JavaScriptCore/wtf/Vector.h +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/Vector.h @@ -49,7 +49,7 @@ namespace WTF { #error WTF_ALIGN macros need alignment control. #endif - #if COMPILER(GCC) && (((__GNUC__ * 100) + __GNUC_MINOR__) >= 303) + #if COMPILER(GCC) && !COMPILER(INTEL) && (((__GNUC__ * 100) + __GNUC_MINOR__) >= 303) typedef char __attribute__((__may_alias__)) AlignedBufferChar; #else typedef char AlignedBufferChar; diff --git a/src/3rdparty/webkit/VERSION b/src/3rdparty/webkit/VERSION index aff3f2a..f919bdf 100644 --- a/src/3rdparty/webkit/VERSION +++ b/src/3rdparty/webkit/VERSION @@ -4,4 +4,4 @@ This is a snapshot of the Qt port of WebKit from and has the sha1 checksum - 460b651cbe4f6994b492ff08614e57b0e31a24c8 + 715b53069911a31a559aa0b3d94ffc6a5ac20988 diff --git a/src/3rdparty/webkit/WebCore/ChangeLog b/src/3rdparty/webkit/WebCore/ChangeLog index 98d4d51..2d20cbd 100644 --- a/src/3rdparty/webkit/WebCore/ChangeLog +++ b/src/3rdparty/webkit/WebCore/ChangeLog @@ -1,3 +1,105 @@ +2010-09-09 Kristian Amlie + + Reviewed by Andreas Kling. + + [Qt] Fixed incorrect Symbian scoping. + + The missing install functionality is only true for mmp based systems. + + https://bugs.webkit.org/show_bug.cgi?id=45268 + + * WebCore.pro: + +2010-09-12 Oswald Buddenhagen + + Reviewed by Simon Hausmann. + + [Qt] fix qt_webkit_version.pri install for in-Qt builds + + Always add the target, even if building inside Qt - as opposed to the + headers and libraries, there are no rules for that coming from + qbase.pri. + + Task-number: QTBUG-13306 + + * WebCore.pro: + +2010-09-12 Oswald Buddenhagen + + Reviewed by Simon Hausmann. + + [Qt] Let QtWebKit inject itself into the qt configuration + + i.e., don't explicitly deal with qt_webkit_version.pri outside of the + webkit source directory. + + Task-number: QTBUG-12379 + + * WebCore.pro: + +2010-08-20 Girish Ramakrishnan + + Reviewed by Ariya Hidayat. + + [Qt] When using the raster graphics system on Maemo5, allow + Flash to render directly into the raster window surface. + wmode=transparent is now supported as a result of this change. + + https://bugs.webkit.org/show_bug.cgi?id=44043 + + * plugins/qt/PluginViewQt.cpp: + (WebCore::PluginView::paintUsingImageSurfaceExtension): + +2010-08-18 Girish Ramakrishnan + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] Implement Maemo5 local rendering NPAPI extension. See + https://wiki.mozilla.org/Plugins:NokiaMaemoImageSurface for details. + + With the local rendering extension, Flash will paint into a 16-bit surface. + For wmode=transparent, Flash expects the surface to contain the contents + beneath it. As it is tricky to implement the content propagation across all + graphics systems, transparent Flash is not supported. We just fill the surface + with white and wmode=transparent behaves the same as wmode=opaque with a white + background. + + https://bugs.webkit.org/show_bug.cgi?id=44043 + + * WebCore.pro: + * plugins/PluginView.cpp: + (WebCore::PluginView::setValue): + (WebCore::PluginView::PluginView): + * plugins/PluginView.h: + * plugins/qt/PluginViewQt.cpp: + (WebCore::PluginView::updatePluginWidget): + (WebCore::PluginView::paintUsingImageSurfaceExtension): + (WebCore::PluginView::paint): + (WebCore::PluginView::platformGetValueStatic): + +2010-08-17 Girish Ramakrishnan + + Reviewed by Antonio Gomes. + + [Qt] On Maemo5, there is no libgdk-x11-2.0.so symlink. Look for + libgdk-x11-2.0.so.0 instead on X11 and Maemo5. + + https://bugs.webkit.org/show_bug.cgi?id=44043 + + * plugins/qt/PluginViewQt.cpp: + (WebCore::getPluginDisplay): + +2010-08-17 Girish Ramakrishnan + + Reviewed by Kenneth Rohde Christiansen. + Set PluginQuirkRequiresDefaultScreenDepth for all Flash versions and not + just Flash 10. + + https://bugs.webkit.org/show_bug.cgi?id=44043 + + * plugins/PluginPackage.cpp: + (WebCore::PluginPackage::determineQuirks): + 2010-08-10 Tor Arne Vestbø Reviewed by Simon Hausmann. diff --git a/src/3rdparty/webkit/WebCore/WebCore.pro b/src/3rdparty/webkit/WebCore/WebCore.pro index 5ea1e77..87638a0 100644 --- a/src/3rdparty/webkit/WebCore/WebCore.pro +++ b/src/3rdparty/webkit/WebCore/WebCore.pro @@ -2192,6 +2192,9 @@ contains(DEFINES, ENABLE_NETSCAPE_PLUGIN_API=1) { CONFIG += x11 LIBS += -lXrender } + maemo5 { + DEFINES += MOZ_PLATFORM_MAEMO=5 + } SOURCES += \ plugins/qt/PluginContainerQt.cpp \ plugins/qt/PluginPackageQt.cpp \ @@ -2857,13 +2860,13 @@ contains(DEFINES, ENABLE_SYMBIAN_DIALOG_PROVIDERS) { } } -!symbian-abld:!symbian-sbsv2 { +!symbian { modfile.files = $$moduleFile modfile.path = $$[QMAKE_MKSPECS]/modules INSTALLS += modfile } else { - # INSTALLS is not implemented in qmake's mmp generators, copy headers manually + # INSTALLS is not implemented in qmake's s60 generators, copy headers manually inst_modfile.commands = $$QMAKE_COPY ${QMAKE_FILE_NAME} ${QMAKE_FILE_OUT} inst_modfile.input = moduleFile @@ -2883,7 +2886,7 @@ HEADERS += $$WEBKIT_API_HEADERS exists($$OUTPUT_DIR/include/QtWebKit/classheaders.pri): include($$OUTPUT_DIR/include/QtWebKit/classheaders.pri) WEBKIT_INSTALL_HEADERS = $$WEBKIT_API_HEADERS $$WEBKIT_CLASS_HEADERS - !symbian { + !symbian-abld:!symbian-sbsv2 { headers.files = $$WEBKIT_INSTALL_HEADERS !isEmpty(INSTALL_HEADERS): headers.path = $$INSTALL_HEADERS/QtWebKit @@ -2894,7 +2897,7 @@ HEADERS += $$WEBKIT_API_HEADERS INSTALLS += target headers } else { - # INSTALLS is not implemented in qmake's s60 generators, copy headers manually + # INSTALLS is not implemented in qmake's mmp generators, copy headers manually inst_headers.commands = $$QMAKE_COPY ${QMAKE_FILE_NAME} ${QMAKE_FILE_OUT} inst_headers.input = WEBKIT_INSTALL_HEADERS inst_headers.CONFIG = no_clean diff --git a/src/3rdparty/webkit/WebCore/bridge/npapi.h b/src/3rdparty/webkit/WebCore/bridge/npapi.h index 533fcba..daa3a36 100644 --- a/src/3rdparty/webkit/WebCore/bridge/npapi.h +++ b/src/3rdparty/webkit/WebCore/bridge/npapi.h @@ -247,6 +247,12 @@ typedef struct _NPRect } NPRect; +typedef struct _NPSize +{ + int32 width; + int32 height; +} NPSize; + #ifdef XP_UNIX /* * Unix specific structures and definitions @@ -373,6 +379,11 @@ typedef enum { /* In the NPDrawingModelCoreAnimation drawing model, the browser asks the plug-in for a Core Animation layer. */ NPPVpluginCoreAnimationLayer = 1003 #endif + + +#if defined(MOZ_PLATFORM_MAEMO) && (MOZ_PLATFORM_MAEMO == 5) + NPPVpluginWindowlessLocalBool = 2002 +#endif } NPPVariable; /* @@ -419,6 +430,9 @@ typedef enum { , NPNVsupportsCocoaBool = 3001 /* TRUE if the browser supports the Cocoa event model */ #endif /* XP_MACOSX */ +#if defined(MOZ_PLATFORM_MAEMO) && (MOZ_PLATFORM_MAEMO == 5) + , NPNVSupportsWindowlessLocal = 2002 +#endif } NPNVariable; typedef enum { @@ -539,6 +553,23 @@ typedef struct _NPWindow } NPWindow; +typedef struct _NPImageExpose +{ + char* data; /* image pointer */ + int32 stride; /* Stride of data image pointer */ + int32 depth; /* Depth of image pointer */ + int32 x; /* Expose x */ + int32 y; /* Expose y */ + uint32 width; /* Expose width */ + uint32 height; /* Expose height */ + NPSize dataSize; /* Data buffer size */ + float translateX; /* translate X matrix value */ + float translateY; /* translate Y matrix value */ + float scaleX; /* scale X matrix value */ + float scaleY; /* scale Y matrix value */ +} NPImageExpose; + + typedef struct _NPFullPrint { NPBool pluginPrinted; /* Set TRUE if plugin handled fullscreen */ diff --git a/src/3rdparty/webkit/WebCore/plugins/PluginPackage.cpp b/src/3rdparty/webkit/WebCore/plugins/PluginPackage.cpp index ad03ecd..3881f54 100644 --- a/src/3rdparty/webkit/WebCore/plugins/PluginPackage.cpp +++ b/src/3rdparty/webkit/WebCore/plugins/PluginPackage.cpp @@ -185,12 +185,12 @@ void PluginPackage::determineQuirks(const String& mimeType) #if PLATFORM(QT) m_quirks.add(PluginQuirkRequiresGtkToolKit); #endif - m_quirks.add(PluginQuirkRequiresDefaultScreenDepth); } else { // Flash 9 and older requests windowless plugins if we return a mozilla user agent m_quirks.add(PluginQuirkWantsMozillaUserAgent); } + m_quirks.add(PluginQuirkRequiresDefaultScreenDepth); m_quirks.add(PluginQuirkThrottleInvalidate); m_quirks.add(PluginQuirkThrottleWMUserPlusOneMessages); m_quirks.add(PluginQuirkFlashURLNotifyBug); diff --git a/src/3rdparty/webkit/WebCore/plugins/PluginView.cpp b/src/3rdparty/webkit/WebCore/plugins/PluginView.cpp index df9a29b..b8b2f2f 100644 --- a/src/3rdparty/webkit/WebCore/plugins/PluginView.cpp +++ b/src/3rdparty/webkit/WebCore/plugins/PluginView.cpp @@ -1,6 +1,7 @@ /* * Copyright (C) 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved. * Copyright (C) 2008 Collabora Ltd. All rights reserved. + * Copyright (C) 2010 Girish Ramakrishnan * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -679,6 +680,12 @@ NPError PluginView::setValue(NPPVariable variable, void* value) } #endif // defined(XP_MACOSX) +#if PLATFORM(QT) && defined(MOZ_PLATFORM_MAEMO) && (MOZ_PLATFORM_MAEMO == 5) + case NPPVpluginWindowlessLocalBool: + m_renderToImage = true; + return NPERR_NO_ERROR; +#endif + default: notImplemented(); return NPERR_GENERIC_ERROR; @@ -852,6 +859,9 @@ PluginView::PluginView(Frame* parentFrame, const IntSize& size, PluginPackage* p , m_colormap(0) , m_pluginDisplay(0) #endif +#if PLATFORM(QT) && defined(MOZ_PLATFORM_MAEMO) && (MOZ_PLATFORM_MAEMO == 5) + , m_renderToImage(false) +#endif , m_loadManually(loadManually) , m_manualStream(0) , m_isJavaScriptPaused(false) diff --git a/src/3rdparty/webkit/WebCore/plugins/PluginView.h b/src/3rdparty/webkit/WebCore/plugins/PluginView.h index 51b2127..f346134 100644 --- a/src/3rdparty/webkit/WebCore/plugins/PluginView.h +++ b/src/3rdparty/webkit/WebCore/plugins/PluginView.h @@ -54,6 +54,10 @@ typedef PlatformWidget PlatformPluginWidget; #include #endif #endif +#if PLATFORM(QT) && defined(MOZ_PLATFORM_MAEMO) && (MOZ_PLATFORM_MAEMO == 5) +#include +class QPainter; +#endif namespace JSC { namespace Bindings { @@ -371,6 +375,12 @@ private: void initXEvent(XEvent* event); #endif +#if PLATFORM(QT) && defined(MOZ_PLATFORM_MAEMO) && (MOZ_PLATFORM_MAEMO == 5) + QImage m_image; + bool m_renderToImage; + void paintUsingImageSurfaceExtension(QPainter* painter, const IntRect& exposedRect); +#endif + IntRect m_clipRect; // The clip rect to apply to a windowed plug-in IntRect m_windowRect; // Our window rect. diff --git a/src/3rdparty/webkit/WebCore/plugins/qt/PluginViewQt.cpp b/src/3rdparty/webkit/WebCore/plugins/qt/PluginViewQt.cpp index fb88b87..8dadc11 100644 --- a/src/3rdparty/webkit/WebCore/plugins/qt/PluginViewQt.cpp +++ b/src/3rdparty/webkit/WebCore/plugins/qt/PluginViewQt.cpp @@ -110,12 +110,20 @@ void PluginView::updatePluginWidget() return; if (!m_isWindowed && m_windowRect.size() != oldWindowRect.size()) { - if (m_drawable) - XFreePixmap(QX11Info::display(), m_drawable); +#if defined(MOZ_PLATFORM_MAEMO) && (MOZ_PLATFORM_MAEMO == 5) + // On Maemo5, Flash always renders to 16-bit buffer + if (m_renderToImage) + m_image = QImage(m_windowRect.width(), m_windowRect.height(), QImage::Format_RGB16); + else +#endif + { + if (m_drawable) + XFreePixmap(QX11Info::display(), m_drawable); - m_drawable = XCreatePixmap(QX11Info::display(), QX11Info::appRootWindow(), m_windowRect.width(), m_windowRect.height(), - ((NPSetWindowCallbackStruct*)m_npWindow.ws_info)->depth); - QApplication::syncX(); // make sure that the server knows about the Drawable + m_drawable = XCreatePixmap(QX11Info::display(), QX11Info::appRootWindow(), m_windowRect.width(), m_windowRect.height(), + ((NPSetWindowCallbackStruct*)m_npWindow.ws_info)->depth); + QApplication::syncX(); // make sure that the server knows about the Drawable + } } // do not call setNPWindowIfNeeded immediately, will be called on paint() @@ -154,6 +162,71 @@ void PluginView::hide() Widget::hide(); } +#if defined(MOZ_PLATFORM_MAEMO) && (MOZ_PLATFORM_MAEMO == 5) +void PluginView::paintUsingImageSurfaceExtension(QPainter* painter, const IntRect& exposedRect) +{ + NPImageExpose imageExpose; + QPoint offset; + QWebPageClient* client = m_parentFrame->view()->hostWindow()->platformPageClient(); + const bool surfaceHasUntransformedContents = client && qobject_cast(client->pluginParent()); + + QPaintDevice* surface = QPainter::redirected(painter->device(), &offset); + + // If the surface is a QImage, we can render directly into it + if (surfaceHasUntransformedContents && surface && surface->devType() == QInternal::Image) { + QImage* image = static_cast(surface); + offset = -offset; // negating the offset gives us the offset of the view within the surface + imageExpose.data = reinterpret_cast(image->bits()); + imageExpose.dataSize.width = image->width(); + imageExpose.dataSize.height = image->height(); + imageExpose.stride = image->bytesPerLine(); + imageExpose.depth = image->depth(); // this is guaranteed to be 16 on Maemo5 + imageExpose.translateX = offset.x() + m_windowRect.x(); + imageExpose.translateY = offset.y() + m_windowRect.y(); + imageExpose.scaleX = 1; + imageExpose.scaleY = 1; + } else { + if (m_isTransparent) { + // On Maemo5, Flash expects the buffer to contain the contents that are below it. + // We don't support transparency for non-raster graphicssystem, so clean the image + // before giving to Flash. + QPainter imagePainter(&m_image); + imagePainter.fillRect(exposedRect, Qt::white); + } + + imageExpose.data = reinterpret_cast(m_image.bits()); + imageExpose.dataSize.width = m_image.width(); + imageExpose.dataSize.height = m_image.height(); + imageExpose.stride = m_image.bytesPerLine(); + imageExpose.depth = m_image.depth(); + imageExpose.translateX = 0; + imageExpose.translateY = 0; + imageExpose.scaleX = 1; + imageExpose.scaleY = 1; + } + imageExpose.x = exposedRect.x(); + imageExpose.y = exposedRect.y(); + imageExpose.width = exposedRect.width(); + imageExpose.height = exposedRect.height(); + + XEvent xevent; + memset(&xevent, 0, sizeof(XEvent)); + XGraphicsExposeEvent& exposeEvent = xevent.xgraphicsexpose; + exposeEvent.type = GraphicsExpose; + exposeEvent.display = 0; + exposeEvent.drawable = reinterpret_cast(&imageExpose); + exposeEvent.x = exposedRect.x(); + exposeEvent.y = exposedRect.y(); + exposeEvent.width = exposedRect.width(); + exposeEvent.height = exposedRect.height(); + + dispatchNPEvent(xevent); + + if (!surfaceHasUntransformedContents || !surface || surface->devType() != QInternal::Image) + painter->drawImage(QPoint(frameRect().x() + exposedRect.x(), frameRect().y() + exposedRect.y()), m_image, exposedRect); +} +#endif + void PluginView::paint(GraphicsContext* context, const IntRect& rect) { if (!m_isStarted) { @@ -166,19 +239,32 @@ void PluginView::paint(GraphicsContext* context, const IntRect& rect) setNPWindowIfNeeded(); - if (m_isWindowed || !m_drawable) + if (m_isWindowed) return; - const bool syncX = m_pluginDisplay && m_pluginDisplay != QX11Info::display(); + if (!m_drawable +#if defined(MOZ_PLATFORM_MAEMO) && (MOZ_PLATFORM_MAEMO == 5) + && m_image.isNull() +#endif + ) + return; QPainter* painter = context->platformContext(); IntRect exposedRect(rect); exposedRect.intersect(frameRect()); exposedRect.move(-frameRect().x(), -frameRect().y()); +#if defined(MOZ_PLATFORM_MAEMO) && (MOZ_PLATFORM_MAEMO == 5) + if (!m_image.isNull()) { + paintUsingImageSurfaceExtension(painter, exposedRect); + return; + } +#endif + QPixmap qtDrawable = QPixmap::fromX11Pixmap(m_drawable, QPixmap::ExplicitlyShared); const int drawableDepth = ((NPSetWindowCallbackStruct*)m_npWindow.ws_info)->depth; ASSERT(drawableDepth == qtDrawable.depth()); + const bool syncX = m_pluginDisplay && m_pluginDisplay != QX11Info::display(); // When printing, Qt uses a QPicture to capture the output in preview mode. The // QPicture holds a reference to the X Pixmap. As a result, the print preview would @@ -576,6 +662,13 @@ bool PluginView::platformGetValueStatic(NPNVariable variable, void* value, NPErr *result = NPERR_NO_ERROR; return true; +#if defined(MOZ_PLATFORM_MAEMO) && (MOZ_PLATFORM_MAEMO == 5) + case NPNVSupportsWindowlessLocal: + *static_cast(value) = true; + *result = NPERR_NO_ERROR; + return true; +#endif + default: return false; } @@ -651,7 +744,7 @@ static Display *getPluginDisplay() // support gdk based plugins (like flash) that use a different X connection. // The code below has the same effect as this one: // Display *gdkDisplay = gdk_x11_display_get_xdisplay(gdk_display_get_default()); - QLibrary library("libgdk-x11-2.0"); + QLibrary library("libgdk-x11-2.0.so.0"); if (!library.load()) return 0; diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebkitglobal.h b/src/3rdparty/webkit/WebKit/qt/Api/qwebkitglobal.h index 665bf1b..63d9e55 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qwebkitglobal.h +++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebkitglobal.h @@ -22,9 +22,9 @@ #include -#define QTWEBKIT_VERSION_STR "2.0.0" +#define QTWEBKIT_VERSION_STR "2.0.1" // QTWEBKIT_VERSION is (major << 16) + (minor << 8) + patch. Similar to Qt. -#define QTWEBKIT_VERSION 0x020000 +#define QTWEBKIT_VERSION 0x020001 // Use: #if (QTWEBKIT_VERSION >= QTWEBKIT_VERSION_CHECK(2, 0, 0)). Similar to Qt. #define QTWEBKIT_VERSION_CHECK(major, minor, patch) ((major<<16)|(minor<<8)|(patch)) diff --git a/src/3rdparty/webkit/WebKit/qt/ChangeLog b/src/3rdparty/webkit/WebKit/qt/ChangeLog index 5083ba5..c6c3d72 100644 --- a/src/3rdparty/webkit/WebKit/qt/ChangeLog +++ b/src/3rdparty/webkit/WebKit/qt/ChangeLog @@ -1,3 +1,80 @@ +2010-09-12 Martin Smith + + Reviewed by Simon Hausmann. + + doc: Changed the title so lists of contents sort better. + + * docs/qtwebkit.qdoc: + +2010-09-12 David Boddie + + Reviewed by Simon Hausmann. + + Doc: More work on the QML documentation. + + * declarative/qdeclarativewebview.cpp: + +2010-09-12 Martin Jones + + Reviewed by Simon Hausmann. + + [Qml] Ensure WebView gets focus when an editable node is clicked on. + + Task-number: QTBUG-13342 + + * declarative/qdeclarativewebview.cpp: + (GraphicsWebView::mousePressEvent): + +2010-09-12 David Boddie + + Reviewed by Simon Hausmann. + + Doc: qdoc fixes. + + * declarative/qdeclarativewebview.cpp: + +2010-09-12 Oswald Buddenhagen + + Reviewed by Simon Hausmann. + + [Qt] let WebKit inject itself into the qt configuration + + Task-number: QTBUG-12379 + + * qt_webkit_version.pri: Use the faster + instead of * + operator to add webkit to the config. + +2010-09-12 Martin Smith + + Reviewed by Simon Hausmann. + + [Qt] Fix group of declarative web view in QML docs. + + * declarative/qdeclarativewebview.cpp: + +2010-08-20 Girish Ramakrishnan + + Reviewed by Ariya Hidayat. + + [Qt] Allow wmode=transparent in QWebView on Maemo5 after r65775. + + https://bugs.webkit.org/show_bug.cgi?id=44043 + + * WebCoreSupport/FrameLoaderClientQt.cpp: + (WebCore::FrameLoaderClientQt::createPlugin): + +2010-08-19 Girish Ramakrishnan + + Reviewed by Kenneth Christiansen. + + [Qt] Inject wmode=opaque for both QWebView and QGraphicsWebView on Maemo5 + as Flash XEmbed support is flaky. + + https://bugs.webkit.org/show_bug.cgi?id=44043 + + * WebCoreSupport/FrameLoaderClientQt.cpp: + (WebCore::FrameLoaderClientQt::createPlugin): + 2010-08-05 David Leong Reviewed by Simon Hausmann. diff --git a/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp b/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp index 713fa39..dcbf614 100644 --- a/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp +++ b/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp @@ -4,7 +4,7 @@ * Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies) * Copyright (C) 2008 Collabora Ltd. All rights reserved. * Coypright (C) 2008 Holger Hans Peter Freyther - * Coypright (C) 2009 Girish Ramakrishnan + * Coypright (C) 2009, 2010 Girish Ramakrishnan * * All rights reserved. * @@ -1349,7 +1349,19 @@ PassRefPtr FrameLoaderClientQt::createPlugin(const IntSize& pluginSize, Vector values = paramValues; if (mimeType == "application/x-shockwave-flash") { QWebPageClient* client = m_webFrame->page()->d->client; - if (!client || !qobject_cast(client->pluginParent())) { + const bool isQWebView = client && qobject_cast(client->pluginParent()); +#if defined(MOZ_PLATFORM_MAEMO) && (MOZ_PLATFORM_MAEMO == 5) + size_t wmodeIndex = params.find("wmode"); + if (wmodeIndex == -1) { + // Disable XEmbed mode and force it to opaque mode + params.append("wmode"); + values.append("opaque"); + } else if (!isQWebView) { + // Disable transparency if client is not a QWebView + values[wmodeIndex] = "opaque"; + } +#else + if (!isQWebView) { // inject wmode=opaque when there is no client or the client is not a QWebView size_t wmodeIndex = params.find("wmode"); if (wmodeIndex == -1) { @@ -1358,6 +1370,7 @@ PassRefPtr FrameLoaderClientQt::createPlugin(const IntSize& pluginSize, } else values[wmodeIndex] = "opaque"; } +#endif } RefPtr pluginView = PluginView::create(m_frame, pluginSize, element, url, diff --git a/src/3rdparty/webkit/WebKit/qt/qt_webkit_version.pri b/src/3rdparty/webkit/WebKit/qt/qt_webkit_version.pri index 4594d1e..f2282f8 100644 --- a/src/3rdparty/webkit/WebKit/qt/qt_webkit_version.pri +++ b/src/3rdparty/webkit/WebKit/qt/qt_webkit_version.pri @@ -1,5 +1,5 @@ -QT_WEBKIT_VERSION = 4.7.0 +QT_WEBKIT_VERSION = 4.7.1 QT_WEBKIT_MAJOR_VERSION = 4 QT_WEBKIT_MINOR_VERSION = 7 -QT_WEBKIT_PATCH_VERSION = 0 +QT_WEBKIT_PATCH_VERSION = 1 QT_CONFIG += webkit -- cgit v0.12 From b04672e479ae245063e641c77d43e311c0851dc0 Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Mon, 13 Sep 2010 09:32:42 +1000 Subject: Fix slot naming clash Reviewed-by: David Boddie --- src/imports/folderlistmodel/qdeclarativefolderlistmodel.cpp | 4 ++-- src/imports/folderlistmodel/qdeclarativefolderlistmodel.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/imports/folderlistmodel/qdeclarativefolderlistmodel.cpp b/src/imports/folderlistmodel/qdeclarativefolderlistmodel.cpp index 4983840..abab33c 100644 --- a/src/imports/folderlistmodel/qdeclarativefolderlistmodel.cpp +++ b/src/imports/folderlistmodel/qdeclarativefolderlistmodel.cpp @@ -167,7 +167,7 @@ QDeclarativeFolderListModel::QDeclarativeFolderListModel(QObject *parent) connect(&d->model, SIGNAL(rowsRemoved(const QModelIndex&,int,int)) , this, SLOT(removed(const QModelIndex&,int,int))); connect(&d->model, SIGNAL(dataChanged(const QModelIndex&,const QModelIndex&)) - , this, SLOT(dataChanged(const QModelIndex&,const QModelIndex&))); + , this, SLOT(handleDataChanged(const QModelIndex&,const QModelIndex&))); connect(&d->model, SIGNAL(modelReset()), this, SLOT(refresh())); connect(&d->model, SIGNAL(layoutChanged()), this, SLOT(refresh())); } @@ -363,7 +363,7 @@ void QDeclarativeFolderListModel::removed(const QModelIndex &index, int start, i } } -void QDeclarativeFolderListModel::dataChanged(const QModelIndex &start, const QModelIndex &end) +void QDeclarativeFolderListModel::handleDataChanged(const QModelIndex &start, const QModelIndex &end) { if (start.parent() == d->folderIndex) emit dataChanged(index(start.row(),0), index(end.row(),0)); diff --git a/src/imports/folderlistmodel/qdeclarativefolderlistmodel.h b/src/imports/folderlistmodel/qdeclarativefolderlistmodel.h index 1bab5f84..24edecd 100644 --- a/src/imports/folderlistmodel/qdeclarativefolderlistmodel.h +++ b/src/imports/folderlistmodel/qdeclarativefolderlistmodel.h @@ -138,7 +138,7 @@ private Q_SLOTS: void refresh(); void inserted(const QModelIndex &index, int start, int end); void removed(const QModelIndex &index, int start, int end); - void dataChanged(const QModelIndex &start, const QModelIndex &end); + void handleDataChanged(const QModelIndex &start, const QModelIndex &end); private: Q_DISABLE_COPY(QDeclarativeFolderListModel) -- cgit v0.12 From a39285f6f5c3355d48810851a7215b951f1aaa4c Mon Sep 17 00:00:00 2001 From: Rhys Weatherley Date: Mon, 13 Sep 2010 09:44:06 +1000 Subject: Fix compilation of QEgl with EGL 1.1 and older. Reviewed-by: Sarah Smith --- src/gui/egl/qegl.cpp | 2 +- src/gui/egl/qegl_p.h | 4 ++++ src/gui/egl/qeglproperties.cpp | 2 ++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/gui/egl/qegl.cpp b/src/gui/egl/qegl.cpp index 605b1e6..af3b79a 100644 --- a/src/gui/egl/qegl.cpp +++ b/src/gui/egl/qegl.cpp @@ -259,7 +259,7 @@ EGLConfig QEgl::defaultConfig(int devType, API api, ConfigOptions options) // Add paint engine requirements if (api == OpenVG) { -#ifndef QVG_SCISSOR_CLIP +#if !defined(QVG_SCISSOR_CLIP) && defined(EGL_ALPHA_MASK_SIZE) configAttribs.setValue(EGL_ALPHA_MASK_SIZE, 1); #endif } else { diff --git a/src/gui/egl/qegl_p.h b/src/gui/egl/qegl_p.h index c214e88..aa08934 100644 --- a/src/gui/egl/qegl_p.h +++ b/src/gui/egl/qegl_p.h @@ -65,6 +65,10 @@ QT_BEGIN_INCLUDE_NAMESPACE #else # include #endif +#if !defined(EGL_VERSION_1_2) +typedef unsigned int EGLenum; +typedef void *EGLClientBuffer; +#endif #else //types from egltypes.h for compiling stub without EGL headers diff --git a/src/gui/egl/qeglproperties.cpp b/src/gui/egl/qeglproperties.cpp index 3638de5..eeae06d 100644 --- a/src/gui/egl/qeglproperties.cpp +++ b/src/gui/egl/qeglproperties.cpp @@ -241,8 +241,10 @@ void QEglProperties::setRenderableType(QEgl::API api) // reductions in complexity are possible. bool QEglProperties::reduceConfiguration() { +#ifdef EGL_SWAP_BEHAVIOR if (value(EGL_SWAP_BEHAVIOR) != EGL_DONT_CARE) removeValue(EGL_SWAP_BEHAVIOR); +#endif #ifdef EGL_VG_ALPHA_FORMAT_PRE_BIT // For OpenVG, we sometimes try to create a surface using a pre-multiplied format. If we can't -- cgit v0.12 From 90c8a68eef4a87209279f4c528c540efe6525384 Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Mon, 13 Sep 2010 10:54:25 +1000 Subject: Ensure flickable velocity is updated when view is moved by setCurrentIndex Task-number: QTBUG-13543 --- src/declarative/graphicsitems/qdeclarativeflickable.cpp | 6 +++--- src/declarative/graphicsitems/qdeclarativeflickable_p_p.h | 1 + src/declarative/graphicsitems/qdeclarativegridview.cpp | 2 ++ src/declarative/graphicsitems/qdeclarativelistview.cpp | 2 ++ 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/declarative/graphicsitems/qdeclarativeflickable.cpp b/src/declarative/graphicsitems/qdeclarativeflickable.cpp index 062bbfb..c0b664f 100644 --- a/src/declarative/graphicsitems/qdeclarativeflickable.cpp +++ b/src/declarative/graphicsitems/qdeclarativeflickable.cpp @@ -128,8 +128,8 @@ QDeclarativeFlickablePrivate::QDeclarativeFlickablePrivate() , flickingHorizontally(false), flickingVertically(false) , hMoved(false), vMoved(false) , movingHorizontally(false), movingVertically(false) - , stealMouse(false), pressed(false) - , interactive(true), deceleration(500), maxVelocity(2000), reportedVelocitySmoothing(100) + , stealMouse(false), pressed(false), interactive(true), calcVelocity(false) + , deceleration(500), maxVelocity(2000), reportedVelocitySmoothing(100) , delayedPressEvent(0), delayedPressTarget(0), pressDelay(0), fixupDuration(600) , vTime(0), visibleArea(0) , flickableDirection(QDeclarativeFlickable::AutoFlickDirection) @@ -981,7 +981,7 @@ void QDeclarativeFlickable::viewportMoved() qreal prevY = d->lastFlickablePosition.x(); qreal prevX = d->lastFlickablePosition.y(); d->velocityTimeline.clear(); - if (d->pressed) { + if (d->pressed || d->calcVelocity) { int elapsed = QDeclarativeItemPrivate::restart(d->velocityTime); if (elapsed > 0) { qreal horizontalVelocity = (prevX - d->hData.move.value()) * 1000 / elapsed; diff --git a/src/declarative/graphicsitems/qdeclarativeflickable_p_p.h b/src/declarative/graphicsitems/qdeclarativeflickable_p_p.h index c398faa..2da034c 100644 --- a/src/declarative/graphicsitems/qdeclarativeflickable_p_p.h +++ b/src/declarative/graphicsitems/qdeclarativeflickable_p_p.h @@ -141,6 +141,7 @@ public: bool stealMouse : 1; bool pressed : 1; bool interactive : 1; + bool calcVelocity : 1; QElapsedTimer lastPosTime; QPointF lastPos; QPointF pressPos; diff --git a/src/declarative/graphicsitems/qdeclarativegridview.cpp b/src/declarative/graphicsitems/qdeclarativegridview.cpp index a0faf14..6a99733 100644 --- a/src/declarative/graphicsitems/qdeclarativegridview.cpp +++ b/src/declarative/graphicsitems/qdeclarativegridview.cpp @@ -2241,7 +2241,9 @@ void QDeclarativeGridView::trackedPositionChanged() } if (viewPos != pos) { cancelFlick(); + d->calcVelocity = true; d->setPosition(pos); + d->calcVelocity = false; } } } diff --git a/src/declarative/graphicsitems/qdeclarativelistview.cpp b/src/declarative/graphicsitems/qdeclarativelistview.cpp index 177c5b3..ae504aa 100644 --- a/src/declarative/graphicsitems/qdeclarativelistview.cpp +++ b/src/declarative/graphicsitems/qdeclarativelistview.cpp @@ -2732,7 +2732,9 @@ void QDeclarativeListView::trackedPositionChanged() } if (viewPos != pos) { cancelFlick(); + d->calcVelocity = true; d->setPosition(pos); + d->calcVelocity = false; } } } -- cgit v0.12 From 491f5f9cc6da171155c613295018b9d54bb683c9 Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Mon, 13 Sep 2010 11:02:24 +1000 Subject: Add test for view velocity update on setCurrentIndex() Task-number: QTBUG-13543 --- .../auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp | 2 ++ .../auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp | 2 ++ 2 files changed, 4 insertions(+) diff --git a/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp b/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp index d4d8bf6..5fd373c 100644 --- a/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp +++ b/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp @@ -604,6 +604,8 @@ void tst_QDeclarativeGridView::currentIndex() // no wrap gridview->setCurrentIndex(0); QCOMPARE(gridview->currentIndex(), 0); + // confirm that the velocity is updated + QTRY_VERIFY(gridview->verticalVelocity() != 0.0); gridview->moveCurrentIndexUp(); QCOMPARE(gridview->currentIndex(), 0); diff --git a/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp b/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp index e4b59a7..cd17fad 100644 --- a/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp +++ b/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp @@ -1016,6 +1016,8 @@ void tst_QDeclarativeListView::currentIndex() // no wrap listview->setCurrentIndex(0); QCOMPARE(listview->currentIndex(), 0); + // confirm that the velocity is updated + QTRY_VERIFY(listview->verticalVelocity() != 0.0); listview->incrementCurrentIndex(); QCOMPARE(listview->currentIndex(), 1); -- cgit v0.12 From ca36badc8925788e06910fab5200633d40e0f328 Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Mon, 13 Sep 2010 15:16:57 +1000 Subject: When onDoubleClicked: is handled don't emit a second onPressed/onClicked Task-number: QTBUG-12250 Reviewed-by: Michael Brasser --- .../graphicsitems/qdeclarativemousearea.cpp | 17 +++++++----- .../graphicsitems/qdeclarativemousearea_p_p.h | 6 ++++ .../qdeclarativemousearea/data/doubleclick.qml | 14 ++++++++++ .../tst_qdeclarativemousearea.cpp | 32 ++++++++++++++++++++++ 4 files changed, 62 insertions(+), 7 deletions(-) create mode 100644 tests/auto/declarative/qdeclarativemousearea/data/doubleclick.qml diff --git a/src/declarative/graphicsitems/qdeclarativemousearea.cpp b/src/declarative/graphicsitems/qdeclarativemousearea.cpp index 5516611..4685e65 100644 --- a/src/declarative/graphicsitems/qdeclarativemousearea.cpp +++ b/src/declarative/graphicsitems/qdeclarativemousearea.cpp @@ -303,7 +303,9 @@ QDeclarativeMouseAreaPrivate::~QDeclarativeMouseAreaPrivate() The \l {MouseEvent}{mouse} parameter provides information about the click, including the x and y position of the release of the click, and whether the click was held. - The \e accepted property of the MouseEvent parameter is ignored in this handler. + If the \e accepted property of the \l {MouseEvent}{mouse} parameter is set to false + in the handler, the onPressed/onReleased/onClicked handlers will be called for the second + click; otherwise they are supressed. The accepted property defaults to true. */ /*! @@ -525,12 +527,13 @@ void QDeclarativeMouseArea::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *even if (!d->absorb) { QDeclarativeItem::mouseDoubleClickEvent(event); } else { - QDeclarativeItem::mouseDoubleClickEvent(event); - if (event->isAccepted()) { - // Only deliver the event if we have accepted the press. - d->saveEvent(event); - QDeclarativeMouseEvent me(d->lastPos.x(), d->lastPos.y(), d->lastButton, d->lastButtons, d->lastModifiers, true, false); - emit this->doubleClicked(&me); + d->saveEvent(event); + QDeclarativeMouseEvent me(d->lastPos.x(), d->lastPos.y(), d->lastButton, d->lastButtons, d->lastModifiers, true, false); + me.setAccepted(d->isDoubleClickConnected()); + emit this->doubleClicked(&me); + if (!me.isAccepted()) { + // Only deliver the press event if we haven't accepted the double click. + QDeclarativeItem::mouseDoubleClickEvent(event); } } } diff --git a/src/declarative/graphicsitems/qdeclarativemousearea_p_p.h b/src/declarative/graphicsitems/qdeclarativemousearea_p_p.h index cf9dc18..48a56d9 100644 --- a/src/declarative/graphicsitems/qdeclarativemousearea_p_p.h +++ b/src/declarative/graphicsitems/qdeclarativemousearea_p_p.h @@ -95,6 +95,12 @@ public: return QObjectPrivate::get(q)->isSignalConnected(idx); } + bool isDoubleClickConnected() { + Q_Q(QDeclarativeMouseArea); + static int idx = QObjectPrivate::get(q)->signalIndex("doubleClicked(QDeclarativeMouseEvent*)"); + return QObjectPrivate::get(q)->isSignalConnected(idx); + } + bool absorb : 1; bool hovered : 1; bool pressed : 1; diff --git a/tests/auto/declarative/qdeclarativemousearea/data/doubleclick.qml b/tests/auto/declarative/qdeclarativemousearea/data/doubleclick.qml new file mode 100644 index 0000000..9cddf1b --- /dev/null +++ b/tests/auto/declarative/qdeclarativemousearea/data/doubleclick.qml @@ -0,0 +1,14 @@ +import Qt 4.7 + +Item { + id: root + property int clicked: 0 + property int doubleClicked: 0 + + MouseArea { + width: 200; height: 200 + onClicked: { root.clicked++ } + onDoubleClicked: { root.doubleClicked++ } + } +} + diff --git a/tests/auto/declarative/qdeclarativemousearea/tst_qdeclarativemousearea.cpp b/tests/auto/declarative/qdeclarativemousearea/tst_qdeclarativemousearea.cpp index c9bb467..e4ec01f 100644 --- a/tests/auto/declarative/qdeclarativemousearea/tst_qdeclarativemousearea.cpp +++ b/tests/auto/declarative/qdeclarativemousearea/tst_qdeclarativemousearea.cpp @@ -62,6 +62,7 @@ private slots: void updateMouseAreaPosOnResize(); void noOnClickedWithPressAndHold(); void onMousePressRejected(); + void doubleClick(); private: QDeclarativeView *createView(); @@ -390,6 +391,37 @@ void tst_QDeclarativeMouseArea::onMousePressRejected() QVERIFY(!canvas->rootObject()->property("mr2_released").toBool()); } +void tst_QDeclarativeMouseArea::doubleClick() +{ + QDeclarativeView *canvas = createView(); + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/doubleclick.qml")); + canvas->show(); + canvas->setFocus(); + QVERIFY(canvas->rootObject() != 0); + + QGraphicsScene *scene = canvas->scene(); + QGraphicsSceneMouseEvent pressEvent(QEvent::GraphicsSceneMousePress); + pressEvent.setScenePos(QPointF(100, 100)); + pressEvent.setButton(Qt::LeftButton); + pressEvent.setButtons(Qt::LeftButton); + QApplication::sendEvent(scene, &pressEvent); + + QGraphicsSceneMouseEvent releaseEvent(QEvent::GraphicsSceneMouseRelease); + releaseEvent.setScenePos(QPointF(100, 100)); + releaseEvent.setButton(Qt::LeftButton); + releaseEvent.setButtons(Qt::LeftButton); + QApplication::sendEvent(scene, &releaseEvent); + + QGraphicsSceneMouseEvent dblClickEvent(QEvent::GraphicsSceneMouseDoubleClick); + dblClickEvent.setScenePos(QPointF(100, 100)); + dblClickEvent.setButton(Qt::LeftButton); + dblClickEvent.setButtons(Qt::LeftButton); + QApplication::sendEvent(scene, &dblClickEvent); + + QCOMPARE(canvas->rootObject()->property("clicked").toInt(), 1); + QCOMPARE(canvas->rootObject()->property("doubleClicked").toInt(), 1); +} + QTEST_MAIN(tst_QDeclarativeMouseArea) #include "tst_qdeclarativemousearea.moc" -- cgit v0.12 From 7275dc27b1bbdb897a94caaf31da2c78c5abfa8c Mon Sep 17 00:00:00 2001 From: Jason Barron Date: Mon, 13 Sep 2010 11:40:24 +0200 Subject: Remove compiler warning in qapplication.cpp. Fix a warning since we were deleting the graphics_system instance, but the type was only forward declared. Reviewed-by: Samuel --- src/gui/kernel/qapplication.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp index d6fb630..caeeeb9 100644 --- a/src/gui/kernel/qapplication.cpp +++ b/src/gui/kernel/qapplication.cpp @@ -65,6 +65,7 @@ #include "qcolormap.h" #include "qdebug.h" #include "private/qgraphicssystemfactory_p.h" +#include "private/qgraphicssystem_p.h" #include "private/qstylesheetstyle_p.h" #include "private/qstyle_p.h" #include "qmessagebox.h" -- cgit v0.12 From c69469ff12eeed23584b5c3b15978a7e75d01df1 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Mon, 13 Sep 2010 14:05:54 +0200 Subject: Linux: Fix mispositioned, misclipped glyphs in large fonts (QStaticText) While drawText() will use the path fallback for large fonts, and never hit this problem, QStaticText will draw the large fonts into the glyph cache. This broke when the freetype (or any other font engine) falls back to the generic implementation of alphaMapForGlyph() which uses path drawing. The problem was that alphaMapForGlyph() is not supposed to contain the bearing of the glyph, only the actual pixels. Since QFontEngine did not honor this contract, we would sample the wrong area in the glyph cache to get the glyph image. Task-number: QTBUG-12540 Reviewed-by: Gunnar --- src/gui/text/qfontengine.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/text/qfontengine.cpp b/src/gui/text/qfontengine.cpp index 1e8461f..a3f4d8a 100644 --- a/src/gui/text/qfontengine.cpp +++ b/src/gui/text/qfontengine.cpp @@ -631,10 +631,10 @@ QImage QFontEngine::alphaMapForGlyph(glyph_t glyph) if (glyph_width <= 0 || glyph_height <= 0) return QImage(); QFixedPoint pt; - pt.x = 0; + pt.x = -glyph_x; pt.y = -glyph_y; // the baseline QPainterPath path; - QImage im(glyph_width + qAbs(glyph_x) + 4, glyph_height, QImage::Format_ARGB32_Premultiplied); + QImage im(glyph_width + 4, glyph_height, QImage::Format_ARGB32_Premultiplied); im.fill(Qt::transparent); QPainter p(&im); p.setRenderHint(QPainter::Antialiasing); -- cgit v0.12 From 2acdc634ee895af4a9738c0f6c2496e388afba38 Mon Sep 17 00:00:00 2001 From: Jani Hautakangas Date: Mon, 13 Sep 2010 13:13:01 +0300 Subject: When using complex transformations rendering goes easily off by one pixel. This happens because of differences in OpenVG and Qt pixel center point handling. Currently there is no easy generic way to adjust Qt pixels to match OpenVG. This patch adjusts pixels for simple affine transformations by rounding them. Task-number: QT-3791 Reviewed-by: Jason Barron --- src/openvg/qpaintengine_vg.cpp | 158 ++++++++++++++++++++++++----------------- 1 file changed, 92 insertions(+), 66 deletions(-) diff --git a/src/openvg/qpaintengine_vg.cpp b/src/openvg/qpaintengine_vg.cpp index 75e5a60..1b0c5e8 100644 --- a/src/openvg/qpaintengine_vg.cpp +++ b/src/openvg/qpaintengine_vg.cpp @@ -196,7 +196,9 @@ public: #endif QTransform transform; // Currently active transform. - bool simpleTransform; // True if the transform is simple (non-projective). + bool affineTransform; // True if the transform is non-projective. + bool simpleTransform; // True if the transform is simple translate + // or 0, 90, 180, and 270 degree rotation qreal penScale; // Pen scaling factor from "transform". QTransform pathTransform; // Calculated VG path transformation. @@ -372,6 +374,7 @@ void QVGPaintEnginePrivate::init() roundRectPath = 0; #endif + affineTransform = true; simpleTransform = true; pathTransformSet = false; penScale = 1.0; @@ -524,12 +527,59 @@ void QVGPaintEnginePrivate::setTransform vgLoadMatrix(mat); } +// Determine if a co-ordinate transform is simple enough to allow +// rectangle-based clipping with vgMask() and rounding translation +// to integers. Simple transforms most often result from origin translations. +static inline bool transformIsSimple(const QTransform& transform) +{ + QTransform::TransformationType type = transform.type(); + if (type == QTransform::TxNone || type == QTransform::TxTranslate) { + return true; + } else if (type == QTransform::TxScale) { + // Check for 0 and 180 degree rotations. + // (0 might happen after 4 rotations of 90 degrees). + qreal m11 = transform.m11(); + qreal m12 = transform.m12(); + qreal m21 = transform.m21(); + qreal m22 = transform.m22(); + if (m12 == 0.0f && m21 == 0.0f) { + if (m11 == 1.0f && m22 == 1.0f) + return true; // 0 degrees + else if (m11 == -1.0f && m22 == -1.0f) + return true; // 180 degrees. + if(m11 == 1.0f && m22 == -1.0f) + return true; // 0 degrees inverted y. + else if(m11 == -1.0f && m22 == 1.0f) + return true; // 180 degrees inverted y. + } + } else if (type == QTransform::TxRotate) { + // Check for 90, and 270 degree rotations. + qreal m11 = transform.m11(); + qreal m12 = transform.m12(); + qreal m21 = transform.m21(); + qreal m22 = transform.m22(); + if (m11 == 0.0f && m22 == 0.0f) { + if (m12 == 1.0f && m21 == -1.0f) + return true; // 90 degrees. + else if (m12 == -1.0f && m21 == 1.0f) + return true; // 270 degrees. + else if (m12 == -1.0f && m21 == -1.0f) + return true; // 90 degrees inverted y. + else if (m12 == 1.0f && m21 == 1.0f) + return true; // 270 degrees inverted y. + } + } + return false; +} + Q_DECL_IMPORT extern bool qt_scaleForTransform(const QTransform &transform, qreal *scale); void QVGPaintEnginePrivate::updateTransform(QPaintDevice *pdev) { VGfloat devh = pdev->height(); + simpleTransform = transformIsSimple(transform); + // Construct the VG transform by combining the Qt transform with // the following viewport transformation: // | 1 0 0 | @@ -552,9 +602,9 @@ void QVGPaintEnginePrivate::updateTransform(QPaintDevice *pdev) // so we will have to convert the co-ordinates ourselves. // Change the matrix to just the viewport transformation. pathTransform = viewport; - simpleTransform = false; + affineTransform = false; } else { - simpleTransform = true; + affineTransform = true; } pathTransformSet = false; @@ -583,7 +633,7 @@ VGPath QVGPaintEnginePrivate::vectorPathToVGPath(const QVectorPath& path) // Size is sufficient segments for drawRoundedRect() paths. QVarLengthArray segments; - if (sizeof(qreal) == sizeof(VGfloat) && elements && simpleTransform) { + if (sizeof(qreal) == sizeof(VGfloat) && elements && affineTransform) { // If Qt was compiled with qreal the same size as VGfloat, // then convert the segment types and use the incoming // points array directly. @@ -618,7 +668,7 @@ VGPath QVGPaintEnginePrivate::vectorPathToVGPath(const QVectorPath& path) int curvePos = 0; QPointF temp; - if (elements && simpleTransform) { + if (elements && affineTransform) { // Convert the members of the element array. for (int i = 0; i < count; ++i) { switch (elements[i]) { @@ -662,7 +712,7 @@ VGPath QVGPaintEnginePrivate::vectorPathToVGPath(const QVectorPath& path) } points += 2; } - } else if (elements && !simpleTransform) { + } else if (elements && !affineTransform) { // Convert the members of the element array after applying the // current transform to the path locally. for (int i = 0; i < count; ++i) { @@ -711,7 +761,7 @@ VGPath QVGPaintEnginePrivate::vectorPathToVGPath(const QVectorPath& path) } points += 2; } - } else if (count > 0 && simpleTransform) { + } else if (count > 0 && affineTransform) { // If there is no element array, then the path is assumed // to be a MoveTo followed by several LineTo's. coords.append(points[0]); @@ -724,7 +774,7 @@ VGPath QVGPaintEnginePrivate::vectorPathToVGPath(const QVectorPath& path) segments.append(VG_LINE_TO_ABS); --count; } - } else if (count > 0 && !simpleTransform) { + } else if (count > 0 && !affineTransform) { // Convert a simple path, and apply the transform locally. temp = transform.map(QPointF(points[0], points[1])); coords.append(temp.x()); @@ -785,7 +835,7 @@ VGPath QVGPaintEnginePrivate::painterPathToVGPath(const QPainterPath& path) bool haveStart = false; bool haveEnd = false; - if (simpleTransform) { + if (affineTransform) { // Convert the members of the element array. for (int i = 0; i < count; ++i) { switch (elements[i].type) { @@ -1560,36 +1610,6 @@ void QVGPaintEngine::stroke(const QVectorPath &path, const QPen &pen) vgDestroyPath(vgpath); } -// Determine if a co-ordinate transform is simple enough to allow -// rectangle-based clipping with vgMask(). Simple transforms most -// often result from origin translations. -static inline bool clipTransformIsSimple(const QTransform& transform) -{ - QTransform::TransformationType type = transform.type(); - if (type == QTransform::TxNone || type == QTransform::TxTranslate) - return true; - if (type == QTransform::TxRotate) { - // Check for 0, 90, 180, and 270 degree rotations. - // (0 might happen after 4 rotations of 90 degrees). - qreal m11 = transform.m11(); - qreal m12 = transform.m12(); - qreal m21 = transform.m21(); - qreal m22 = transform.m22(); - if (m11 == 0.0f && m22 == 0.0f) { - if (m12 == 1.0f && m21 == -1.0f) - return true; // 90 degrees. - else if (m12 == -1.0f && m21 == 1.0f) - return true; // 270 degrees. - } else if (m12 == 0.0f && m21 == 0.0f) { - if (m11 == -1.0f && m22 == -1.0f) - return true; // 180 degrees. - else if (m11 == 1.0f && m22 == 1.0f) - return true; // 0 degrees. - } - } - return false; -} - #if defined(QVG_SCISSOR_CLIP) void QVGPaintEngine::clip(const QVectorPath &path, Qt::ClipOperation op) @@ -1607,7 +1627,7 @@ void QVGPaintEngine::clip(const QVectorPath &path, Qt::ClipOperation op) // We aren't using masking, so handle simple QRectF's only. if (path.shape() == QVectorPath::RectangleHint && - path.elementCount() == 4 && clipTransformIsSimple(d->transform)) { + path.elementCount() == 4 && d->simpleTransform) { // Clipping region that resulted from QPainter::setClipRect(QRectF). // Convert it into a QRect and apply. const qreal *points = path.points(); @@ -1757,7 +1777,7 @@ void QVGPaintEngine::clip(const QVectorPath &path, Qt::ClipOperation op) // We don't have vgRenderToMask(), so handle simple QRectF's only. if (path.shape() == QVectorPath::RectangleHint && - path.elementCount() == 4 && clipTransformIsSimple(d->transform)) { + path.elementCount() == 4 && d->simpleTransform) { // Clipping region that resulted from QPainter::setClipRect(QRectF). // Convert it into a QRect and apply. const qreal *points = path.points(); @@ -1809,7 +1829,7 @@ void QVGPaintEngine::clip(const QRect &rect, Qt::ClipOperation op) d->dirty |= QPaintEngine::DirtyClipRegion; // If we have a non-simple transform, then use path-based clipping. - if (op != Qt::NoClip && !clipTransformIsSimple(d->transform)) { + if (op != Qt::NoClip && !d->simpleTransform) { QPaintEngineEx::clip(rect, op); return; } @@ -1928,7 +1948,7 @@ void QVGPaintEngine::clip(const QRegion ®ion, Qt::ClipOperation op) d->dirty |= QPaintEngine::DirtyClipRegion; // If we have a non-simple transform, then use path-based clipping. - if (op != Qt::NoClip && !clipTransformIsSimple(d->transform)) { + if (op != Qt::NoClip && !d->simpleTransform) { QPaintEngineEx::clip(region, op); return; } @@ -2505,14 +2525,14 @@ void QVGPaintEngine::fillRect(const QRectF &rect, const QBrush &brush) // Check to see if we can use vgClear() for faster filling. if (brush.style() == Qt::SolidPattern && brush.isOpaque() && - clipTransformIsSimple(d->transform) && d->opacity == 1.0f && + d->simpleTransform && d->opacity == 1.0f && clearRect(rect, brush.color())) { return; } #if !defined(QVG_NO_MODIFY_PATH) VGfloat coords[8]; - if (d->simpleTransform) { + if (d->affineTransform) { coords[0] = rect.x(); coords[1] = rect.y(); coords[2] = rect.x() + rect.width(); @@ -2547,14 +2567,14 @@ void QVGPaintEngine::fillRect(const QRectF &rect, const QColor &color) Q_D(QVGPaintEngine); // Check to see if we can use vgClear() for faster filling. - if (clipTransformIsSimple(d->transform) && d->opacity == 1.0f && color.alpha() == 255 && + if (d->simpleTransform && d->opacity == 1.0f && color.alpha() == 255 && clearRect(rect, color)) { return; } #if !defined(QVG_NO_MODIFY_PATH) VGfloat coords[8]; - if (d->simpleTransform) { + if (d->affineTransform) { coords[0] = rect.x(); coords[1] = rect.y(); coords[2] = rect.x() + rect.width(); @@ -2587,7 +2607,7 @@ void QVGPaintEngine::fillRect(const QRectF &rect, const QColor &color) void QVGPaintEngine::drawRoundedRect(const QRectF &rect, qreal xrad, qreal yrad, Qt::SizeMode mode) { Q_D(QVGPaintEngine); - if (d->simpleTransform) { + if (d->affineTransform) { QVGPainterState *s = state(); VGPath vgpath = d->roundedRectPath(rect, xrad, yrad, mode); d->draw(vgpath, s->pen, s->brush); @@ -2606,7 +2626,7 @@ void QVGPaintEngine::drawRects(const QRect *rects, int rectCount) QVGPainterState *s = state(); for (int i = 0; i < rectCount; ++i, ++rects) { VGfloat coords[8]; - if (d->simpleTransform) { + if (d->affineTransform) { coords[0] = rects->x(); coords[1] = rects->y(); coords[2] = rects->x() + rects->width(); @@ -2647,7 +2667,7 @@ void QVGPaintEngine::drawRects(const QRectF *rects, int rectCount) QVGPainterState *s = state(); for (int i = 0; i < rectCount; ++i, ++rects) { VGfloat coords[8]; - if (d->simpleTransform) { + if (d->affineTransform) { coords[0] = rects->x(); coords[1] = rects->y(); coords[2] = rects->x() + rects->width(); @@ -2685,7 +2705,7 @@ void QVGPaintEngine::drawLines(const QLine *lines, int lineCount) QVGPainterState *s = state(); for (int i = 0; i < lineCount; ++i, ++lines) { VGfloat coords[4]; - if (d->simpleTransform) { + if (d->affineTransform) { coords[0] = lines->x1(); coords[1] = lines->y1(); coords[2] = lines->x2(); @@ -2713,7 +2733,7 @@ void QVGPaintEngine::drawLines(const QLineF *lines, int lineCount) QVGPainterState *s = state(); for (int i = 0; i < lineCount; ++i, ++lines) { VGfloat coords[4]; - if (d->simpleTransform) { + if (d->affineTransform) { coords[0] = lines->x1(); coords[1] = lines->y1(); coords[2] = lines->x2(); @@ -2739,7 +2759,7 @@ void QVGPaintEngine::drawEllipse(const QRectF &r) // Based on the description of vguEllipse() in the OpenVG specification. // We don't use vguEllipse(), to avoid unnecessary library dependencies. Q_D(QVGPaintEngine); - if (d->simpleTransform) { + if (d->affineTransform) { QVGPainterState *s = state(); VGPath path = vgCreatePath(VG_PATH_FORMAT_STANDARD, VG_PATH_DATATYPE_F, @@ -2812,7 +2832,7 @@ void QVGPaintEngine::drawPoints(const QPointF *points, int pointCount) for (int i = 0; i < pointCount; ++i, ++points) { VGfloat coords[4]; - if (d->simpleTransform) { + if (d->affineTransform) { coords[0] = points->x(); coords[1] = points->y(); coords[2] = coords[0]; @@ -2846,7 +2866,7 @@ void QVGPaintEngine::drawPoints(const QPoint *points, int pointCount) for (int i = 0; i < pointCount; ++i, ++points) { VGfloat coords[4]; - if (d->simpleTransform) { + if (d->affineTransform) { coords[0] = points->x(); coords[1] = points->y(); coords[2] = coords[0]; @@ -2880,7 +2900,7 @@ void QVGPaintEngine::drawPolygon(const QPointF *points, int pointCount, PolygonD QVarLengthArray coords; QVarLengthArray segments; for (int i = 0; i < pointCount; ++i, ++points) { - if (d->simpleTransform) { + if (d->affineTransform) { coords.append(points->x()); coords.append(points->y()); } else { @@ -2927,7 +2947,7 @@ void QVGPaintEngine::drawPolygon(const QPoint *points, int pointCount, PolygonDr QVarLengthArray coords; QVarLengthArray segments; for (int i = 0; i < pointCount; ++i, ++points) { - if (d->simpleTransform) { + if (d->affineTransform) { coords.append(points->x()); coords.append(points->y()); } else { @@ -2962,7 +2982,7 @@ void QVGPaintEngine::drawPolygon(const QPoint *points, int pointCount, PolygonDr void QVGPaintEnginePrivate::setImageOptions() { - if (opacity != 1.0f && simpleTransform) { + if (opacity != 1.0f && affineTransform) { if (opacity != paintOpacity) { VGfloat values[4]; values[0] = 1.0f; @@ -3009,7 +3029,10 @@ static void drawVGImage(QVGPaintEnginePrivate *d, QTransform transform(d->imageTransform); VGfloat scaleX = sr.width() == 0.0f ? 0.0f : r.width() / sr.width(); VGfloat scaleY = sr.height() == 0.0f ? 0.0f : r.height() / sr.height(); - transform.translate(r.x(), r.y()); + if (d->simpleTransform) + transform.translate(qRound(r.x()), qRound(r.y())); + else + transform.translate(r.x(), r.y()); transform.scale(scaleX, scaleY); d->setTransform(VG_MATRIX_IMAGE_USER_TO_SURFACE, transform); @@ -3027,7 +3050,10 @@ static void drawVGImage(QVGPaintEnginePrivate *d, return; QTransform transform(d->imageTransform); - transform.translate(pos.x(), pos.y()); + if(d->simpleTransform) + transform.translate(qRound(pos.x()), qRound(pos.y())); + else + transform.translate(pos.x(), pos.y()); d->setTransform(VG_MATRIX_IMAGE_USER_TO_SURFACE, transform); d->setImageOptions(); @@ -3070,7 +3096,7 @@ void QVGPaintEngine::drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF QVGPixmapData *vgpd = static_cast(pd); if (!vgpd->isValid()) return; - if (d->simpleTransform) + if (d->affineTransform) drawVGImage(d, r, vgpd->toVGImage(), vgpd->size(), sr); else drawVGImage(d, r, vgpd->toVGImage(d->opacity), vgpd->size(), sr); @@ -3089,7 +3115,7 @@ void QVGPaintEngine::drawPixmap(const QPointF &pos, const QPixmap &pm) QVGPixmapData *vgpd = static_cast(pd); if (!vgpd->isValid()) return; - if (d->simpleTransform) + if (d->affineTransform) drawVGImage(d, pos, vgpd->toVGImage()); else drawVGImage(d, pos, vgpd->toVGImage(d->opacity)); @@ -3104,7 +3130,7 @@ void QVGPaintEngine::drawImage { Q_D(QVGPaintEngine); VGImage vgImg; - if (d->simpleTransform || d->opacity == 1.0f) + if (d->affineTransform || d->opacity == 1.0f) vgImg = toVGImageSubRect(image, sr.toRect(), flags); else vgImg = toVGImageWithOpacitySubRect(image, d->opacity, sr.toRect()); @@ -3127,7 +3153,7 @@ void QVGPaintEngine::drawImage(const QPointF &pos, const QImage &image) { Q_D(QVGPaintEngine); VGImage vgImg; - if (d->simpleTransform || d->opacity == 1.0f) + if (d->affineTransform || d->opacity == 1.0f) vgImg = toVGImage(image); else vgImg = toVGImageWithOpacity(image, d->opacity); @@ -3160,7 +3186,7 @@ void QVGPaintEngine::drawPixmapFragments(const QPainter::PixmapFragment *drawing QPixmapData *pd = pixmap.pixmapData(); if (!pd) return; // null QPixmap - if (pd->classId() != QPixmapData::OpenVGClass || !d->simpleTransform) { + if (pd->classId() != QPixmapData::OpenVGClass || !d->affineTransform) { QPaintEngineEx::drawPixmapFragments(drawingData, dataCount, pixmap, hints); return; } @@ -3385,7 +3411,7 @@ void QVGPaintEngine::drawTextItem(const QPointF &p, const QTextItem &textItem) // If we are not using a simple transform, then fall back // to the default Qt path stroking algorithm. - if (!d->simpleTransform) { + if (!d->affineTransform) { QPaintEngineEx::drawTextItem(p, textItem); return; } -- cgit v0.12 From 548155fec3a8b575215625d4fd767e63c20f6b84 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Nilsen?= Date: Mon, 13 Sep 2010 14:23:04 +0200 Subject: Assertion calledEmitUpdated fails in QGraphicsScene. Problem was that the 'updateAll' boolean was reset to 'false' when it really should have been unchanged. This happened when rendering the scene from outside the view's paint event (i.e. from QGraphicsView/Scene::render). We only want to reset 'updateAll' when triggering drawItems() from QGraphicsView::paintEvent, i.e. when the 'view' pointer != 0. Broke after commit: dda8a57c. Auto test included. Task-number: QT-3674 --- src/gui/graphicsview/qgraphicsscene.cpp | 2 +- tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp index 539685a..36a24db 100644 --- a/src/gui/graphicsview/qgraphicsscene.cpp +++ b/src/gui/graphicsview/qgraphicsscene.cpp @@ -5270,7 +5270,6 @@ void QGraphicsScene::drawItems(QPainter *painter, if (!d->unpolishedItems.isEmpty()) d->_q_polishItems(); - d->updateAll = false; QTransform viewTransform = painter->worldTransform(); Q_UNUSED(options); @@ -5279,6 +5278,7 @@ void QGraphicsScene::drawItems(QPainter *painter, QRegion *expose = 0; const quint32 oldRectAdjust = d->rectAdjust; if (view) { + d->updateAll = false; expose = &view->d_func()->exposedRegion; if (view->d_func()->optimizationFlags & QGraphicsView::DontAdjustForAntialiasing) d->rectAdjust = 1; diff --git a/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp b/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp index c145623..b8e729e 100644 --- a/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp +++ b/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp @@ -287,6 +287,7 @@ private slots: void taskQTBUG_5904_crashWithDeviceCoordinateCache(); void taskQT657_paintIntoCacheWithTransparentParts(); void taskQTBUG_7863_paintIntoCacheWithTransparentParts(); + void taskQT_3674_doNotCrash(); }; void tst_QGraphicsScene::initTestCase() @@ -4565,6 +4566,25 @@ void tst_QGraphicsScene::taskQTBUG_7863_paintIntoCacheWithTransparentParts() } } +void tst_QGraphicsScene::taskQT_3674_doNotCrash() +{ + QGraphicsScene scene; + + QGraphicsView view(&scene); + view.resize(200, 200); + + QPixmap pixmap(view.size()); + QPainter painter(&pixmap); + view.render(&painter); + painter.end(); + + scene.addItem(new QGraphicsWidget); + scene.setBackgroundBrush(Qt::green); + + QApplication::processEvents(); + QApplication::processEvents(); +} + void tst_QGraphicsScene::zeroScale() { //should not crash -- cgit v0.12 From 5d9fb4b86ffd604e65ade61a252037dca224af53 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Mon, 13 Sep 2010 15:50:40 +0200 Subject: tests: fix compilation with suncc Patch derived from the tasks Task-number: QTBUG-12997 Task-number: QTBUG-12984 Task-number: QTBUG-12985 Task-number: QTBUG-12990 Task-number: QTBUG-12999 --- tests/auto/moc/tst_moc.cpp | 8 ++++---- tests/auto/q3table/tst_q3table.cpp | 8 ++++---- tests/auto/qcompleter/tst_qcompleter.cpp | 4 ++-- tests/auto/qobject/tst_qobject.cpp | 8 ++++---- .../qsequentialanimationgroup/tst_qsequentialanimationgroup.cpp | 4 ++-- 5 files changed, 16 insertions(+), 16 deletions(-) diff --git a/tests/auto/moc/tst_moc.cpp b/tests/auto/moc/tst_moc.cpp index f9c3ccb..bb23f49 100644 --- a/tests/auto/moc/tst_moc.cpp +++ b/tests/auto/moc/tst_moc.cpp @@ -1077,10 +1077,10 @@ void tst_Moc::qprivateslots() class PrivatePropertyTest : public QObject { Q_OBJECT - Q_PROPERTY(int foo READ foo WRITE setFoo); - Q_PRIVATE_PROPERTY(d, int bar READ bar WRITE setBar); - Q_PRIVATE_PROPERTY(PrivatePropertyTest::d, int plop READ plop WRITE setPlop); - Q_PRIVATE_PROPERTY(PrivatePropertyTest::d_func(), int baz READ baz WRITE setBaz); + Q_PROPERTY(int foo READ foo WRITE setFoo) + Q_PRIVATE_PROPERTY(d, int bar READ bar WRITE setBar) + Q_PRIVATE_PROPERTY(PrivatePropertyTest::d, int plop READ plop WRITE setPlop) + Q_PRIVATE_PROPERTY(PrivatePropertyTest::d_func(), int baz READ baz WRITE setBaz) class MyDPointer { public: MyDPointer() : mBar(0), mPlop(0) {} diff --git a/tests/auto/q3table/tst_q3table.cpp b/tests/auto/q3table/tst_q3table.cpp index 90bf806..93de251 100644 --- a/tests/auto/q3table/tst_q3table.cpp +++ b/tests/auto/q3table/tst_q3table.cpp @@ -502,7 +502,7 @@ void tst_Q3Table::pageUpDownNavigation() void tst_Q3Table::simpleKeyboardNavigation() { QApplication::setActiveWindow(testWidget); - QTRY_COMPARE(QApplication::activeWindow(), testWidget); + QTRY_COMPARE(QApplication::activeWindow(), static_cast(testWidget)); QWidget *w; // Test for task #24726 @@ -1208,7 +1208,7 @@ void tst_Q3Table::editCheck() table.show(); QApplication::setActiveWindow(&table); QTest::qWaitForWindowShown(&table); - QTRY_COMPARE(QApplication::activeWindow(), &table); + QTRY_COMPARE(QApplication::activeWindow(), static_cast(&table)); table.setCurrentCell(0, 0); #ifdef WAITS QTest::qWait(50); @@ -1345,7 +1345,7 @@ void tst_Q3Table::valueChanged() testWidget->show(); QApplication::setActiveWindow(testWidget); QTest::qWaitForWindowShown(testWidget); - QTRY_COMPARE(QApplication::activeWindow(), testWidget); + QTRY_COMPARE(QApplication::activeWindow(), static_cast(testWidget)); #ifdef WAITS QTest::qWait(50); #endif @@ -1395,7 +1395,7 @@ void tst_Q3Table::dateTimeEdit() testWidget->show(); QApplication::setActiveWindow(testWidget); QTest::qWaitForWindowShown(testWidget); - QTRY_COMPARE(QApplication::activeWindow(), testWidget); + QTRY_COMPARE(QApplication::activeWindow(), static_cast(testWidget)); #ifdef WAITS QTest::qWait(50); #endif diff --git a/tests/auto/qcompleter/tst_qcompleter.cpp b/tests/auto/qcompleter/tst_qcompleter.cpp index a62720b..1590528 100644 --- a/tests/auto/qcompleter/tst_qcompleter.cpp +++ b/tests/auto/qcompleter/tst_qcompleter.cpp @@ -1324,7 +1324,7 @@ void tst_QCompleter::task253125_lineEditCompletion() #endif QTest::qWait(10); QApplication::setActiveWindow(&edit); - QTRY_COMPARE(QApplication::activeWindow(), &edit); + QTRY_COMPARE(QApplication::activeWindow(), static_cast(&edit)); QTest::keyClick(&edit, 'i'); QCOMPARE(edit.completer()->currentCompletion(), QString("iota")); @@ -1362,7 +1362,7 @@ void tst_QCompleter::task247560_keyboardNavigation() QTest::qWait(10); QApplication::setActiveWindow(&edit); - QTRY_COMPARE(QApplication::activeWindow(), &edit); + QTRY_COMPARE(QApplication::activeWindow(), static_cast(&edit)); QTest::keyClick(&edit, 'r'); QTest::keyClick(edit.completer()->popup(), Qt::Key_Down); diff --git a/tests/auto/qobject/tst_qobject.cpp b/tests/auto/qobject/tst_qobject.cpp index 08b7c19..5f6262e 100644 --- a/tests/auto/qobject/tst_qobject.cpp +++ b/tests/auto/qobject/tst_qobject.cpp @@ -3243,16 +3243,16 @@ void tst_QObject::overloads() QCOMPARE(obj2.s_num, 101); emit obj1.sig(&obj2, &obj3); //this signal is connected QCOMPARE(obj1.s_num, 11); - QCOMPARE(obj1.o1_obj, &obj2); + QCOMPARE(obj1.o1_obj, (QObject *)&obj2); QCOMPARE(obj1.o2_obj, &obj3); QCOMPARE(obj1.o3_obj, (QObject *)0); //default arg of the signal - QCOMPARE(obj1.o4_obj, qApp); //default arg of the slot + QCOMPARE(obj1.o4_obj, (QObject *)qApp); //default arg of the slot QCOMPARE(obj2.s_num, 111); - QCOMPARE(obj2.o1_obj, &obj2); + QCOMPARE(obj2.o1_obj, (QObject *)&obj2); QCOMPARE(obj2.o2_obj, &obj3); QCOMPARE(obj2.o3_obj, (QObject *)0); //default arg of the signal - QCOMPARE(obj2.o4_obj, qApp); //default arg of the slot + QCOMPARE(obj2.o4_obj, (QObject *)qApp); //default arg of the slot } class ManySignals : public QObject diff --git a/tests/auto/qsequentialanimationgroup/tst_qsequentialanimationgroup.cpp b/tests/auto/qsequentialanimationgroup/tst_qsequentialanimationgroup.cpp index e154528..e16be8b 100644 --- a/tests/auto/qsequentialanimationgroup/tst_qsequentialanimationgroup.cpp +++ b/tests/auto/qsequentialanimationgroup/tst_qsequentialanimationgroup.cpp @@ -381,7 +381,7 @@ void tst_QSequentialAnimationGroup::setCurrentTimeWithUncontrolledAnimation() QCOMPARE(a1_s_o2->currentLoopTime(), 250); QCOMPARE(notTimeDriven->currentLoopTime(), 0); QCOMPARE(loopsForever->currentLoopTime(), 0); - QCOMPARE(group.currentAnimation(), notTimeDriven); + QCOMPARE(group.currentAnimation(), static_cast(notTimeDriven)); // Current time = 505 group.setCurrentTime(505); @@ -391,7 +391,7 @@ void tst_QSequentialAnimationGroup::setCurrentTimeWithUncontrolledAnimation() QCOMPARE(a1_s_o2->currentLoopTime(), 250); QCOMPARE(notTimeDriven->currentLoopTime(), 5); QCOMPARE(loopsForever->currentLoopTime(), 0); - QCOMPARE(group.currentAnimation(), notTimeDriven); + QCOMPARE(group.currentAnimation(), static_cast(notTimeDriven)); QCOMPARE(sequence->state(), QAnimationGroup::Stopped); QCOMPARE(a1_s_o1->state(), QAnimationGroup::Stopped); QCOMPARE(a1_s_o2->state(), QAnimationGroup::Stopped); -- cgit v0.12 From 52f82846e651d240f6e610f91bc63b3ee74b3d44 Mon Sep 17 00:00:00 2001 From: Benjamin Poulain Date: Fri, 10 Sep 2010 21:51:13 +0200 Subject: Remove the memory safety for the first scanline of the SSSE3 blending MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Memory is allocated on 16 bytes boundaries. We can do the aligned load without risking a invalid memory access. This simplify the code. Reviewed-by: Samuel Rødal --- src/gui/painting/qdrawhelper_ssse3.cpp | 75 ++-------------------------------- 1 file changed, 3 insertions(+), 72 deletions(-) diff --git a/src/gui/painting/qdrawhelper_ssse3.cpp b/src/gui/painting/qdrawhelper_ssse3.cpp index 4cb4089..fb5602e 100644 --- a/src/gui/painting/qdrawhelper_ssse3.cpp +++ b/src/gui/painting/qdrawhelper_ssse3.cpp @@ -79,69 +79,6 @@ inline static void blend_pixel(quint32 &dst, const quint32 src) } -#define BLEND_SOURCE_OVER_ARGB32_FIRST_ROW_SSSE3(dst, src, length, nullVector, half, one, colorMask, alphaMask) { \ - int x = 0; \ -\ - /* First, get dst aligned. */ \ - const int offsetToAlignOn16Bytes = (4 - ((reinterpret_cast(dst) >> 2) & 0x3)) & 0x3;\ - const int prologLength = qMin(length, offsetToAlignOn16Bytes);\ -\ - for (; x < prologLength; ++x) {\ - blend_pixel(dst[x], src[x]); \ - } \ -\ - const int minusOffsetToAlignSrcOn16Bytes = (reinterpret_cast(&(src[x])) >> 2) & 0x3;\ -\ - if (!minusOffsetToAlignSrcOn16Bytes) {\ - /* src is aligned, usual algorithm but with aligned operations.\ - See the SSE2 version for more documentation on the algorithm itself. */\ - const __m128i alphaShuffleMask = _mm_set_epi8(0xff,15,0xff,15,0xff,11,0xff,11,0xff,7,0xff,7,0xff,3,0xff,3);\ - for (; x < length-3; x += 4) { \ - const __m128i srcVector = _mm_load_si128((__m128i *)&src[x]); \ - const __m128i srcVectorAlpha = _mm_and_si128(srcVector, alphaMask); \ - if (_mm_movemask_epi8(_mm_cmpeq_epi32(srcVectorAlpha, alphaMask)) == 0xffff) { \ - _mm_store_si128((__m128i *)&dst[x], srcVector); \ - } else if (_mm_movemask_epi8(_mm_cmpeq_epi32(srcVectorAlpha, nullVector)) != 0xffff) { \ - __m128i alphaChannel = _mm_shuffle_epi8(srcVector, alphaShuffleMask); \ - alphaChannel = _mm_sub_epi16(one, alphaChannel); \ - const __m128i dstVector = _mm_load_si128((__m128i *)&dst[x]); \ - __m128i destMultipliedByOneMinusAlpha; \ - BYTE_MUL_SSE2(destMultipliedByOneMinusAlpha, dstVector, alphaChannel, colorMask, half); \ - const __m128i result = _mm_add_epi8(srcVector, destMultipliedByOneMinusAlpha); \ - _mm_store_si128((__m128i *)&dst[x], result); \ - } \ - } /* end for() */\ - } else if ((length - x) >= 8) {\ - /* We are at the first line, so "x - minusOffsetToAlignSrcOn16Bytes" could go before src, and\ - generate an invalid access. */\ -\ - /* We use two vectors to extract the src: prevLoaded for the first pixels, lastLoaded for the current pixels. */\ - __m128i srcVectorPrevLoaded;\ - if (minusOffsetToAlignSrcOn16Bytes > prologLength) {\ - /* We go forward 4 pixels to avoid reading before src. */\ - for (; x < prologLength + 4; ++x)\ - blend_pixel(dst[x], src[x]); \ - }\ - srcVectorPrevLoaded = _mm_load_si128((__m128i *)&src[x - minusOffsetToAlignSrcOn16Bytes]);\ - const int palignrOffset = minusOffsetToAlignSrcOn16Bytes << 2;\ -\ - const __m128i alphaShuffleMask = _mm_set_epi8(0xff,15,0xff,15,0xff,11,0xff,11,0xff,7,0xff,7,0xff,3,0xff,3);\ - switch (palignrOffset) {\ - case 4:\ - BLENDING_LOOP(4, length)\ - break;\ - case 8:\ - BLENDING_LOOP(8, length)\ - break;\ - case 12:\ - BLENDING_LOOP(12, length)\ - break;\ - }\ - }\ - for (; x < length; ++x) \ - blend_pixel(dst[x], src[x]); \ -} - // Basically blend src over dst with the const alpha defined as constAlphaVector. // nullVector, half, one, colorMask are constant accross the whole image/texture, and should be defined as: //const __m128i nullVector = _mm_set1_epi32(0); @@ -153,7 +90,7 @@ inline static void blend_pixel(quint32 &dst, const quint32 src) // The computation being done is: // result = s + d * (1-alpha) // with shortcuts if fully opaque or fully transparent. -#define BLEND_SOURCE_OVER_ARGB32_MAIN_SSSE3(dst, src, length, nullVector, half, one, colorMask, alphaMask) { \ +#define BLEND_SOURCE_OVER_ARGB32_SSSE3(dst, src, length, nullVector, half, one, colorMask, alphaMask) { \ int x = 0; \ \ /* First, get dst aligned. */ \ @@ -218,14 +155,8 @@ void qt_blend_argb32_on_argb32_ssse3(uchar *destPixels, int dbpl, const __m128i one = _mm_set1_epi16(0xff); const __m128i colorMask = _mm_set1_epi32(0x00ff00ff); - // We have to unrol the first row in order to deal with the load on unaligned data - // prior to the src pointer. - BLEND_SOURCE_OVER_ARGB32_FIRST_ROW_SSSE3(dst, src, w, nullVector, half, one, colorMask, alphaMask); - dst = (quint32 *)(((uchar *) dst) + dbpl); - src = (const quint32 *)(((const uchar *) src) + sbpl); - - for (int y = 1; y < h; ++y) { - BLEND_SOURCE_OVER_ARGB32_MAIN_SSSE3(dst, src, w, nullVector, half, one, colorMask, alphaMask); + for (int y = 0; y < h; ++y) { + BLEND_SOURCE_OVER_ARGB32_SSSE3(dst, src, w, nullVector, half, one, colorMask, alphaMask); dst = (quint32 *)(((uchar *) dst) + dbpl); src = (const quint32 *)(((const uchar *) src) + sbpl); } -- cgit v0.12 From faba2072ae1cf3661caceae2ef4f87cee485cf29 Mon Sep 17 00:00:00 2001 From: Benjamin Poulain Date: Mon, 13 Sep 2010 15:29:25 +0200 Subject: Use the stream operation for the SSE2 implementation of memfill32 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Writing the data of memfill() to a cacheline is unecessary because the data is not reused directly. We can use the stream operations to avoid the cache completely. When testing memfill32 separately, the function is twice as fast on Core2 and Atom. Reviewed-by: Samuel Rødal --- src/gui/painting/qdrawhelper_sse2.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/gui/painting/qdrawhelper_sse2.cpp b/src/gui/painting/qdrawhelper_sse2.cpp index ba2ba32..ac73958 100644 --- a/src/gui/painting/qdrawhelper_sse2.cpp +++ b/src/gui/painting/qdrawhelper_sse2.cpp @@ -266,10 +266,10 @@ void qt_memfill32_sse2(quint32 *dest, quint32 value, int count) int n = (count128 + 3) / 4; switch (count128 & 0x3) { - case 0: do { _mm_store_si128(dst128++, value128); - case 3: _mm_store_si128(dst128++, value128); - case 2: _mm_store_si128(dst128++, value128); - case 1: _mm_store_si128(dst128++, value128); + case 0: do { _mm_stream_si128(dst128++, value128); + case 3: _mm_stream_si128(dst128++, value128); + case 2: _mm_stream_si128(dst128++, value128); + case 1: _mm_stream_si128(dst128++, value128); } while (--n > 0); } -- cgit v0.12 From 90fd66a0c435e3b314327ab7126d2dc4e850fee8 Mon Sep 17 00:00:00 2001 From: Adenilson Cavalcanti da Silva Date: Mon, 13 Sep 2010 18:16:18 +0100 Subject: Fix compile error for runonphone on linux/gcc4.4.3 Make it build: - fixing missing prototype declaration - explicit inclusion header file Merge-request: 813 Reviewed-by: Shane Kearns --- tools/runonphone/ossignalconverter.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/runonphone/ossignalconverter.cpp b/tools/runonphone/ossignalconverter.cpp index 6554e9f..8566458 100644 --- a/tools/runonphone/ossignalconverter.cpp +++ b/tools/runonphone/ossignalconverter.cpp @@ -42,6 +42,7 @@ #include "ossignalconverter_p.h" #include #include +#include Q_GLOBAL_STATIC(OsSignalConverter, osSignalConverter); -- cgit v0.12