summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/accessible/accessible.pri2
-rw-r--r--src/gui/accessible/qaccessible.h2
-rw-r--r--src/gui/accessible/qaccessiblebridge.h1
-rw-r--r--src/gui/accessible/qaccessiblecache_p.h2
-rw-r--r--src/gui/accessible/qaccessibleobject.h1
-rw-r--r--src/gui/accessible/qaccessibleplugin.h1
-rw-r--r--src/gui/accessible/qplatformaccessibility.h4
-rw-r--r--src/gui/animation/qguivariantanimation.cpp5
-rw-r--r--src/gui/configure.json1095
-rw-r--r--src/gui/configure.pri67
-rw-r--r--src/gui/doc/src/qtgui.qdoc13
-rw-r--r--src/gui/gui.pro16
-rw-r--r--src/gui/image/image.pri14
-rw-r--r--src/gui/image/qbitmap.h1
-rw-r--r--src/gui/image/qbmphandler_p.h1
-rw-r--r--src/gui/image/qgifhandler.cpp1218
-rw-r--r--src/gui/image/qgifhandler.pri3
-rw-r--r--src/gui/image/qgifhandler_p.h105
-rw-r--r--src/gui/image/qicon.h2
-rw-r--r--src/gui/image/qicon_p.h2
-rw-r--r--src/gui/image/qiconengine.h2
-rw-r--r--src/gui/image/qiconengineplugin.h1
-rw-r--r--src/gui/image/qiconloader.cpp38
-rw-r--r--src/gui/image/qiconloader_p.h2
-rw-r--r--src/gui/image/qimage.cpp79
-rw-r--r--src/gui/image/qimage.h10
-rw-r--r--src/gui/image/qimage_conversions.cpp43
-rw-r--r--src/gui/image/qimage_darwin.mm141
-rw-r--r--src/gui/image/qimage_p.h5
-rw-r--r--src/gui/image/qimage_sse4.cpp2
-rw-r--r--src/gui/image/qimageiohandler.h1
-rw-r--r--src/gui/image/qimagepixmapcleanuphooks_p.h1
-rw-r--r--src/gui/image/qimagereader.cpp71
-rw-r--r--src/gui/image/qimagereader.h1
-rw-r--r--src/gui/image/qimagewriter.cpp25
-rw-r--r--src/gui/image/qimagewriter.h1
-rw-r--r--src/gui/image/qjpeghandler.cpp1144
-rw-r--r--src/gui/image/qjpeghandler.pri11
-rw-r--r--src/gui/image/qjpeghandler_p.h85
-rw-r--r--src/gui/image/qmovie.h3
-rw-r--r--src/gui/image/qpaintengine_pic_p.h10
-rw-r--r--src/gui/image/qpicture.h1
-rw-r--r--src/gui/image/qpicture_p.h1
-rw-r--r--src/gui/image/qpictureformatplugin.h1
-rw-r--r--src/gui/image/qpixmap.cpp14
-rw-r--r--src/gui/image/qpixmap.h1
-rw-r--r--src/gui/image/qpixmap_blitter.cpp12
-rw-r--r--src/gui/image/qpixmap_blitter_p.h1
-rw-r--r--src/gui/image/qpixmap_raster.cpp21
-rw-r--r--src/gui/image/qpixmap_raster_p.h2
-rw-r--r--src/gui/image/qpixmap_win.cpp170
-rw-r--r--src/gui/image/qpixmapcache.h1
-rw-r--r--src/gui/image/qpixmapcache_p.h1
-rw-r--r--src/gui/image/qplatformpixmap.h1
-rw-r--r--src/gui/image/qpnghandler.cpp49
-rw-r--r--src/gui/image/qpnghandler.pri4
-rw-r--r--src/gui/image/qpnghandler_p.h7
-rw-r--r--src/gui/image/qppmhandler_p.h7
-rw-r--r--src/gui/image/qxbmhandler_p.h7
-rw-r--r--src/gui/image/qxpmhandler.cpp2
-rw-r--r--src/gui/image/qxpmhandler_p.h7
-rw-r--r--src/gui/itemmodels/qstandarditemmodel.cpp48
-rw-r--r--src/gui/itemmodels/qstandarditemmodel.h1
-rw-r--r--src/gui/itemmodels/qstandarditemmodel_p.h1
-rw-r--r--src/gui/kernel/kernel.pri4
-rw-r--r--src/gui/kernel/qclipboard.cpp4
-rw-r--r--src/gui/kernel/qclipboard.h1
-rw-r--r--src/gui/kernel/qcursor.h1
-rw-r--r--src/gui/kernel/qcursor_p.h2
-rw-r--r--src/gui/kernel/qdnd.cpp35
-rw-r--r--src/gui/kernel/qdnd_p.h1
-rw-r--r--src/gui/kernel/qdrag.h1
-rw-r--r--src/gui/kernel/qevent.cpp139
-rw-r--r--src/gui/kernel/qevent.h31
-rw-r--r--src/gui/kernel/qevent_p.h7
-rw-r--r--src/gui/kernel/qgenericplugin.h1
-rw-r--r--src/gui/kernel/qgenericpluginfactory.h1
-rw-r--r--src/gui/kernel/qguiapplication.cpp52
-rw-r--r--src/gui/kernel/qguiapplication.h4
-rw-r--r--src/gui/kernel/qguiapplication_p.h1
-rw-r--r--src/gui/kernel/qhighdpiscaling.cpp9
-rw-r--r--src/gui/kernel/qhighdpiscaling_p.h10
-rw-r--r--src/gui/kernel/qinputdevicemanager_p.h1
-rw-r--r--src/gui/kernel/qinputdevicemanager_p_p.h1
-rw-r--r--src/gui/kernel/qinputmethod.h1
-rw-r--r--src/gui/kernel/qinputmethod_p.h1
-rw-r--r--src/gui/kernel/qkeymapper_p.h1
-rw-r--r--src/gui/kernel/qkeysequence.cpp10
-rw-r--r--src/gui/kernel/qkeysequence.h2
-rw-r--r--src/gui/kernel/qkeysequence_p.h1
-rw-r--r--src/gui/kernel/qoffscreensurface.h1
-rw-r--r--src/gui/kernel/qopenglcontext.cpp15
-rw-r--r--src/gui/kernel/qopenglcontext.h2
-rw-r--r--src/gui/kernel/qopenglcontext_p.h2
-rw-r--r--src/gui/kernel/qopenglwindow.cpp2
-rw-r--r--src/gui/kernel/qopenglwindow.h2
-rw-r--r--src/gui/kernel/qpaintdevicewindow.h1
-rw-r--r--src/gui/kernel/qpaintdevicewindow_p.h1
-rw-r--r--src/gui/kernel/qpalette.h1
-rw-r--r--src/gui/kernel/qpixelformat.h2
-rw-r--r--src/gui/kernel/qplatformclipboard.h2
-rw-r--r--src/gui/kernel/qplatformcursor.cpp10
-rw-r--r--src/gui/kernel/qplatformcursor.h9
-rw-r--r--src/gui/kernel/qplatformdialoghelper.cpp95
-rw-r--r--src/gui/kernel/qplatformdialoghelper.h70
-rw-r--r--src/gui/kernel/qplatformdrag.h2
-rw-r--r--src/gui/kernel/qplatformgraphicsbuffer.h1
-rw-r--r--src/gui/kernel/qplatformgraphicsbufferhelper.cpp4
-rw-r--r--src/gui/kernel/qplatformgraphicsbufferhelper.h1
-rw-r--r--src/gui/kernel/qplatforminputcontext.h1
-rw-r--r--src/gui/kernel/qplatforminputcontext_p.h1
-rw-r--r--src/gui/kernel/qplatforminputcontextfactory_p.h1
-rw-r--r--src/gui/kernel/qplatforminputcontextplugin_p.h1
-rw-r--r--src/gui/kernel/qplatformintegration.cpp2
-rw-r--r--src/gui/kernel/qplatformintegration.h4
-rw-r--r--src/gui/kernel/qplatformintegrationfactory_p.h1
-rw-r--r--src/gui/kernel/qplatformintegrationplugin.h1
-rw-r--r--src/gui/kernel/qplatformmenu.h4
-rw-r--r--src/gui/kernel/qplatformnativeinterface.h1
-rw-r--r--src/gui/kernel/qplatformoffscreensurface.h1
-rw-r--r--src/gui/kernel/qplatformopenglcontext.h1
-rw-r--r--src/gui/kernel/qplatformscreen.h1
-rw-r--r--src/gui/kernel/qplatformscreen_p.h2
-rw-r--r--src/gui/kernel/qplatformservices.h2
-rw-r--r--src/gui/kernel/qplatformsessionmanager.h1
-rw-r--r--src/gui/kernel/qplatformsharedgraphicscache.h1
-rw-r--r--src/gui/kernel/qplatformsurface.h1
-rw-r--r--src/gui/kernel/qplatformsystemtrayicon.h1
-rw-r--r--src/gui/kernel/qplatformtheme.cpp25
-rw-r--r--src/gui/kernel/qplatformtheme.h13
-rw-r--r--src/gui/kernel/qplatformtheme_p.h4
-rw-r--r--src/gui/kernel/qplatformthemefactory_p.h1
-rw-r--r--src/gui/kernel/qplatformthemeplugin.h1
-rw-r--r--src/gui/kernel/qplatformwindow.h1
-rw-r--r--src/gui/kernel/qplatformwindow_p.h1
-rw-r--r--src/gui/kernel/qrasterwindow.h1
-rw-r--r--src/gui/kernel/qscreen.cpp4
-rw-r--r--src/gui/kernel/qscreen.h1
-rw-r--r--src/gui/kernel/qscreen_p.h1
-rw-r--r--src/gui/kernel/qsessionmanager.h1
-rw-r--r--src/gui/kernel/qsessionmanager_p.h1
-rw-r--r--src/gui/kernel/qshapedpixmapdndwindow_p.h1
-rw-r--r--src/gui/kernel/qshortcutmap_p.h1
-rw-r--r--src/gui/kernel/qsimpledrag_p.h1
-rw-r--r--src/gui/kernel/qstylehints.cpp32
-rw-r--r--src/gui/kernel/qstylehints.h5
-rw-r--r--src/gui/kernel/qsurface.h1
-rw-r--r--src/gui/kernel/qsurfaceformat.h8
-rw-r--r--src/gui/kernel/qt_gui_pch.h2
-rw-r--r--src/gui/kernel/qtguiglobal.h (renamed from src/gui/image/qnativeimage.cpp)40
-rw-r--r--src/gui/kernel/qtguiglobal_p.h (renamed from src/gui/image/qnativeimage_p.h)38
-rw-r--r--src/gui/kernel/qtouchdevice.h1
-rw-r--r--src/gui/kernel/qtouchdevice_p.h1
-rw-r--r--src/gui/kernel/qwindow.h1
-rw-r--r--src/gui/kernel/qwindow_p.h1
-rw-r--r--src/gui/kernel/qwindowdefs.h2
-rw-r--r--src/gui/kernel/qwindowdefs_win.h11
-rw-r--r--src/gui/kernel/qwindowsysteminterface.cpp16
-rw-r--r--src/gui/kernel/qwindowsysteminterface.h6
-rw-r--r--src/gui/kernel/qwindowsysteminterface_p.h1
-rw-r--r--src/gui/math3d/qgenericmatrix.h1
-rw-r--r--src/gui/math3d/qmatrix4x4.h1
-rw-r--r--src/gui/math3d/qquaternion.h1
-rw-r--r--src/gui/math3d/qvector2d.h1
-rw-r--r--src/gui/math3d/qvector3d.h1
-rw-r--r--src/gui/math3d/qvector4d.h1
-rw-r--r--src/gui/opengl/opengl.pri17
-rw-r--r--src/gui/opengl/qopengl.h28
-rw-r--r--src/gui/opengl/qopengl2pexvertexarray_p.h1
-rw-r--r--src/gui/opengl/qopengl_p.h1
-rw-r--r--src/gui/opengl/qopenglbuffer.h2
-rw-r--r--src/gui/opengl/qopenglcustomshaderstage_p.h2
-rw-r--r--src/gui/opengl/qopengldebug.h2
-rw-r--r--src/gui/opengl/qopenglengineshadermanager.cpp4
-rw-r--r--src/gui/opengl/qopenglengineshadermanager_p.h1
-rw-r--r--src/gui/opengl/qopenglengineshadersource_p.h1
-rw-r--r--src/gui/opengl/qopenglextensions_p.h1
-rw-r--r--src/gui/opengl/qopenglextrafunctions.h2
-rw-r--r--src/gui/opengl/qopenglframebufferobject.cpp9
-rw-r--r--src/gui/opengl/qopenglframebufferobject.h2
-rw-r--r--src/gui/opengl/qopenglframebufferobject_p.h7
-rw-r--r--src/gui/opengl/qopenglfunctions.h2
-rw-r--r--src/gui/opengl/qopenglfunctions_1_0.cpp10
-rw-r--r--src/gui/opengl/qopenglfunctions_1_0.h2
-rw-r--r--src/gui/opengl/qopenglfunctions_1_1.cpp20
-rw-r--r--src/gui/opengl/qopenglfunctions_1_1.h2
-rw-r--r--src/gui/opengl/qopenglfunctions_1_2.cpp30
-rw-r--r--src/gui/opengl/qopenglfunctions_1_2.h2
-rw-r--r--src/gui/opengl/qopenglfunctions_1_3.cpp40
-rw-r--r--src/gui/opengl/qopenglfunctions_1_3.h2
-rw-r--r--src/gui/opengl/qopenglfunctions_1_4.cpp50
-rw-r--r--src/gui/opengl/qopenglfunctions_1_4.h2
-rw-r--r--src/gui/opengl/qopenglfunctions_1_5.cpp55
-rw-r--r--src/gui/opengl/qopenglfunctions_1_5.h2
-rw-r--r--src/gui/opengl/qopenglfunctions_2_0.cpp60
-rw-r--r--src/gui/opengl/qopenglfunctions_2_0.h2
-rw-r--r--src/gui/opengl/qopenglfunctions_2_1.cpp65
-rw-r--r--src/gui/opengl/qopenglfunctions_2_1.h2
-rw-r--r--src/gui/opengl/qopenglfunctions_3_0.cpp70
-rw-r--r--src/gui/opengl/qopenglfunctions_3_0.h2
-rw-r--r--src/gui/opengl/qopenglfunctions_3_1.cpp50
-rw-r--r--src/gui/opengl/qopenglfunctions_3_1.h2
-rw-r--r--src/gui/opengl/qopenglfunctions_3_2_compatibility.cpp80
-rw-r--r--src/gui/opengl/qopenglfunctions_3_2_compatibility.h2
-rw-r--r--src/gui/opengl/qopenglfunctions_3_2_core.cpp55
-rw-r--r--src/gui/opengl/qopenglfunctions_3_2_core.h2
-rw-r--r--src/gui/opengl/qopenglfunctions_3_3_compatibility.cpp90
-rw-r--r--src/gui/opengl/qopenglfunctions_3_3_compatibility.h2
-rw-r--r--src/gui/opengl/qopenglfunctions_3_3_core.cpp60
-rw-r--r--src/gui/opengl/qopenglfunctions_3_3_core.h2
-rw-r--r--src/gui/opengl/qopenglfunctions_4_0_compatibility.cpp95
-rw-r--r--src/gui/opengl/qopenglfunctions_4_0_compatibility.h2
-rw-r--r--src/gui/opengl/qopenglfunctions_4_0_core.cpp65
-rw-r--r--src/gui/opengl/qopenglfunctions_4_0_core.h2
-rw-r--r--src/gui/opengl/qopenglfunctions_4_1_compatibility.cpp100
-rw-r--r--src/gui/opengl/qopenglfunctions_4_1_compatibility.h2
-rw-r--r--src/gui/opengl/qopenglfunctions_4_1_core.cpp70
-rw-r--r--src/gui/opengl/qopenglfunctions_4_1_core.h2
-rw-r--r--src/gui/opengl/qopenglfunctions_4_2_compatibility.cpp105
-rw-r--r--src/gui/opengl/qopenglfunctions_4_2_compatibility.h2
-rw-r--r--src/gui/opengl/qopenglfunctions_4_2_core.cpp75
-rw-r--r--src/gui/opengl/qopenglfunctions_4_2_core.h2
-rw-r--r--src/gui/opengl/qopenglfunctions_4_3_compatibility.cpp110
-rw-r--r--src/gui/opengl/qopenglfunctions_4_3_compatibility.h2
-rw-r--r--src/gui/opengl/qopenglfunctions_4_3_core.cpp80
-rw-r--r--src/gui/opengl/qopenglfunctions_4_3_core.h2
-rw-r--r--src/gui/opengl/qopenglfunctions_4_4_compatibility.cpp115
-rw-r--r--src/gui/opengl/qopenglfunctions_4_4_compatibility.h2
-rw-r--r--src/gui/opengl/qopenglfunctions_4_4_core.cpp85
-rw-r--r--src/gui/opengl/qopenglfunctions_4_4_core.h2
-rw-r--r--src/gui/opengl/qopenglfunctions_4_5_compatibility.cpp125
-rw-r--r--src/gui/opengl/qopenglfunctions_4_5_compatibility.h2
-rw-r--r--src/gui/opengl/qopenglfunctions_4_5_core.cpp90
-rw-r--r--src/gui/opengl/qopenglfunctions_4_5_core.h2
-rw-r--r--src/gui/opengl/qopenglfunctions_es2.h2
-rw-r--r--src/gui/opengl/qopenglgradientcache_p.h1
-rw-r--r--src/gui/opengl/qopenglpaintdevice.cpp2
-rw-r--r--src/gui/opengl/qopenglpaintdevice.h2
-rw-r--r--src/gui/opengl/qopenglpaintdevice_p.h1
-rw-r--r--src/gui/opengl/qopenglpaintengine.cpp6
-rw-r--r--src/gui/opengl/qopenglpaintengine_p.h1
-rw-r--r--src/gui/opengl/qopenglpixeltransferoptions.h2
-rw-r--r--src/gui/opengl/qopenglqueryhelper_p.h2
-rw-r--r--src/gui/opengl/qopenglshadercache_p.h2
-rw-r--r--src/gui/opengl/qopenglshaderprogram.cpp17
-rw-r--r--src/gui/opengl/qopenglshaderprogram.h2
-rw-r--r--src/gui/opengl/qopengltexture.cpp2
-rw-r--r--src/gui/opengl/qopengltexture.h2
-rw-r--r--src/gui/opengl/qopengltexture_p.h1
-rw-r--r--src/gui/opengl/qopengltextureblitter.cpp194
-rw-r--r--src/gui/opengl/qopengltextureblitter.h (renamed from src/gui/opengl/qopengltextureblitter_p.h)27
-rw-r--r--src/gui/opengl/qopengltexturecache_p.h1
-rw-r--r--src/gui/opengl/qopengltextureglyphcache_p.h7
-rw-r--r--src/gui/opengl/qopengltexturehelper_p.h2
-rw-r--r--src/gui/opengl/qopengltimerquery.h2
-rw-r--r--src/gui/opengl/qopenglversionfunctions.h2
-rw-r--r--src/gui/opengl/qopenglversionfunctionsfactory_p.h3
-rw-r--r--src/gui/opengl/qopenglvertexarrayobject.h2
-rw-r--r--src/gui/painting/painting.pri15
-rw-r--r--src/gui/painting/qbackingstore.h1
-rw-r--r--src/gui/painting/qbezier_p.h1
-rw-r--r--src/gui/painting/qblendfunctions_p.h1
-rw-r--r--src/gui/painting/qblittable_p.h1
-rw-r--r--src/gui/painting/qbrush.cpp59
-rw-r--r--src/gui/painting/qbrush.h1
-rw-r--r--src/gui/painting/qcolor.cpp325
-rw-r--r--src/gui/painting/qcolor.h2
-rw-r--r--src/gui/painting/qcolor_p.cpp381
-rw-r--r--src/gui/painting/qcolor_p.h3
-rw-r--r--src/gui/painting/qcompositionfunctions.cpp104
-rw-r--r--src/gui/painting/qcoregraphics.mm565
-rw-r--r--src/gui/painting/qcoregraphics_p.h121
-rw-r--r--src/gui/painting/qcosmeticstroker_p.h1
-rw-r--r--src/gui/painting/qcssutil.cpp2
-rw-r--r--src/gui/painting/qdatabuffer_p.h1
-rw-r--r--src/gui/painting/qdrawhelper.cpp1251
-rw-r--r--src/gui/painting/qdrawhelper_avx2.cpp309
-rw-r--r--src/gui/painting/qdrawhelper_p.h28
-rw-r--r--src/gui/painting/qdrawhelper_sse4.cpp16
-rw-r--r--src/gui/painting/qdrawhelper_ssse3.cpp9
-rw-r--r--src/gui/painting/qdrawhelper_x86_p.h1
-rw-r--r--src/gui/painting/qdrawingprimitive_sse2_p.h25
-rw-r--r--src/gui/painting/qemulationpaintengine_p.h1
-rw-r--r--src/gui/painting/qfixed_p.h1
-rw-r--r--src/gui/painting/qmatrix.h1
-rw-r--r--src/gui/painting/qmemrotate_p.h1
-rw-r--r--src/gui/painting/qoutlinemapper_p.h1
-rw-r--r--src/gui/painting/qpagedpaintdevice.h1
-rw-r--r--src/gui/painting/qpagedpaintdevice_p.h1
-rw-r--r--src/gui/painting/qpagelayout.h1
-rw-r--r--src/gui/painting/qpagesize.cpp2
-rw-r--r--src/gui/painting/qpagesize.h1
-rw-r--r--src/gui/painting/qpaintdevice.h1
-rw-r--r--src/gui/painting/qpaintengine.h1
-rw-r--r--src/gui/painting/qpaintengine_blitter.cpp18
-rw-r--r--src/gui/painting/qpaintengine_blitter_p.h1
-rw-r--r--src/gui/painting/qpaintengine_p.h6
-rw-r--r--src/gui/painting/qpaintengine_raster_p.h1
-rw-r--r--src/gui/painting/qpaintengineex_p.h1
-rw-r--r--src/gui/painting/qpainter.cpp10
-rw-r--r--src/gui/painting/qpainter.h1
-rw-r--r--src/gui/painting/qpainter_p.h1
-rw-r--r--src/gui/painting/qpainterpath.cpp7
-rw-r--r--src/gui/painting/qpainterpath.h1
-rw-r--r--src/gui/painting/qpainterpath_p.h1
-rw-r--r--src/gui/painting/qpathclipper.cpp4
-rw-r--r--src/gui/painting/qpathclipper_p.h1
-rw-r--r--src/gui/painting/qpathsimplifier_p.h1
-rw-r--r--src/gui/painting/qpdf.cpp9
-rw-r--r--src/gui/painting/qpdf_p.h2
-rw-r--r--src/gui/painting/qpdfwriter.h2
-rw-r--r--src/gui/painting/qpen.h1
-rw-r--r--src/gui/painting/qplatformbackingstore.cpp19
-rw-r--r--src/gui/painting/qplatformbackingstore.h3
-rw-r--r--src/gui/painting/qpolygon.cpp15
-rw-r--r--src/gui/painting/qpolygon.h1
-rw-r--r--src/gui/painting/qpolygonclipper_p.h1
-rw-r--r--src/gui/painting/qrasterizer_p.h2
-rw-r--r--src/gui/painting/qrbtree_p.h (renamed from src/gui/opengl/qrbtree_p.h)2
-rw-r--r--src/gui/painting/qregion.cpp160
-rw-r--r--src/gui/painting/qregion.h18
-rw-r--r--src/gui/painting/qrgb.h2
-rw-r--r--src/gui/painting/qrgba64.h2
-rw-r--r--src/gui/painting/qrgba64_p.h101
-rw-r--r--src/gui/painting/qstroker_p.h1
-rw-r--r--src/gui/painting/qtextureglyphcache.cpp3
-rw-r--r--src/gui/painting/qtextureglyphcache_p.h3
-rw-r--r--src/gui/painting/qtransform.cpp12
-rw-r--r--src/gui/painting/qtransform.h1
-rw-r--r--src/gui/painting/qtriangulatingstroker.cpp (renamed from src/gui/opengl/qtriangulatingstroker.cpp)0
-rw-r--r--src/gui/painting/qtriangulatingstroker_p.h (renamed from src/gui/opengl/qtriangulatingstroker_p.h)1
-rw-r--r--src/gui/painting/qtriangulator.cpp (renamed from src/gui/opengl/qtriangulator.cpp)17
-rw-r--r--src/gui/painting/qtriangulator_p.h (renamed from src/gui/opengl/qtriangulator_p.h)1
-rw-r--r--src/gui/painting/qvectorpath_p.h1
-rw-r--r--src/gui/text/qabstracttextdocumentlayout.cpp28
-rw-r--r--src/gui/text/qabstracttextdocumentlayout.h4
-rw-r--r--src/gui/text/qabstracttextdocumentlayout_p.h1
-rw-r--r--src/gui/text/qcssparser.cpp93
-rw-r--r--src/gui/text/qcssparser_p.h23
-rw-r--r--src/gui/text/qcssscanner.cpp863
-rw-r--r--src/gui/text/qdistancefield.cpp70
-rw-r--r--src/gui/text/qdistancefield_p.h24
-rw-r--r--src/gui/text/qfont.cpp29
-rw-r--r--src/gui/text/qfont.h2
-rw-r--r--src/gui/text/qfont_p.h3
-rw-r--r--src/gui/text/qfontdatabase.cpp36
-rw-r--r--src/gui/text/qfontdatabase.h1
-rw-r--r--src/gui/text/qfontengine.cpp27
-rw-r--r--src/gui/text/qfontengine_ft.cpp55
-rw-r--r--src/gui/text/qfontengine_ft_p.h1
-rw-r--r--src/gui/text/qfontengine_p.h6
-rw-r--r--src/gui/text/qfontengine_qpf2.cpp5
-rw-r--r--src/gui/text/qfontengine_qpf2_p.h1
-rw-r--r--src/gui/text/qfontengineglyphcache_p.h2
-rw-r--r--src/gui/text/qfontinfo.h1
-rw-r--r--src/gui/text/qfontmetrics.cpp36
-rw-r--r--src/gui/text/qfontmetrics.h3
-rw-r--r--src/gui/text/qfontsubset.cpp4
-rw-r--r--src/gui/text/qfontsubset_p.h1
-rw-r--r--src/gui/text/qfragmentmap_p.h2
-rw-r--r--src/gui/text/qglyphrun.h1
-rw-r--r--src/gui/text/qglyphrun_p.h1
-rw-r--r--src/gui/text/qharfbuzzng_p.h1
-rw-r--r--src/gui/text/qplatformfontdatabase.cpp6
-rw-r--r--src/gui/text/qplatformfontdatabase.h2
-rw-r--r--src/gui/text/qrawfont.cpp17
-rw-r--r--src/gui/text/qrawfont.h2
-rw-r--r--src/gui/text/qrawfont_p.h1
-rw-r--r--src/gui/text/qstatictext.h1
-rw-r--r--src/gui/text/qstatictext_p.h1
-rw-r--r--src/gui/text/qsyntaxhighlighter.h2
-rw-r--r--src/gui/text/qtextcursor.cpp8
-rw-r--r--src/gui/text/qtextcursor.h1
-rw-r--r--src/gui/text/qtextcursor_p.h1
-rw-r--r--src/gui/text/qtextdocument.cpp8
-rw-r--r--src/gui/text/qtextdocument.h1
-rw-r--r--src/gui/text/qtextdocument_p.cpp15
-rw-r--r--src/gui/text/qtextdocument_p.h6
-rw-r--r--src/gui/text/qtextdocumentfragment.cpp2
-rw-r--r--src/gui/text/qtextdocumentfragment.h1
-rw-r--r--src/gui/text/qtextdocumentfragment_p.h1
-rw-r--r--src/gui/text/qtextdocumentlayout.cpp13
-rw-r--r--src/gui/text/qtextdocumentlayout_p.h1
-rw-r--r--src/gui/text/qtextdocumentwriter.cpp5
-rw-r--r--src/gui/text/qtextdocumentwriter.h1
-rw-r--r--src/gui/text/qtextengine.cpp28
-rw-r--r--src/gui/text/qtextengine_p.h2
-rw-r--r--src/gui/text/qtextformat.h1
-rw-r--r--src/gui/text/qtextformat_p.h1
-rw-r--r--src/gui/text/qtexthtmlparser.cpp6
-rw-r--r--src/gui/text/qtexthtmlparser_p.h1
-rw-r--r--src/gui/text/qtextimagehandler.cpp4
-rw-r--r--src/gui/text/qtextimagehandler_p.h1
-rw-r--r--src/gui/text/qtextlayout.cpp6
-rw-r--r--src/gui/text/qtextlayout.h1
-rw-r--r--src/gui/text/qtextlist.h1
-rw-r--r--src/gui/text/qtextobject.h1
-rw-r--r--src/gui/text/qtextobject_p.h1
-rw-r--r--src/gui/text/qtextodfwriter.cpp6
-rw-r--r--src/gui/text/qtextodfwriter_p.h8
-rw-r--r--src/gui/text/qtextoption.h1
-rw-r--r--src/gui/text/qtexttable.h2
-rw-r--r--src/gui/text/qtexttable_p.h1
-rw-r--r--src/gui/text/qzip.cpp10
-rw-r--r--src/gui/text/qzipreader_p.h1
-rw-r--r--src/gui/text/qzipwriter_p.h2
-rw-r--r--src/gui/text/text.pri2
-rw-r--r--src/gui/util/qabstractlayoutstyleinfo_p.h1
-rw-r--r--src/gui/util/qdesktopservices.h1
-rw-r--r--src/gui/util/qgridlayoutengine_p.h1
-rw-r--r--src/gui/util/qhexstring_p.h2
-rw-r--r--src/gui/util/qlayoutpolicy_p.h1
-rw-r--r--src/gui/util/qvalidator.cpp15
-rw-r--r--src/gui/util/qvalidator.h1
414 files changed, 6779 insertions, 6083 deletions
diff --git a/src/gui/accessible/accessible.pri b/src/gui/accessible/accessible.pri
index b7f341d5b7..8dd821fe6a 100644
--- a/src/gui/accessible/accessible.pri
+++ b/src/gui/accessible/accessible.pri
@@ -1,6 +1,6 @@
# Qt accessibility module
-contains(QT_CONFIG, accessibility) {
+qtConfig(accessibility) {
HEADERS += \
accessible/qaccessible.h \
accessible/qaccessiblecache_p.h \
diff --git a/src/gui/accessible/qaccessible.h b/src/gui/accessible/qaccessible.h
index 7bc124f7d9..27756d764d 100644
--- a/src/gui/accessible/qaccessible.h
+++ b/src/gui/accessible/qaccessible.h
@@ -37,7 +37,7 @@
**
****************************************************************************/
-#include <QtCore/qglobal.h>
+#include <QtGui/qtguiglobal.h>
#ifndef QT_NO_ACCESSIBILITY
#ifndef QACCESSIBLE_H
diff --git a/src/gui/accessible/qaccessiblebridge.h b/src/gui/accessible/qaccessiblebridge.h
index c161e01b0f..7429716e65 100644
--- a/src/gui/accessible/qaccessiblebridge.h
+++ b/src/gui/accessible/qaccessiblebridge.h
@@ -40,6 +40,7 @@
#ifndef QACCESSIBLEBRIDGE_H
#define QACCESSIBLEBRIDGE_H
+#include <QtGui/qtguiglobal.h>
#include <QtCore/qplugin.h>
#include <QtCore/qfactoryinterface.h>
diff --git a/src/gui/accessible/qaccessiblecache_p.h b/src/gui/accessible/qaccessiblecache_p.h
index a9208702e4..f054ee9678 100644
--- a/src/gui/accessible/qaccessiblecache_p.h
+++ b/src/gui/accessible/qaccessiblecache_p.h
@@ -51,7 +51,7 @@
// We mean it.
//
-#include <QtCore/qglobal.h>
+#include <QtGui/private/qtguiglobal_p.h>
#include <QtCore/qobject.h>
#include <QtCore/qhash.h>
diff --git a/src/gui/accessible/qaccessibleobject.h b/src/gui/accessible/qaccessibleobject.h
index 5918e942bd..dd69dcb081 100644
--- a/src/gui/accessible/qaccessibleobject.h
+++ b/src/gui/accessible/qaccessibleobject.h
@@ -40,6 +40,7 @@
#ifndef QACCESSIBLEOBJECT_H
#define QACCESSIBLEOBJECT_H
+#include <QtGui/qtguiglobal.h>
#include <QtGui/qaccessible.h>
QT_BEGIN_NAMESPACE
diff --git a/src/gui/accessible/qaccessibleplugin.h b/src/gui/accessible/qaccessibleplugin.h
index b0c28e5bf8..09d4c542d3 100644
--- a/src/gui/accessible/qaccessibleplugin.h
+++ b/src/gui/accessible/qaccessibleplugin.h
@@ -40,6 +40,7 @@
#ifndef QACCESSIBLEPLUGIN_H
#define QACCESSIBLEPLUGIN_H
+#include <QtGui/qtguiglobal.h>
#include <QtGui/qaccessible.h>
#include <QtCore/qfactoryinterface.h>
diff --git a/src/gui/accessible/qplatformaccessibility.h b/src/gui/accessible/qplatformaccessibility.h
index 5dc4781bb2..5d668c2bd6 100644
--- a/src/gui/accessible/qplatformaccessibility.h
+++ b/src/gui/accessible/qplatformaccessibility.h
@@ -48,9 +48,11 @@
// source and binary incompatible with future versions of Qt.
//
-#include <QtCore/qobject.h>
+#include <QtGui/qtguiglobal.h>
+
#ifndef QT_NO_ACCESSIBILITY
+#include <QtCore/qobject.h>
#include <QtGui/qaccessible.h>
QT_BEGIN_NAMESPACE
diff --git a/src/gui/animation/qguivariantanimation.cpp b/src/gui/animation/qguivariantanimation.cpp
index e18340d302..b72764e048 100644
--- a/src/gui/animation/qguivariantanimation.cpp
+++ b/src/gui/animation/qguivariantanimation.cpp
@@ -36,11 +36,12 @@
** $QT_END_LICENSE$
**
****************************************************************************/
-#include <QtCore/qvariantanimation.h>
-#include <private/qvariantanimation_p.h>
+#include <QtGui/qtguiglobal.h>
#ifndef QT_NO_ANIMATION
+#include <QtCore/qvariantanimation.h>
+#include <private/qvariantanimation_p.h>
#include <QtGui/qcolor.h>
#include <QtGui/qvector2d.h>
#include <QtGui/qvector3d.h>
diff --git a/src/gui/configure.json b/src/gui/configure.json
new file mode 100644
index 0000000000..376359ba37
--- /dev/null
+++ b/src/gui/configure.json
@@ -0,0 +1,1095 @@
+{
+ "module": "gui",
+ "depends": [
+ "core"
+ ],
+ "testDir": "../../config.tests",
+
+ "commandline": {
+ "options": {
+ "angle": "boolean",
+ "directfb": "boolean",
+ "directwrite": "boolean",
+ "egl": "boolean",
+ "eglfs": "boolean",
+ "evdev": "boolean",
+ "fontconfig": "boolean",
+ "freetype": { "type": "enum", "values": [ "no", "qt", "system" ] },
+ "gbm": "boolean",
+ "gif": "boolean",
+ "harfbuzz": { "type": "enum", "values": [ "no", "qt", "system" ] },
+ "ico": "boolean",
+ "imf": { "type": "boolean", "name": "qqnx_imf" },
+ "kms": "boolean",
+ "lgmon": "boolean",
+ "libinput": "boolean",
+ "libjpeg": { "type": "enum", "values": [ "no", "qt", "system" ] },
+ "libpng": { "type": "enum", "values": [ "no", "qt", "system" ] },
+ "linuxfb": "boolean",
+ "mirclient": "boolean",
+ "mtdev": "boolean",
+ "opengl": { "type": "optionalString", "values": [ "no", "yes", "desktop", "es2", "dynamic" ] },
+ "opengl-es-2": { "type": "void", "name": "opengl", "value": "es2" },
+ "opengles3": "boolean",
+ "qpa": { "type": "string", "name": "qpa_default_platform" },
+ "qpa-platform-guard": "boolean",
+ "sm": { "type": "boolean", "name": "sessionmanager" },
+ "tslib": "boolean",
+ "xcb": { "type": "enum", "values": [ "no", "yes", "qt", "system" ] },
+ "xcb-xlib": "boolean",
+ "xinput2": "boolean",
+ "xkb": "boolean",
+ "xkb-config-root": "string",
+ "xkbcommon": { "type": "enum", "values": [ "no", "qt", "system" ] },
+ "xkbcommon-evdev": "boolean",
+ "xkbcommon-x11": { "type": "enum", "name": "xkbcommon", "values": [ "no", "qt", "system" ] },
+ "xrender": "boolean"
+ }
+ },
+
+ "libraries": {
+ "bcm_host": {
+ "export": "",
+ "sources": [
+ "-lbcm_host"
+ ]
+ },
+ "directfb": {
+ "label": "DirectFB",
+ "test": "qpa/directfb",
+ "sources": [
+ { "type": "pkgConfig", "args": "directfb" }
+ ]
+ },
+ "directwrite": {
+ "label": "DirectWrite",
+ "export": "",
+ "test": "win/directwrite",
+ "sources": [
+ "-ldwrite"
+ ]
+ },
+ "drm": {
+ "label": "KMS",
+ "test": "qpa/kms",
+ "sources": [
+ { "type": "pkgConfig", "args": "libdrm" },
+ "-ldrm"
+ ]
+ },
+ "egl": {
+ "label": "EGL",
+ "test": "qpa/egl",
+ "sources": [
+ { "type": "pkgConfig", "args": "egl" },
+ { "type": "makeSpec", "spec": "EGL" }
+ ]
+ },
+ "freetype": {
+ "label": "FreeType",
+ "export": "",
+ "test": "unix/freetype",
+ "sources": [
+ "-lfreetype"
+ ]
+ },
+ "fontconfig": {
+ "label": "Fontconfig",
+ "test": "unix/fontconfig",
+ "sources": [
+ { "type": "pkgConfig", "args": "fontconfig freetype2" },
+ "-lfontconfig -lfreetype"
+ ]
+ },
+ "gbm": {
+ "label": "GBM",
+ "test": "qpa/gbm",
+ "sources": [
+ { "type": "pkgConfig", "args": "gbm" }
+ ]
+ },
+ "harfbuzz": {
+ "label": "HarfBuzz",
+ "test": "unix/harfbuzz",
+ "sources": [
+ "-lharfbuzz"
+ ]
+ },
+ "imf": {
+ "label": "IMF",
+ "export": "",
+ "test": "unix/qqnx_imf",
+ "sources": [
+ "-linput_client"
+ ]
+ },
+ "lgmon": {
+ "label": "lgmon",
+ "test": "unix/lgmon",
+ "sources": [
+ "-llgmon"
+ ]
+ },
+ "libinput": {
+ "label": "libinput",
+ "test": "unix/libinput",
+ "sources": [
+ { "type": "pkgConfig", "args": "libinput" }
+ ]
+ },
+ "libjpeg": {
+ "label": "libjpeg",
+ "test": "unix/libjpeg",
+ "sources": [
+ { "libs": "-llibjpeg", "condition": "config.msvc" },
+ { "libs": "-ljpeg", "condition": "!config.msvc" }
+ ]
+ },
+ "libpng": {
+ "label": "libpng",
+ "test": "unix/libpng",
+ "sources": [
+ { "type": "pkgConfig", "args": "libpng" },
+ { "libs": "-llibpng", "condition": "config.msvc" },
+ { "libs": "-lpng", "condition": "!config.msvc" }
+ ]
+ },
+ "mirclient": {
+ "label": "Mir client libraries",
+ "export": "",
+ "test": "qpa/mirclient",
+ "sources": [
+ { "type": "pkgConfig", "args": "egl mirclient ubuntu-platform-api" }
+ ]
+ },
+ "mtdev": {
+ "label": "mtdev",
+ "export": "",
+ "test": "unix/mtdev",
+ "sources": [
+ { "type": "pkgConfig", "args": "mtdev" }
+ ]
+ },
+ "opengl": {
+ "label": "Desktop OpenGL",
+ "test": "unix/opengldesktop",
+ "sources": [
+ { "type": "pkgConfig", "args": "gl" },
+ { "type": "makeSpec", "spec": "OPENGL" }
+ ]
+ },
+ "opengl_es2": {
+ "label": "OpenGL ES 2.0",
+ "test": "unix/opengles2",
+ "sources": [
+ { "type": "pkgConfig", "args": "glesv2" },
+ { "type": "makeSpec", "spec": "OPENGL_ES2" }
+ ]
+ },
+ "tslib": {
+ "label": "tslib",
+ "test": "unix/tslib",
+ "sources": [
+ "-lts"
+ ]
+ },
+ "wayland_server": {
+ "label": "Wayland Server",
+ "export": "",
+ "test": "qpa/wayland-server",
+ "sources": [
+ { "type": "pkgConfig", "args": "wayland-server" }
+ ]
+ },
+ "x11sm": {
+ "label": "X11 session management",
+ "sources": [
+ { "type": "pkgConfig", "args": "sm ice" }
+ ]
+ },
+ "xcb": {
+ "label": "XCB >= 1.5 (core)",
+ "test": "qpa/xcb",
+ "sources": [
+ { "type": "pkgConfig", "args": "xcb >= 1.5" },
+ "-lxcb"
+ ]
+ },
+ "xcb_syslibs": {
+ "label": "XCB (secondary)",
+ "test": "qpa/xcb-syslibs",
+ "sources": [
+ { "type": "pkgConfig",
+ "args": "xcb xcb-shm xcb-sync xcb-xfixes xcb-randr xcb-image xcb-keysyms xcb-icccm xcb-shape" },
+ "-lxcb -lxcb-shm -lxcb-sync -lxcb-xfixes -lxcb-randr -lxcb-image -lxcb-keysyms -lxcb-icccm -lxcb-shape"
+ ]
+ },
+ "xcb_xlib": {
+ "label": "XCB Xlib",
+ "test": "qpa/xcb-xlib",
+ "sources": [
+ { "type": "pkgConfig", "args": "X11-xcb x11 xcb" },
+ "-lxcb -lX11 -lX11-xcb"
+ ]
+ },
+ "xcb_xkb": {
+ "label": "XCB XKB >= 1.10",
+ "test": "qpa/xcb-xkb",
+ "sources": [
+ { "type": "pkgConfig", "args": "xcb-xkb >= 1.10 xcb" },
+ "-lxcb-xkb -lxcb"
+ ]
+ },
+ "xcb_render": {
+ "label": "XCB XRender",
+ "test": "qpa/xcb-render",
+ "sources": [
+ { "type": "pkgConfig", "args": "xcb-renderutil xcb-render xcb" },
+ "-lxcb-render-util -lxcb-render -lxcb"
+ ]
+ },
+ "xcb_glx": {
+ "label": "XCB GLX",
+ "test": "qpa/xcb-glx",
+ "sources": [
+ { "type": "pkgConfig", "args": "xcb-glx xcb" },
+ "-lxcb-glx -lxcb"
+ ]
+ },
+ "xinput2": {
+ "label": "Xinput2",
+ "test": "x11/xinput2",
+ "sources": [
+ { "type": "pkgConfig", "args": "xi" },
+ "-lXi"
+ ]
+ },
+ "xkbcommon": {
+ "label": "xkbcommon",
+ "export": "xkbcommon_evdev",
+ "test": "unix/xkbcommon",
+ "sources": [
+ { "type": "pkgConfig", "args": "xkbcommon" }
+ ]
+ },
+ "xkbcommon_x11": {
+ "label": "xkbcommon-x11 >= 0.4.1",
+ "export": "xkbcommon",
+ "sources": [
+ { "type": "pkgConfig", "args": "xkbcommon xkbcommon-x11 >= 0.4.1" }
+ ]
+ },
+ "xrender": {
+ "label": "XRender",
+ "test": "x11/xrender",
+ "sources": [
+ "-lXrender"
+ ]
+ }
+ },
+
+ "testTypeAliases": {
+ "files": [ "directX" ],
+ "getPkgConfigVariable": [ "xkbConfigRoot" ]
+ },
+
+ "tests": {
+ "direct2d": {
+ "label": "Direct 2D",
+ "type": "compile",
+ "test": "qpa/direct2d",
+ "use": "direct2d"
+ },
+ "directwrite2": {
+ "label": "DirectWrite 2",
+ "type": "compile",
+ "test": "win/directwrite2",
+ "use": "directwrite"
+ },
+ "directx": {
+ "label": "DirectX SDK",
+ "type": "directX",
+ "files": [
+ "d3dcompiler.h",
+ "d3d11.lib",
+ "fxc.exe"
+ ]
+ },
+ "egl-x11": {
+ "label": "EGL on X11",
+ "type": "compile",
+ "test": "qpa/egl-x11",
+ "use": "egl xcb_xlib"
+ },
+ "egl-brcm": {
+ "label": "Broadcom EGL (Rasberry Pi)",
+ "type": "compile",
+ "test": "qpa/eglfs-brcm",
+ "use": "egl bcm_host"
+ },
+ "egl-egldevice": {
+ "label": "EGLDevice",
+ "type": "compile",
+ "test": "qpa/eglfs-egldevice",
+ "use": "egl"
+ },
+ "egl-mali": {
+ "label": "Mali EGL",
+ "type": "compile",
+ "test": "qpa/eglfs-mali",
+ "use": "egl"
+ },
+ "egl-mali-2": {
+ "label": "Mali 2 EGL",
+ "type": "compile",
+ "test": "qpa/eglfs-mali-2",
+ "use": "egl"
+ },
+ "egl-viv": {
+ "label": "i.Mx6 EGL",
+ "type": "compile",
+ "test": "qpa/eglfs-viv",
+ "use": "egl"
+ },
+ "evdev": {
+ "label": "evdev",
+ "type": "compile",
+ "test": "unix/evdev"
+ },
+ "linuxfb": {
+ "label": "LinuxFB",
+ "type": "compile",
+ "test": "qpa/linuxfb"
+ },
+ "opengles3": {
+ "label": "OpenGL ES 3.0",
+ "type": "compile",
+ "test": "unix/opengles3",
+ "use": "opengl_es2"
+ },
+ "opengles31": {
+ "label": "OpenGL ES 3.1",
+ "type": "compile",
+ "test": "unix/opengles31",
+ "use": "opengl_es2"
+ },
+ "qpa_default_platform": {
+ "label": "default QPA platform",
+ "type": "qpaDefaultPlatform",
+ "log": "value"
+ },
+ "x11prefix": {
+ "label": "X11 prefix",
+ "type": "getPkgConfigVariable",
+ "pkg-config-args": "x11",
+ "pkg-config-variable": "prefix",
+ "value": "/usr",
+ "log": "value"
+ },
+ "xkbconfigroot": {
+ "label": "XKB config root",
+ "type": "xkbConfigRoot",
+ "pkg-config-args": "xkeyboard-config",
+ "pkg-config-variable": "xkb_base",
+ "log": "value"
+ },
+ "xlib": {
+ "label": "XLib",
+ "type": "compile",
+ "test": "x11/xlib"
+ }
+ },
+
+ "features": {
+ "accessibility-atspi-bridge": {
+ "label": "ATSPI Bridge",
+ "condition": "features.accessibility && features.xcb && features.dbus",
+ "output": [ "privateFeature", "feature" ]
+ },
+ "angle": {
+ "label": "ANGLE",
+ "autoDetect": "features.opengles2 || features.opengl-dynamic",
+ "condition": "config.win32 && tests.directx",
+ "output": [
+ "publicFeature",
+ { "type": "define", "name": "QT_OPENGL_ES_2_ANGLE" }
+ ]
+ },
+ "directfb": {
+ "label": "DirectFB",
+ "autoDetect": false,
+ "condition": "libs.directfb",
+ "output": [ "privateFeature" ]
+ },
+ "directwrite": {
+ "label": "DirectWrite",
+ "emitIf": "config.win32",
+ "condition": "libs.directwrite",
+ "output": [ "privateFeature" ]
+ },
+ "directwrite2": {
+ "label": "DirectWrite 2",
+ "emitIf": "config.win32",
+ "condition": "features.directwrite && tests.directwrite2",
+ "output": [ "privateFeature" ]
+ },
+ "direct2d": {
+ "label": "Direct 2D",
+ "autoDetect": false,
+ "condition": "tests.direct2d",
+ "output": [ "privateFeature" ]
+ },
+ "evdev": {
+ "label": "evdev",
+ "condition": "tests.evdev",
+ "output": [ "privateFeature" ]
+ },
+ "freetype": {
+ "label": "FreeType",
+ "output": [ "privateFeature", "feature" ]
+ },
+ "system-freetype": {
+ "label": " Using system FreeType",
+ "enable": "input.freetype == 'system'",
+ "disable": "input.freetype == 'qt'",
+ "autoDetect": "!config.win32",
+ "condition": "features.freetype && libs.freetype",
+ "output": [ "privateFeature" ]
+ },
+ "fontconfig": {
+ "label": "Fontconfig",
+ "condition": "!config.win32 && !config.darwin && features.system-freetype && libs.fontconfig",
+ "output": [ "privateFeature", "feature" ]
+ },
+ "gbm": {
+ "label": "GBM",
+ "condition": "libs.gbm",
+ "output": [ "publicQtConfig" ]
+ },
+ "harfbuzz": {
+ "label": "HarfBuzz",
+ "output": [ "privateFeature", "feature" ]
+ },
+ "system-harfbuzz": {
+ "label": " Using system HarfBuzz",
+ "enable": "input.harfbuzz == 'system'",
+ "disable": "input.harfbuzz == 'qt'",
+ "autoDetect": "!config.darwin && !config.win32",
+ "condition": "features.harfbuzz && libs.harfbuzz",
+ "output": [ "privateFeature" ]
+ },
+ "qqnx_imf": {
+ "label": "IMF",
+ "emitIf": "config.qnx",
+ "condition": "libs.imf",
+ "output": [ "privateConfig" ]
+ },
+ "integrityfb": {
+ "label": "INTEGRITY framebuffer",
+ "condition": "config.integrity",
+ "output": [ "privateFeature" ]
+ },
+ "kms": {
+ "label": "KMS",
+ "condition": "libs.drm",
+ "output": [ "publicQtConfig" ]
+ },
+ "libinput": {
+ "label": "libinput",
+ "condition": "features.libudev && libs.libinput",
+ "output": [ "privateFeature" ]
+ },
+ "lgmon": {
+ "label": "lgmon",
+ "emitIf": "config.qnx",
+ "condition": "libs.lgmon",
+ "output": [ "privateConfig" ]
+ },
+ "linuxfb": {
+ "label": "LinuxFB",
+ "condition": "tests.linuxfb",
+ "output": [ "privateFeature" ]
+ },
+ "mirclient": {
+ "label": "Mir client",
+ "condition": "libs.mirclient",
+ "output": [ "privateFeature" ]
+ },
+ "mtdev": {
+ "label": "mtdev",
+ "condition": "libs.mtdev",
+ "output": [ "privateFeature" ]
+ },
+ "opengles2": {
+ "label": "OpenGL ES 2.0",
+ "enable": "input.opengl == 'es2'",
+ "disable": "input.opengl == 'desktop' || input.opengl == 'dynamic' || input.opengl == 'no'",
+ "condition": "config.win32 || (!config.watchos && !features.opengl-desktop && libs.opengl_es2)",
+ "output": [
+ "publicFeature",
+ "publicQtConfig",
+ { "type": "define", "name": "QT_OPENGL_ES" },
+ { "type": "define", "name": "QT_OPENGL_ES_2" }
+ ]
+ },
+ "opengles3": {
+ "label": "OpenGL ES 3.0",
+ "condition": "features.opengles2 && !features.angle && tests.opengles3",
+ "output": [
+ "publicFeature",
+ { "type": "define", "name": "QT_OPENGL_ES_3" }
+ ]
+ },
+ "opengles31": {
+ "label": "OpenGL ES 3.1",
+ "condition": "features.opengles3 && tests.opengles31",
+ "output": [
+ "publicFeature",
+ { "type": "define", "name": "QT_OPENGL_ES_3_1" }
+ ]
+ },
+ "opengl-desktop": {
+ "label": "Desktop OpenGL",
+ "enable": "input.opengl == 'desktop'",
+ "disable": "input.opengl == 'es2' || input.opengl == 'dynamic' || input.opengl == 'no'",
+ "condition": "(config.win32 && !config.winrt && !features.opengles2 && (config.msvc || libs.opengl))
+ || (!config.watchos && !config.win32 && libs.opengl)"
+ },
+ "opengl-dynamic": {
+ "label": "Dynamic OpenGL",
+ "enable": "input.opengl == 'dynamic'",
+ "autoDetect": false,
+ "condition": "config.win32 && !config.winrt",
+ "output": [
+ { "type": "publicFeature", "name": "dynamicgl" },
+ { "type": "define", "name": "QT_OPENGL_DYNAMIC" }
+ ]
+ },
+ "opengl": {
+ "label": "OpenGL",
+ "condition": "features.opengl-desktop || features.opengl-dynamic || features.opengles2",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "egl": {
+ "label": "EGL",
+ "condition": "features.opengl && (features.angle || libs.egl)",
+ "output": [ "privateFeature", "feature" ]
+ },
+ "egl_x11": {
+ "label": "EGL on X11",
+ "condition": "features.egl && tests.egl-x11",
+ "output": [ "privateFeature" ]
+ },
+ "eglfs": {
+ "label": "EGLFS",
+ "autoDetect": "!config.android && !config.win32",
+ "condition": "features.egl",
+ "output": [ "privateFeature" ]
+ },
+ "eglfs_brcm": {
+ "label": "EGLFS Rasberry Pi",
+ "condition": "features.eglfs && tests.egl-brcm",
+ "output": [ "privateFeature" ]
+ },
+ "eglfs_egldevice": {
+ "label": "EGLFS EGLDevice",
+ "condition": "features.eglfs && tests.egl-egldevice && features.kms",
+ "output": [ "privateFeature" ]
+ },
+ "eglfs_gbm": {
+ "label": "EGLFS GBM",
+ "condition": "features.eglfs && features.gbm && features.kms",
+ "output": [ "privateFeature" ]
+ },
+ "eglfs_mali": {
+ "label": "EGLFS Mali",
+ "condition": "features.eglfs && (tests.egl-mali || tests.egl-mali-2)",
+ "output": [ "privateFeature" ]
+ },
+ "eglfs_viv": {
+ "label": "EGLFS i.Mx6",
+ "condition": "features.eglfs && tests.egl-viv",
+ "output": [ "privateFeature" ]
+ },
+ "eglfs_viv_wl": {
+ "label": "EGLFS i.Mx6 Wayland",
+ "condition": "features.eglfs_viv && libs.wayland_server",
+ "output": [ "privateFeature" ]
+ },
+ "gif": {
+ "label": "GIF",
+ "output": [
+ "privateFeature",
+ { "type": "define", "negative": true, "name": "QT_NO_IMAGEFORMAT_GIF" }
+ ]
+ },
+ "ico": {
+ "label": "ICO",
+ "output": [ "privateFeature", "feature" ]
+ },
+ "jpeg": {
+ "label": "JPEG",
+ "disable": "input.libjpeg == 'no'",
+ "output": [
+ "privateFeature",
+ { "type": "define", "negative": true, "name": "QT_NO_IMAGEFORMAT_JPEG" }
+ ]
+ },
+ "system-jpeg": {
+ "label": " Using system libjpeg",
+ "disable": "input.libjpeg == 'qt'",
+ "enable": "input.libjpeg == 'system'",
+ "condition": "features.jpeg && libs.libjpeg",
+ "output": [ "privateFeature" ]
+ },
+ "png": {
+ "label": "PNG",
+ "disable": "input.libpng == 'no'",
+ "output": [
+ "privateFeature",
+ { "type": "define", "negative": true, "name": "QT_NO_IMAGEFORMAT_PNG" }
+ ]
+ },
+ "system-png": {
+ "label": " Using system libpng",
+ "disable": "input.libpng == 'qt'",
+ "enable": "input.libpng == 'system'",
+ "condition": "features.png && libs.libpng",
+ "output": [ "privateFeature" ]
+ },
+ "qpa_default_platform": {
+ "label": "QPA default platform",
+ "condition": "features.gui",
+ "output": [
+ { "type": "define", "name": "QT_QPA_DEFAULT_PLATFORM_NAME", "value": "tests.qpa_default_platform.name" },
+ { "type": "varAssign", "public": true, "name": "QT_DEFAULT_QPA_PLUGIN", "value": "tests.qpa_default_platform.plugin",
+ "condition": "!features.shared" }
+ ]
+ },
+ "sessionmanager": {
+ "label": "Session Management",
+ "purpose": "Provides an interface to the windowing system's session management.",
+ "section": "Kernel",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "tslib": {
+ "label": "tslib",
+ "condition": "libs.tslib",
+ "output": [ "privateFeature" ]
+ },
+ "xcb": {
+ "label": "XCB",
+ "autoDetect": "!config.darwin",
+ "condition": "libs.xcb",
+ "output": [ "privateFeature" ]
+ },
+ "system-xcb": {
+ "label": "Using system provided XCB libraries",
+ "enable": "input.xcb == 'system' || input.xcb == 'yes'",
+ "disable": "input.xcb == 'qt' || input.xcb == 'no'",
+ "autoDetect": "!config.darwin",
+ "condition": "libs.xcb && libs.xcb_syslibs",
+ "output": [ "privateFeature" ]
+ },
+ "x11-prefix": {
+ "label": "X11 prefix",
+ "emitIf": "features.xcb",
+ "output": [ { "type": "varAssign", "name": "QMAKE_X11_PREFIX", "value": "tests.x11prefix.value" } ]
+ },
+ "xcb-glx": {
+ "label": "XCB GLX",
+ "emitIf": "features.xcb",
+ "condition": "libs.xcb_glx",
+ "output": [ "privateFeature" ]
+ },
+ "xcb-render": {
+ "label": "XCB render",
+ "emitIf": "features.system-xcb",
+ "condition": "libs.xcb_render",
+ "output": [ "privateFeature" ]
+ },
+ "xcb-xlib": {
+ "label": "XCB Xlib",
+ "emitIf": "features.xcb",
+ "condition": "libs.xcb_xlib",
+ "output": [ "privateFeature" ]
+ },
+ "xcb-sm": {
+ "label": "xcb-sm",
+ "emitIf": "features.xcb",
+ "condition": "features.sessionmanager && libs.x11sm",
+ "output": [ "privateFeature" ]
+ },
+ "xinput2": {
+ "label": "Xinput2",
+ "condition": "libs.xinput2",
+ "output": [ "privateFeature" ]
+ },
+ "xkbcommon-evdev": {
+ "label": "xkbcommon-evdev",
+ "condition": "libs.xkbcommon",
+ "output": [ "privateFeature" ]
+ },
+ "xkbcommon-system": {
+ "label": "Using system-provided xkbcommon",
+ "emitIf": "features.xcb",
+ "enable": "input.xkbcommon == 'system'",
+ "disable": "input.xkbcommon == 'qt' || input.xkbcommon == 'no'",
+ "condition": "libs.xkbcommon_x11",
+ "output": [ "privateFeature" ]
+ },
+ "xkb": {
+ "label": "XCB XKB",
+ "condition": "features.system-xcb && libs.xcb_xkb",
+ "output": [ "privateFeature" ]
+ },
+ "xkb-config-root": {
+ "label": "XKB config root",
+ "emitIf": "features.xcb",
+ "condition": "features.xcb && !features.xkbcommon-system && tests.xkbconfigroot",
+ "output": [ { "type": "varAssign", "name": "QMAKE_XKB_CONFIG_ROOT", "value": "tests.xkbconfigroot.value"} ]
+ },
+ "xlib": {
+ "label": "XLib",
+ "condition": "tests.xlib",
+ "output": [ "privateFeature" ]
+ },
+ "xrender": {
+ "label": "Xrender",
+ "condition": "libs.xrender",
+ "output": [ "privateFeature", "feature" ]
+ },
+ "texthtmlparser": {
+ "label": "HtmlParser",
+ "purpose": "Provides a parser for HTML.",
+ "section": "Kernel",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "textodfwriter": {
+ "label": "OdfWriter",
+ "purpose": "Provides an ODF writer.",
+ "section": "Kernel",
+ "condition": "features.xmlstreamwriter",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "cssparser": {
+ "label": "CssParser",
+ "purpose": "Provides a parser for Cascading Style Sheets.",
+ "section": "Kernel",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "draganddrop": {
+ "label": "Drag and Drop",
+ "purpose": "Supports the drag and drop mechansim.",
+ "section": "Kernel",
+ "condition": "features.imageformat_xpm",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "shortcut": {
+ "label": "QShortcut",
+ "purpose": "Provides keyboard accelerators and shortcuts.",
+ "section": "Kernel",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "action": {
+ "label": "QAction",
+ "purpose": "Provides widget actions.",
+ "section": "Kernel",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "cursor": {
+ "label": "QCursor",
+ "purpose": "Provides mouse cursors.",
+ "section": "Kernel",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "clipboard": {
+ "label": "QClipboard",
+ "purpose": "Provides cut and paste operations.",
+ "section": "Kernel",
+ "condition": "!config.integrity && !config.qnx",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "wheelevent": {
+ "label": "QWheelEvent",
+ "purpose": "Supports wheel events.",
+ "section": "Kernel",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "tabletevent": {
+ "label": "QTabletEvent",
+ "purpose": "Supports tablet events.",
+ "section": "Kernel",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "im": {
+ "label": "QInputContext",
+ "purpose": "Provides complex input methods.",
+ "section": "Kernel",
+ "condition": "features.library",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "validator": {
+ "label": "QValidator",
+ "purpose": "Supports validation of input text.",
+ "section": "Widgets",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "standarditemmodel": {
+ "label": "QStandardItemModel",
+ "purpose": "Provides a generic model for storing custom data.",
+ "section": "ItemViews",
+ "condition": "features.itemmodel",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "imageformatplugin": {
+ "label": "QImageIOPlugin",
+ "purpose": "Provides a base for writing a image format plugins.",
+ "section": "Images",
+ "condition": "features.library",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "movie": {
+ "label": "QMovie",
+ "purpose": "Supports animated images.",
+ "section": "Images",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "imageformat_bmp": {
+ "label": "BMP Image Format",
+ "purpose": "Supports Microsoft's Bitmap image file format.",
+ "section": "Images",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "imageformat_ppm": {
+ "label": "PPM Image Format",
+ "purpose": "Supports the Portable Pixmap image file format.",
+ "section": "Images",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "imageformat_xbm": {
+ "label": "XBM Image Format",
+ "purpose": "Supports the X11 Bitmap image file format.",
+ "section": "Images",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "imageformat_xpm": {
+ "label": "XPM Image Format",
+ "purpose": "Supports the X11 Pixmap image file format.",
+ "section": "Images",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "imageformat_png": {
+ "label": "PNG Image Format",
+ "purpose": "Supports the Portable Network Graphics image file format.",
+ "section": "Images",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "imageformat_jpeg": {
+ "label": "JPEG Image Format",
+ "purpose": "Supports the Joint Photographic Experts Group image file format.",
+ "section": "Images",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "image_heuristic_mask": {
+ "label": "QImage::createHeuristicMask()",
+ "purpose": "Supports creating a 1-bpp heuristic mask for images.",
+ "section": "Images",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "image_text": {
+ "label": "Image Text",
+ "purpose": "Supports image file text strings.",
+ "section": "Images",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "picture": {
+ "label": "QPicture",
+ "purpose": "Supports recording and replaying QPainter commands.",
+ "section": "Painting",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "colornames": {
+ "label": "Color Names",
+ "purpose": "Supports color names such as \"red\", used by QColor and by some HTML documents.",
+ "section": "Painting",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "pdf": {
+ "label": "QPdf",
+ "purpose": "Provides a PDF backend for QPainter.",
+ "section": "Painting",
+ "condition": "features.temporaryfile",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "freetype": {
+ "label": "Freetype Font Engine",
+ "purpose": "Supports the FreeType 2 font engine (and its supported font formats).",
+ "section": "Fonts",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "desktopservices": {
+ "label": "QDesktopServices",
+ "purpose": "Provides methods for accessing common desktop services.",
+ "section": "Utilities",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "systemtrayicon": {
+ "label": "QSystemTrayIcon",
+ "purpose": "Provides an icon for an application in the system tray.",
+ "section": "Utilities",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "accessibility": {
+ "label": "Accessibility",
+ "purpose": "Provides accessibility support.",
+ "section": "Utilities",
+ "condition": "features.properties",
+ "output": [ "publicFeature", "feature" ]
+ }
+ },
+
+ "earlyReport": [
+ {
+ "type": "error",
+ "condition": "input.xcb != '' && input.xcb != 'no' && input.xkbcommon == 'no'",
+ "message": "XCB plugin requires libxkbcommon. See -qt-xkbcommon-x11 and -system-xkbcommon-x11."
+ }
+ ],
+
+ "report": [
+ {
+ "type": "warning",
+ "condition": "features.xcb && !features.xkbcommon-system && !features.xkb-config-root",
+ "message": "Could not find XKB config root, use -xkb-config-root to set a path to
+XKB configuration data. This is required for keyboard input support."
+ },
+ {
+ "type": "note",
+ "condition": "features.accessibility && features.xcb && !features.accessibility-atspi-bridge",
+ "message": "Disabling Linux Accessibility Bridge: D-Bus is missing."
+ },
+ {
+ "type": "warning",
+ "condition": "input.qpa-platform-guard != ''",
+ "message": "The [-no]-qpa-platform-guard argument is deprecated and has no effect."
+ },
+ {
+ "type": "warning",
+ "condition": "features.gui && config.linux && !config.android && !features.xcb && !features.eglfs && !features.directfb && !features.linuxfb && !features.mirclient",
+ "message": "No QPA platform plugin enabled! This will
+produce a Qt that cannot run GUI applications.
+The dependencies needed for xcb to build are listed in
+src/plugins/platforms/xcb/README"
+ },
+ {
+ "type": "warning",
+ "condition": "config.win32 && (features.opengles2 || features.opengl-dynamic) && !features.angle",
+ "message": "Using OpenGL ES 2.0 on Windows without ANGLE.
+The build will most likely fail.
+Specify -opengl desktop to use regular OpenGL."
+ },
+ {
+ "type": "warning",
+ "condition": "config.darwin && features.system-harfbuzz",
+ "message": "On OS X, AAT is supported only with -qt-harfbuzz."
+ },
+ {
+ "type": "error",
+ "condition": "features.gui && !config.watchos && input.opengl != 'no' && !features.opengl-desktop && !features.opengles2 && !features.opengl-dynamic",
+ "message": "The OpenGL functionality tests failed!
+You might need to modify the include and library search paths by editing QMAKE_INCDIR_OPENGL[_ES2],
+QMAKE_LIBDIR_OPENGL[_ES2] and QMAKE_LIBS_OPENGL[_ES2] in the mkspec for your platform."
+ }
+ ],
+
+ "summary": [
+ {
+ "section": "Qt Gui",
+ "entries": [
+ "freetype",
+ "system-freetype",
+ "harfbuzz",
+ "system-harfbuzz",
+ "fontconfig",
+ {
+ "section": "Image formats",
+ "entries": [
+ "gif", "ico", "jpeg", "system-jpeg", "png", "system-png"
+ ]
+ },
+ {
+ "section": "OpenGL",
+ "entries": [
+ {
+ "type": "feature",
+ "args": "angle",
+ "condition": "config.win32"
+ },
+ "egl",
+ "opengl-desktop",
+ {
+ "type": "feature",
+ "args": "opengl-dynamic",
+ "condition": "config.win32"
+ },
+ "opengles2",
+ "opengles3",
+ "opengles31"
+ ]
+ },
+ "sessionmanager"
+ ]
+ },
+ {
+ "section": "Features used by QPA backends",
+ "entries": [
+ "evdev",
+ "libinput",
+ "mtdev",
+ "tslib",
+ "xkbcommon-evdev"
+ ]
+ },
+ {
+ "section": "QPA backends",
+ "entries": [
+ "directfb", "eglfs",
+ {
+ "section": "EGLFS details",
+ "condition": "features.eglfs",
+ "entries": [
+ "eglfs_viv", "eglfs_viv_wl", "eglfs_egldevice", "eglfs_gbm", "eglfs_mali", "eglfs_brcm", "egl_x11"
+ ]
+ },
+ "linuxfb", "mirclient",
+ {
+ "message": "INTEGRITY framebuffer",
+ "condition": "config.integrity",
+ "args": "integrityfb"
+ },
+ {
+ "section": "QNX",
+ "condition": "config.qnx",
+ "entries": [
+ "lgmon", "qqnx_imf"
+ ]
+ },
+ {
+ "section": "X11",
+ "condition": "features.xcb",
+ "entries": [
+ "system-xcb", "egl_x11", "xinput2", "xkb", "xlib", "xrender", "xcb-render", "xcb-glx", "xcb-xlib", "xkbcommon-system"
+ ]
+ },
+ {
+ "section": "Windows",
+ "condition": "config.win32",
+ "entries": [
+ "direct2d", "directwrite", "directwrite2"
+ ]
+ }
+ ]
+ }
+ ]
+}
diff --git a/src/gui/configure.pri b/src/gui/configure.pri
new file mode 100644
index 0000000000..d79c5a6bba
--- /dev/null
+++ b/src/gui/configure.pri
@@ -0,0 +1,67 @@
+# custom tests
+
+# Check for Direct X SDK (include, lib, and direct shader compiler 'fxc').
+# Up to Direct X SDK June 2010 and for MinGW, this is pointed to by the
+# DXSDK_DIR variable. Starting with Windows Kit 8, it is included in
+# the Windows SDK. Checking for the header is not sufficient, since it
+# is also present in MinGW.
+defineTest(qtConfTest_directX) {
+ dxdir = $$getenv("DXSDK_DIR")
+ !isEmpty(dxdir) {
+ EXTRA_INCLUDEPATH += $$dxdir/include
+ equals(QT_ARCH, x86_64): \
+ EXTRA_LIBDIR += $$dxdir/lib/x64
+ else: \
+ EXTRA_LIBDIR += $$dxdir/lib/x86
+ EXTRA_PATH += $$dxdir/Utilities/bin/x86
+ }
+
+ $$qtConfEvaluate("features.sse2") {
+ ky = $$size($${1}.files._KEYS_)
+ $${1}.files._KEYS_ += $$ky
+ # Not present on MinGW-32
+ $${1}.files.$${ky} = "intrin.h"
+ }
+
+ qtConfTest_files($${1}): return(true)
+ return(false)
+}
+
+defineTest(qtConfTest_xkbConfigRoot) {
+ qtConfTest_getPkgConfigVariable($${1}): return(true)
+
+ for (dir, $$list("/usr/share/X11/xkb", "/usr/local/share/X11/xkb")) {
+ exists($$dir) {
+ $${1}.value = $$dir
+ export($${1}.value)
+ $${1}.cache += value
+ export($${1}.cache)
+ return(true)
+ }
+ }
+ return(false)
+}
+
+defineTest(qtConfTest_qpaDefaultPlatform) {
+ name =
+ !isEmpty(config.input.qpa_default_platform): name = $$config.input.qpa_default_platform
+ else: !isEmpty(QT_QPA_DEFAULT_PLATFORM): name = $$QT_QPA_DEFAULT_PLATFORM
+ else: winrt: name = winrt
+ else: win32: name = windows
+ else: android: name = android
+ else: macos: name = cocoa
+ else: ios: name = ios
+ else: qnx: name = qnx
+ else: integrity: name = integrityfb
+ else: name = xcb
+
+ $${1}.value = $$name
+ $${1}.plugin = q$$name
+ $${1}.name = "\"$$name\""
+ export($${1}.value)
+ export($${1}.plugin)
+ export($${1}.name)
+ $${1}.cache += value plugin name
+ export($${1}.cache)
+ return(true)
+}
diff --git a/src/gui/doc/src/qtgui.qdoc b/src/gui/doc/src/qtgui.qdoc
index 9781135960..a9fe520d5e 100644
--- a/src/gui/doc/src/qtgui.qdoc
+++ b/src/gui/doc/src/qtgui.qdoc
@@ -187,6 +187,19 @@
More info in \l{Drag and Drop}
+ \section1 Licenses and Attributions
+
+ Qt GUI is available under commercial licenses from \l{The Qt Company}.
+ In addition, it is available under the
+ \l{GNU Lesser General Public License, version 3}, or
+ the \l{GNU General Public License, version 2}.
+ See \l{Qt Licensing} for further details.
+
+ Furthermore Qt GUI potentially contains third party
+ modules under following permissive licenses:
+
+ \generatelist{groupsbymodule attributions-qtgui}
+
\section1 Reference
\list
\li \l{Qt GUI C++ Classes}
diff --git a/src/gui/gui.pro b/src/gui/gui.pro
index 462f133ff8..a6eaadd6c5 100644
--- a/src/gui/gui.pro
+++ b/src/gui/gui.pro
@@ -1,7 +1,7 @@
TARGET = QtGui
QT = core-private
-contains(QT_CONFIG, opengl.*): MODULE_CONFIG = opengl
+qtConfig(opengl.*): MODULE_CONFIG = opengl
DEFINES += QT_NO_USING_NAMESPACE
@@ -18,7 +18,7 @@ MODULE_PLUGIN_TYPES = \
egldeviceintegrations
# This is here only because the platform plugin is no module, obviously.
-win32:contains(QT_CONFIG, angle)|contains(QT_CONFIG, dynamicgl) {
+qtConfig(angle) {
MODULE_AUX_INCLUDES = \
\$\$QT_MODULE_INCLUDE_BASE/QtANGLE
}
@@ -53,7 +53,7 @@ load(cmake_functions)
win32: CMAKE_WINDOWS_BUILD = True
-contains(QT_CONFIG, angle) {
+qtConfig(angle) {
CMAKE_GL_INCDIRS = $$CMAKE_INCLUDE_DIR
CMAKE_ANGLE_EGL_DLL_RELEASE = libEGL.dll
CMAKE_ANGLE_EGL_IMPLIB_RELEASE = libEGL.lib
@@ -66,22 +66,22 @@ contains(QT_CONFIG, angle) {
CMAKE_QT_OPENGL_IMPLEMENTATION = GLESv2
} else {
- contains(QT_CONFIG, egl) {
+ qtConfig(egl) {
CMAKE_EGL_LIBS = $$cmakeProcessLibs($$QMAKE_LIBS_EGL)
!isEmpty(QMAKE_LIBDIR_EGL): CMAKE_EGL_LIBDIR += $$cmakeTargetPath($$QMAKE_LIBDIR_EGL)
}
- contains(QT_CONFIG, opengles2) {
+ qtConfig(opengles2) {
!isEmpty(QMAKE_INCDIR_OPENGL_ES2): CMAKE_GL_INCDIRS = $$cmakeTargetPaths($$QMAKE_INCDIR_OPENGL_ES2)
CMAKE_OPENGL_INCDIRS = $$cmakePortablePaths($$QMAKE_INCDIR_OPENGL_ES2)
CMAKE_OPENGL_LIBS = $$cmakeProcessLibs($$QMAKE_LIBS_OPENGL_ES2)
!isEmpty(QMAKE_LIBDIR_OPENGL_ES2): CMAKE_OPENGL_LIBDIR = $$cmakePortablePaths($$QMAKE_LIBDIR_OPENGL_ES2)
CMAKE_GL_HEADER_NAME = GLES2/gl2.h
CMAKE_QT_OPENGL_IMPLEMENTATION = GLESv2
- } else:contains(QT_CONFIG, opengl) {
+ } else: qtConfig(opengl) {
!isEmpty(QMAKE_INCDIR_OPENGL): CMAKE_GL_INCDIRS = $$cmakeTargetPaths($$QMAKE_INCDIR_OPENGL)
CMAKE_OPENGL_INCDIRS = $$cmakePortablePaths($$QMAKE_INCDIR_OPENGL)
- !contains(QT_CONFIG, dynamicgl): CMAKE_OPENGL_LIBS = $$cmakeProcessLibs($$QMAKE_LIBS_OPENGL)
+ !qtConfig(dynamicgl): CMAKE_OPENGL_LIBS = $$cmakeProcessLibs($$QMAKE_LIBS_OPENGL)
!isEmpty(QMAKE_LIBDIR_OPENGL): CMAKE_OPENGL_LIBDIR = $$cmakePortablePaths($$QMAKE_LIBDIR_OPENGL)
CMAKE_GL_HEADER_NAME = GL/gl.h
mac: CMAKE_GL_HEADER_NAME = gl.h
@@ -89,6 +89,6 @@ contains(QT_CONFIG, angle) {
}
}
-contains(QT_CONFIG, egl): CMAKE_EGL_INCDIRS = $$cmakePortablePaths($$QMAKE_INCDIR_EGL)
+qtConfig(egl): CMAKE_EGL_INCDIRS = $$cmakePortablePaths($$QMAKE_INCDIR_EGL)
QMAKE_DYNAMIC_LIST_FILE = $$PWD/QtGui.dynlist
diff --git a/src/gui/image/image.pri b/src/gui/image/image.pri
index 8db944e5e3..3c4d2c0bbf 100644
--- a/src/gui/image/image.pri
+++ b/src/gui/image/image.pri
@@ -11,7 +11,6 @@ HEADERS += \
image/qimagereader.h \
image/qimagewriter.h \
image/qmovie.h \
- image/qnativeimage_p.h \
image/qpaintengine_pic_p.h \
image/qpicture.h \
image/qpicture_p.h \
@@ -45,7 +44,6 @@ SOURCES += \
image/qmovie.cpp \
image/qpixmap_raster.cpp \
image/qpixmap_blitter.cpp \
- image/qnativeimage.cpp \
image/qimagepixmapcleanuphooks.cpp \
image/qicon.cpp \
image/qiconloader.cpp \
@@ -55,6 +53,8 @@ SOURCES += \
win32:!winrt: SOURCES += image/qpixmap_win.cpp
+darwin: OBJECTIVE_SOURCES += image/qimage_darwin.mm
+
NO_PCH_SOURCES += image/qimage_compat.cpp
false: SOURCES += $$NO_PCH_SOURCES # Hack for QtCreator
@@ -71,11 +71,11 @@ SOURCES += \
image/qxbmhandler.cpp \
image/qxpmhandler.cpp
-!contains(QT_CONFIG, no-png):include($$PWD/qpnghandler.pri)
-else:DEFINES *= QT_NO_IMAGEFORMAT_PNG
-
-contains(QT_CONFIG, jpeg):include($$PWD/qjpeghandler.pri)
-contains(QT_CONFIG, gif):include($$PWD/qgifhandler.pri)
+qtConfig(png) {
+ HEADERS += image/qpnghandler_p.h
+ SOURCES += image/qpnghandler.cpp
+ include($$PWD/../../3rdparty/png_dependency.pri)
+}
# SIMD
SSE2_SOURCES += image/qimage_sse2.cpp
diff --git a/src/gui/image/qbitmap.h b/src/gui/image/qbitmap.h
index 68727e74b5..def59b3f89 100644
--- a/src/gui/image/qbitmap.h
+++ b/src/gui/image/qbitmap.h
@@ -40,6 +40,7 @@
#ifndef QBITMAP_H
#define QBITMAP_H
+#include <QtGui/qtguiglobal.h>
#include <QtGui/qpixmap.h>
QT_BEGIN_NAMESPACE
diff --git a/src/gui/image/qbmphandler_p.h b/src/gui/image/qbmphandler_p.h
index c4800e3f97..258ce0fce6 100644
--- a/src/gui/image/qbmphandler_p.h
+++ b/src/gui/image/qbmphandler_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#include "QtGui/qimageiohandler.h"
#ifndef QT_NO_IMAGEFORMAT_BMP
diff --git a/src/gui/image/qgifhandler.cpp b/src/gui/image/qgifhandler.cpp
deleted file mode 100644
index bae74bf9a1..0000000000
--- a/src/gui/image/qgifhandler.cpp
+++ /dev/null
@@ -1,1218 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-** WARNING:
-** A separate license from Unisys may be required to use the gif
-** reader. See http://www.unisys.com/about__unisys/lzw/
-** for information from Unisys
-**
-****************************************************************************/
-
-#include "qgifhandler_p.h"
-
-#include <qimage.h>
-#include <qiodevice.h>
-#include <qvariant.h>
-
-QT_BEGIN_NAMESPACE
-
-#define Q_TRANSPARENT 0x00ffffff
-
-// avoid going through QImage::scanLine() which calls detach
-#define FAST_SCAN_LINE(bits, bpl, y) (bits + (y) * bpl)
-
-
-/*
- Incremental image decoder for GIF image format.
-
- This subclass of QImageFormat decodes GIF format images,
- including animated GIFs. Internally in
-*/
-
-class QGIFFormat {
-public:
- QGIFFormat();
- ~QGIFFormat();
-
- int decode(QImage *image, const uchar* buffer, int length,
- int *nextFrameDelay, int *loopCount);
- static void scan(QIODevice *device, QVector<QSize> *imageSizes, int *loopCount);
-
- bool newFrame;
- bool partialNewFrame;
-
-private:
- void fillRect(QImage *image, int x, int y, int w, int h, QRgb col);
- inline QRgb color(uchar index) const;
-
- // GIF specific stuff
- QRgb* globalcmap;
- QRgb* localcmap;
- QImage backingstore;
- unsigned char hold[16];
- bool gif89;
- int count;
- int ccount;
- int expectcount;
- enum State {
- Header,
- LogicalScreenDescriptor,
- GlobalColorMap,
- LocalColorMap,
- Introducer,
- ImageDescriptor,
- TableImageLZWSize,
- ImageDataBlockSize,
- ImageDataBlock,
- ExtensionLabel,
- GraphicControlExtension,
- ApplicationExtension,
- NetscapeExtensionBlockSize,
- NetscapeExtensionBlock,
- SkipBlockSize,
- SkipBlock,
- Done,
- Error
- } state;
- int gncols;
- int lncols;
- int ncols;
- int lzwsize;
- bool lcmap;
- int swidth, sheight;
- int width, height;
- int left, top, right, bottom;
- enum Disposal { NoDisposal, DoNotChange, RestoreBackground, RestoreImage };
- Disposal disposal;
- bool disposed;
- int trans_index;
- bool gcmap;
- int bgcol;
- int interlace;
- int accum;
- int bitcount;
-
- enum { max_lzw_bits=12 }; // (poor-compiler's static const int)
-
- int code_size, clear_code, end_code, max_code_size, max_code;
- int firstcode, oldcode, incode;
- short* table[2];
- short* stack;
- short *sp;
- bool needfirst;
- int x, y;
- int frame;
- bool out_of_bounds;
- bool digress;
- void nextY(unsigned char *bits, int bpl);
- void disposePrevious(QImage *image);
-};
-
-/*!
- Constructs a QGIFFormat.
-*/
-QGIFFormat::QGIFFormat()
-{
- globalcmap = 0;
- localcmap = 0;
- lncols = 0;
- gncols = 0;
- disposal = NoDisposal;
- out_of_bounds = false;
- disposed = true;
- frame = -1;
- state = Header;
- count = 0;
- lcmap = false;
- newFrame = false;
- partialNewFrame = false;
- table[0] = 0;
- table[1] = 0;
- stack = 0;
-}
-
-/*!
- Destroys a QGIFFormat.
-*/
-QGIFFormat::~QGIFFormat()
-{
- if (globalcmap) delete[] globalcmap;
- if (localcmap) delete[] localcmap;
- delete [] stack;
-}
-
-void QGIFFormat::disposePrevious(QImage *image)
-{
- if (out_of_bounds) {
- // flush anything that survived
- // ### Changed: QRect(0, 0, swidth, sheight)
- }
-
- // Handle disposal of previous image before processing next one
-
- if (disposed) return;
-
- int l = qMin(swidth-1,left);
- int r = qMin(swidth-1,right);
- int t = qMin(sheight-1,top);
- int b = qMin(sheight-1,bottom);
-
- switch (disposal) {
- case NoDisposal:
- break;
- case DoNotChange:
- break;
- case RestoreBackground:
- if (trans_index>=0) {
- // Easy: we use the transparent color
- fillRect(image, l, t, r-l+1, b-t+1, Q_TRANSPARENT);
- } else if (bgcol>=0) {
- // Easy: we use the bgcol given
- fillRect(image, l, t, r-l+1, b-t+1, color(bgcol));
- } else {
- // Impossible: We don't know of a bgcol - use pixel 0
- const QRgb *bits = reinterpret_cast<const QRgb *>(image->constBits());
- fillRect(image, l, t, r-l+1, b-t+1, bits[0]);
- }
- // ### Changed: QRect(l, t, r-l+1, b-t+1)
- break;
- case RestoreImage: {
- if (frame >= 0) {
- for (int ln=t; ln<=b; ln++) {
- memcpy(image->scanLine(ln)+l,
- backingstore.constScanLine(ln-t),
- (r-l+1)*sizeof(QRgb));
- }
- // ### Changed: QRect(l, t, r-l+1, b-t+1)
- }
- }
- }
- disposal = NoDisposal; // Until an extension says otherwise.
-
- disposed = true;
-}
-
-/*!
- This function decodes some data into image changes.
-
- Returns the number of bytes consumed.
-*/
-int QGIFFormat::decode(QImage *image, const uchar *buffer, int length,
- int *nextFrameDelay, int *loopCount)
-{
- // We are required to state that
- // "The Graphics Interchange Format(c) is the Copyright property of
- // CompuServe Incorporated. GIF(sm) is a Service Mark property of
- // CompuServe Incorporated."
-
- if (!stack) {
- stack = new short[(1 << max_lzw_bits) * 4];
- table[0] = &stack[(1 << max_lzw_bits) * 2];
- table[1] = &stack[(1 << max_lzw_bits) * 3];
- }
-
- image->detach();
- int bpl = image->bytesPerLine();
- unsigned char *bits = image->bits();
-
-#define LM(l, m) (((m)<<8)|l)
- digress = false;
- const int initial = length;
- while (!digress && length) {
- length--;
- unsigned char ch=*buffer++;
- switch (state) {
- case Header:
- hold[count++]=ch;
- if (count==6) {
- // Header
- gif89=(hold[3]!='8' || hold[4]!='7');
- state=LogicalScreenDescriptor;
- count=0;
- }
- break;
- case LogicalScreenDescriptor:
- hold[count++]=ch;
- if (count==7) {
- // Logical Screen Descriptor
- swidth=LM(hold[0], hold[1]);
- sheight=LM(hold[2], hold[3]);
- gcmap=!!(hold[4]&0x80);
- //UNUSED: bpchan=(((hold[4]&0x70)>>3)+1);
- //UNUSED: gcmsortflag=!!(hold[4]&0x08);
- gncols=2<<(hold[4]&0x7);
- bgcol=(gcmap) ? hold[5] : -1;
- //aspect=hold[6] ? double(hold[6]+15)/64.0 : 1.0;
-
- trans_index = -1;
- count=0;
- ncols=gncols;
- if (gcmap) {
- ccount=0;
- state=GlobalColorMap;
- globalcmap = new QRgb[gncols+1]; // +1 for trans_index
- globalcmap[gncols] = Q_TRANSPARENT;
- } else {
- state=Introducer;
- }
- }
- break;
- case GlobalColorMap: case LocalColorMap:
- hold[count++]=ch;
- if (count==3) {
- QRgb rgb = qRgb(hold[0], hold[1], hold[2]);
- if (state == LocalColorMap) {
- if (ccount < lncols)
- localcmap[ccount] = rgb;
- } else {
- globalcmap[ccount] = rgb;
- }
- if (++ccount >= ncols) {
- if (state == LocalColorMap)
- state=TableImageLZWSize;
- else
- state=Introducer;
- }
- count=0;
- }
- break;
- case Introducer:
- hold[count++]=ch;
- switch (ch) {
- case ',':
- state=ImageDescriptor;
- break;
- case '!':
- state=ExtensionLabel;
- break;
- case ';':
- // ### Changed: QRect(0, 0, swidth, sheight)
- state=Done;
- break;
- default:
- digress=true;
- // Unexpected Introducer - ignore block
- state=Error;
- }
- break;
- case ImageDescriptor:
- hold[count++]=ch;
- if (count==10) {
- int newleft=LM(hold[1], hold[2]);
- int newtop=LM(hold[3], hold[4]);
- int newwidth=LM(hold[5], hold[6]);
- int newheight=LM(hold[7], hold[8]);
-
- // disbelieve ridiculous logical screen sizes,
- // unless the image frames are also large.
- if (swidth/10 > qMax(newwidth,200))
- swidth = -1;
- if (sheight/10 > qMax(newheight,200))
- sheight = -1;
-
- if (swidth <= 0)
- swidth = newleft + newwidth;
- if (sheight <= 0)
- sheight = newtop + newheight;
-
- QImage::Format format = trans_index >= 0 ? QImage::Format_ARGB32 : QImage::Format_RGB32;
- if (image->isNull()) {
- (*image) = QImage(swidth, sheight, format);
- bpl = image->bytesPerLine();
- bits = image->bits();
- memset(bits, 0, image->byteCount());
- }
-
- // Check if the previous attempt to create the image failed. If it
- // did then the image is broken and we should give up.
- if (image->isNull()) {
- state = Error;
- return -1;
- }
-
- disposePrevious(image);
- disposed = false;
-
- left = newleft;
- top = newtop;
- width = newwidth;
- height = newheight;
-
- right=qMax(0, qMin(left+width, swidth)-1);
- bottom=qMax(0, qMin(top+height, sheight)-1);
- lcmap=!!(hold[9]&0x80);
- interlace=!!(hold[9]&0x40);
- //bool lcmsortflag=!!(hold[9]&0x20);
- lncols=lcmap ? (2<<(hold[9]&0x7)) : 0;
- if (lncols) {
- if (localcmap)
- delete [] localcmap;
- localcmap = new QRgb[lncols+1];
- localcmap[lncols] = Q_TRANSPARENT;
- ncols = lncols;
- } else {
- ncols = gncols;
- }
- frame++;
- if (frame == 0) {
- if (left || top || width<swidth || height<sheight) {
- // Not full-size image - erase with bg or transparent
- if (trans_index >= 0) {
- fillRect(image, 0, 0, swidth, sheight, color(trans_index));
- // ### Changed: QRect(0, 0, swidth, sheight)
- } else if (bgcol>=0) {
- fillRect(image, 0, 0, swidth, sheight, color(bgcol));
- // ### Changed: QRect(0, 0, swidth, sheight)
- }
- }
- }
-
- if (disposal == RestoreImage) {
- int l = qMin(swidth-1,left);
- int r = qMin(swidth-1,right);
- int t = qMin(sheight-1,top);
- int b = qMin(sheight-1,bottom);
- int w = r-l+1;
- int h = b-t+1;
-
- if (backingstore.width() < w
- || backingstore.height() < h) {
- // We just use the backing store as a byte array
- backingstore = QImage(qMax(backingstore.width(), w),
- qMax(backingstore.height(), h),
- QImage::Format_RGB32);
- memset(backingstore.bits(), 0, backingstore.byteCount());
- }
- const int dest_bpl = backingstore.bytesPerLine();
- unsigned char *dest_data = backingstore.bits();
- for (int ln=0; ln<h; ln++) {
- memcpy(FAST_SCAN_LINE(dest_data, dest_bpl, ln),
- FAST_SCAN_LINE(bits, bpl, t+ln) + l, w*sizeof(QRgb));
- }
- }
-
- count=0;
- if (lcmap) {
- ccount=0;
- state=LocalColorMap;
- } else {
- state=TableImageLZWSize;
- }
- x = left;
- y = top;
- accum = 0;
- bitcount = 0;
- sp = stack;
- firstcode = oldcode = 0;
- needfirst = true;
- out_of_bounds = left>=swidth || y>=sheight;
- }
- break;
- case TableImageLZWSize: {
- lzwsize=ch;
- if (lzwsize > max_lzw_bits) {
- state=Error;
- } else {
- code_size=lzwsize+1;
- clear_code=1<<lzwsize;
- end_code=clear_code+1;
- max_code_size=2*clear_code;
- max_code=clear_code+2;
- int i;
- for (i=0; i<clear_code; i++) {
- table[0][i]=0;
- table[1][i]=i;
- }
- state=ImageDataBlockSize;
- }
- count=0;
- break;
- } case ImageDataBlockSize:
- expectcount=ch;
- if (expectcount) {
- state=ImageDataBlock;
- } else {
- state=Introducer;
- digress = true;
- newFrame = true;
- }
- break;
- case ImageDataBlock:
- count++;
- accum|=(ch<<bitcount);
- bitcount+=8;
- while (bitcount>=code_size && state==ImageDataBlock) {
- int code=accum&((1<<code_size)-1);
- bitcount-=code_size;
- accum>>=code_size;
-
- if (code==clear_code) {
- if (!needfirst) {
- code_size=lzwsize+1;
- max_code_size=2*clear_code;
- max_code=clear_code+2;
- }
- needfirst=true;
- } else if (code==end_code) {
- bitcount = -32768;
- // Left the block end arrive
- } else {
- if (needfirst) {
- firstcode=oldcode=code;
- if (!out_of_bounds && image->height() > y && ((frame == 0) || (firstcode != trans_index)))
- ((QRgb*)FAST_SCAN_LINE(bits, bpl, y))[x] = color(firstcode);
- x++;
- if (x>=swidth) out_of_bounds = true;
- needfirst=false;
- if (x>=left+width) {
- x=left;
- out_of_bounds = left>=swidth || y>=sheight;
- nextY(bits, bpl);
- }
- } else {
- incode=code;
- if (code>=max_code) {
- *sp++=firstcode;
- code=oldcode;
- }
- while (code>=clear_code+2) {
- if (code >= max_code) {
- state = Error;
- return -1;
- }
- *sp++=table[1][code];
- if (code==table[0][code]) {
- state=Error;
- return -1;
- }
- if (sp-stack>=(1<<(max_lzw_bits))*2) {
- state=Error;
- return -1;
- }
- code=table[0][code];
- }
- if (code < 0) {
- state = Error;
- return -1;
- }
-
- *sp++=firstcode=table[1][code];
- code=max_code;
- if (code<(1<<max_lzw_bits)) {
- table[0][code]=oldcode;
- table[1][code]=firstcode;
- max_code++;
- if ((max_code>=max_code_size)
- && (max_code_size<(1<<max_lzw_bits)))
- {
- max_code_size*=2;
- code_size++;
- }
- }
- oldcode=incode;
- const int h = image->height();
- QRgb *line = 0;
- if (!out_of_bounds && h > y)
- line = (QRgb*)FAST_SCAN_LINE(bits, bpl, y);
- while (sp>stack) {
- const uchar index = *(--sp);
- if (!out_of_bounds && h > y && ((frame == 0) || (index != trans_index))) {
- line[x] = color(index);
- }
- x++;
- if (x>=swidth) out_of_bounds = true;
- if (x>=left+width) {
- x=left;
- out_of_bounds = left>=swidth || y>=sheight;
- nextY(bits, bpl);
- if (!out_of_bounds && h > y)
- line = (QRgb*)FAST_SCAN_LINE(bits, bpl, y);
- }
- }
- }
- }
- }
- partialNewFrame = true;
- if (count==expectcount) {
- count=0;
- state=ImageDataBlockSize;
- }
- break;
- case ExtensionLabel:
- switch (ch) {
- case 0xf9:
- state=GraphicControlExtension;
- break;
- case 0xff:
- state=ApplicationExtension;
- break;
-#if 0
- case 0xfe:
- state=CommentExtension;
- break;
- case 0x01:
- break;
-#endif
- default:
- state=SkipBlockSize;
- }
- count=0;
- break;
- case ApplicationExtension:
- if (count<11) hold[count]=ch;
- count++;
- if (count==hold[0]+1) {
- if (qstrncmp((char*)(hold+1), "NETSCAPE", 8)==0) {
- // Looping extension
- state=NetscapeExtensionBlockSize;
- } else {
- state=SkipBlockSize;
- }
- count=0;
- }
- break;
- case NetscapeExtensionBlockSize:
- expectcount=ch;
- count=0;
- if (expectcount) state=NetscapeExtensionBlock;
- else state=Introducer;
- break;
- case NetscapeExtensionBlock:
- if (count<3) hold[count]=ch;
- count++;
- if (count==expectcount) {
- *loopCount = hold[1]+hold[2]*256;
- state=SkipBlockSize; // Ignore further blocks
- }
- break;
- case GraphicControlExtension:
- if (count<5) hold[count]=ch;
- count++;
- if (count==hold[0]+1) {
- disposePrevious(image);
- disposal=Disposal((hold[1]>>2)&0x7);
- //UNUSED: waitforuser=!!((hold[1]>>1)&0x1);
- int delay=count>3 ? LM(hold[2], hold[3]) : 1;
- // IE and mozilla use a minimum delay of 10. With the minimum delay of 10
- // we are compatible to them and avoid huge loads on the app and xserver.
- *nextFrameDelay = (delay < 2 ? 10 : delay) * 10;
-
- bool havetrans=hold[1]&0x1;
- trans_index = havetrans ? hold[4] : -1;
-
- count=0;
- state=SkipBlockSize;
- }
- break;
- case SkipBlockSize:
- expectcount=ch;
- count=0;
- if (expectcount) state=SkipBlock;
- else state=Introducer;
- break;
- case SkipBlock:
- count++;
- if (count==expectcount) state=SkipBlockSize;
- break;
- case Done:
- digress=true;
- /* Netscape ignores the junk, so we do too.
- length++; // Unget
- state=Error; // More calls to this is an error
- */
- break;
- case Error:
- return -1; // Called again after done.
- }
- }
- return initial-length;
-}
-
-/*!
- Scans through the data stream defined by \a device and returns the image
- sizes found in the stream in the \a imageSizes vector.
-*/
-void QGIFFormat::scan(QIODevice *device, QVector<QSize> *imageSizes, int *loopCount)
-{
- if (!device)
- return;
-
- qint64 oldPos = device->pos();
- if (device->isSequential() || !device->seek(0))
- return;
-
- int colorCount = 0;
- int localColorCount = 0;
- int globalColorCount = 0;
- int colorReadCount = 0;
- bool localColormap = false;
- bool globalColormap = false;
- int count = 0;
- int blockSize = 0;
- int imageWidth = 0;
- int imageHeight = 0;
- bool done = false;
- uchar hold[16];
- State state = Header;
-
- const int readBufferSize = 40960; // 40k read buffer
- QByteArray readBuffer(device->read(readBufferSize));
-
- if (readBuffer.isEmpty()) {
- device->seek(oldPos);
- return;
- }
-
- // This is a specialized version of the state machine from decode(),
- // which doesn't do any image decoding or mallocing, and has an
- // optimized way of skipping SkipBlocks, ImageDataBlocks and
- // Global/LocalColorMaps.
-
- while (!readBuffer.isEmpty()) {
- int length = readBuffer.size();
- const uchar *buffer = (const uchar *) readBuffer.constData();
- while (!done && length) {
- length--;
- uchar ch = *buffer++;
- switch (state) {
- case Header:
- hold[count++] = ch;
- if (count == 6) {
- state = LogicalScreenDescriptor;
- count = 0;
- }
- break;
- case LogicalScreenDescriptor:
- hold[count++] = ch;
- if (count == 7) {
- imageWidth = LM(hold[0], hold[1]);
- imageHeight = LM(hold[2], hold[3]);
- globalColormap = !!(hold[4] & 0x80);
- globalColorCount = 2 << (hold[4] & 0x7);
- count = 0;
- colorCount = globalColorCount;
- if (globalColormap) {
- int colorTableSize = 3 * globalColorCount;
- if (length >= colorTableSize) {
- // skip the global color table in one go
- length -= colorTableSize;
- buffer += colorTableSize;
- state = Introducer;
- } else {
- colorReadCount = 0;
- state = GlobalColorMap;
- }
- } else {
- state=Introducer;
- }
- }
- break;
- case GlobalColorMap:
- case LocalColorMap:
- hold[count++] = ch;
- if (count == 3) {
- if (++colorReadCount >= colorCount) {
- if (state == LocalColorMap)
- state = TableImageLZWSize;
- else
- state = Introducer;
- }
- count = 0;
- }
- break;
- case Introducer:
- hold[count++] = ch;
- switch (ch) {
- case 0x2c:
- state = ImageDescriptor;
- break;
- case 0x21:
- state = ExtensionLabel;
- break;
- case 0x3b:
- state = Done;
- break;
- default:
- done = true;
- state = Error;
- }
- break;
- case ImageDescriptor:
- hold[count++] = ch;
- if (count == 10) {
- int newLeft = LM(hold[1], hold[2]);
- int newTop = LM(hold[3], hold[4]);
- int newWidth = LM(hold[5], hold[6]);
- int newHeight = LM(hold[7], hold[8]);
-
- if (imageWidth/10 > qMax(newWidth,200))
- imageWidth = -1;
- if (imageHeight/10 > qMax(newHeight,200))
- imageHeight = -1;
-
- if (imageWidth <= 0)
- imageWidth = newLeft + newWidth;
- if (imageHeight <= 0)
- imageHeight = newTop + newHeight;
-
- *imageSizes << QSize(imageWidth, imageHeight);
-
- localColormap = !!(hold[9] & 0x80);
- localColorCount = localColormap ? (2 << (hold[9] & 0x7)) : 0;
- if (localColorCount)
- colorCount = localColorCount;
- else
- colorCount = globalColorCount;
-
- count = 0;
- if (localColormap) {
- int colorTableSize = 3 * localColorCount;
- if (length >= colorTableSize) {
- // skip the local color table in one go
- length -= colorTableSize;
- buffer += colorTableSize;
- state = TableImageLZWSize;
- } else {
- colorReadCount = 0;
- state = LocalColorMap;
- }
- } else {
- state = TableImageLZWSize;
- }
- }
- break;
- case TableImageLZWSize:
- if (ch > max_lzw_bits)
- state = Error;
- else
- state = ImageDataBlockSize;
- count = 0;
- break;
- case ImageDataBlockSize:
- blockSize = ch;
- if (blockSize) {
- if (length >= blockSize) {
- // we can skip the block in one go
- length -= blockSize;
- buffer += blockSize;
- count = 0;
- } else {
- state = ImageDataBlock;
- }
- } else {
- state = Introducer;
- }
- break;
- case ImageDataBlock:
- ++count;
- if (count == blockSize) {
- count = 0;
- state = ImageDataBlockSize;
- }
- break;
- case ExtensionLabel:
- switch (ch) {
- case 0xf9:
- state = GraphicControlExtension;
- break;
- case 0xff:
- state = ApplicationExtension;
- break;
- default:
- state = SkipBlockSize;
- }
- count = 0;
- break;
- case ApplicationExtension:
- if (count < 11)
- hold[count] = ch;
- ++count;
- if (count == hold[0] + 1) {
- if (qstrncmp((char*)(hold+1), "NETSCAPE", 8) == 0)
- state=NetscapeExtensionBlockSize;
- else
- state=SkipBlockSize;
- count = 0;
- }
- break;
- case GraphicControlExtension:
- if (count < 5)
- hold[count] = ch;
- ++count;
- if (count == hold[0] + 1) {
- count = 0;
- state = SkipBlockSize;
- }
- break;
- case NetscapeExtensionBlockSize:
- blockSize = ch;
- count = 0;
- if (blockSize)
- state = NetscapeExtensionBlock;
- else
- state = Introducer;
- break;
- case NetscapeExtensionBlock:
- if (count < 3)
- hold[count] = ch;
- count++;
- if (count == blockSize) {
- *loopCount = LM(hold[1], hold[2]);
- state = SkipBlockSize;
- }
- break;
- case SkipBlockSize:
- blockSize = ch;
- count = 0;
- if (blockSize) {
- if (length >= blockSize) {
- // we can skip the block in one go
- length -= blockSize;
- buffer += blockSize;
- } else {
- state = SkipBlock;
- }
- } else {
- state = Introducer;
- }
- break;
- case SkipBlock:
- ++count;
- if (count == blockSize)
- state = SkipBlockSize;
- break;
- case Done:
- done = true;
- break;
- case Error:
- device->seek(oldPos);
- return;
- }
- }
- readBuffer = device->read(readBufferSize);
- }
- device->seek(oldPos);
- return;
-}
-
-void QGIFFormat::fillRect(QImage *image, int col, int row, int w, int h, QRgb color)
-{
- if (w>0) {
- for (int j=0; j<h; j++) {
- QRgb *line = (QRgb*)image->scanLine(j+row);
- for (int i=0; i<w; i++)
- *(line+col+i) = color;
- }
- }
-}
-
-void QGIFFormat::nextY(unsigned char *bits, int bpl)
-{
- if (out_of_bounds)
- return;
- int my;
- switch (interlace) {
- case 0: // Non-interlaced
- // if (!out_of_bounds) {
- // ### Changed: QRect(left, y, right - left + 1, 1);
- // }
- y++;
- break;
- case 1: {
- int i;
- my = qMin(7, bottom-y);
- // Don't dup with transparency
- if (trans_index < 0) {
- for (i=1; i<=my; i++) {
- memcpy(FAST_SCAN_LINE(bits, bpl, y+i)+left*sizeof(QRgb), FAST_SCAN_LINE(bits, bpl, y)+left*sizeof(QRgb),
- (right-left+1)*sizeof(QRgb));
- }
- }
-
- // if (!out_of_bounds) {
- // ### Changed: QRect(left, y, right - left + 1, my + 1);
- // }
-// if (!out_of_bounds)
-// qDebug("consumer->changed(QRect(%d, %d, %d, %d))", left, y, right-left+1, my+1);
- y+=8;
- if (y>bottom) {
- interlace++; y=top+4;
- if (y > bottom) { // for really broken GIFs with bottom < 5
- interlace=2;
- y = top + 2;
- if (y > bottom) { // for really broken GIF with bottom < 3
- interlace = 0;
- y = top + 1;
- }
- }
- }
- } break;
- case 2: {
- int i;
- my = qMin(3, bottom-y);
- // Don't dup with transparency
- if (trans_index < 0) {
- for (i=1; i<=my; i++) {
- memcpy(FAST_SCAN_LINE(bits, bpl, y+i)+left*sizeof(QRgb), FAST_SCAN_LINE(bits, bpl, y)+left*sizeof(QRgb),
- (right-left+1)*sizeof(QRgb));
- }
- }
-
- // if (!out_of_bounds) {
- // ### Changed: QRect(left, y, right - left + 1, my + 1);
- // }
- y+=8;
- if (y>bottom) {
- interlace++; y=top+2;
- // handle broken GIF with bottom < 3
- if (y > bottom) {
- interlace = 3;
- y = top + 1;
- }
- }
- } break;
- case 3: {
- int i;
- my = qMin(1, bottom-y);
- // Don't dup with transparency
- if (trans_index < 0) {
- for (i=1; i<=my; i++) {
- memcpy(FAST_SCAN_LINE(bits, bpl, y+i)+left*sizeof(QRgb), FAST_SCAN_LINE(bits, bpl, y)+left*sizeof(QRgb),
- (right-left+1)*sizeof(QRgb));
- }
- }
- // if (!out_of_bounds) {
- // ### Changed: QRect(left, y, right - left + 1, my + 1);
- // }
- y+=4;
- if (y>bottom) { interlace++; y=top+1; }
- } break;
- case 4:
- // if (!out_of_bounds) {
- // ### Changed: QRect(left, y, right - left + 1, 1);
- // }
- y+=2;
- }
-
- // Consume bogus extra lines
- if (y >= sheight) out_of_bounds=true; //y=bottom;
-}
-
-inline QRgb QGIFFormat::color(uchar index) const
-{
- if (index > ncols)
- return Q_TRANSPARENT;
-
- QRgb *map = lcmap ? localcmap : globalcmap;
- QRgb col = map ? map[index] : 0;
- return index == trans_index ? col & Q_TRANSPARENT : col;
-}
-
-//-------------------------------------------------------------------------
-//-------------------------------------------------------------------------
-//-------------------------------------------------------------------------
-
-QGifHandler::QGifHandler()
-{
- gifFormat = new QGIFFormat;
- nextDelay = 100;
- loopCnt = -1;
- frameNumber = -1;
- scanIsCached = false;
-}
-
-QGifHandler::~QGifHandler()
-{
- delete gifFormat;
-}
-
-// Does partial decode if necessary, just to see if an image is coming
-
-bool QGifHandler::imageIsComing() const
-{
- const int GifChunkSize = 4096;
-
- while (!gifFormat->partialNewFrame) {
- if (buffer.isEmpty()) {
- buffer += device()->read(GifChunkSize);
- if (buffer.isEmpty())
- break;
- }
-
- int decoded = gifFormat->decode(&lastImage, (const uchar *)buffer.constData(), buffer.size(),
- &nextDelay, &loopCnt);
- if (decoded == -1)
- break;
- buffer.remove(0, decoded);
- }
- return gifFormat->partialNewFrame;
-}
-
-bool QGifHandler::canRead() const
-{
- if (canRead(device()) || imageIsComing()) {
- setFormat("gif");
- return true;
- }
-
- return false;
-}
-
-bool QGifHandler::canRead(QIODevice *device)
-{
- if (!device) {
- qWarning("QGifHandler::canRead() called with no device");
- return false;
- }
-
- char head[6];
- if (device->peek(head, sizeof(head)) == sizeof(head))
- return qstrncmp(head, "GIF87a", 6) == 0
- || qstrncmp(head, "GIF89a", 6) == 0;
- return false;
-}
-
-bool QGifHandler::read(QImage *image)
-{
- const int GifChunkSize = 4096;
-
- while (!gifFormat->newFrame) {
- if (buffer.isEmpty()) {
- buffer += device()->read(GifChunkSize);
- if (buffer.isEmpty())
- break;
- }
-
- int decoded = gifFormat->decode(&lastImage, (const uchar *)buffer.constData(), buffer.size(),
- &nextDelay, &loopCnt);
- if (decoded == -1)
- break;
- buffer.remove(0, decoded);
- }
- if (gifFormat->newFrame || (gifFormat->partialNewFrame && device()->atEnd())) {
- *image = lastImage;
- ++frameNumber;
- gifFormat->newFrame = false;
- gifFormat->partialNewFrame = false;
- return true;
- }
-
- return false;
-}
-
-bool QGifHandler::write(const QImage &image)
-{
- Q_UNUSED(image);
- return false;
-}
-
-bool QGifHandler::supportsOption(ImageOption option) const
-{
- if (!device() || device()->isSequential())
- return option == Animation;
- else
- return option == Size
- || option == Animation;
-}
-
-QVariant QGifHandler::option(ImageOption option) const
-{
- if (option == Size) {
- if (!scanIsCached) {
- QGIFFormat::scan(device(), &imageSizes, &loopCnt);
- scanIsCached = true;
- }
- // before the first frame is read, or we have an empty data stream
- if (frameNumber == -1)
- return (imageSizes.count() > 0) ? QVariant(imageSizes.at(0)) : QVariant();
- // after the last frame has been read, the next size is undefined
- if (frameNumber >= imageSizes.count() - 1)
- return QVariant();
- // and the last case: the size of the next frame
- return imageSizes.at(frameNumber + 1);
- } else if (option == Animation) {
- return true;
- }
- return QVariant();
-}
-
-void QGifHandler::setOption(ImageOption option, const QVariant &value)
-{
- Q_UNUSED(option);
- Q_UNUSED(value);
-}
-
-int QGifHandler::nextImageDelay() const
-{
- return nextDelay;
-}
-
-int QGifHandler::imageCount() const
-{
- if (!scanIsCached) {
- QGIFFormat::scan(device(), &imageSizes, &loopCnt);
- scanIsCached = true;
- }
- return imageSizes.count();
-}
-
-int QGifHandler::loopCount() const
-{
- if (!scanIsCached) {
- QGIFFormat::scan(device(), &imageSizes, &loopCnt);
- scanIsCached = true;
- }
-
- if (loopCnt == 0)
- return -1;
- else if (loopCnt == -1)
- return 0;
- else
- return loopCnt;
-}
-
-int QGifHandler::currentImageNumber() const
-{
- return frameNumber;
-}
-
-QByteArray QGifHandler::name() const
-{
- return "gif";
-}
-
-QT_END_NAMESPACE
diff --git a/src/gui/image/qgifhandler.pri b/src/gui/image/qgifhandler.pri
deleted file mode 100644
index ec33101451..0000000000
--- a/src/gui/image/qgifhandler.pri
+++ /dev/null
@@ -1,3 +0,0 @@
-# common to plugin and built-in forms
-HEADERS += $$PWD/qgifhandler_p.h
-SOURCES += $$PWD/qgifhandler.cpp
diff --git a/src/gui/image/qgifhandler_p.h b/src/gui/image/qgifhandler_p.h
deleted file mode 100644
index bc3debe83c..0000000000
--- a/src/gui/image/qgifhandler_p.h
+++ /dev/null
@@ -1,105 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-** WARNING:
-** A separate license from Unisys may be required to use the gif
-** reader. See http://www.unisys.com/about__unisys/lzw/
-** for information from Unisys
-**
-****************************************************************************/
-
-#ifndef QGIFHANDLER_P_H
-#define QGIFHANDLER_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtGui/qimageiohandler.h>
-#include <QtGui/qimage.h>
-#include <QtCore/qbytearray.h>
-
-QT_BEGIN_NAMESPACE
-
-class QGIFFormat;
-class QGifHandler : public QImageIOHandler
-{
-public:
- QGifHandler();
- ~QGifHandler();
-
- bool canRead() const Q_DECL_OVERRIDE;
- bool read(QImage *image) Q_DECL_OVERRIDE;
- bool write(const QImage &image) Q_DECL_OVERRIDE;
-
- QByteArray name() const Q_DECL_OVERRIDE;
-
- static bool canRead(QIODevice *device);
-
- QVariant option(ImageOption option) const Q_DECL_OVERRIDE;
- void setOption(ImageOption option, const QVariant &value) Q_DECL_OVERRIDE;
- bool supportsOption(ImageOption option) const Q_DECL_OVERRIDE;
-
- int imageCount() const Q_DECL_OVERRIDE;
- int loopCount() const Q_DECL_OVERRIDE;
- int nextImageDelay() const Q_DECL_OVERRIDE;
- int currentImageNumber() const Q_DECL_OVERRIDE;
-
-private:
- bool imageIsComing() const;
- QGIFFormat *gifFormat;
- QString fileName;
- mutable QByteArray buffer;
- mutable QImage lastImage;
-
- mutable int nextDelay;
- mutable int loopCnt;
- int frameNumber;
- mutable QVector<QSize> imageSizes;
- mutable bool scanIsCached;
-};
-
-QT_END_NAMESPACE
-
-#endif // QGIFHANDLER_P_H
diff --git a/src/gui/image/qicon.h b/src/gui/image/qicon.h
index 1b0e73c21b..40d3e92af9 100644
--- a/src/gui/image/qicon.h
+++ b/src/gui/image/qicon.h
@@ -40,7 +40,7 @@
#ifndef QICON_H
#define QICON_H
-#include <QtCore/qglobal.h>
+#include <QtGui/qtguiglobal.h>
#include <QtCore/qsize.h>
#include <QtCore/qlist.h>
#include <QtGui/qpixmap.h>
diff --git a/src/gui/image/qicon_p.h b/src/gui/image/qicon_p.h
index cfae9b3e52..a978a72192 100644
--- a/src/gui/image/qicon_p.h
+++ b/src/gui/image/qicon_p.h
@@ -51,7 +51,7 @@
// We mean it.
//
-#include <QtCore/qglobal.h>
+#include <QtGui/private/qtguiglobal_p.h>
#include <QtCore/qsize.h>
#include <QtCore/qlist.h>
#include <QtGui/qpixmap.h>
diff --git a/src/gui/image/qiconengine.h b/src/gui/image/qiconengine.h
index c702a1e8bb..b0c92ced73 100644
--- a/src/gui/image/qiconengine.h
+++ b/src/gui/image/qiconengine.h
@@ -40,7 +40,7 @@
#ifndef QICONENGINE_H
#define QICONENGINE_H
-#include <QtCore/qglobal.h>
+#include <QtGui/qtguiglobal.h>
#include <QtCore/qlist.h>
#include <QtGui/qicon.h>
diff --git a/src/gui/image/qiconengineplugin.h b/src/gui/image/qiconengineplugin.h
index aacb3a9ebb..7a01d3731c 100644
--- a/src/gui/image/qiconengineplugin.h
+++ b/src/gui/image/qiconengineplugin.h
@@ -40,6 +40,7 @@
#ifndef QICONENGINEPLUGIN_H
#define QICONENGINEPLUGIN_H
+#include <QtGui/qtguiglobal.h>
#include <QtCore/qplugin.h>
#include <QtCore/qfactoryinterface.h>
diff --git a/src/gui/image/qiconloader.cpp b/src/gui/image/qiconloader.cpp
index 0233ccbf87..eda9d6f24e 100644
--- a/src/gui/image/qiconloader.cpp
+++ b/src/gui/image/qiconloader.cpp
@@ -168,7 +168,7 @@ class QIconCacheGtkReader
{
public:
explicit QIconCacheGtkReader(const QString &themeDir);
- QVector<const char *> lookup(const QString &);
+ QVector<const char *> lookup(const QStringRef &);
bool isValid() const { return m_isValid; }
private:
QFile m_file;
@@ -199,7 +199,7 @@ private:
QIconCacheGtkReader::QIconCacheGtkReader(const QString &dirName)
: m_isValid(false)
{
- QFileInfo info(dirName + QLatin1Literal("/icon-theme.cache"));
+ QFileInfo info(dirName + QLatin1String("/icon-theme.cache"));
if (!info.exists() || info.lastModified() < QFileInfo(dirName).lastModified())
return;
m_file.setFileName(info.absoluteFilePath());
@@ -241,7 +241,7 @@ static quint32 icon_name_hash(const char *p)
with this name is present. The char* are pointers to the mapped data.
For example, this would return { "32x32/apps", "24x24/apps" , ... }
*/
-QVector<const char *> QIconCacheGtkReader::lookup(const QString &name)
+QVector<const char *> QIconCacheGtkReader::lookup(const QStringRef &name)
{
QVector<const char *> ret;
if (!isValid())
@@ -316,10 +316,8 @@ QIconTheme::QIconTheme(const QString &themeName)
#ifndef QT_NO_SETTINGS
if (themeIndex.exists()) {
const QSettings indexReader(themeIndex.fileName(), QSettings::IniFormat);
- QStringListIterator keyIterator(indexReader.allKeys());
- while (keyIterator.hasNext()) {
-
- const QString key = keyIterator.next();
+ const QStringList keys = indexReader.allKeys();
+ for (const QString &key : keys) {
if (key.endsWith(QLatin1String("/Size"))) {
// Note the QSettings ini-format does not accept
// slashes in key names, hence we have to cheat
@@ -396,7 +394,7 @@ QThemeIconInfo QIconLoader::findIconHelper(const QString &themeName,
const QStringList contentDirs = theme.contentDirs();
- QString iconNameFallback = iconName;
+ QStringRef iconNameFallback(&iconName);
// Iterate through all icon's fallbacks in current theme
while (info.entries.isEmpty()) {
@@ -431,27 +429,29 @@ QThemeIconInfo QIconLoader::findIconHelper(const QString &themeName,
QString contentDir = contentDirs.at(i) + QLatin1Char('/');
for (int j = 0; j < subDirs.size() ; ++j) {
const QIconDirInfo &dirInfo = subDirs.at(j);
- QString subdir = dirInfo.path;
- QDir currentDir(contentDir + subdir);
- if (currentDir.exists(pngIconName)) {
+ const QString subDir = contentDir + dirInfo.path + QLatin1Char('/');
+ const QString pngPath = subDir + pngIconName;
+ if (QFile::exists(pngPath)) {
PixmapEntry *iconEntry = new PixmapEntry;
iconEntry->dir = dirInfo;
- iconEntry->filename = currentDir.filePath(pngIconName);
+ iconEntry->filename = pngPath;
// Notice we ensure that pixmap entries always come before
// scalable to preserve search order afterwards
info.entries.prepend(iconEntry);
- } else if (m_supportsSvg &&
- currentDir.exists(svgIconName)) {
- ScalableEntry *iconEntry = new ScalableEntry;
- iconEntry->dir = dirInfo;
- iconEntry->filename = currentDir.filePath(svgIconName);
- info.entries.append(iconEntry);
+ } else if (m_supportsSvg) {
+ const QString svgPath = subDir + svgIconName;
+ if (QFile::exists(svgPath)) {
+ ScalableEntry *iconEntry = new ScalableEntry;
+ iconEntry->dir = dirInfo;
+ iconEntry->filename = svgPath;
+ info.entries.append(iconEntry);
+ }
}
}
}
if (!info.entries.isEmpty()) {
- info.iconName = iconNameFallback;
+ info.iconName = iconNameFallback.toString();
break;
}
diff --git a/src/gui/image/qiconloader_p.h b/src/gui/image/qiconloader_p.h
index 0945add2fb..583499be76 100644
--- a/src/gui/image/qiconloader_p.h
+++ b/src/gui/image/qiconloader_p.h
@@ -40,7 +40,7 @@
#ifndef QICONLOADER_P_H
#define QICONLOADER_P_H
-#include <QtCore/qglobal.h>
+#include <QtGui/private/qtguiglobal_p.h>
#ifndef QT_NO_ICON
//
diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp
index 64673d44b8..8bbcfa612d 100644
--- a/src/gui/image/qimage.cpp
+++ b/src/gui/image/qimage.cpp
@@ -780,9 +780,8 @@ QImage::QImage() Q_DECL_NOEXCEPT
drawing onto it with QPainter.
*/
QImage::QImage(int width, int height, Format format)
- : QPaintDevice()
+ : QImage(QSize(width, height), format)
{
- d = QImageData::create(QSize(width, height), format);
}
/*!
@@ -1889,7 +1888,7 @@ void QImage::invertPixels(InvertMode mode)
case QImage::Format_RGBA8888:
if (mode == InvertRgba)
break;
- // no break
+ Q_FALLTHROUGH();
case QImage::Format_RGBX8888:
#if Q_BYTE_ORDER == Q_BIG_ENDIAN
xorbits = 0xffffff00;
@@ -1901,7 +1900,7 @@ void QImage::invertPixels(InvertMode mode)
case QImage::Format_ARGB32:
if (mode == InvertRgba)
break;
- // no break
+ Q_FALLTHROUGH();
case QImage::Format_RGB32:
xorbits = 0x00ffffff;
break;
@@ -2286,7 +2285,7 @@ QRgb QImage::pixel(int x, int y) const
const QPixelLayout *layout = &qPixelLayouts[d->format];
uint result;
const uint *ptr = qFetchPixels[layout->bpp](&result, s, x, 1);
- return *layout->convertToARGB32PM(&result, ptr, 1, layout, 0);
+ return *layout->convertToARGB32PM(&result, ptr, 1, 0, 0);
}
/*!
@@ -2388,7 +2387,7 @@ void QImage::setPixel(int x, int y, uint index_or_rgb)
const QPixelLayout *layout = &qPixelLayouts[d->format];
uint result;
- const uint *ptr = layout->convertFromARGB32PM(&result, &index_or_rgb, 1, layout, 0);
+ const uint *ptr = layout->convertFromARGB32PM(&result, &index_or_rgb, 1, 0, 0);
qStorePixels[layout->bpp](s, ptr, x, 1);
}
@@ -2574,7 +2573,7 @@ bool QImage::allGray() const
while (x < d->width) {
int l = qMin(d->width - x, buffer_size);
const uint *ptr = fetch(buffer, b, x, l);
- ptr = layout->convertToARGB32PM(buffer, ptr, l, layout, 0);
+ ptr = layout->convertToARGB32PM(buffer, ptr, l, 0, 0);
for (int i = 0; i < l; ++i) {
if (!qIsGray(ptr[i]))
return false;
@@ -3015,6 +3014,37 @@ template<class T> inline void do_mirror_data(QImageData *dst, QImageData *src,
}
}
+inline void do_flip(QImageData *dst, QImageData *src, int w, int h, int depth)
+{
+ const int data_bytes_per_line = w * (depth / 8);
+ if (dst == src) {
+ uint *srcPtr = reinterpret_cast<uint *>(src->data);
+ uint *dstPtr = reinterpret_cast<uint *>(dst->data + (h - 1) * dst->bytes_per_line);
+ h = h / 2;
+ const int uint_per_line = (data_bytes_per_line + 3) >> 2; // bytes per line must be a multiple of 4
+ for (int y = 0; y < h; ++y) {
+ // This is auto-vectorized, no need for SSE2 or NEON versions:
+ for (int x = 0; x < uint_per_line; x++) {
+ const uint d = dstPtr[x];
+ const uint s = srcPtr[x];
+ dstPtr[x] = s;
+ srcPtr[x] = d;
+ }
+ srcPtr += src->bytes_per_line >> 2;
+ dstPtr -= dst->bytes_per_line >> 2;
+ }
+
+ } else {
+ const uchar *srcPtr = src->data;
+ uchar *dstPtr = dst->data + (h - 1) * dst->bytes_per_line;
+ for (int y = 0; y < h; ++y) {
+ memcpy(dstPtr, srcPtr, data_bytes_per_line);
+ srcPtr += src->bytes_per_line;
+ dstPtr -= dst->bytes_per_line;
+ }
+ }
+}
+
inline void do_mirror(QImageData *dst, QImageData *src, bool horizontal, bool vertical)
{
Q_ASSERT(src->width == dst->width && src->height == dst->height && src->depth == dst->depth);
@@ -3027,6 +3057,12 @@ inline void do_mirror(QImageData *dst, QImageData *src, bool horizontal, bool ve
depth = 8;
}
+ if (vertical && !horizontal) {
+ // This one is simple and common, so do it a little more optimized
+ do_flip(dst, src, w, h, depth);
+ return;
+ }
+
int dstX0 = 0, dstXIncr = 1;
int dstY0 = 0, dstYIncr = 1;
if (horizontal) {
@@ -5217,4 +5253,33 @@ Q_GUI_EXPORT void qt_imageTransform(QImage &src, QImageIOHandler::Transformation
}
}
+QMap<QString, QString> qt_getImageText(const QImage &image, const QString &description)
+{
+ QMap<QString, QString> text = qt_getImageTextFromDescription(description);
+ const auto textKeys = image.textKeys();
+ for (const QString &key : textKeys) {
+ if (!key.isEmpty() && !text.contains(key))
+ text.insert(key, image.text(key));
+ }
+ return text;
+}
+
+QMap<QString, QString> qt_getImageTextFromDescription(const QString &description)
+{
+ QMap<QString, QString> text;
+ const auto pairs = description.splitRef(QLatin1String("\n\n"));
+ for (const QStringRef &pair : pairs) {
+ int index = pair.indexOf(QLatin1Char(':'));
+ if (index >= 0 && pair.indexOf(QLatin1Char(' ')) < index) {
+ if (!pair.trimmed().isEmpty())
+ text.insert(QLatin1String("Description"), pair.toString().simplified());
+ } else {
+ const QStringRef key = pair.left(index);
+ if (!key.trimmed().isEmpty())
+ text.insert(key.toString(), pair.mid(index + 2).toString().simplified());
+ }
+ }
+ return text;
+}
+
QT_END_NAMESPACE
diff --git a/src/gui/image/qimage.h b/src/gui/image/qimage.h
index 6f8e214b11..91aaf673d0 100644
--- a/src/gui/image/qimage.h
+++ b/src/gui/image/qimage.h
@@ -40,6 +40,7 @@
#ifndef QIMAGE_H
#define QIMAGE_H
+#include <QtGui/qtguiglobal.h>
#include <QtGui/qcolor.h>
#include <QtGui/qrgb.h>
#include <QtGui/qpaintdevice.h>
@@ -53,6 +54,10 @@
#include <QtCore/qstringlist.h>
#endif
+#if defined(Q_OS_DARWIN) || defined(Q_QDOC)
+Q_FORWARD_DECLARE_MUTABLE_CG_TYPE(CGImage);
+#endif
+
QT_BEGIN_NAMESPACE
@@ -320,6 +325,11 @@ public:
static QPixelFormat toPixelFormat(QImage::Format format) Q_DECL_NOTHROW;
static QImage::Format toImageFormat(QPixelFormat format) Q_DECL_NOTHROW;
+ // Platform spesific conversion functions
+#if defined(Q_OS_DARWIN) || defined(Q_QDOC)
+ CGImageRef toCGImage() const Q_DECL_CF_RETURNS_RETAINED;
+#endif
+
#if QT_DEPRECATED_SINCE(5, 0)
QT_DEPRECATED inline QString text(const char *key, const char *lang = Q_NULLPTR) const;
QT_DEPRECATED inline QList<QImageTextKeyLang> textList() const;
diff --git a/src/gui/image/qimage_conversions.cpp b/src/gui/image/qimage_conversions.cpp
index bb0b76d55f..9bd098b7b1 100644
--- a/src/gui/image/qimage_conversions.cpp
+++ b/src/gui/image/qimage_conversions.cpp
@@ -108,7 +108,7 @@ void qGamma_correct_back_to_linear_cs(QImage *image)
// The drawhelper conversions from/to RGB32 are passthroughs which is not always correct for general image conversion.
static const uint *QT_FASTCALL convertRGB32FromARGB32PM(uint *buffer, const uint *src, int count,
- const QPixelLayout *, const QRgb *)
+ const QVector<QRgb> *, QDitherInfo *)
{
for (int i = 0; i < count; ++i)
buffer[i] = 0xff000000 | qUnpremultiply(src[i]);
@@ -116,7 +116,7 @@ static const uint *QT_FASTCALL convertRGB32FromARGB32PM(uint *buffer, const uint
}
static const uint *QT_FASTCALL convertRGB32ToARGB32PM(uint *buffer, const uint *src, int count,
- const QPixelLayout *, const QRgb *)
+ const QVector<QRgb> *, QDitherInfo *)
{
for (int i = 0; i < count; ++i)
buffer[i] = 0xff000000 |src[i];
@@ -124,16 +124,18 @@ static const uint *QT_FASTCALL convertRGB32ToARGB32PM(uint *buffer, const uint *
}
#ifdef QT_COMPILER_SUPPORTS_SSE4_1
-extern const uint *QT_FASTCALL convertRGB32FromARGB32PM_sse4(uint *buffer, const uint *src, int count, const QPixelLayout *, const QRgb *);
+extern const uint *QT_FASTCALL convertRGB32FromARGB32PM_sse4(uint *buffer, const uint *src, int count,
+ const QVector<QRgb> *, QDitherInfo *);
#endif
-void convert_generic(QImageData *dest, const QImageData *src, Qt::ImageConversionFlags)
+void convert_generic(QImageData *dest, const QImageData *src, Qt::ImageConversionFlags flags)
{
// Cannot be used with indexed formats.
Q_ASSERT(dest->format > QImage::Format_Indexed8);
Q_ASSERT(src->format > QImage::Format_Indexed8);
const int buffer_size = 2048;
- uint buffer[buffer_size];
+ uint buf[buffer_size];
+ uint *buffer = buf;
const QPixelLayout *srcLayout = &qPixelLayouts[src->format];
const QPixelLayout *destLayout = &qPixelLayouts[dest->format];
const uchar *srcData = src->data;
@@ -158,15 +160,26 @@ void convert_generic(QImageData *dest, const QImageData *src, Qt::ImageConversio
convertFromARGB32PM = convertRGB32FromARGB32PM;
}
}
+ QDitherInfo dither;
+ QDitherInfo *ditherPtr = 0;
+ if ((flags & Qt::PreferDither) && (flags & Qt::Dither_Mask) != Qt::ThresholdDither)
+ ditherPtr = &dither;
for (int y = 0; y < src->height; ++y) {
+ dither.y = y;
int x = 0;
while (x < src->width) {
- int l = qMin(src->width - x, buffer_size);
+ dither.x = x;
+ int l = src->width - x;
+ if (destLayout->bpp == QPixelLayout::BPP32)
+ buffer = reinterpret_cast<uint *>(destData) + x;
+ else
+ l = qMin(l, buffer_size);
const uint *ptr = fetch(buffer, srcData, x, l);
- ptr = convertToARGB32PM(buffer, ptr, l, srcLayout, 0);
- ptr = convertFromARGB32PM(buffer, ptr, l, destLayout, 0);
- store(destData, ptr, x, l);
+ ptr = convertToARGB32PM(buffer, ptr, l, 0, ditherPtr);
+ ptr = convertFromARGB32PM(buffer, ptr, l, 0, ditherPtr);
+ if (ptr != reinterpret_cast<uint *>(destData))
+ store(destData, ptr, x, l);
x += l;
}
srcData += src->bytes_per_line;
@@ -174,7 +187,7 @@ void convert_generic(QImageData *dest, const QImageData *src, Qt::ImageConversio
}
}
-bool convert_generic_inplace(QImageData *data, QImage::Format dst_format, Qt::ImageConversionFlags)
+bool convert_generic_inplace(QImageData *data, QImage::Format dst_format, Qt::ImageConversionFlags flags)
{
// Cannot be used with indexed formats or between formats with different pixel depths.
Q_ASSERT(dst_format > QImage::Format_Indexed8);
@@ -207,14 +220,20 @@ bool convert_generic_inplace(QImageData *data, QImage::Format dst_format, Qt::Im
convertFromARGB32PM = convertRGB32FromARGB32PM;
}
}
+ QDitherInfo dither;
+ QDitherInfo *ditherPtr = 0;
+ if ((flags & Qt::PreferDither) && (flags & Qt::Dither_Mask) != Qt::ThresholdDither)
+ ditherPtr = &dither;
for (int y = 0; y < data->height; ++y) {
+ dither.y = y;
int x = 0;
while (x < data->width) {
+ dither.x = x;
int l = qMin(data->width - x, buffer_size);
const uint *ptr = fetch(buffer, srcData, x, l);
- ptr = convertToARGB32PM(buffer, ptr, l, srcLayout, 0);
- ptr = convertFromARGB32PM(buffer, ptr, l, destLayout, 0);
+ ptr = convertToARGB32PM(buffer, ptr, l, 0, ditherPtr);
+ ptr = convertFromARGB32PM(buffer, ptr, l, 0, ditherPtr);
// The conversions might be passthrough and not use the buffer, in that case we are already done.
if (srcData != (const uchar*)ptr)
store(srcData, ptr, x, l);
diff --git a/src/gui/image/qimage_darwin.mm b/src/gui/image/qimage_darwin.mm
new file mode 100644
index 0000000000..d72733abd3
--- /dev/null
+++ b/src/gui/image/qimage_darwin.mm
@@ -0,0 +1,141 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the QtGui module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL21$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qimage.h"
+
+#include <private/qcore_mac_p.h>
+
+#import <Foundation/Foundation.h>
+#import <CoreGraphics/CoreGraphics.h>
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ Creates a \c CGImage equivalent to the QImage \a image. Returns a
+ \c CGImageRef handle.
+
+ The returned CGImageRef partakes in the QImage implicit sharing,
+ and holds a reference to the QImage data. CGImage is immutable
+ and will never detach the QImage. Writing to the QImage will detach
+ as usual.
+
+ This function is fast, and does not copy or convert image data.
+
+ The following image formats are supported, and will be mapped to
+ a corresponding native image type:
+
+ \table
+ \header
+ \li Qt
+ \li CoreGraphics
+ \row
+ \li Format_ARGB32
+ \li kCGImageAlphaFirst | kCGBitmapByteOrder32Host
+ \row
+ \li Format_RGB32
+ \li kCGImageAlphaNoneSkipFirst | kCGBitmapByteOrder32Host
+ \row
+ \li Format_RGBA8888_Premultiplied
+ \li kCGImageAlphaPremultipliedLast | kCGBitmapByteOrder32Big
+ \row
+ \li Format_RGBA8888
+ \li kCGImageAlphaLast | kCGBitmapByteOrder32Big
+ \row
+ \li Format_RGBX8888
+ \li kCGImageAlphaNoneSkipLast | kCGBitmapByteOrder32Big
+ \row
+ \li Format_ARGB32_Premultiplied
+ \li kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Host
+ \endtable
+
+ Other formats are not supported; this function returns a null
+ CGImageRef for those cases. Users of this function may then
+ convert the QImage to a supported formate first, for example
+ Format_ARGB32_Premultiplied.
+
+ The CGImageRef color space is set to the sRGB color space.
+
+ \sa toNSImage()
+*/
+CGImageRef QImage::toCGImage() const
+{
+ if (isNull())
+ return nil;
+
+ // Determine the target native format
+ uint cgflags = kCGImageAlphaNone;
+ switch (format()) {
+ case QImage::Format_ARGB32:
+ cgflags = kCGImageAlphaFirst | kCGBitmapByteOrder32Host;
+ break;
+ case QImage::Format_RGB32:
+ cgflags = kCGImageAlphaNoneSkipFirst | kCGBitmapByteOrder32Host;
+ break;
+ case QImage::Format_RGBA8888_Premultiplied:
+ cgflags = kCGImageAlphaPremultipliedLast | kCGBitmapByteOrder32Big;
+ break;
+ case QImage::Format_RGBA8888:
+ cgflags = kCGImageAlphaLast | kCGBitmapByteOrder32Big;
+ break;
+ case QImage::Format_RGBX8888:
+ cgflags = kCGImageAlphaNoneSkipLast | kCGBitmapByteOrder32Big;
+ break;
+ case QImage::Format_ARGB32_Premultiplied:
+ cgflags = kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Host;
+ break;
+ default: break;
+ }
+
+ // Format not supported: return nil CGImageRef
+ if (cgflags == kCGImageAlphaNone)
+ return nil;
+
+ // Create a data provider that owns a copy of the QImage and references the image data.
+ auto deleter = [](void *image, const void *, size_t)
+ { delete static_cast<QImage *>(image); };
+ QCFType<CGDataProviderRef> dataProvider =
+ CGDataProviderCreateWithData(new QImage(*this), bits(), byteCount(), deleter);
+
+ QCFType<CGColorSpaceRef> colorSpace = CGColorSpaceCreateWithName(kCGColorSpaceSRGB);
+
+ const size_t bitsPerComponent = 8;
+ const size_t bitsPerPixel = 32;
+ const CGFloat *decode = nullptr;
+ const bool shouldInterpolate = false;
+
+ return CGImageCreate(width(), height(), bitsPerComponent, bitsPerPixel,
+ this->bytesPerLine(), colorSpace, cgflags, dataProvider,
+ decode, shouldInterpolate, kCGRenderingIntentDefault);
+}
+
+QT_END_NAMESPACE
diff --git a/src/gui/image/qimage_p.h b/src/gui/image/qimage_p.h
index 3e76f39b94..775ab6d541 100644
--- a/src/gui/image/qimage_p.h
+++ b/src/gui/image/qimage_p.h
@@ -51,7 +51,7 @@
// We mean it.
//
-#include <QtCore/qglobal.h>
+#include <QtGui/private/qtguiglobal_p.h>
#include <QMap>
#include <QVector>
@@ -212,6 +212,9 @@ inline QImage::Format qt_alphaVersionForPainting(QImage::Format format)
return toFormat;
}
+Q_GUI_EXPORT QMap<QString, QString> qt_getImageText(const QImage &image, const QString &description);
+Q_GUI_EXPORT QMap<QString, QString> qt_getImageTextFromDescription(const QString &description);
+
QT_END_NAMESPACE
#endif // QIMAGE_P_H
diff --git a/src/gui/image/qimage_sse4.cpp b/src/gui/image/qimage_sse4.cpp
index 1f3f8f0d3f..0e2c2f492e 100644
--- a/src/gui/image/qimage_sse4.cpp
+++ b/src/gui/image/qimage_sse4.cpp
@@ -48,7 +48,7 @@
QT_BEGIN_NAMESPACE
const uint *QT_FASTCALL convertRGB32FromARGB32PM_sse4(uint *buffer, const uint *src, int count,
- const QPixelLayout *, const QRgb *)
+ const QVector<QRgb> *, QDitherInfo *)
{
for (int i = 0; i < count; ++i)
buffer[i] = 0xff000000 | qUnpremultiply_sse4(src[i]);
diff --git a/src/gui/image/qimageiohandler.h b/src/gui/image/qimageiohandler.h
index 8f196ee9e0..baf9853259 100644
--- a/src/gui/image/qimageiohandler.h
+++ b/src/gui/image/qimageiohandler.h
@@ -40,6 +40,7 @@
#ifndef QIMAGEIOHANDLER_H
#define QIMAGEIOHANDLER_H
+#include <QtGui/qtguiglobal.h>
#include <QtCore/qiodevice.h>
#include <QtCore/qplugin.h>
#include <QtCore/qfactoryinterface.h>
diff --git a/src/gui/image/qimagepixmapcleanuphooks_p.h b/src/gui/image/qimagepixmapcleanuphooks_p.h
index f0ac17b0a9..29144c6656 100644
--- a/src/gui/image/qimagepixmapcleanuphooks_p.h
+++ b/src/gui/image/qimagepixmapcleanuphooks_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#include <QtGui/qpixmap.h>
QT_BEGIN_NAMESPACE
diff --git a/src/gui/image/qimagereader.cpp b/src/gui/image/qimagereader.cpp
index 4dada4ca82..4390e46fde 100644
--- a/src/gui/image/qimagereader.cpp
+++ b/src/gui/image/qimagereader.cpp
@@ -147,6 +147,9 @@
#include <private/qfactoryloader_p.h>
#include <QMutexLocker>
+// for qt_getImageText
+#include <private/qimage_p.h>
+
// image handlers
#include <private/qbmphandler_p.h>
#include <private/qppmhandler_p.h>
@@ -155,12 +158,6 @@
#ifndef QT_NO_IMAGEFORMAT_PNG
#include <private/qpnghandler_p.h>
#endif
-#ifndef QT_NO_IMAGEFORMAT_JPEG
-#include <private/qjpeghandler_p.h>
-#endif
-#ifdef QT_BUILTIN_GIF_READER
-#include <private/qgifhandler_p.h>
-#endif
#include <algorithm>
@@ -175,13 +172,6 @@ enum _qt_BuiltInFormatType {
#ifndef QT_NO_IMAGEFORMAT_PNG
_qt_PngFormat,
#endif
-#ifndef QT_NO_IMAGEFORMAT_JPEG
- _qt_JpgFormat,
- _qt_JpegFormat,
-#endif
-#ifdef QT_BUILTIN_GIF_READER
- _qt_GifFormat,
-#endif
#ifndef QT_NO_IMAGEFORMAT_BMP
_qt_BmpFormat,
#endif
@@ -210,13 +200,6 @@ static const _qt_BuiltInFormatStruct _qt_BuiltInFormats[] = {
#ifndef QT_NO_IMAGEFORMAT_PNG
{"png", "image/png"},
#endif
-#ifndef QT_NO_IMAGEFORMAT_JPEG
- {"jpg", "image/jpeg"},
- {"jpeg", "image/jpeg"},
-#endif
-#ifdef QT_BUILTIN_GIF_READER
- {"gif", "image/gif"},
-#endif
#ifndef QT_NO_IMAGEFORMAT_BMP
{"bmp", "image/bmp"},
#endif
@@ -357,14 +340,6 @@ static QImageIOHandler *createReadHandlerHelper(QIODevice *device,
} else if (testFormat == "png") {
handler = new QPngHandler;
#endif
-#ifndef QT_NO_IMAGEFORMAT_JPEG
- } else if (testFormat == "jpg" || testFormat == "jpeg") {
- handler = new QJpegHandler;
-#endif
-#ifdef QT_BUILTIN_GIF_READER
- } else if (testFormat == "gif") {
- handler = new QGifHandler;
-#endif
#ifndef QT_NO_IMAGEFORMAT_BMP
} else if (testFormat == "bmp") {
handler = new QBmpHandler;
@@ -442,19 +417,6 @@ static QImageIOHandler *createReadHandlerHelper(QIODevice *device,
handler = new QPngHandler;
break;
#endif
-#ifndef QT_NO_IMAGEFORMAT_JPEG
- case _qt_JpgFormat:
- case _qt_JpegFormat:
- if (QJpegHandler::canRead(device))
- handler = new QJpegHandler;
- break;
-#endif
-#ifdef QT_BUILTIN_GIF_READER
- case _qt_GifFormat:
- if (QGifHandler::canRead(device))
- handler = new QGifHandler;
- break;
-#endif
#ifndef QT_NO_IMAGEFORMAT_BMP
case _qt_BmpFormat:
if (QBmpHandler::canRead(device))
@@ -491,8 +453,8 @@ static QImageIOHandler *createReadHandlerHelper(QIODevice *device,
if (handler) {
#ifdef QIMAGEREADER_DEBUG
- qDebug() << "QImageReader::createReadHandler: the" << _qt_BuiltInFormats[currentFormat].extension
- << "built-in handler can read this data";
+ qDebug("QImageReader::createReadHandler: the %s built-in handler can read this data",
+ _qt_BuiltInFormats[currentFormat].extension);
#endif
break;
}
@@ -607,7 +569,7 @@ bool QImageReaderPrivate::initHandler()
do {
file->setFileName(fileName + QLatin1Char('.')
- + QString::fromLatin1(extensions.at(currentExtension++).constData()));
+ + QLatin1String(extensions.at(currentExtension++).constData()));
file->open(QIODevice::ReadOnly);
} while (!file->isOpen() && currentExtension < extensions.size());
@@ -633,18 +595,8 @@ bool QImageReaderPrivate::initHandler()
*/
void QImageReaderPrivate::getText()
{
- if (!text.isEmpty() || (!handler && !initHandler()) || !handler->supportsOption(QImageIOHandler::Description))
- return;
- foreach (const QString &pair, handler->option(QImageIOHandler::Description).toString().split(
- QLatin1String("\n\n"))) {
- int index = pair.indexOf(QLatin1Char(':'));
- if (index >= 0 && pair.indexOf(QLatin1Char(' ')) < index) {
- text.insert(QLatin1String("Description"), pair.simplified());
- } else {
- QString key = pair.left(index);
- text.insert(key, pair.mid(index + 2).simplified());
- }
- }
+ if (text.isEmpty() && (handler || initHandler()) && handler->supportsOption(QImageIOHandler::Description))
+ text = qt_getImageTextFromDescription(handler->option(QImageIOHandler::Description).toString());
}
/*!
@@ -674,12 +626,9 @@ QImageReader::QImageReader(QIODevice *device, const QByteArray &format)
\sa setFileName()
*/
QImageReader::QImageReader(const QString &fileName, const QByteArray &format)
- : d(new QImageReaderPrivate(this))
+ : QImageReader(new QFile(fileName), format)
{
- QFile *file = new QFile(fileName);
- d->device = file;
d->deleteDevice = true;
- d->format = format;
}
/*!
@@ -1202,7 +1151,7 @@ bool QImageReader::autoTransform() const
case QImageReaderPrivate::UsePluginDefault:
if (d->initHandler())
return d->handler->supportsOption(QImageIOHandler::TransformedByDefault);
- // no break
+ Q_FALLTHROUGH();
default:
break;
}
diff --git a/src/gui/image/qimagereader.h b/src/gui/image/qimagereader.h
index ad4f56c001..9d6c1e0b1e 100644
--- a/src/gui/image/qimagereader.h
+++ b/src/gui/image/qimagereader.h
@@ -40,6 +40,7 @@
#ifndef QIMAGEREADER_H
#define QIMAGEREADER_H
+#include <QtGui/qtguiglobal.h>
#include <QtCore/qbytearray.h>
#include <QtCore/qcoreapplication.h>
#include <QtGui/qimage.h>
diff --git a/src/gui/image/qimagewriter.cpp b/src/gui/image/qimagewriter.cpp
index 35db038601..f3af2738af 100644
--- a/src/gui/image/qimagewriter.cpp
+++ b/src/gui/image/qimagewriter.cpp
@@ -115,12 +115,6 @@
#ifndef QT_NO_IMAGEFORMAT_PNG
#include <private/qpnghandler_p.h>
#endif
-#ifndef QT_NO_IMAGEFORMAT_JPEG
-#include <private/qjpeghandler_p.h>
-#endif
-#ifdef QT_BUILTIN_GIF_READER
-#include <private/qgifhandler_p.h>
-#endif
#include <algorithm>
@@ -184,14 +178,6 @@ static QImageIOHandler *createWriteHandlerHelper(QIODevice *device,
} else if (testFormat == "png") {
handler = new QPngHandler;
#endif
-#ifndef QT_NO_IMAGEFORMAT_JPEG
- } else if (testFormat == "jpg" || testFormat == "jpeg") {
- handler = new QJpegHandler;
-#endif
-#ifdef QT_BUILTIN_GIF_READER
- } else if (testFormat == "gif") {
- handler = new QGifHandler;
-#endif
#ifndef QT_NO_IMAGEFORMAT_BMP
} else if (testFormat == "bmp") {
handler = new QBmpHandler;
@@ -340,12 +326,9 @@ QImageWriter::QImageWriter(QIODevice *device, const QByteArray &format)
by inspecting the extension of \a fileName.
*/
QImageWriter::QImageWriter(const QString &fileName, const QByteArray &format)
- : d(new QImageWriterPrivate(this))
+ : QImageWriter(new QFile(fileName), format)
{
- QFile *file = new QFile(fileName);
- d->device = file;
d->deleteDevice = true;
- d->format = format;
}
/*!
@@ -910,9 +893,6 @@ QList<QByteArray> QImageWriter::supportedImageFormats()
#ifndef QT_NO_IMAGEFORMAT_PNG
formats << "png";
#endif
-#ifndef QT_NO_IMAGEFORMAT_JPEG
- formats << "jpg" << "jpeg";
-#endif
#ifndef QT_NO_IMAGEFORMATPLUGIN
supportedImageHandlerFormats(loader(), QImageIOPlugin::CanWrite, &formats);
@@ -951,9 +931,6 @@ QList<QByteArray> QImageWriter::supportedMimeTypes()
#ifndef QT_NO_IMAGEFORMAT_PNG
mimeTypes << "image/png";
#endif
-#ifndef QT_NO_IMAGEFORMAT_JPEG
- mimeTypes << "image/jpeg";
-#endif
#ifndef QT_NO_IMAGEFORMATPLUGIN
supportedImageHandlerMimeTypes(loader(), QImageIOPlugin::CanWrite, &mimeTypes);
diff --git a/src/gui/image/qimagewriter.h b/src/gui/image/qimagewriter.h
index a6208ae5dc..58f8c51472 100644
--- a/src/gui/image/qimagewriter.h
+++ b/src/gui/image/qimagewriter.h
@@ -40,6 +40,7 @@
#ifndef QIMAGEWRITER_H
#define QIMAGEWRITER_H
+#include <QtGui/qtguiglobal.h>
#include <QtCore/qbytearray.h>
#include <QtCore/qcoreapplication.h>
#include <QtCore/qlist.h>
diff --git a/src/gui/image/qjpeghandler.cpp b/src/gui/image/qjpeghandler.cpp
deleted file mode 100644
index 52e8b39f11..0000000000
--- a/src/gui/image/qjpeghandler.cpp
+++ /dev/null
@@ -1,1144 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qjpeghandler_p.h"
-
-#include <qimage.h>
-#include <qvariant.h>
-#include <qvector.h>
-#include <qbuffer.h>
-#include <qmath.h>
-#include <private/qsimd_p.h>
-
-#include <stdio.h> // jpeglib needs this to be pre-included
-#include <setjmp.h>
-
-#ifdef FAR
-#undef FAR
-#endif
-
-// including jpeglib.h seems to be a little messy
-extern "C" {
-// mingw includes rpcndr.h but does not define boolean
-#if defined(Q_OS_WIN) && defined(Q_CC_GNU)
-# if defined(__RPCNDR_H__) && !defined(boolean)
- typedef unsigned char boolean;
-# define HAVE_BOOLEAN
-# endif
-#endif
-
-#define XMD_H // shut JPEGlib up
-#if defined(Q_OS_UNIXWARE)
-# define HAVE_BOOLEAN // libjpeg under Unixware seems to need this
-#endif
-#include <jpeglib.h>
-#ifdef const
-# undef const // remove crazy C hackery in jconfig.h
-#endif
-}
-
-QT_BEGIN_NAMESPACE
-QT_WARNING_DISABLE_GCC("-Wclobbered")
-
-Q_GUI_EXPORT void QT_FASTCALL qt_convert_rgb888_to_rgb32(quint32 *dst, const uchar *src, int len);
-typedef void (QT_FASTCALL *Rgb888ToRgb32Converter)(quint32 *dst, const uchar *src, int len);
-
-struct my_error_mgr : public jpeg_error_mgr {
- jmp_buf setjmp_buffer;
-};
-
-extern "C" {
-
-static void my_error_exit (j_common_ptr cinfo)
-{
- my_error_mgr* myerr = (my_error_mgr*) cinfo->err;
- char buffer[JMSG_LENGTH_MAX];
- (*cinfo->err->format_message)(cinfo, buffer);
- qWarning("%s", buffer);
- longjmp(myerr->setjmp_buffer, 1);
-}
-
-static void my_output_message(j_common_ptr cinfo)
-{
- char buffer[JMSG_LENGTH_MAX];
- (*cinfo->err->format_message)(cinfo, buffer);
- qWarning("%s", buffer);
-}
-
-}
-
-
-static const int max_buf = 4096;
-
-struct my_jpeg_source_mgr : public jpeg_source_mgr {
- // Nothing dynamic - cannot rely on destruction over longjump
- QIODevice *device;
- JOCTET buffer[max_buf];
- const QBuffer *memDevice;
-
-public:
- my_jpeg_source_mgr(QIODevice *device);
-};
-
-extern "C" {
-
-static void qt_init_source(j_decompress_ptr)
-{
-}
-
-static boolean qt_fill_input_buffer(j_decompress_ptr cinfo)
-{
- my_jpeg_source_mgr* src = (my_jpeg_source_mgr*)cinfo->src;
- qint64 num_read = 0;
- if (src->memDevice) {
- src->next_input_byte = (const JOCTET *)(src->memDevice->data().constData() + src->memDevice->pos());
- num_read = src->memDevice->data().size() - src->memDevice->pos();
- src->device->seek(src->memDevice->data().size());
- } else {
- src->next_input_byte = src->buffer;
- num_read = src->device->read((char*)src->buffer, max_buf);
- }
- if (num_read <= 0) {
- // Insert a fake EOI marker - as per jpeglib recommendation
- src->next_input_byte = src->buffer;
- src->buffer[0] = (JOCTET) 0xFF;
- src->buffer[1] = (JOCTET) JPEG_EOI;
- src->bytes_in_buffer = 2;
- } else {
- src->bytes_in_buffer = num_read;
- }
- return TRUE;
-}
-
-static void qt_skip_input_data(j_decompress_ptr cinfo, long num_bytes)
-{
- my_jpeg_source_mgr* src = (my_jpeg_source_mgr*)cinfo->src;
-
- // `dumb' implementation from jpeglib
-
- /* Just a dumb implementation for now. Could use fseek() except
- * it doesn't work on pipes. Not clear that being smart is worth
- * any trouble anyway --- large skips are infrequent.
- */
- if (num_bytes > 0) {
- while (num_bytes > (long) src->bytes_in_buffer) { // Should not happen in case of memDevice
- num_bytes -= (long) src->bytes_in_buffer;
- (void) qt_fill_input_buffer(cinfo);
- /* note we assume that qt_fill_input_buffer will never return false,
- * so suspension need not be handled.
- */
- }
- src->next_input_byte += (size_t) num_bytes;
- src->bytes_in_buffer -= (size_t) num_bytes;
- }
-}
-
-static void qt_term_source(j_decompress_ptr cinfo)
-{
- my_jpeg_source_mgr* src = (my_jpeg_source_mgr*)cinfo->src;
- if (!src->device->isSequential())
- src->device->seek(src->device->pos() - src->bytes_in_buffer);
-}
-
-}
-
-inline my_jpeg_source_mgr::my_jpeg_source_mgr(QIODevice *device)
-{
- jpeg_source_mgr::init_source = qt_init_source;
- jpeg_source_mgr::fill_input_buffer = qt_fill_input_buffer;
- jpeg_source_mgr::skip_input_data = qt_skip_input_data;
- jpeg_source_mgr::resync_to_restart = jpeg_resync_to_restart;
- jpeg_source_mgr::term_source = qt_term_source;
- this->device = device;
- memDevice = qobject_cast<QBuffer *>(device);
- bytes_in_buffer = 0;
- next_input_byte = buffer;
-}
-
-
-inline static bool read_jpeg_size(int &w, int &h, j_decompress_ptr cinfo)
-{
- (void) jpeg_calc_output_dimensions(cinfo);
-
- w = cinfo->output_width;
- h = cinfo->output_height;
- return true;
-}
-
-#define HIGH_QUALITY_THRESHOLD 50
-
-inline static bool read_jpeg_format(QImage::Format &format, j_decompress_ptr cinfo)
-{
-
- bool result = true;
- switch (cinfo->output_components) {
- case 1:
- format = QImage::Format_Grayscale8;
- break;
- case 3:
- case 4:
- format = QImage::Format_RGB32;
- break;
- default:
- result = false;
- break;
- }
- cinfo->output_scanline = cinfo->output_height;
- return result;
-}
-
-static bool ensureValidImage(QImage *dest, struct jpeg_decompress_struct *info,
- const QSize& size)
-{
- QImage::Format format;
- switch (info->output_components) {
- case 1:
- format = QImage::Format_Grayscale8;
- break;
- case 3:
- case 4:
- format = QImage::Format_RGB32;
- break;
- default:
- return false; // unsupported format
- }
-
- if (dest->size() != size || dest->format() != format)
- *dest = QImage(size, format);
-
- return !dest->isNull();
-}
-
-static bool read_jpeg_image(QImage *outImage,
- QSize scaledSize, QRect scaledClipRect,
- QRect clipRect, volatile int inQuality,
- Rgb888ToRgb32Converter converter,
- j_decompress_ptr info, struct my_error_mgr* err )
-{
- if (!setjmp(err->setjmp_buffer)) {
- // -1 means default quality.
- int quality = inQuality;
- if (quality < 0)
- quality = 75;
-
- // If possible, merge the scaledClipRect into either scaledSize
- // or clipRect to avoid doing a separate scaled clipping pass.
- // Best results are achieved by clipping before scaling, not after.
- if (!scaledClipRect.isEmpty()) {
- if (scaledSize.isEmpty() && clipRect.isEmpty()) {
- // No clipping or scaling before final clip.
- clipRect = scaledClipRect;
- scaledClipRect = QRect();
- } else if (scaledSize.isEmpty()) {
- // Clipping, but no scaling: combine the clip regions.
- scaledClipRect.translate(clipRect.topLeft());
- clipRect = scaledClipRect.intersected(clipRect);
- scaledClipRect = QRect();
- } else if (clipRect.isEmpty()) {
- // No clipping, but scaling: if we can map back to an
- // integer pixel boundary, then clip before scaling.
- if ((info->image_width % scaledSize.width()) == 0 &&
- (info->image_height % scaledSize.height()) == 0) {
- int x = scaledClipRect.x() * info->image_width /
- scaledSize.width();
- int y = scaledClipRect.y() * info->image_height /
- scaledSize.height();
- int width = (scaledClipRect.right() + 1) *
- info->image_width / scaledSize.width() - x;
- int height = (scaledClipRect.bottom() + 1) *
- info->image_height / scaledSize.height() - y;
- clipRect = QRect(x, y, width, height);
- scaledSize = scaledClipRect.size();
- scaledClipRect = QRect();
- }
- } else {
- // Clipping and scaling: too difficult to figure out,
- // and not a likely use case, so do it the long way.
- }
- }
-
- // Determine the scale factor to pass to libjpeg for quick downscaling.
- if (!scaledSize.isEmpty() && info->image_width && info->image_height) {
- if (clipRect.isEmpty()) {
- double f = qMin(double(info->image_width) / scaledSize.width(),
- double(info->image_height) / scaledSize.height());
-
- // libjpeg supports M/8 scaling with M=[1,16]. All downscaling factors
- // are a speed improvement, but upscaling during decode is slower.
- info->scale_num = qBound(1, qCeil(8/f), 8);
- info->scale_denom = 8;
- } else {
- info->scale_denom = qMin(clipRect.width() / scaledSize.width(),
- clipRect.height() / scaledSize.height());
-
- // Only scale by powers of two when clipping so we can
- // keep the exact pixel boundaries
- if (info->scale_denom < 2)
- info->scale_denom = 1;
- else if (info->scale_denom < 4)
- info->scale_denom = 2;
- else if (info->scale_denom < 8)
- info->scale_denom = 4;
- else
- info->scale_denom = 8;
- info->scale_num = 1;
-
- // Correct the scale factor so that we clip accurately.
- // It is recommended that the clip rectangle be aligned
- // on an 8-pixel boundary for best performance.
- while (info->scale_denom > 1 &&
- ((clipRect.x() % info->scale_denom) != 0 ||
- (clipRect.y() % info->scale_denom) != 0 ||
- (clipRect.width() % info->scale_denom) != 0 ||
- (clipRect.height() % info->scale_denom) != 0)) {
- info->scale_denom /= 2;
- }
- }
- }
-
- // If high quality not required, use fast decompression
- if( quality < HIGH_QUALITY_THRESHOLD ) {
- info->dct_method = JDCT_IFAST;
- info->do_fancy_upsampling = FALSE;
- }
-
- (void) jpeg_calc_output_dimensions(info);
-
- // Determine the clip region to extract.
- QRect imageRect(0, 0, info->output_width, info->output_height);
- QRect clip;
- if (clipRect.isEmpty()) {
- clip = imageRect;
- } else if (info->scale_denom == info->scale_num) {
- clip = clipRect.intersected(imageRect);
- } else {
- // The scale factor was corrected above to ensure that
- // we don't miss pixels when we scale the clip rectangle.
- clip = QRect(clipRect.x() / int(info->scale_denom),
- clipRect.y() / int(info->scale_denom),
- clipRect.width() / int(info->scale_denom),
- clipRect.height() / int(info->scale_denom));
- clip = clip.intersected(imageRect);
- }
-
- // Allocate memory for the clipped QImage.
- if (!ensureValidImage(outImage, info, clip.size()))
- longjmp(err->setjmp_buffer, 1);
-
- // Avoid memcpy() overhead if grayscale with no clipping.
- bool quickGray = (info->output_components == 1 &&
- clip == imageRect);
- if (!quickGray) {
- // Ask the jpeg library to allocate a temporary row.
- // The library will automatically delete it for us later.
- // The libjpeg docs say we should do this before calling
- // jpeg_start_decompress(). We can't use "new" here
- // because we are inside the setjmp() block and an error
- // in the jpeg input stream would cause a memory leak.
- JSAMPARRAY rows = (info->mem->alloc_sarray)
- ((j_common_ptr)info, JPOOL_IMAGE,
- info->output_width * info->output_components, 1);
-
- (void) jpeg_start_decompress(info);
-
- while (info->output_scanline < info->output_height) {
- int y = int(info->output_scanline) - clip.y();
- if (y >= clip.height())
- break; // We've read the entire clip region, so abort.
-
- (void) jpeg_read_scanlines(info, rows, 1);
-
- if (y < 0)
- continue; // Haven't reached the starting line yet.
-
- if (info->output_components == 3) {
- uchar *in = rows[0] + clip.x() * 3;
- QRgb *out = (QRgb*)outImage->scanLine(y);
- converter(out, in, clip.width());
- } else if (info->out_color_space == JCS_CMYK) {
- // Convert CMYK->RGB.
- uchar *in = rows[0] + clip.x() * 4;
- QRgb *out = (QRgb*)outImage->scanLine(y);
- for (int i = 0; i < clip.width(); ++i) {
- int k = in[3];
- *out++ = qRgb(k * in[0] / 255, k * in[1] / 255,
- k * in[2] / 255);
- in += 4;
- }
- } else if (info->output_components == 1) {
- // Grayscale.
- memcpy(outImage->scanLine(y),
- rows[0] + clip.x(), clip.width());
- }
- }
- } else {
- // Load unclipped grayscale data directly into the QImage.
- (void) jpeg_start_decompress(info);
- while (info->output_scanline < info->output_height) {
- uchar *row = outImage->scanLine(info->output_scanline);
- (void) jpeg_read_scanlines(info, &row, 1);
- }
- }
-
- if (info->output_scanline == info->output_height)
- (void) jpeg_finish_decompress(info);
-
- if (info->density_unit == 1) {
- outImage->setDotsPerMeterX(int(100. * info->X_density / 2.54));
- outImage->setDotsPerMeterY(int(100. * info->Y_density / 2.54));
- } else if (info->density_unit == 2) {
- outImage->setDotsPerMeterX(int(100. * info->X_density));
- outImage->setDotsPerMeterY(int(100. * info->Y_density));
- }
-
- if (scaledSize.isValid() && scaledSize != clip.size()) {
- *outImage = outImage->scaled(scaledSize, Qt::IgnoreAspectRatio, quality >= HIGH_QUALITY_THRESHOLD ? Qt::SmoothTransformation : Qt::FastTransformation);
- }
-
- if (!scaledClipRect.isEmpty())
- *outImage = outImage->copy(scaledClipRect);
- return !outImage->isNull();
- }
- else
- return false;
-}
-
-struct my_jpeg_destination_mgr : public jpeg_destination_mgr {
- // Nothing dynamic - cannot rely on destruction over longjump
- QIODevice *device;
- JOCTET buffer[max_buf];
-
-public:
- my_jpeg_destination_mgr(QIODevice *);
-};
-
-
-extern "C" {
-
-static void qt_init_destination(j_compress_ptr)
-{
-}
-
-static boolean qt_empty_output_buffer(j_compress_ptr cinfo)
-{
- my_jpeg_destination_mgr* dest = (my_jpeg_destination_mgr*)cinfo->dest;
-
- int written = dest->device->write((char*)dest->buffer, max_buf);
- if (written == -1)
- (*cinfo->err->error_exit)((j_common_ptr)cinfo);
-
- dest->next_output_byte = dest->buffer;
- dest->free_in_buffer = max_buf;
-
- return TRUE;
-}
-
-static void qt_term_destination(j_compress_ptr cinfo)
-{
- my_jpeg_destination_mgr* dest = (my_jpeg_destination_mgr*)cinfo->dest;
- qint64 n = max_buf - dest->free_in_buffer;
-
- qint64 written = dest->device->write((char*)dest->buffer, n);
- if (written == -1)
- (*cinfo->err->error_exit)((j_common_ptr)cinfo);
-}
-
-}
-
-inline my_jpeg_destination_mgr::my_jpeg_destination_mgr(QIODevice *device)
-{
- jpeg_destination_mgr::init_destination = qt_init_destination;
- jpeg_destination_mgr::empty_output_buffer = qt_empty_output_buffer;
- jpeg_destination_mgr::term_destination = qt_term_destination;
- this->device = device;
- next_output_byte = buffer;
- free_in_buffer = max_buf;
-}
-
-
-static inline void set_text(const QImage &image, j_compress_ptr cinfo, const QString &description)
-{
- QMap<QString, QString> text;
- foreach (const QString &key, image.textKeys()) {
- if (!key.isEmpty())
- text.insert(key, image.text(key));
- }
- foreach (const QString &pair, description.split(QLatin1String("\n\n"))) {
- int index = pair.indexOf(QLatin1Char(':'));
- if (index >= 0 && pair.indexOf(QLatin1Char(' ')) < index) {
- QString s = pair.simplified();
- if (!s.isEmpty())
- text.insert(QLatin1String("Description"), s);
- } else {
- QString key = pair.left(index);
- if (!key.simplified().isEmpty())
- text.insert(key, pair.mid(index + 2).simplified());
- }
- }
- if (text.isEmpty())
- return;
-
- for (QMap<QString, QString>::ConstIterator it = text.constBegin(); it != text.constEnd(); ++it) {
- QByteArray comment = it.key().toLatin1();
- if (!comment.isEmpty())
- comment += ": ";
- comment += it.value().toLatin1();
- if (comment.length() > 65530)
- comment.truncate(65530);
- jpeg_write_marker(cinfo, JPEG_COM, (const JOCTET *)comment.constData(), comment.size());
- }
-}
-
-static bool write_jpeg_image(const QImage &image, QIODevice *device, volatile int sourceQuality, const QString &description, bool optimize, bool progressive)
-{
- bool success = false;
- const QVector<QRgb> cmap = image.colorTable();
-
- if (image.format() == QImage::Format_Invalid || image.format() == QImage::Format_Alpha8)
- return false;
-
- struct jpeg_compress_struct cinfo;
- JSAMPROW row_pointer[1];
- row_pointer[0] = 0;
-
- struct my_jpeg_destination_mgr *iod_dest = new my_jpeg_destination_mgr(device);
- struct my_error_mgr jerr;
-
- cinfo.err = jpeg_std_error(&jerr);
- jerr.error_exit = my_error_exit;
- jerr.output_message = my_output_message;
-
- if (!setjmp(jerr.setjmp_buffer)) {
- // WARNING:
- // this if loop is inside a setjmp/longjmp branch
- // do not create C++ temporaries here because the destructor may never be called
- // if you allocate memory, make sure that you can free it (row_pointer[0])
- jpeg_create_compress(&cinfo);
-
- cinfo.dest = iod_dest;
-
- cinfo.image_width = image.width();
- cinfo.image_height = image.height();
-
- bool gray = false;
- switch (image.format()) {
- case QImage::Format_Mono:
- case QImage::Format_MonoLSB:
- case QImage::Format_Indexed8:
- gray = true;
- for (int i = image.colorCount(); gray && i; i--) {
- gray = gray & qIsGray(cmap[i-1]);
- }
- cinfo.input_components = gray ? 1 : 3;
- cinfo.in_color_space = gray ? JCS_GRAYSCALE : JCS_RGB;
- break;
- case QImage::Format_Grayscale8:
- gray = true;
- cinfo.input_components = 1;
- cinfo.in_color_space = JCS_GRAYSCALE;
- break;
- default:
- cinfo.input_components = 3;
- cinfo.in_color_space = JCS_RGB;
- }
-
- jpeg_set_defaults(&cinfo);
-
- qreal diffInch = qAbs(image.dotsPerMeterX()*2.54/100. - qRound(image.dotsPerMeterX()*2.54/100.))
- + qAbs(image.dotsPerMeterY()*2.54/100. - qRound(image.dotsPerMeterY()*2.54/100.));
- qreal diffCm = (qAbs(image.dotsPerMeterX()/100. - qRound(image.dotsPerMeterX()/100.))
- + qAbs(image.dotsPerMeterY()/100. - qRound(image.dotsPerMeterY()/100.)))*2.54;
- if (diffInch < diffCm) {
- cinfo.density_unit = 1; // dots/inch
- cinfo.X_density = qRound(image.dotsPerMeterX()*2.54/100.);
- cinfo.Y_density = qRound(image.dotsPerMeterY()*2.54/100.);
- } else {
- cinfo.density_unit = 2; // dots/cm
- cinfo.X_density = (image.dotsPerMeterX()+50) / 100;
- cinfo.Y_density = (image.dotsPerMeterY()+50) / 100;
- }
-
- if (optimize)
- cinfo.optimize_coding = true;
-
- if (progressive)
- jpeg_simple_progression(&cinfo);
-
- int quality = sourceQuality >= 0 ? qMin(int(sourceQuality),100) : 75;
- jpeg_set_quality(&cinfo, quality, TRUE /* limit to baseline-JPEG values */);
- jpeg_start_compress(&cinfo, TRUE);
-
- set_text(image, &cinfo, description);
-
- row_pointer[0] = new uchar[cinfo.image_width*cinfo.input_components];
- int w = cinfo.image_width;
- while (cinfo.next_scanline < cinfo.image_height) {
- uchar *row = row_pointer[0];
- switch (image.format()) {
- case QImage::Format_Mono:
- case QImage::Format_MonoLSB:
- if (gray) {
- const uchar* data = image.constScanLine(cinfo.next_scanline);
- if (image.format() == QImage::Format_MonoLSB) {
- for (int i=0; i<w; i++) {
- bool bit = !!(*(data + (i >> 3)) & (1 << (i & 7)));
- row[i] = qRed(cmap[bit]);
- }
- } else {
- for (int i=0; i<w; i++) {
- bool bit = !!(*(data + (i >> 3)) & (1 << (7 -(i & 7))));
- row[i] = qRed(cmap[bit]);
- }
- }
- } else {
- const uchar* data = image.constScanLine(cinfo.next_scanline);
- if (image.format() == QImage::Format_MonoLSB) {
- for (int i=0; i<w; i++) {
- bool bit = !!(*(data + (i >> 3)) & (1 << (i & 7)));
- *row++ = qRed(cmap[bit]);
- *row++ = qGreen(cmap[bit]);
- *row++ = qBlue(cmap[bit]);
- }
- } else {
- for (int i=0; i<w; i++) {
- bool bit = !!(*(data + (i >> 3)) & (1 << (7 -(i & 7))));
- *row++ = qRed(cmap[bit]);
- *row++ = qGreen(cmap[bit]);
- *row++ = qBlue(cmap[bit]);
- }
- }
- }
- break;
- case QImage::Format_Indexed8:
- if (gray) {
- const uchar* pix = image.constScanLine(cinfo.next_scanline);
- for (int i=0; i<w; i++) {
- *row = qRed(cmap[*pix]);
- ++row; ++pix;
- }
- } else {
- const uchar* pix = image.constScanLine(cinfo.next_scanline);
- for (int i=0; i<w; i++) {
- *row++ = qRed(cmap[*pix]);
- *row++ = qGreen(cmap[*pix]);
- *row++ = qBlue(cmap[*pix]);
- ++pix;
- }
- }
- break;
- case QImage::Format_Grayscale8:
- memcpy(row, image.constScanLine(cinfo.next_scanline), w);
- break;
- case QImage::Format_RGB888:
- memcpy(row, image.constScanLine(cinfo.next_scanline), w * 3);
- break;
- case QImage::Format_RGB32:
- case QImage::Format_ARGB32:
- case QImage::Format_ARGB32_Premultiplied:
- {
- const QRgb* rgb = (const QRgb*)image.constScanLine(cinfo.next_scanline);
- for (int i=0; i<w; i++) {
- *row++ = qRed(*rgb);
- *row++ = qGreen(*rgb);
- *row++ = qBlue(*rgb);
- ++rgb;
- }
- }
- break;
- default:
- {
- // (Testing shows that this way is actually faster than converting to RGB888 + memcpy)
- QImage rowImg = image.copy(0, cinfo.next_scanline, w, 1).convertToFormat(QImage::Format_RGB32);
- const QRgb* rgb = (const QRgb*)rowImg.constScanLine(0);
- for (int i=0; i<w; i++) {
- *row++ = qRed(*rgb);
- *row++ = qGreen(*rgb);
- *row++ = qBlue(*rgb);
- ++rgb;
- }
- }
- break;
- }
- jpeg_write_scanlines(&cinfo, row_pointer, 1);
- }
-
- jpeg_finish_compress(&cinfo);
- jpeg_destroy_compress(&cinfo);
- success = true;
- } else {
- jpeg_destroy_compress(&cinfo);
- success = false;
- }
-
- delete iod_dest;
- delete [] row_pointer[0];
- return success;
-}
-
-class QJpegHandlerPrivate
-{
-public:
- enum State {
- Ready,
- ReadHeader,
- ReadingEnd,
- Error
- };
-
- QJpegHandlerPrivate(QJpegHandler *qq)
- : quality(75), transformation(QImageIOHandler::TransformationNone), iod_src(0),
- rgb888ToRgb32ConverterPtr(qt_convert_rgb888_to_rgb32), state(Ready), optimize(false), progressive(false), q(qq)
- {}
-
- ~QJpegHandlerPrivate()
- {
- if(iod_src)
- {
- jpeg_destroy_decompress(&info);
- delete iod_src;
- iod_src = 0;
- }
- }
-
- bool readJpegHeader(QIODevice*);
- bool read(QImage *image);
-
- int quality;
- QImageIOHandler::Transformations transformation;
- QVariant size;
- QImage::Format format;
- QSize scaledSize;
- QRect scaledClipRect;
- QRect clipRect;
- QString description;
- QStringList readTexts;
-
- struct jpeg_decompress_struct info;
- struct my_jpeg_source_mgr * iod_src;
- struct my_error_mgr err;
-
- Rgb888ToRgb32Converter rgb888ToRgb32ConverterPtr;
-
- State state;
-
- bool optimize;
- bool progressive;
-
- QJpegHandler *q;
-};
-
-static bool readExifHeader(QDataStream &stream)
-{
- char prefix[6];
- if (stream.readRawData(prefix, sizeof(prefix)) != sizeof(prefix))
- return false;
- static const char exifMagic[6] = {'E', 'x', 'i', 'f', 0, 0};
- return memcmp(prefix, exifMagic, 6) == 0;
-}
-
-/*
- * Returns -1 on error
- * Returns 0 if no Exif orientation was found
- * Returns 1 orientation is horizontal (normal)
- * Returns 2 mirror horizontal
- * Returns 3 rotate 180
- * Returns 4 mirror vertical
- * Returns 5 mirror horizontal and rotate 270 CCW
- * Returns 6 rotate 90 CW
- * Returns 7 mirror horizontal and rotate 90 CW
- * Returns 8 rotate 270 CW
- */
-static int getExifOrientation(QByteArray &exifData)
-{
- QDataStream stream(&exifData, QIODevice::ReadOnly);
-
- if (!readExifHeader(stream))
- return -1;
-
- quint16 val;
- quint32 offset;
- const qint64 headerStart = stream.device()->pos();
-
- // read byte order marker
- stream >> val;
- if (val == 0x4949) // 'II' == Intel
- stream.setByteOrder(QDataStream::LittleEndian);
- else if (val == 0x4d4d) // 'MM' == Motorola
- stream.setByteOrder(QDataStream::BigEndian);
- else
- return -1; // unknown byte order
-
- // read size
- stream >> val;
- if (val != 0x2a)
- return -1;
-
- stream >> offset;
-
- // read IFD
- while (!stream.atEnd()) {
- quint16 numEntries;
-
- // skip offset bytes to get the next IFD
- const qint64 bytesToSkip = offset - (stream.device()->pos() - headerStart);
-
- if (stream.skipRawData(bytesToSkip) != bytesToSkip)
- return -1;
-
- stream >> numEntries;
-
- for (; numEntries > 0; --numEntries) {
- quint16 tag;
- quint16 type;
- quint32 components;
- quint16 value;
- quint16 dummy;
-
- stream >> tag >> type >> components >> value >> dummy;
- if (tag == 0x0112) { // Tag Exif.Image.Orientation
- if (components != 1)
- return -1;
- if (type != 3) // we are expecting it to be an unsigned short
- return -1;
- if (value < 1 || value > 8) // check for valid range
- return -1;
-
- // It is possible to include the orientation multiple times.
- // Right now the first value is returned.
- return value;
- }
- }
-
- // read offset to next IFD
- stream >> offset;
- if (offset == 0) // this is the last IFD
- break;
- }
-
- // No Exif orientation was found
- return 0;
-}
-
-static QImageIOHandler::Transformations exif2Qt(int exifOrientation)
-{
- switch (exifOrientation) {
- case 1: // normal
- return QImageIOHandler::TransformationNone;
- case 2: // mirror horizontal
- return QImageIOHandler::TransformationMirror;
- case 3: // rotate 180
- return QImageIOHandler::TransformationRotate180;
- case 4: // mirror vertical
- return QImageIOHandler::TransformationFlip;
- case 5: // mirror horizontal and rotate 270 CW
- return QImageIOHandler::TransformationFlipAndRotate90;
- case 6: // rotate 90 CW
- return QImageIOHandler::TransformationRotate90;
- case 7: // mirror horizontal and rotate 90 CW
- return QImageIOHandler::TransformationMirrorAndRotate90;
- case 8: // rotate 270 CW
- return QImageIOHandler::TransformationRotate270;
- }
- qWarning("Invalid EXIF orientation");
- return QImageIOHandler::TransformationNone;
-}
-
-/*!
- \internal
-*/
-bool QJpegHandlerPrivate::readJpegHeader(QIODevice *device)
-{
- if(state == Ready)
- {
- state = Error;
- iod_src = new my_jpeg_source_mgr(device);
-
- info.err = jpeg_std_error(&err);
- err.error_exit = my_error_exit;
- err.output_message = my_output_message;
-
- jpeg_create_decompress(&info);
- info.src = iod_src;
-
- if (!setjmp(err.setjmp_buffer)) {
- jpeg_save_markers(&info, JPEG_COM, 0xFFFF);
- jpeg_save_markers(&info, JPEG_APP0 + 1, 0xFFFF); // Exif uses APP1 marker
-
- (void) jpeg_read_header(&info, TRUE);
-
- int width = 0;
- int height = 0;
- read_jpeg_size(width, height, &info);
- size = QSize(width, height);
-
- format = QImage::Format_Invalid;
- read_jpeg_format(format, &info);
-
- QByteArray exifData;
-
- for (jpeg_saved_marker_ptr marker = info.marker_list; marker != NULL; marker = marker->next) {
- if (marker->marker == JPEG_COM) {
- QString key, value;
- QString s = QString::fromLatin1((const char *)marker->data, marker->data_length);
- int index = s.indexOf(QLatin1String(": "));
- if (index == -1 || s.indexOf(QLatin1Char(' ')) < index) {
- key = QLatin1String("Description");
- value = s;
- } else {
- key = s.left(index);
- value = s.mid(index + 2);
- }
- if (!description.isEmpty())
- description += QLatin1String("\n\n");
- description += key + QLatin1String(": ") + value.simplified();
- readTexts.append(key);
- readTexts.append(value);
- } else if (marker->marker == JPEG_APP0 + 1) {
- exifData.append((const char*)marker->data, marker->data_length);
- }
- }
-
- if (!exifData.isEmpty()) {
- // Exif data present
- int exifOrientation = getExifOrientation(exifData);
- if (exifOrientation > 0)
- transformation = exif2Qt(exifOrientation);
- }
-
- state = ReadHeader;
- return true;
- }
- else
- {
- return false;
- }
- }
- else if(state == Error)
- return false;
- return true;
-}
-
-bool QJpegHandlerPrivate::read(QImage *image)
-{
- if(state == Ready)
- readJpegHeader(q->device());
-
- if(state == ReadHeader)
- {
- bool success = read_jpeg_image(image, scaledSize, scaledClipRect, clipRect, quality, rgb888ToRgb32ConverterPtr, &info, &err);
- if (success) {
- for (int i = 0; i < readTexts.size()-1; i+=2)
- image->setText(readTexts.at(i), readTexts.at(i+1));
-
- state = ReadingEnd;
- return true;
- }
-
- state = Error;
- }
-
- return false;
-
-}
-
-Q_GUI_EXPORT void QT_FASTCALL qt_convert_rgb888_to_rgb32_neon(quint32 *dst, const uchar *src, int len);
-Q_GUI_EXPORT void QT_FASTCALL qt_convert_rgb888_to_rgb32_ssse3(quint32 *dst, const uchar *src, int len);
-extern "C" void qt_convert_rgb888_to_rgb32_mips_dspr2_asm(quint32 *dst, const uchar *src, int len);
-
-QJpegHandler::QJpegHandler()
- : d(new QJpegHandlerPrivate(this))
-{
-#if defined(__ARM_NEON__)
- // from qimage_neon.cpp
- if (qCpuHasFeature(NEON))
- d->rgb888ToRgb32ConverterPtr = qt_convert_rgb888_to_rgb32_neon;
-#endif
-
-#if defined(QT_COMPILER_SUPPORTS_SSSE3)
- // from qimage_ssse3.cpps
- if (qCpuHasFeature(SSSE3)) {
- d->rgb888ToRgb32ConverterPtr = qt_convert_rgb888_to_rgb32_ssse3;
- }
-#endif // QT_COMPILER_SUPPORTS_SSSE3
-#if defined(QT_COMPILER_SUPPORTS_MIPS_DSPR2)
- if (qCpuHasFeature(DSPR2)) {
- d->rgb888ToRgb32ConverterPtr = qt_convert_rgb888_to_rgb32_mips_dspr2_asm;
- }
-#endif // QT_COMPILER_SUPPORTS_DSPR2
-}
-
-QJpegHandler::~QJpegHandler()
-{
- delete d;
-}
-
-bool QJpegHandler::canRead() const
-{
- if(d->state == QJpegHandlerPrivate::Ready && !canRead(device()))
- return false;
-
- if (d->state != QJpegHandlerPrivate::Error && d->state != QJpegHandlerPrivate::ReadingEnd) {
- setFormat("jpeg");
- return true;
- }
-
- return false;
-}
-
-bool QJpegHandler::canRead(QIODevice *device)
-{
- if (!device) {
- qWarning("QJpegHandler::canRead() called with no device");
- return false;
- }
-
- char buffer[2];
- if (device->peek(buffer, 2) != 2)
- return false;
- return uchar(buffer[0]) == 0xff && uchar(buffer[1]) == 0xd8;
-}
-
-bool QJpegHandler::read(QImage *image)
-{
- if (!canRead())
- return false;
- return d->read(image);
-}
-
-extern void qt_imageTransform(QImage &src, QImageIOHandler::Transformations orient);
-
-bool QJpegHandler::write(const QImage &image)
-{
- if (d->transformation != QImageIOHandler::TransformationNone) {
- // We don't support writing EXIF headers so apply the transform to the data.
- QImage img = image;
- qt_imageTransform(img, d->transformation);
- return write_jpeg_image(img, device(), d->quality, d->description, d->optimize, d->progressive);
- }
- return write_jpeg_image(image, device(), d->quality, d->description, d->optimize, d->progressive);
-}
-
-bool QJpegHandler::supportsOption(ImageOption option) const
-{
- return option == Quality
- || option == ScaledSize
- || option == ScaledClipRect
- || option == ClipRect
- || option == Description
- || option == Size
- || option == ImageFormat
- || option == OptimizedWrite
- || option == ProgressiveScanWrite
- || option == ImageTransformation;
-}
-
-QVariant QJpegHandler::option(ImageOption option) const
-{
- switch(option) {
- case Quality:
- return d->quality;
- case ScaledSize:
- return d->scaledSize;
- case ScaledClipRect:
- return d->scaledClipRect;
- case ClipRect:
- return d->clipRect;
- case Description:
- d->readJpegHeader(device());
- return d->description;
- case Size:
- d->readJpegHeader(device());
- return d->size;
- case ImageFormat:
- d->readJpegHeader(device());
- return d->format;
- case OptimizedWrite:
- return d->optimize;
- case ProgressiveScanWrite:
- return d->progressive;
- case ImageTransformation:
- d->readJpegHeader(device());
- return int(d->transformation);
- default:
- break;
- }
-
- return QVariant();
-}
-
-void QJpegHandler::setOption(ImageOption option, const QVariant &value)
-{
- switch(option) {
- case Quality:
- d->quality = value.toInt();
- break;
- case ScaledSize:
- d->scaledSize = value.toSize();
- break;
- case ScaledClipRect:
- d->scaledClipRect = value.toRect();
- break;
- case ClipRect:
- d->clipRect = value.toRect();
- break;
- case Description:
- d->description = value.toString();
- break;
- case OptimizedWrite:
- d->optimize = value.toBool();
- break;
- case ProgressiveScanWrite:
- d->progressive = value.toBool();
- break;
- case ImageTransformation: {
- int transformation = value.toInt();
- if (transformation > 0 && transformation < 8)
- d->transformation = QImageIOHandler::Transformations(transformation);
- }
- default:
- break;
- }
-}
-
-QByteArray QJpegHandler::name() const
-{
- return "jpeg";
-}
-
-QT_END_NAMESPACE
diff --git a/src/gui/image/qjpeghandler.pri b/src/gui/image/qjpeghandler.pri
deleted file mode 100644
index de40c6742e..0000000000
--- a/src/gui/image/qjpeghandler.pri
+++ /dev/null
@@ -1,11 +0,0 @@
-# common to plugin and built-in forms
-HEADERS += $$PWD/qjpeghandler_p.h
-SOURCES += $$PWD/qjpeghandler.cpp
-contains(QT_CONFIG, system-jpeg) {
- msvc: \
- LIBS += libjpeg.lib
- else: \
- LIBS += -ljpeg
-} else {
- include($$PWD/../../3rdparty/libjpeg.pri)
-}
diff --git a/src/gui/image/qjpeghandler_p.h b/src/gui/image/qjpeghandler_p.h
deleted file mode 100644
index 534ce12115..0000000000
--- a/src/gui/image/qjpeghandler_p.h
+++ /dev/null
@@ -1,85 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QJPEGHANDLER_P_H
-#define QJPEGHANDLER_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtGui/qimageiohandler.h>
-#include <QtCore/QSize>
-#include <QtCore/QRect>
-
-QT_BEGIN_NAMESPACE
-
-class QJpegHandlerPrivate;
-class QJpegHandler : public QImageIOHandler
-{
-public:
- QJpegHandler();
- ~QJpegHandler();
-
- bool canRead() const Q_DECL_OVERRIDE;
- bool read(QImage *image) Q_DECL_OVERRIDE;
- bool write(const QImage &image) Q_DECL_OVERRIDE;
-
- QByteArray name() const Q_DECL_OVERRIDE;
-
- static bool canRead(QIODevice *device);
-
- QVariant option(ImageOption option) const Q_DECL_OVERRIDE;
- void setOption(ImageOption option, const QVariant &value) Q_DECL_OVERRIDE;
- bool supportsOption(ImageOption option) const Q_DECL_OVERRIDE;
-
-private:
- QJpegHandlerPrivate *d;
-};
-
-QT_END_NAMESPACE
-
-#endif // QJPEGHANDLER_P_H
diff --git a/src/gui/image/qmovie.h b/src/gui/image/qmovie.h
index cf644d3347..2b41e07dba 100644
--- a/src/gui/image/qmovie.h
+++ b/src/gui/image/qmovie.h
@@ -40,10 +40,11 @@
#ifndef QMOVIE_H
#define QMOVIE_H
-#include <QtCore/qobject.h>
+#include <QtGui/qtguiglobal.h>
#ifndef QT_NO_MOVIE
+#include <QtCore/qobject.h>
#include <QtCore/qbytearray.h>
#include <QtCore/qlist.h>
#include <QtGui/qimagereader.h>
diff --git a/src/gui/image/qpaintengine_pic_p.h b/src/gui/image/qpaintengine_pic_p.h
index 6894593092..7c690c1498 100644
--- a/src/gui/image/qpaintengine_pic_p.h
+++ b/src/gui/image/qpaintengine_pic_p.h
@@ -44,15 +44,15 @@
// W A R N I N G
// -------------
//
-// This file is not part of the Qt API. It exists for the convenience
-// of QAbstractItemModel*. This header file may change from version
-// to version without notice, or even be removed.
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
//
// We mean it.
//
-//
-#include "QtGui/qpaintengine.h"
+#include <QtGui/private/qtguiglobal_p.h>
+#include <QtGui/qpaintengine.h>
#ifndef QT_NO_PICTURE
diff --git a/src/gui/image/qpicture.h b/src/gui/image/qpicture.h
index f375157317..8da11caee4 100644
--- a/src/gui/image/qpicture.h
+++ b/src/gui/image/qpicture.h
@@ -40,6 +40,7 @@
#ifndef QPICTURE_H
#define QPICTURE_H
+#include <QtGui/qtguiglobal.h>
#include <QtCore/qiodevice.h>
#include <QtCore/qstringlist.h>
#include <QtCore/qsharedpointer.h>
diff --git a/src/gui/image/qpicture_p.h b/src/gui/image/qpicture_p.h
index df1235469c..67db9aa354 100644
--- a/src/gui/image/qpicture_p.h
+++ b/src/gui/image/qpicture_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#include "QtCore/qatomic.h"
#include "QtCore/qbuffer.h"
#include "QtCore/qobjectdefs.h"
diff --git a/src/gui/image/qpictureformatplugin.h b/src/gui/image/qpictureformatplugin.h
index 003ccac116..32195687c7 100644
--- a/src/gui/image/qpictureformatplugin.h
+++ b/src/gui/image/qpictureformatplugin.h
@@ -40,6 +40,7 @@
#ifndef QPICTUREFORMATPLUGIN_H
#define QPICTUREFORMATPLUGIN_H
+#include <QtGui/qtguiglobal.h>
#include <QtCore/qplugin.h>
#include <QtCore/qfactoryinterface.h>
diff --git a/src/gui/image/qpixmap.cpp b/src/gui/image/qpixmap.cpp
index 59d6dc12c6..a360debf5b 100644
--- a/src/gui/image/qpixmap.cpp
+++ b/src/gui/image/qpixmap.cpp
@@ -125,12 +125,8 @@ QPixmap::QPixmap()
*/
QPixmap::QPixmap(int w, int h)
- : QPaintDevice()
+ : QPixmap(QSize(w, h))
{
- if (!qt_pixmap_thread_test())
- doInit(0, 0, QPlatformPixmap::PixmapType);
- else
- doInit(w, h, QPlatformPixmap::PixmapType);
}
/*!
@@ -144,12 +140,8 @@ QPixmap::QPixmap(int w, int h)
*/
QPixmap::QPixmap(const QSize &size)
- : QPaintDevice()
+ : QPixmap(size, QPlatformPixmap::PixmapType)
{
- if (!qt_pixmap_thread_test())
- doInit(0, 0, QPlatformPixmap::PixmapType);
- else
- doInit(size.width(), size.height(), QPlatformPixmap::PixmapType);
}
/*!
@@ -778,7 +770,7 @@ bool QPixmap::load(const QString &fileName, const char *format, Qt::ImageConvers
QFileInfo info(fileName);
QString key = QLatin1String("qt_pixmap")
% info.absoluteFilePath()
- % HexString<uint>(info.lastModified().toTime_t())
+ % HexString<uint>(info.lastModified().toSecsSinceEpoch())
% HexString<quint64>(info.size())
% HexString<uint>(data ? data->pixelType() : QPlatformPixmap::PixmapType);
diff --git a/src/gui/image/qpixmap.h b/src/gui/image/qpixmap.h
index 165ec4a6b8..d651b57fd5 100644
--- a/src/gui/image/qpixmap.h
+++ b/src/gui/image/qpixmap.h
@@ -40,6 +40,7 @@
#ifndef QPIXMAP_H
#define QPIXMAP_H
+#include <QtGui/qtguiglobal.h>
#include <QtGui/qpaintdevice.h>
#include <QtGui/qcolor.h>
#include <QtCore/qnamespace.h>
diff --git a/src/gui/image/qpixmap_blitter.cpp b/src/gui/image/qpixmap_blitter.cpp
index 0906b65d96..950695a9d7 100644
--- a/src/gui/image/qpixmap_blitter.cpp
+++ b/src/gui/image/qpixmap_blitter.cpp
@@ -113,10 +113,10 @@ int QBlittablePlatformPixmap::metric(QPaintDevice::PaintDeviceMetric metric) con
return qRound(h * 25.4 / qt_defaultDpiY());
case QPaintDevice::PdmDepth:
return 32;
- case QPaintDevice::PdmDpiX: // fall-through
+ case QPaintDevice::PdmDpiX:
case QPaintDevice::PdmPhysicalDpiX:
return qt_defaultDpiX();
- case QPaintDevice::PdmDpiY: // fall-through
+ case QPaintDevice::PdmDpiY:
case QPaintDevice::PdmPhysicalDpiY:
return qt_defaultDpiY();
case QPaintDevice::PdmDevicePixelRatio:
@@ -152,7 +152,7 @@ void QBlittablePlatformPixmap::fill(const QColor &color)
uint pixel = qPremultiply(color.rgba());
const QPixelLayout *layout = &qPixelLayouts[blittable()->lock()->format()];
Q_ASSERT(layout->convertFromARGB32PM);
- layout->convertFromARGB32PM(&pixel, &pixel, 1, layout, 0);
+ layout->convertFromARGB32PM(&pixel, &pixel, 1, 0, 0);
//so premultiplied formats are supported and ARGB32 and RGB32
blittable()->lock()->fill(pixel);
@@ -298,10 +298,8 @@ QRectF QBlittablePlatformPixmap::clipAndTransformRect(const QRectF &rect) const
if (clipData->hasRectClip) {
transformationRect &= clipData->clipRect;
} else if (clipData->hasRegionClip) {
- const QVector<QRect> rects = clipData->clipRegion.rects();
- for (int i = 0; i < rects.size(); i++) {
- transformationRect &= rects.at(i);
- }
+ for (const QRect &rect : clipData->clipRegion)
+ transformationRect &= rect;
}
}
}
diff --git a/src/gui/image/qpixmap_blitter_p.h b/src/gui/image/qpixmap_blitter_p.h
index bc97bbc1df..9889cfb8ec 100644
--- a/src/gui/image/qpixmap_blitter_p.h
+++ b/src/gui/image/qpixmap_blitter_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#include <qpa/qplatformpixmap.h>
#include <private/qpaintengine_blitter_p.h>
diff --git a/src/gui/image/qpixmap_raster.cpp b/src/gui/image/qpixmap_raster.cpp
index 13104ce17f..741f7713da 100644
--- a/src/gui/image/qpixmap_raster.cpp
+++ b/src/gui/image/qpixmap_raster.cpp
@@ -42,7 +42,6 @@
#include <private/qfont_p.h>
#include "qpixmap_raster_p.h"
-#include "qnativeimage_p.h"
#include "qimage_p.h"
#include "qpaintengine.h"
@@ -50,9 +49,12 @@
#include "qimage.h"
#include <QBuffer>
#include <QImageReader>
+#include <QGuiApplication>
+#include <QScreen>
#include <private/qimage_p.h>
#include <private/qsimd_p.h>
#include <private/qdrawhelper_p.h>
+#include <qpa/qplatformscreen.h>
QT_BEGIN_NAMESPACE
@@ -88,6 +90,13 @@ QRasterPlatformPixmap::~QRasterPlatformPixmap()
{
}
+QImage::Format QRasterPlatformPixmap::systemOpaqueFormat()
+{
+ if (!QGuiApplication::primaryScreen())
+ return QImage::Format_RGB32;
+ return QGuiApplication::primaryScreen()->handle()->format();
+}
+
QPlatformPixmap *QRasterPlatformPixmap::createCompatiblePlatformPixmap() const
{
return new QRasterPlatformPixmap(pixelType());
@@ -99,7 +108,7 @@ void QRasterPlatformPixmap::resize(int width, int height)
if (pixelType() == BitmapType)
format = QImage::Format_MonoLSB;
else
- format = QNativeImage::systemFormat();
+ format = systemOpaqueFormat();
image = QImage(width, height, format);
w = width;
@@ -195,7 +204,7 @@ void QRasterPlatformPixmap::fill(const QColor &color)
}
pixel = qPremultiply(color.rgba());
const QPixelLayout *layout = &qPixelLayouts[image.format()];
- layout->convertFromARGB32PM(&pixel, &pixel, 1, layout, 0);
+ layout->convertFromARGB32PM(&pixel, &pixel, 1, 0, 0);
} else if (image.format() == QImage::Format_Alpha8) {
pixel = qAlpha(color.rgba());
} else if (image.format() == QImage::Format_Grayscale8) {
@@ -306,13 +315,13 @@ void QRasterPlatformPixmap::createPixmapForImage(QImage &sourceImage, Qt::ImageC
? QImage::Format_ARGB32_Premultiplied
: QImage::Format_RGB32;
} else {
- QImage::Format opaqueFormat = QNativeImage::systemFormat();
+ QImage::Format opaqueFormat = systemOpaqueFormat();
QImage::Format alphaFormat = qt_alphaVersionForPainting(opaqueFormat);
if (!sourceImage.hasAlphaChannel()) {
format = opaqueFormat;
} else if ((flags & Qt::NoOpaqueDetection) == 0
- && !const_cast<QImage &>(sourceImage).data_ptr()->checkForAlphaPixels())
+ && !sourceImage.data_ptr()->checkForAlphaPixels())
{
format = opaqueFormat;
} else {
@@ -335,7 +344,7 @@ void QRasterPlatformPixmap::createPixmapForImage(QImage &sourceImage, Qt::ImageC
} else if (inPlace && sourceImage.d->convertInPlace(format, flags)) {
image = sourceImage;
} else {
- image = sourceImage.convertToFormat(format);
+ image = sourceImage.convertToFormat(format, flags);
}
if (image.d) {
diff --git a/src/gui/image/qpixmap_raster_p.h b/src/gui/image/qpixmap_raster_p.h
index 1a42757669..95e018eb35 100644
--- a/src/gui/image/qpixmap_raster_p.h
+++ b/src/gui/image/qpixmap_raster_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#include <qpa/qplatformpixmap.h>
@@ -87,6 +88,7 @@ protected:
void createPixmapForImage(QImage &sourceImage, Qt::ImageConversionFlags flags, bool inPlace);
void setImage(const QImage &image);
QImage image;
+ static QImage::Format systemOpaqueFormat();
private:
friend class QPixmap;
diff --git a/src/gui/image/qpixmap_win.cpp b/src/gui/image/qpixmap_win.cpp
index 7f20586156..92f6964783 100644
--- a/src/gui/image/qpixmap_win.cpp
+++ b/src/gui/image/qpixmap_win.cpp
@@ -48,84 +48,6 @@
QT_BEGIN_NAMESPACE
-#ifdef Q_OS_WINCE
-#define GetDIBits(a,b,c,d,e,f,g) qt_wince_GetDIBits(a,b,c,d,e,f,g)
-int qt_wince_GetDIBits(HDC /*hdc*/ , HBITMAP hSourceBitmap, uint, uint, LPVOID lpvBits, LPBITMAPINFO, uint)
-{
- if (!lpvBits) {
- qWarning("::GetDIBits(), lpvBits NULL");
- return 0;
- }
- BITMAP bm;
- GetObject(hSourceBitmap, sizeof(BITMAP), &bm);
- bm.bmHeight = qAbs(bm.bmHeight);
-
- HBITMAP hTargetBitmap;
- void *pixels;
-
- BITMAPINFO dibInfo;
- memset(&dibInfo, 0, sizeof(dibInfo));
- dibInfo.bmiHeader.biBitCount = 32;
- dibInfo.bmiHeader.biClrImportant = 0;
- dibInfo.bmiHeader.biClrUsed = 0;
- dibInfo.bmiHeader.biCompression = BI_RGB;;
- dibInfo.bmiHeader.biHeight = -bm.bmHeight;
- dibInfo.bmiHeader.biWidth = bm.bmWidth;
- dibInfo.bmiHeader.biPlanes = 1;
- dibInfo.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
- dibInfo.bmiHeader.biSizeImage = bm.bmWidth * bm.bmHeight * 4;
-
- HDC displayDC = GetDC(NULL);
- if (!displayDC) {
- qWarning("::GetDIBits(), failed to GetDC");
- return 0;
- }
-
- int ret = bm.bmHeight;
-
- hTargetBitmap = CreateDIBSection(displayDC, (const BITMAPINFO*) &dibInfo, DIB_RGB_COLORS,
- (void**)&pixels, NULL, 0);
- if (!hTargetBitmap) {
- qWarning("::GetDIBits(), failed to CreateDIBSection");
- return 0;
- }
-
- HDC hdcSrc = CreateCompatibleDC(displayDC);
- HDC hdcDst = CreateCompatibleDC(displayDC);
-
- if (!(hdcDst && hdcSrc)) {
- qWarning("::GetDIBits(), failed to CreateCompatibleDC");
- ret = 0;
- }
-
- HBITMAP hOldBitmap1 = (HBITMAP) SelectObject(hdcSrc, hSourceBitmap);
- HBITMAP hOldBitmap2 = (HBITMAP) SelectObject(hdcDst, hTargetBitmap);
-
- if (!(hOldBitmap1 && hOldBitmap2)) {
- qWarning("::GetDIBits(), failed to SelectObject for bitmaps");
- ret = 0;
- }
-
- if (!BitBlt(hdcDst, 0, 0, bm.bmWidth, bm.bmHeight, hdcSrc, 0, 0, SRCCOPY)) {
- qWarning("::GetDIBits(), BitBlt failed");
- ret = 0;
- }
-
- SelectObject(hdcSrc, hOldBitmap1);
- SelectObject(hdcDst, hOldBitmap2);
-
- DeleteDC(hdcSrc);
- DeleteDC(hdcDst);
-
- ReleaseDC(NULL, displayDC);
-
- memcpy(lpvBits, pixels, dibInfo.bmiHeader.biSizeImage);
-
- DeleteObject(hTargetBitmap);
- return ret;
-}
-#endif
-
static inline void initBitMapInfoHeader(int width, int height, bool topToBottom, BITMAPINFOHEADER *bih)
{
memset(bih, 0, sizeof(BITMAPINFOHEADER));
@@ -325,8 +247,6 @@ Q_GUI_EXPORT HICON qt_pixmapToWinHICON(const QPixmap &p)
return hIcon;
}
-#ifndef Q_OS_WINCE
-
Q_GUI_EXPORT QImage qt_imageFromWinHBITMAP(HDC hdc, HBITMAP bitmap, int w, int h)
{
QImage image(w, h, QImage::Format_ARGB32_Premultiplied);
@@ -415,95 +335,5 @@ Q_GUI_EXPORT QPixmap qt_pixmapFromWinHICON(HICON icon)
DeleteDC(hdc);
return QPixmap::fromImage(image);
}
-#else //ifndef Q_OS_WINCE
-Q_GUI_EXPORT QPixmap qt_pixmapFromWinHICON(HICON icon)
-{
- HDC screenDevice = GetDC(0);
- HDC hdc = CreateCompatibleDC(screenDevice);
- ReleaseDC(0, screenDevice);
-
- ICONINFO iconinfo;
- bool result = GetIconInfo(icon, &iconinfo);
- if (!result)
- qWarning("QPixmap::fromWinHICON(), failed to GetIconInfo()");
-
- int w = 0;
- int h = 0;
- if (!iconinfo.xHotspot || !iconinfo.yHotspot) {
- // We could not retrieve the icon size via GetIconInfo,
- // so we try again using the icon bitmap.
- BITMAP bm;
- int result = GetObject(iconinfo.hbmColor, sizeof(BITMAP), &bm);
- if (!result) result = GetObject(iconinfo.hbmMask, sizeof(BITMAP), &bm);
- if (!result) {
- qWarning("QPixmap::fromWinHICON(), failed to retrieve icon size");
- return QPixmap();
- }
- w = bm.bmWidth;
- h = bm.bmHeight;
- } else {
- // x and y Hotspot describes the icon center
- w = iconinfo.xHotspot * 2;
- h = iconinfo.yHotspot * 2;
- }
- const DWORD dwImageSize = w * h * 4;
-
- BITMAPINFO bmi;
- memset(&bmi, 0, sizeof(bmi));
- bmi.bmiHeader.biSize = sizeof(BITMAPINFO);
- bmi.bmiHeader.biWidth = w;
- bmi.bmiHeader.biHeight = -h;
- bmi.bmiHeader.biPlanes = 1;
- bmi.bmiHeader.biBitCount = 32;
- bmi.bmiHeader.biCompression = BI_RGB;
- bmi.bmiHeader.biSizeImage = dwImageSize;
-
- uchar* bits;
-
- HBITMAP winBitmap = CreateDIBSection(hdc, &bmi, DIB_RGB_COLORS, (void**) &bits, 0, 0);
- if (winBitmap )
- memset(bits, 0xff, dwImageSize);
- if (!winBitmap) {
- qWarning("QPixmap::fromWinHICON(), failed to CreateDIBSection()");
- return QPixmap();
- }
-
- HGDIOBJ oldhdc = (HBITMAP)SelectObject(hdc, winBitmap);
- if (!DrawIconEx( hdc, 0, 0, icon, w, h, 0, 0, DI_NORMAL))
- qWarning("QPixmap::fromWinHICON(), failed to DrawIcon()");
-
- uint mask = 0xff000000;
- // Create image and copy data into image.
- QImage image(w, h, QImage::Format_ARGB32);
-
- if (!image.isNull()) { // failed to alloc?
- int bytes_per_line = w * sizeof(QRgb);
- for (int y=0; y < h; ++y) {
- QRgb *dest = (QRgb *) image.scanLine(y);
- const QRgb *src = (const QRgb *) (bits + y * bytes_per_line);
- for (int x=0; x < w; ++x) {
- dest[x] = src[x];
- }
- }
- }
- if (!DrawIconEx( hdc, 0, 0, icon, w, h, 0, 0, DI_MASK))
- qWarning("QPixmap::fromWinHICON(), failed to DrawIcon()");
- if (!image.isNull()) { // failed to alloc?
- int bytes_per_line = w * sizeof(QRgb);
- for (int y=0; y < h; ++y) {
- QRgb *dest = (QRgb *) image.scanLine(y);
- const QRgb *src = (const QRgb *) (bits + y * bytes_per_line);
- for (int x=0; x < w; ++x) {
- if (!src[x])
- dest[x] = dest[x] | mask;
- }
- }
- }
- SelectObject(hdc, oldhdc); //restore state
- DeleteObject(winBitmap);
- DeleteDC(hdc);
- return QPixmap::fromImage(image);
-}
-#endif //ifndef Q_OS_WINCE
QT_END_NAMESPACE
diff --git a/src/gui/image/qpixmapcache.h b/src/gui/image/qpixmapcache.h
index cc35fd0fd2..856b82f559 100644
--- a/src/gui/image/qpixmapcache.h
+++ b/src/gui/image/qpixmapcache.h
@@ -40,6 +40,7 @@
#ifndef QPIXMAPCACHE_H
#define QPIXMAPCACHE_H
+#include <QtGui/qtguiglobal.h>
#include <QtGui/qpixmap.h>
QT_BEGIN_NAMESPACE
diff --git a/src/gui/image/qpixmapcache_p.h b/src/gui/image/qpixmapcache_p.h
index 951c4ea9b1..3c57367514 100644
--- a/src/gui/image/qpixmapcache_p.h
+++ b/src/gui/image/qpixmapcache_p.h
@@ -50,6 +50,7 @@
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#include "qpixmapcache.h"
#include "qpaintengine.h"
#include <private/qimage_p.h>
diff --git a/src/gui/image/qplatformpixmap.h b/src/gui/image/qplatformpixmap.h
index c83278a4c3..8513755cca 100644
--- a/src/gui/image/qplatformpixmap.h
+++ b/src/gui/image/qplatformpixmap.h
@@ -49,6 +49,7 @@
// source and binary incompatible with future versions of Qt.
//
+#include <QtGui/qtguiglobal.h>
#include <QtGui/qpixmap.h>
#include <QtCore/qatomic.h>
diff --git a/src/gui/image/qpnghandler.cpp b/src/gui/image/qpnghandler.cpp
index d021e6f09f..fdf77e162c 100644
--- a/src/gui/image/qpnghandler.cpp
+++ b/src/gui/image/qpnghandler.cpp
@@ -49,6 +49,8 @@
#include <qvariant.h>
#include <qvector.h>
+#include <private/qimage_p.h> // for qt_getImageText
+
#include <png.h>
#include <pngconf.h>
@@ -75,20 +77,8 @@
# endif
#endif
-#ifdef Q_OS_WINCE
-#define CALLBACK_CALL_TYPE __cdecl
-#else
-#define CALLBACK_CALL_TYPE
-#endif
-
QT_BEGIN_NAMESPACE
-#if defined(Q_OS_WINCE) && defined(STANDARDSHELL_UI_MODEL)
-# define Q_INTERNAL_WIN_NO_THROW __declspec(nothrow)
-#else
-# define Q_INTERNAL_WIN_NO_THROW
-#endif
-
// avoid going through QImage::scanLine() which calls detach
#define FAST_SCAN_LINE(data, bpl, y) (data + (y) * bpl)
@@ -190,7 +180,7 @@ private:
extern "C" {
static
-void CALLBACK_CALL_TYPE iod_read_fn(png_structp png_ptr, png_bytep data, png_size_t length)
+void iod_read_fn(png_structp png_ptr, png_bytep data, png_size_t length)
{
QPngHandlerPrivate *d = (QPngHandlerPrivate *)png_get_io_ptr(png_ptr);
QIODevice *in = d->q->device();
@@ -215,7 +205,7 @@ void CALLBACK_CALL_TYPE iod_read_fn(png_structp png_ptr, png_bytep data, png_siz
static
-void CALLBACK_CALL_TYPE qpiw_write_fn(png_structp png_ptr, png_bytep data, png_size_t length)
+void qpiw_write_fn(png_structp png_ptr, png_bytep data, png_size_t length)
{
QPNGImageWriter* qpiw = (QPNGImageWriter*)png_get_io_ptr(png_ptr);
QIODevice* out = qpiw->device();
@@ -229,7 +219,7 @@ void CALLBACK_CALL_TYPE qpiw_write_fn(png_structp png_ptr, png_bytep data, png_s
static
-void CALLBACK_CALL_TYPE qpiw_flush_fn(png_structp /* png_ptr */)
+void qpiw_flush_fn(png_structp /* png_ptr */)
{
}
@@ -487,7 +477,7 @@ static void read_image_scaled(QImage *outImage, png_structp png_ptr, png_infop i
}
extern "C" {
-static void CALLBACK_CALL_TYPE qt_png_warning(png_structp /*png_ptr*/, png_const_charp message)
+static void qt_png_warning(png_structp /*png_ptr*/, png_const_charp message)
{
qWarning("libpng warning: %s", message);
}
@@ -495,7 +485,7 @@ static void CALLBACK_CALL_TYPE qt_png_warning(png_structp /*png_ptr*/, png_const
}
-void Q_INTERNAL_WIN_NO_THROW QPngHandlerPrivate::readPngTexts(png_info *info)
+void QPngHandlerPrivate::readPngTexts(png_info *info)
{
png_textp text_ptr;
int num_text=0;
@@ -522,7 +512,7 @@ void Q_INTERNAL_WIN_NO_THROW QPngHandlerPrivate::readPngTexts(png_info *info)
}
-bool Q_INTERNAL_WIN_NO_THROW QPngHandlerPrivate::readPngHeader()
+bool QPngHandlerPrivate::readPngHeader()
{
state = Error;
png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING,0,0,0);
@@ -566,7 +556,7 @@ bool Q_INTERNAL_WIN_NO_THROW QPngHandlerPrivate::readPngHeader()
return true;
}
-bool Q_INTERNAL_WIN_NO_THROW QPngHandlerPrivate::readPngImage(QImage *outImage)
+bool QPngHandlerPrivate::readPngImage(QImage *outImage)
{
if (state == Error)
return false;
@@ -730,27 +720,10 @@ void QPNGImageWriter::setGamma(float g)
gamma = g;
}
-
static void set_text(const QImage &image, png_structp png_ptr, png_infop info_ptr,
const QString &description)
{
- QMap<QString, QString> text;
- foreach (const QString &key, image.textKeys()) {
- if (!key.isEmpty())
- text.insert(key, image.text(key));
- }
- foreach (const QString &pair, description.split(QLatin1String("\n\n"))) {
- int index = pair.indexOf(QLatin1Char(':'));
- if (index >= 0 && pair.indexOf(QLatin1Char(' ')) < index) {
- QString s = pair.simplified();
- if (!s.isEmpty())
- text.insert(QLatin1String("Description"), s);
- } else {
- QString key = pair.left(index);
- if (!key.simplified().isEmpty())
- text.insert(key, pair.mid(index + 2).simplified());
- }
- }
+ const QMap<QString, QString> text = qt_getImageText(image, description);
if (text.isEmpty())
return;
@@ -810,7 +783,7 @@ bool QPNGImageWriter::writeImage(const QImage& image, int off_x, int off_y)
return writeImage(image, -1, QString(), off_x, off_y);
}
-bool Q_INTERNAL_WIN_NO_THROW QPNGImageWriter::writeImage(const QImage& image, volatile int quality_in, const QString &description,
+bool QPNGImageWriter::writeImage(const QImage& image, volatile int quality_in, const QString &description,
int off_x_in, int off_y_in)
{
QPoint offset = image.offset();
diff --git a/src/gui/image/qpnghandler.pri b/src/gui/image/qpnghandler.pri
index 505d214130..e69de29bb2 100644
--- a/src/gui/image/qpnghandler.pri
+++ b/src/gui/image/qpnghandler.pri
@@ -1,4 +0,0 @@
-HEADERS += $$PWD/qpnghandler_p.h
-SOURCES += $$PWD/qpnghandler.cpp
-
-include($$PWD/../../3rdparty/png_dependency.pri)
diff --git a/src/gui/image/qpnghandler_p.h b/src/gui/image/qpnghandler_p.h
index fb5a830baa..269df25794 100644
--- a/src/gui/image/qpnghandler_p.h
+++ b/src/gui/image/qpnghandler_p.h
@@ -44,13 +44,14 @@
// W A R N I N G
// -------------
//
-// This file is not part of the Qt API. It exists for the convenience
-// of the QLibrary class. This header file may change from
-// version to version without notice, or even be removed.
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
//
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#include "QtGui/qimageiohandler.h"
#ifndef QT_NO_IMAGEFORMAT_PNG
diff --git a/src/gui/image/qppmhandler_p.h b/src/gui/image/qppmhandler_p.h
index 1e8ca2b81e..8889d9e663 100644
--- a/src/gui/image/qppmhandler_p.h
+++ b/src/gui/image/qppmhandler_p.h
@@ -44,13 +44,14 @@
// W A R N I N G
// -------------
//
-// This file is not part of the Qt API. It exists for the convenience
-// of the QLibrary class. This header file may change from
-// version to version without notice, or even be removed.
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
//
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#include "QtGui/qimageiohandler.h"
#ifndef QT_NO_IMAGEFORMAT_PPM
diff --git a/src/gui/image/qxbmhandler_p.h b/src/gui/image/qxbmhandler_p.h
index 5094a43ef6..561153376d 100644
--- a/src/gui/image/qxbmhandler_p.h
+++ b/src/gui/image/qxbmhandler_p.h
@@ -44,13 +44,14 @@
// W A R N I N G
// -------------
//
-// This file is not part of the Qt API. It exists for the convenience
-// of the QLibrary class. This header file may change from
-// version to version without notice, or even be removed.
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
//
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#include "QtGui/qimageiohandler.h"
#ifndef QT_NO_IMAGEFORMAT_XBM
diff --git a/src/gui/image/qxpmhandler.cpp b/src/gui/image/qxpmhandler.cpp
index c8c8f993d3..1f1f6b388f 100644
--- a/src/gui/image/qxpmhandler.cpp
+++ b/src/gui/image/qxpmhandler.cpp
@@ -845,7 +845,7 @@ static bool read_xpm_header(
if (!read_xpm_string(buf, device, source, index, state))
return false;
-#if defined(_MSC_VER) && _MSC_VER >= 1400 && !defined(Q_OS_WINCE)
+#ifdef Q_CC_MSVC
if (sscanf_s(buf, "%d %d %d %d", w, h, ncols, cpp) < 4)
#else
if (sscanf(buf, "%d %d %d %d", w, h, ncols, cpp) < 4)
diff --git a/src/gui/image/qxpmhandler_p.h b/src/gui/image/qxpmhandler_p.h
index 9a2041be94..af3e98d3ff 100644
--- a/src/gui/image/qxpmhandler_p.h
+++ b/src/gui/image/qxpmhandler_p.h
@@ -44,13 +44,14 @@
// W A R N I N G
// -------------
//
-// This file is not part of the Qt API. It exists for the convenience
-// of the QLibrary class. This header file may change from
-// version to version without notice, or even be removed.
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
//
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#include "QtGui/qimageiohandler.h"
#ifndef QT_NO_IMAGEFORMAT_XPM
diff --git a/src/gui/itemmodels/qstandarditemmodel.cpp b/src/gui/itemmodels/qstandarditemmodel.cpp
index 5c04510af1..e965045524 100644
--- a/src/gui/itemmodels/qstandarditemmodel.cpp
+++ b/src/gui/itemmodels/qstandarditemmodel.cpp
@@ -705,20 +705,16 @@ void QStandardItemModelPrivate::columnsRemoved(QStandardItem *parent,
Constructs an item.
*/
QStandardItem::QStandardItem()
- : d_ptr(new QStandardItemPrivate)
+ : QStandardItem(*new QStandardItemPrivate)
{
- Q_D(QStandardItem);
- d->q_ptr = this;
}
/*!
Constructs an item with the given \a text.
*/
QStandardItem::QStandardItem(const QString &text)
- : d_ptr(new QStandardItemPrivate)
+ : QStandardItem(*new QStandardItemPrivate)
{
- Q_D(QStandardItem);
- d->q_ptr = this;
setText(text);
}
@@ -726,22 +722,17 @@ QStandardItem::QStandardItem(const QString &text)
Constructs an item with the given \a icon and \a text.
*/
QStandardItem::QStandardItem(const QIcon &icon, const QString &text)
- : d_ptr(new QStandardItemPrivate)
+ : QStandardItem(text)
{
- Q_D(QStandardItem);
- d->q_ptr = this;
setIcon(icon);
- setText(text);
}
/*!
Constructs an item with \a rows rows and \a columns columns of child items.
*/
QStandardItem::QStandardItem(int rows, int columns)
- : d_ptr(new QStandardItemPrivate)
+ : QStandardItem(*new QStandardItemPrivate)
{
- Q_D(QStandardItem);
- d->q_ptr = this;
setRowCount(rows);
setColumnCount(columns);
}
@@ -1877,36 +1868,7 @@ bool QStandardItem::operator<(const QStandardItem &other) const
{
const int role = model() ? model()->sortRole() : Qt::DisplayRole;
const QVariant l = data(role), r = other.data(role);
- // this code is copied from QSortFilterProxyModel::lessThan()
- if (l.userType() == QVariant::Invalid)
- return false;
- if (r.userType() == QVariant::Invalid)
- return true;
- switch (l.userType()) {
- case QVariant::Int:
- return l.toInt() < r.toInt();
- case QVariant::UInt:
- return l.toUInt() < r.toUInt();
- case QVariant::LongLong:
- return l.toLongLong() < r.toLongLong();
- case QVariant::ULongLong:
- return l.toULongLong() < r.toULongLong();
- case QMetaType::Float:
- return l.toFloat() < r.toFloat();
- case QVariant::Double:
- return l.toDouble() < r.toDouble();
- case QVariant::Char:
- return l.toChar() < r.toChar();
- case QVariant::Date:
- return l.toDate() < r.toDate();
- case QVariant::Time:
- return l.toTime() < r.toTime();
- case QVariant::DateTime:
- return l.toDateTime() < r.toDateTime();
- case QVariant::String:
- default:
- return l.toString().compare(r.toString()) < 0;
- }
+ return QAbstractItemModelPrivate::isVariantLessThan(l, r);
}
/*!
diff --git a/src/gui/itemmodels/qstandarditemmodel.h b/src/gui/itemmodels/qstandarditemmodel.h
index 476b936a25..a9cde106c1 100644
--- a/src/gui/itemmodels/qstandarditemmodel.h
+++ b/src/gui/itemmodels/qstandarditemmodel.h
@@ -40,6 +40,7 @@
#ifndef QSTANDARDITEMMODEL_H
#define QSTANDARDITEMMODEL_H
+#include <QtGui/qtguiglobal.h>
#include <QtCore/qabstractitemmodel.h>
#include <QtGui/qbrush.h>
#include <QtGui/qfont.h>
diff --git a/src/gui/itemmodels/qstandarditemmodel_p.h b/src/gui/itemmodels/qstandarditemmodel_p.h
index 1849e1a850..fbba93b93a 100644
--- a/src/gui/itemmodels/qstandarditemmodel_p.h
+++ b/src/gui/itemmodels/qstandarditemmodel_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#include "private/qabstractitemmodel_p.h"
#ifndef QT_NO_STANDARDITEMMODEL
diff --git a/src/gui/kernel/kernel.pri b/src/gui/kernel/kernel.pri
index 73a5a7b6ab..3b7e03a0ff 100644
--- a/src/gui/kernel/kernel.pri
+++ b/src/gui/kernel/kernel.pri
@@ -6,6 +6,8 @@ PRECOMPILED_HEADER = kernel/qt_gui_pch.h
KERNEL_P= kernel
HEADERS += \
+ kernel/qtguiglobal.h \
+ kernel/qtguiglobal_p.h \
kernel/qgenericpluginfactory.h \
kernel/qgenericplugin.h \
kernel/qwindowsysteminterface.h \
@@ -137,7 +139,7 @@ SOURCES += \
kernel/qhighdpiscaling.cpp
-contains(QT_CONFIG, opengl)|contains(QT_CONFIG, opengles2) {
+qtConfig(opengl(es2)?) {
HEADERS += \
kernel/qplatformopenglcontext.h \
kernel/qopenglcontext.h \
diff --git a/src/gui/kernel/qclipboard.cpp b/src/gui/kernel/qclipboard.cpp
index bb3895c2f5..ec6c0bcc36 100644
--- a/src/gui/kernel/qclipboard.cpp
+++ b/src/gui/kernel/qclipboard.cpp
@@ -553,7 +553,7 @@ bool QClipboard::ownsFindBuffer() const
bool QClipboard::supportsMode(Mode mode) const
{
QPlatformClipboard *clipboard = QGuiApplicationPrivate::platformIntegration()->clipboard();
- return clipboard->supportsMode(mode);
+ return clipboard && clipboard->supportsMode(mode);
}
/*!
@@ -565,7 +565,7 @@ bool QClipboard::supportsMode(Mode mode) const
bool QClipboard::ownsMode(Mode mode) const
{
QPlatformClipboard *clipboard = QGuiApplicationPrivate::platformIntegration()->clipboard();
- return clipboard->ownsMode(mode);
+ return clipboard && clipboard->ownsMode(mode);
}
/*!
diff --git a/src/gui/kernel/qclipboard.h b/src/gui/kernel/qclipboard.h
index 2588288880..e91444d3dc 100644
--- a/src/gui/kernel/qclipboard.h
+++ b/src/gui/kernel/qclipboard.h
@@ -40,6 +40,7 @@
#ifndef QCLIPBOARD_H
#define QCLIPBOARD_H
+#include <QtGui/qtguiglobal.h>
#include <QtCore/qobject.h>
QT_BEGIN_NAMESPACE
diff --git a/src/gui/kernel/qcursor.h b/src/gui/kernel/qcursor.h
index 814e8ab7bd..c7e9188e5b 100644
--- a/src/gui/kernel/qcursor.h
+++ b/src/gui/kernel/qcursor.h
@@ -40,6 +40,7 @@
#ifndef QCURSOR_H
#define QCURSOR_H
+#include <QtGui/qtguiglobal.h>
#include <QtCore/qpoint.h>
#include <QtGui/qwindowdefs.h>
diff --git a/src/gui/kernel/qcursor_p.h b/src/gui/kernel/qcursor_p.h
index 8dcea7fdcc..37245a793f 100644
--- a/src/gui/kernel/qcursor_p.h
+++ b/src/gui/kernel/qcursor_p.h
@@ -51,8 +51,8 @@
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#include "QtCore/qatomic.h"
-#include "QtCore/qglobal.h"
#include "QtCore/qnamespace.h"
#include "QtGui/qpixmap.h"
diff --git a/src/gui/kernel/qdnd.cpp b/src/gui/kernel/qdnd.cpp
index 21f9b46654..a59612474b 100644
--- a/src/gui/kernel/qdnd.cpp
+++ b/src/gui/kernel/qdnd.cpp
@@ -149,17 +149,12 @@ Qt::DropAction QDragManager::drag(QDrag *o)
#if !(defined(QT_NO_DRAGANDDROP) && defined(QT_NO_CLIPBOARD))
-static QStringList imageReadMimeFormats()
+static QStringList imageMimeFormats(const QList<QByteArray> &imageFormats)
{
QStringList formats;
- QList<QByteArray> imageFormats = QImageReader::supportedImageFormats();
- const int numImageFormats = imageFormats.size();
- formats.reserve(numImageFormats);
- for (int i = 0; i < numImageFormats; ++i) {
- QString format = QLatin1String("image/");
- format += QString::fromLatin1(imageFormats.at(i).toLower());
- formats.append(format);
- }
+ formats.reserve(imageFormats.size());
+ for (const auto &format : imageFormats)
+ formats.append(QLatin1String("image/") + QLatin1String(format.toLower()));
//put png at the front because it is best
int pngIndex = formats.indexOf(QLatin1String("image/png"));
@@ -169,25 +164,15 @@ static QStringList imageReadMimeFormats()
return formats;
}
-
-static QStringList imageWriteMimeFormats()
+static inline QStringList imageReadMimeFormats()
{
- QStringList formats;
- QList<QByteArray> imageFormats = QImageWriter::supportedImageFormats();
- const int numImageFormats = imageFormats.size();
- formats.reserve(numImageFormats);
- for (int i = 0; i < numImageFormats; ++i) {
- QString format = QLatin1String("image/");
- format += QString::fromLatin1(imageFormats.at(i).toLower());
- formats.append(format);
- }
+ return imageMimeFormats(QImageReader::supportedImageFormats());
+}
- //put png at the front because it is best
- int pngIndex = formats.indexOf(QLatin1String("image/png"));
- if (pngIndex != -1 && pngIndex != 0)
- formats.move(pngIndex, 0);
- return formats;
+static inline QStringList imageWriteMimeFormats()
+{
+ return imageMimeFormats(QImageWriter::supportedImageFormats());
}
QInternalMimeData::QInternalMimeData()
diff --git a/src/gui/kernel/qdnd_p.h b/src/gui/kernel/qdnd_p.h
index af7aaf771a..6f2ec46252 100644
--- a/src/gui/kernel/qdnd_p.h
+++ b/src/gui/kernel/qdnd_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#include "QtCore/qobject.h"
#include "QtCore/qmap.h"
#include "QtCore/qmimedata.h"
diff --git a/src/gui/kernel/qdrag.h b/src/gui/kernel/qdrag.h
index 6332899c39..a8288e1b53 100644
--- a/src/gui/kernel/qdrag.h
+++ b/src/gui/kernel/qdrag.h
@@ -40,6 +40,7 @@
#ifndef QDRAG_H
#define QDRAG_H
+#include <QtGui/qtguiglobal.h>
#include <QtCore/qobject.h>
QT_BEGIN_NAMESPACE
diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp
index 19220b5492..affc4c2526 100644
--- a/src/gui/kernel/qevent.cpp
+++ b/src/gui/kernel/qevent.cpp
@@ -289,7 +289,7 @@ QMouseEvent::QMouseEvent(Type type, const QPointF &localPos, Qt::MouseButton but
QMouseEvent::QMouseEvent(Type type, const QPointF &localPos, const QPointF &screenPos,
Qt::MouseButton button, Qt::MouseButtons buttons,
Qt::KeyboardModifiers modifiers)
- : QInputEvent(type, modifiers), l(localPos), w(localPos), s(screenPos), b(button), mouseState(buttons), caps(0)
+ : QMouseEvent(type, localPos, localPos, screenPos, button, buttons, modifiers)
{}
/*!
@@ -342,7 +342,7 @@ QMouseEvent::QMouseEvent(Type type, const QPointF &localPos, const QPointF &wind
QMouseEvent::QMouseEvent(QEvent::Type type, const QPointF &localPos, const QPointF &windowPos, const QPointF &screenPos,
Qt::MouseButton button, Qt::MouseButtons buttons,
Qt::KeyboardModifiers modifiers, Qt::MouseEventSource source)
- : QInputEvent(type, modifiers), l(localPos), w(windowPos), s(screenPos), b(button), mouseState(buttons), caps(0)
+ : QMouseEvent(type, localPos, windowPos, screenPos, button, buttons, modifiers)
{
QGuiApplicationPrivate::setMouseEventSource(this, source);
}
@@ -405,6 +405,18 @@ Qt::MouseEventFlags QMouseEvent::flags() const
*/
/*!
+ \fn void QMouseEvent::setLocalPos(const QPointF &localPosition)
+
+ \since 5.8
+
+ \internal
+
+ Sets the local position in the mouse event to \a localPosition. This allows to re-use one event
+ when sending it to a series of receivers that expect the local pos in their
+ respective local coordinates.
+*/
+
+/*!
\fn QPointF QMouseEvent::windowPos() const
\since 5.0
@@ -829,9 +841,8 @@ QWheelEvent::QWheelEvent(const QPointF &pos, const QPointF& globalPos, int delta
QWheelEvent::QWheelEvent(const QPointF &pos, const QPointF& globalPos,
QPoint pixelDelta, QPoint angleDelta, int qt4Delta, Qt::Orientation qt4Orientation,
Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers)
- : QInputEvent(Wheel, modifiers), p(pos), g(globalPos), pixelD(pixelDelta),
- angleD(angleDelta), qt4D(qt4Delta), qt4O(qt4Orientation), mouseState(buttons), ph(Qt::NoScrollPhase),
- src(Qt::MouseEventNotSynthesized), invertedScrolling(false)
+ : QWheelEvent(pos, globalPos, pixelDelta, angleDelta, qt4Delta, qt4Orientation,
+ buttons, modifiers, Qt::NoScrollPhase)
{}
/*!
@@ -860,9 +871,8 @@ QWheelEvent::QWheelEvent(const QPointF &pos, const QPointF& globalPos,
QWheelEvent::QWheelEvent(const QPointF &pos, const QPointF& globalPos,
QPoint pixelDelta, QPoint angleDelta, int qt4Delta, Qt::Orientation qt4Orientation,
Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, Qt::ScrollPhase phase)
- : QInputEvent(Wheel, modifiers), p(pos), g(globalPos), pixelD(pixelDelta),
- angleD(angleDelta), qt4D(qt4Delta), qt4O(qt4Orientation), mouseState(buttons), ph(phase),
- src(Qt::MouseEventNotSynthesized), invertedScrolling(false)
+ : QWheelEvent(pos, globalPos, pixelDelta, angleDelta, qt4Delta, qt4Orientation,
+ buttons, modifiers, phase, Qt::MouseEventNotSynthesized)
{}
/*!
@@ -896,9 +906,8 @@ QWheelEvent::QWheelEvent(const QPointF &pos, const QPointF& globalPos,
QWheelEvent::QWheelEvent(const QPointF &pos, const QPointF& globalPos,
QPoint pixelDelta, QPoint angleDelta, int qt4Delta, Qt::Orientation qt4Orientation,
Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, Qt::ScrollPhase phase, Qt::MouseEventSource source)
- : QInputEvent(Wheel, modifiers), p(pos), g(globalPos), pixelD(pixelDelta),
- angleD(angleDelta), qt4D(qt4Delta), qt4O(qt4Orientation), mouseState(buttons), ph(phase), src(source),
- invertedScrolling(false)
+ : QWheelEvent(pos, globalPos, pixelDelta, angleDelta, qt4Delta, qt4Orientation,
+ buttons, modifiers, phase, source, false)
{}
/*!
@@ -1767,7 +1776,7 @@ QIconDragEvent::~QIconDragEvent()
coordinates.
*/
QContextMenuEvent::QContextMenuEvent(Reason reason, const QPoint &pos, const QPoint &globalPos)
- : QInputEvent(ContextMenu), p(pos), gp(globalPos), reas(reason)
+ : QContextMenuEvent(reason, pos, globalPos, Qt::NoModifier)
{}
/*!
@@ -2065,6 +2074,16 @@ QContextMenuEvent::QContextMenuEvent(Reason reason, const QPoint &pos)
*/
/*!
+ \fn QInputMethodEvent::Attribute::Attribute(AttributeType type, int start, int length)
+ \overload
+ \since 5.7
+
+ Constructs an input method attribute with no value. \a type
+ specifies the type of attribute, and \a start and \a length
+ the position of the attribute.
+*/
+
+/*!
Constructs an event of type QEvent::InputMethod. The
attributes(), preeditString(), commitString(), replacementStart(),
and replacementLength() are initialized to default values.
@@ -2440,19 +2459,8 @@ QTabletEvent::QTabletEvent(Type type, const QPointF &pos, const QPointF &globalP
int device, int pointerType,
qreal pressure, int xTilt, int yTilt, qreal tangentialPressure,
qreal rotation, int z, Qt::KeyboardModifiers keyState, qint64 uniqueID)
- : QInputEvent(type, keyState),
- mPos(pos),
- mGPos(globalPos),
- mDev(device),
- mPointerType(pointerType),
- mXT(xTilt),
- mYT(yTilt),
- mZ(z),
- mPress(pressure),
- mTangential(tangentialPressure),
- mRot(rotation),
- mUnique(uniqueID),
- mExtra(new QTabletEventPrivate(Qt::NoButton, Qt::NoButton))
+ : QTabletEvent(type, pos, globalPos, device, pointerType, pressure, xTilt, yTilt,
+ tangentialPressure, rotation, z, keyState, uniqueID, Qt::NoButton, Qt::NoButton)
{
}
@@ -3967,6 +3975,7 @@ QDebug operator<<(QDebug dbg, const QEvent *e)
dbg << ')';
}
break;
+#ifndef QT_NO_SHORTCUT
case QEvent::Shortcut: {
const QShortcutEvent *se = static_cast<const QShortcutEvent *>(e);
dbg << "QShortcutEvent(" << se->key().toString() << ", id=" << se->shortcutId();
@@ -3975,6 +3984,7 @@ QDebug operator<<(QDebug dbg, const QEvent *e)
dbg << ')';
}
break;
+#endif
case QEvent::FocusAboutToChange:
case QEvent::FocusIn:
case QEvent::FocusOut:
@@ -4414,6 +4424,7 @@ QTouchEvent::~QTouchEvent()
The values of this enum describe additional information about a touch point.
\value Pen Indicates that the contact has been made by a designated pointing device (e.g. a pen) instead of a finger.
+ \value Token Indicates that the contact has been made by a fiducial object (e.g. a knob or other token) instead of a finger.
*/
/*!
@@ -4460,6 +4471,22 @@ int QTouchEvent::TouchPoint::id() const
}
/*!
+ \since 5.8
+ Returns the unique ID of this touch point or token, if any.
+
+ It is normally invalid (with a \l {QPointerUniqueId::numeric()} {numeric()} value of -1),
+ because touchscreens cannot uniquely identify fingers. But when the
+ \l {TouchPoint::InfoFlag} {Token} flag is set, it is expected to uniquely
+ identify a specific token (fiducial object).
+
+ \sa flags
+*/
+QPointerUniqueId QTouchEvent::TouchPoint::uniqueId() const
+{
+ return d->uniqueId;
+}
+
+/*!
Returns the current state of this touch point.
*/
Qt::TouchPointState QTouchEvent::TouchPoint::state() const
@@ -4663,6 +4690,19 @@ qreal QTouchEvent::TouchPoint::pressure() const
}
/*!
+ \since 5.8
+ Returns the angular orientation of this touch point. The return value is in degrees,
+ where zero (the default) indicates the finger or token is pointing upwards,
+ a negative angle means it's rotated to the left, and a positive angle means
+ it's rotated to the right. Most touchscreens do not detect rotation, so
+ zero is the most common value.
+*/
+qreal QTouchEvent::TouchPoint::rotation() const
+{
+ return d->rotation;
+}
+
+/*!
Returns a velocity vector for this touch point.
The vector is in the screen's coordinate system, using pixels per seconds for the magnitude.
@@ -4713,6 +4753,14 @@ void QTouchEvent::TouchPoint::setId(int id)
}
/*! \internal */
+void QTouchEvent::TouchPoint::setUniqueId(qint64 uid)
+{
+ if (d->ref.load() != 1)
+ d = d->detach();
+ d->uniqueId = QPointerUniqueId(uid);
+}
+
+/*! \internal */
void QTouchEvent::TouchPoint::setState(Qt::TouchPointStates state)
{
if (d->ref.load() != 1)
@@ -4849,6 +4897,14 @@ void QTouchEvent::TouchPoint::setPressure(qreal pressure)
}
/*! \internal */
+void QTouchEvent::TouchPoint::setRotation(qreal angle)
+{
+ if (d->ref.load() != 1)
+ d = d->detach();
+ d->rotation = angle;
+}
+
+/*! \internal */
void QTouchEvent::TouchPoint::setVelocity(const QVector2D &v)
{
if (d->ref.load() != 1)
@@ -5119,4 +5175,37 @@ Qt::ApplicationState QApplicationStateChangeEvent::applicationState() const
return m_applicationState;
}
+/*!
+ \class QPointerUniqueId
+ \since 5.8
+ \ingroup events
+ \inmodule QtGui
+
+ \brief QPointerUniqueId identifies a unique object, such as a tagged token
+ or stylus, which is used with a pointing device.
+
+ \sa QTouchEvent::TouchPoint
+*/
+
+/*!
+ Constructs a unique pointer ID with a numeric \a id provided by the hardware.
+ The default is -1, which means an invalid pointer ID.
+*/
+QPointerUniqueId::QPointerUniqueId(qint64 id)
+ : m_numericId(id)
+{
+}
+
+/*!
+ \property QPointerUniqueId::numeric
+ \brief the numeric unique ID of the token represented by a touchpoint
+
+ This is the numeric unique ID if the device provides that type of ID;
+ otherwise it is -1.
+*/
+qint64 QPointerUniqueId::numeric() const
+{
+ return m_numericId;
+}
+
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qevent.h b/src/gui/kernel/qevent.h
index 570212966f..a062331bd8 100644
--- a/src/gui/kernel/qevent.h
+++ b/src/gui/kernel/qevent.h
@@ -40,6 +40,7 @@
#ifndef QEVENT_H
#define QEVENT_H
+#include <QtGui/qtguiglobal.h>
#include <QtGui/qwindowdefs.h>
#include <QtGui/qregion.h>
#include <QtCore/qnamespace.h>
@@ -51,7 +52,7 @@
#include <QtCore/qvector.h>
#include <QtCore/qset.h> // ### Qt 6: Remove
#include <QtCore/qurl.h>
-#include <QtCore/qfile.h> // ### Qt 6: Replace by <qiodevice.h> and forward declare QFile
+#include <QtCore/qfile.h> // ### Qt 6: Replace by <QtCore/qiodevice.h> and forward declare QFile
#include <QtGui/qvector2d.h>
#include <QtGui/qtouchdevice.h> // ### Qt 6: Replace by forward declaration
@@ -131,6 +132,8 @@ public:
inline Qt::MouseButton button() const { return b; }
inline Qt::MouseButtons buttons() const { return mouseState; }
+ inline void setLocalPos(const QPointF &localPosition) { l = localPosition; }
+
#if QT_DEPRECATED_SINCE(5, 0)
QT_DEPRECATED inline QPointF posF() const { return l; }
#endif
@@ -535,8 +538,9 @@ public:
class Attribute {
public:
Attribute(AttributeType typ, int s, int l, QVariant val) : type(typ), start(s), length(l), value(qMove(val)) {}
- AttributeType type;
+ Attribute(AttributeType typ, int s, int l) : type(typ), start(s), length(l), value() {}
+ AttributeType type;
int start;
int length;
QVariant value;
@@ -789,6 +793,22 @@ inline bool operator==(QKeyEvent *e, QKeySequence::StandardKey key){return (e ?
inline bool operator==(QKeySequence::StandardKey key, QKeyEvent *e){return (e ? e->matches(key) : false);}
#endif // QT_NO_SHORTCUT
+class QPointerUniqueIdPrivate;
+class Q_GUI_EXPORT QPointerUniqueId
+{
+ Q_GADGET
+ Q_PROPERTY(qint64 numeric READ numeric CONSTANT)
+public:
+ explicit QPointerUniqueId(qint64 id = -1);
+
+ qint64 numeric() const;
+
+private:
+ // TODO for TUIO 2, or any other type of complex token ID, a d-pointer can replace
+ // m_numericId without changing the size of this class.
+ qint64 m_numericId;
+};
+
class QTouchEventTouchPointPrivate;
class Q_GUI_EXPORT QTouchEvent : public QInputEvent
{
@@ -797,7 +817,8 @@ public:
{
public:
enum InfoFlag {
- Pen = 0x0001
+ Pen = 0x0001,
+ Token = 0x0002
};
#ifndef Q_MOC_RUN
// otherwise moc gives
@@ -823,6 +844,7 @@ public:
{ qSwap(d, other.d); }
int id() const;
+ QPointerUniqueId uniqueId() const;
Qt::TouchPointState state() const;
@@ -847,12 +869,14 @@ public:
QRectF screenRect() const;
qreal pressure() const;
+ qreal rotation() const;
QVector2D velocity() const;
InfoFlags flags() const;
QVector<QPointF> rawScreenPositions() const;
// internal
void setId(int id);
+ void setUniqueId(qint64 uid);
void setState(Qt::TouchPointStates state);
void setPos(const QPointF &pos);
void setScenePos(const QPointF &scenePos);
@@ -870,6 +894,7 @@ public:
void setSceneRect(const QRectF &sceneRect);
void setScreenRect(const QRectF &screenRect);
void setPressure(qreal pressure);
+ void setRotation(qreal angle);
void setVelocity(const QVector2D &v);
void setFlags(InfoFlags flags);
void setRawScreenPositions(const QVector<QPointF> &positions);
diff --git a/src/gui/kernel/qevent_p.h b/src/gui/kernel/qevent_p.h
index 726aa05d36..7e82b9c654 100644
--- a/src/gui/kernel/qevent_p.h
+++ b/src/gui/kernel/qevent_p.h
@@ -40,7 +40,7 @@
#ifndef QEVENT_P_H
#define QEVENT_P_H
-#include <QtCore/qglobal.h>
+#include <QtGui/private/qtguiglobal_p.h>
#include <QtCore/qurl.h>
#include <QtGui/qevent.h>
@@ -65,7 +65,8 @@ public:
: ref(1),
id(id),
state(Qt::TouchPointReleased),
- pressure(qreal(-1.))
+ pressure(qreal(-1.)),
+ rotation(qreal(0.))
{ }
inline QTouchEventTouchPointPrivate *detach()
@@ -79,12 +80,14 @@ public:
QAtomicInt ref;
int id;
+ QPointerUniqueId uniqueId;
Qt::TouchPointStates state;
QRectF rect, sceneRect, screenRect;
QPointF normalizedPos,
startPos, startScenePos, startScreenPos, startNormalizedPos,
lastPos, lastScenePos, lastScreenPos, lastNormalizedPos;
qreal pressure;
+ qreal rotation;
QVector2D velocity;
QTouchEvent::TouchPoint::InfoFlags flags;
QVector<QPointF> rawScreenPositions;
diff --git a/src/gui/kernel/qgenericplugin.h b/src/gui/kernel/qgenericplugin.h
index 7f1a493861..e8aa2e6f32 100644
--- a/src/gui/kernel/qgenericplugin.h
+++ b/src/gui/kernel/qgenericplugin.h
@@ -40,6 +40,7 @@
#ifndef QGENERICPLUGIN_H
#define QGENERICPLUGIN_H
+#include <QtGui/qtguiglobal.h>
#include <QtCore/qplugin.h>
#include <QtCore/qfactoryinterface.h>
diff --git a/src/gui/kernel/qgenericpluginfactory.h b/src/gui/kernel/qgenericpluginfactory.h
index 282f3fed6d..9cc77a0590 100644
--- a/src/gui/kernel/qgenericpluginfactory.h
+++ b/src/gui/kernel/qgenericpluginfactory.h
@@ -40,6 +40,7 @@
#ifndef QGENERICPLUGINFACTORY_H
#define QGENERICPLUGINFACTORY_H
+#include <QtGui/qtguiglobal.h>
#include <QtCore/qstringlist.h>
QT_BEGIN_NAMESPACE
diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp
index f60cfd8af3..2ed7eb2cfb 100644
--- a/src/gui/kernel/qguiapplication.cpp
+++ b/src/gui/kernel/qguiapplication.cpp
@@ -104,13 +104,13 @@
#if defined(Q_OS_MAC)
# include "private/qcore_mac_p.h"
-#elif defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
+#elif defined(Q_OS_WIN)
# include <QtCore/qt_windows.h>
# include <QtCore/QLibraryInfo>
# if defined(Q_OS_WINPHONE)
# include <Objbase.h>
# endif
-#endif // Q_OS_WIN && !Q_OS_WINCE
+#endif // Q_OS_WIN
#include <ctype.h>
@@ -656,9 +656,20 @@ QGuiApplicationPrivate::QGuiApplicationPrivate(int &argc, char **argv, int flags
*/
void QGuiApplication::setApplicationDisplayName(const QString &name)
{
- if (!QGuiApplicationPrivate::displayName)
- QGuiApplicationPrivate::displayName = new QString;
- *QGuiApplicationPrivate::displayName = name;
+ if (!QGuiApplicationPrivate::displayName) {
+ QGuiApplicationPrivate::displayName = new QString(name);
+ if (qGuiApp) {
+ disconnect(qGuiApp, &QGuiApplication::applicationNameChanged,
+ qGuiApp, &QGuiApplication::applicationDisplayNameChanged);
+
+ if (QGuiApplicationPrivate::displayName != applicationName())
+ emit qGuiApp->applicationDisplayNameChanged();
+ }
+ } else if (name != *QGuiApplicationPrivate::displayName) {
+ *QGuiApplicationPrivate::displayName = name;
+ if (qGuiApp)
+ emit qGuiApp->applicationDisplayNameChanged();
+ }
}
QString QGuiApplication::applicationDisplayName()
@@ -1054,7 +1065,7 @@ QWindow *QGuiApplication::topLevelAt(const QPoint &pos)
\li \c eglfs is a platform plugin for running Qt5 applications on top of
EGL and OpenGL ES 2.0 without an actual windowing system (like X11
or Wayland). For more information, see \l{EGLFS}.
- \li \c ios
+ \li \c ios (also used for tvOS)
\li \c kms is an experimental platform plugin using kernel modesetting
and \l{http://dri.freedesktop.org/wiki/DRM}{DRM} (Direct Rendering
Manager).
@@ -1102,12 +1113,12 @@ static void init_platform(const QString &pluginArgument, const QString &platform
keys.join(QStringLiteral(", ")));
}
fatalMessage += QStringLiteral("Reinstalling the application may fix this problem.");
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
+#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
// Windows: Display message box unless it is a console application
// or debug build showing an assert box.
if (!QLibraryInfo::isDebugBuild() && !GetConsoleWindow())
MessageBox(0, (LPCTSTR)fatalMessage.utf16(), (LPCTSTR)(QCoreApplication::applicationName().utf16()), MB_OK | MB_ICONERROR);
-#endif // Q_OS_WIN && !Q_OS_WINCE && !Q_OS_WINRT
+#endif // Q_OS_WIN && !Q_OS_WINRT
qFatal("%s", qPrintable(fatalMessage));
return;
}
@@ -1186,7 +1197,7 @@ static void init_plugins(const QList<QByteArray> &pluginList)
if (plugin)
QGuiApplicationPrivate::generic_plugin_list.append(plugin);
else
- qWarning() << "No such plugin for spec " << pluginSpec;
+ qWarning("No such plugin for spec \"%s\"", pluginSpec.constData());
}
}
@@ -1310,7 +1321,7 @@ void QGuiApplicationPrivate::init()
#ifndef QT_NO_SESSIONMANAGER
QString session_id;
QString session_key;
-# if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
+# if defined(Q_OS_WIN)
wchar_t guidstr[40];
GUID guid;
CoCreateGuid(&guid);
@@ -1424,9 +1435,8 @@ void QGuiApplicationPrivate::init()
init_plugins(pluginList);
QWindowSystemInterface::flushWindowSystemEvents();
-#ifndef QT_NO_SESSIONMANAGER
Q_Q(QGuiApplication);
-
+#ifndef QT_NO_SESSIONMANAGER
// connect to the session manager
session_manager = new QSessionManager(q, session_id, session_key);
#endif
@@ -1455,6 +1465,10 @@ void QGuiApplicationPrivate::init()
if (layout_direction == Qt::LayoutDirectionAuto || force_reverse)
QGuiApplication::setLayoutDirection(qt_detectRTLLanguage() ? Qt::RightToLeft : Qt::LeftToRight);
+
+ if (!QGuiApplicationPrivate::displayName)
+ QObject::connect(q, &QGuiApplication::applicationNameChanged,
+ q, &QGuiApplication::applicationDisplayNameChanged);
}
extern void qt_cleanupFontDatabase();
@@ -2450,6 +2464,7 @@ void QGuiApplicationPrivate::processTouchEvent(QWindowSystemInterfacePrivate::To
QWindow *window = e->window.data();
typedef QPair<Qt::TouchPointStates, QList<QTouchEvent::TouchPoint> > StatesAndTouchPoints;
QHash<QWindow *, StatesAndTouchPoints> windowsNeedingEvents;
+ bool velocityOnly = false;
for (int i = 0; i < e->points.count(); ++i) {
QTouchEvent::TouchPoint touchPoint = e->points.at(i);
@@ -2526,8 +2541,14 @@ void QGuiApplicationPrivate::processTouchEvent(QWindowSystemInterfacePrivate::To
// Stationary points might not be delivered down to the receiving item
// and get their position transformed, keep the old values instead.
- if (touchPoint.state() != Qt::TouchPointStationary)
+ if (touchPoint.state() == Qt::TouchPointStationary) {
+ if (touchInfo.touchPoint.velocity() != touchPoint.velocity()) {
+ touchInfo.touchPoint.setVelocity(touchPoint.velocity());
+ velocityOnly = true;
+ }
+ } else {
touchInfo.touchPoint = touchPoint;
+ }
break;
}
@@ -2561,7 +2582,10 @@ void QGuiApplicationPrivate::processTouchEvent(QWindowSystemInterfacePrivate::To
break;
case Qt::TouchPointStationary:
// don't send the event if nothing changed
- continue;
+ if (velocityOnly)
+ eventType = QEvent::TouchUpdate;
+ else
+ continue;
default:
eventType = QEvent::TouchUpdate;
break;
diff --git a/src/gui/kernel/qguiapplication.h b/src/gui/kernel/qguiapplication.h
index 10057c5b7f..6721970222 100644
--- a/src/gui/kernel/qguiapplication.h
+++ b/src/gui/kernel/qguiapplication.h
@@ -40,6 +40,7 @@
#ifndef QGUIAPPLICATION_H
#define QGUIAPPLICATION_H
+#include <QtGui/qtguiglobal.h>
#include <QtCore/qcoreapplication.h>
#include <QtGui/qwindowdefs.h>
#include <QtGui/qinputmethod.h>
@@ -72,7 +73,7 @@ class Q_GUI_EXPORT QGuiApplication : public QCoreApplication
{
Q_OBJECT
Q_PROPERTY(QIcon windowIcon READ windowIcon WRITE setWindowIcon)
- Q_PROPERTY(QString applicationDisplayName READ applicationDisplayName WRITE setApplicationDisplayName)
+ Q_PROPERTY(QString applicationDisplayName READ applicationDisplayName WRITE setApplicationDisplayName NOTIFY applicationDisplayNameChanged)
Q_PROPERTY(QString desktopFileName READ desktopFileName WRITE setDesktopFileName)
Q_PROPERTY(Qt::LayoutDirection layoutDirection READ layoutDirection WRITE setLayoutDirection NOTIFY layoutDirectionChanged)
Q_PROPERTY(QString platformName READ platformName STORED false)
@@ -183,6 +184,7 @@ Q_SIGNALS:
void saveStateRequest(QSessionManager &sessionManager);
#endif
void paletteChanged(const QPalette &pal);
+ void applicationDisplayNameChanged();
protected:
bool event(QEvent *) Q_DECL_OVERRIDE;
diff --git a/src/gui/kernel/qguiapplication_p.h b/src/gui/kernel/qguiapplication_p.h
index a028441a2f..e1a35e048c 100644
--- a/src/gui/kernel/qguiapplication_p.h
+++ b/src/gui/kernel/qguiapplication_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#include <QtGui/qguiapplication.h>
#include <QtCore/QPointF>
diff --git a/src/gui/kernel/qhighdpiscaling.cpp b/src/gui/kernel/qhighdpiscaling.cpp
index fccd81f8e8..1085b546a7 100644
--- a/src/gui/kernel/qhighdpiscaling.cpp
+++ b/src/gui/kernel/qhighdpiscaling.cpp
@@ -68,10 +68,11 @@ static inline qreal initialGlobalScaleFactor()
}
} else {
if (qEnvironmentVariableIsSet(legacyDevicePixelEnvVar)) {
- qWarning() << "Warning:" << legacyDevicePixelEnvVar << "is deprecated. Instead use:" << endl
- << " " << autoScreenEnvVar << "to enable platform plugin controlled per-screen factors." << endl
- << " " << screenFactorsEnvVar << "to set per-screen factors." << endl
- << " " << scaleFactorEnvVar << "to set the application global scale factor.";
+ qWarning("Warning: %s is deprecated. Instead use:\n"
+ " %s to enable platform plugin controlled per-screen factors.\n"
+ " %s to set per-screen factors.\n"
+ " %s to set the application global scale factor.",
+ legacyDevicePixelEnvVar, autoScreenEnvVar, screenFactorsEnvVar, scaleFactorEnvVar);
int dpr = qEnvironmentVariableIntValue(legacyDevicePixelEnvVar);
if (dpr > 0)
diff --git a/src/gui/kernel/qhighdpiscaling_p.h b/src/gui/kernel/qhighdpiscaling_p.h
index eb3a9d5545..32c8f07dc0 100644
--- a/src/gui/kernel/qhighdpiscaling_p.h
+++ b/src/gui/kernel/qhighdpiscaling_p.h
@@ -51,7 +51,7 @@
// We mean it.
//
-#include <QtCore/qglobal.h>
+#include <QtGui/private/qtguiglobal_p.h>
#include <QtCore/qmargins.h>
#include <QtCore/qmath.h>
#include <QtCore/qrect.h>
@@ -382,8 +382,7 @@ inline QRegion fromNativeLocalRegion(const QRegion &pixelRegion, const QWindow *
qreal scaleFactor = QHighDpiScaling::factor(window);
QRegion pointRegion;
- const auto rects = pixelRegion.rects();
- for (const QRect &rect : rects) {
+ for (const QRect &rect : pixelRegion) {
pointRegion += QRect(fromNative(rect.topLeft(), scaleFactor),
fromNative(rect.size(), scaleFactor));
}
@@ -399,7 +398,7 @@ inline QRegion fromNativeLocalExposedRegion(const QRegion &pixelRegion, const QW
const qreal scaleFactor = QHighDpiScaling::factor(window);
QRegion pointRegion;
- foreach (const QRect &rect, pixelRegion.rects()) {
+ for (const QRect &rect : pixelRegion) {
const QPointF topLeftP = QPointF(rect.topLeft()) / scaleFactor;
const QPointF bottomRightP = QPointF(rect.bottomRight()) / scaleFactor;
pointRegion += QRect(QPoint(qFloor(topLeftP.x()), qFloor(topLeftP.y())),
@@ -415,8 +414,7 @@ inline QRegion toNativeLocalRegion(const QRegion &pointRegion, const QWindow *wi
qreal scaleFactor = QHighDpiScaling::factor(window);
QRegion pixelRegon;
- const auto rects = pointRegion.rects();
- for (const QRect &rect : rects) {
+ for (const QRect &rect : pointRegion) {
pixelRegon += QRect(toNative(rect.topLeft(), scaleFactor),
toNative(rect.size(), scaleFactor));
}
diff --git a/src/gui/kernel/qinputdevicemanager_p.h b/src/gui/kernel/qinputdevicemanager_p.h
index 1cf0443834..11bbaae592 100644
--- a/src/gui/kernel/qinputdevicemanager_p.h
+++ b/src/gui/kernel/qinputdevicemanager_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#include <QtCore/qobject.h>
QT_BEGIN_NAMESPACE
diff --git a/src/gui/kernel/qinputdevicemanager_p_p.h b/src/gui/kernel/qinputdevicemanager_p_p.h
index 45d8b64172..ae91f3a2ab 100644
--- a/src/gui/kernel/qinputdevicemanager_p_p.h
+++ b/src/gui/kernel/qinputdevicemanager_p_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#include <QtCore/qmap.h>
#include <private/qobject_p.h>
#include "qinputdevicemanager_p.h"
diff --git a/src/gui/kernel/qinputmethod.h b/src/gui/kernel/qinputmethod.h
index 1a63d1314e..efdefb6e5a 100644
--- a/src/gui/kernel/qinputmethod.h
+++ b/src/gui/kernel/qinputmethod.h
@@ -40,6 +40,7 @@
#ifndef QINPUTMETHOD_H
#define QINPUTMETHOD_H
+#include <QtGui/qtguiglobal.h>
#include <QtCore/qobject.h>
QT_BEGIN_NAMESPACE
diff --git a/src/gui/kernel/qinputmethod_p.h b/src/gui/kernel/qinputmethod_p.h
index 3f7cd195ea..81723bbe30 100644
--- a/src/gui/kernel/qinputmethod_p.h
+++ b/src/gui/kernel/qinputmethod_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#include <qinputmethod.h>
#include <private/qobject_p.h>
#include <QtCore/QWeakPointer>
diff --git a/src/gui/kernel/qkeymapper_p.h b/src/gui/kernel/qkeymapper_p.h
index 59977688e4..aeec7b7414 100644
--- a/src/gui/kernel/qkeymapper_p.h
+++ b/src/gui/kernel/qkeymapper_p.h
@@ -50,6 +50,7 @@
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#include <qobject.h>
#include <private/qobject_p.h>
#include <qkeysequence.h>
diff --git a/src/gui/kernel/qkeysequence.cpp b/src/gui/kernel/qkeysequence.cpp
index 9a75f4bc83..d59bd63caf 100644
--- a/src/gui/kernel/qkeysequence.cpp
+++ b/src/gui/kernel/qkeysequence.cpp
@@ -1211,9 +1211,13 @@ QString QKeySequence::encodeString(int key)
static inline void addKey(QString &str, const QString &theKey, QKeySequence::SequenceFormat format)
{
- if (!str.isEmpty())
- str += (format == QKeySequence::NativeText) ? QCoreApplication::translate("QShortcut", "+")
- : QString::fromLatin1("+");
+ if (!str.isEmpty()) {
+ if (format == QKeySequence::NativeText)
+ str += QCoreApplication::translate("QShortcut", "+");
+ else
+ str += QLatin1Char('+');
+ }
+
str += theKey;
}
diff --git a/src/gui/kernel/qkeysequence.h b/src/gui/kernel/qkeysequence.h
index 3a660b063e..6bdfd84ca3 100644
--- a/src/gui/kernel/qkeysequence.h
+++ b/src/gui/kernel/qkeysequence.h
@@ -40,7 +40,7 @@
#ifndef QKEYSEQUENCE_H
#define QKEYSEQUENCE_H
-#include <QtCore/qnamespace.h>
+#include <QtGui/qtguiglobal.h>
#include <QtCore/qstring.h>
#include <QtCore/qobjectdefs.h>
diff --git a/src/gui/kernel/qkeysequence_p.h b/src/gui/kernel/qkeysequence_p.h
index 116e91c0cd..8ba86c31b8 100644
--- a/src/gui/kernel/qkeysequence_p.h
+++ b/src/gui/kernel/qkeysequence_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#include "qkeysequence.h"
#include <algorithm>
diff --git a/src/gui/kernel/qoffscreensurface.h b/src/gui/kernel/qoffscreensurface.h
index d639407e1a..bacc9c851a 100644
--- a/src/gui/kernel/qoffscreensurface.h
+++ b/src/gui/kernel/qoffscreensurface.h
@@ -40,6 +40,7 @@
#ifndef QOFFSCREENSURFACE_H
#define QOFFSCREENSURFACE_H
+#include <QtGui/qtguiglobal.h>
#include <QtCore/QObject>
#include <QtGui/qsurface.h>
diff --git a/src/gui/kernel/qopenglcontext.cpp b/src/gui/kernel/qopenglcontext.cpp
index 0f7bbfd2e1..7e5697e5d8 100644
--- a/src/gui/kernel/qopenglcontext.cpp
+++ b/src/gui/kernel/qopenglcontext.cpp
@@ -940,13 +940,20 @@ GLuint QOpenGLContext::defaultFramebufferObject() const
If \a surface is 0 this is equivalent to calling doneCurrent().
- Do not call this function from a different thread than the one the
+ Avoid calling this function from a different thread than the one the
QOpenGLContext instance lives in. If you wish to use QOpenGLContext from a
different thread you should first call make sure it's not current in the
current thread, by calling doneCurrent() if necessary. Then call
moveToThread(otherThread) before using it in the other thread.
- \sa functions(), doneCurrent()
+ By default Qt employs a check that enforces the above condition on the
+ thread affinity. It is still possible to disable this check by setting the
+ \c{Qt::AA_DontCheckOpenGLContextThreadAffinity} application attribute. Be
+ sure to understand the consequences of using QObjects from outside
+ the thread they live in, as explained in the
+ \l{QObject#Thread Affinity}{QObject thread affinity} documentation.
+
+ \sa functions(), doneCurrent(), Qt::AA_DontCheckOpenGLContextThreadAffinity
*/
bool QOpenGLContext::makeCurrent(QSurface *surface)
{
@@ -954,8 +961,10 @@ bool QOpenGLContext::makeCurrent(QSurface *surface)
if (!isValid())
return false;
- if (Q_UNLIKELY(thread() != QThread::currentThread()))
+ if (Q_UNLIKELY(!qApp->testAttribute(Qt::AA_DontCheckOpenGLContextThreadAffinity)
+ && thread() != QThread::currentThread())) {
qFatal("Cannot make QOpenGLContext current in a different thread");
+ }
if (!surface) {
doneCurrent();
diff --git a/src/gui/kernel/qopenglcontext.h b/src/gui/kernel/qopenglcontext.h
index 33e3f1c3f6..3ec9ce3188 100644
--- a/src/gui/kernel/qopenglcontext.h
+++ b/src/gui/kernel/qopenglcontext.h
@@ -40,7 +40,7 @@
#ifndef QOPENGLCONTEXT_H
#define QOPENGLCONTEXT_H
-#include <QtCore/qglobal.h>
+#include <QtGui/qtguiglobal.h>
#ifndef QT_NO_OPENGL
diff --git a/src/gui/kernel/qopenglcontext_p.h b/src/gui/kernel/qopenglcontext_p.h
index 2fe8446c65..57f70356b8 100644
--- a/src/gui/kernel/qopenglcontext_p.h
+++ b/src/gui/kernel/qopenglcontext_p.h
@@ -51,6 +51,8 @@
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
+
#ifndef QT_NO_OPENGL
#include "qopengl.h"
diff --git a/src/gui/kernel/qopenglwindow.cpp b/src/gui/kernel/qopenglwindow.cpp
index 8ab5c08442..e1bd3d11b2 100644
--- a/src/gui/kernel/qopenglwindow.cpp
+++ b/src/gui/kernel/qopenglwindow.cpp
@@ -42,7 +42,7 @@
#include <QtGui/QOpenGLFramebufferObject>
#include <QtGui/QOpenGLPaintDevice>
#include <QtGui/QOpenGLFunctions>
-#include <QtGui/private/qopengltextureblitter_p.h>
+#include <QtGui/QOpenGLTextureBlitter>
#include <QtGui/private/qopenglextensions_p.h>
#include <QtGui/private/qopenglcontext_p.h>
#include <QtGui/QMatrix4x4>
diff --git a/src/gui/kernel/qopenglwindow.h b/src/gui/kernel/qopenglwindow.h
index 6e2a8ab904..fe236f9538 100644
--- a/src/gui/kernel/qopenglwindow.h
+++ b/src/gui/kernel/qopenglwindow.h
@@ -40,7 +40,7 @@
#ifndef QOPENGLWINDOW_H
#define QOPENGLWINDOW_H
-#include <QtCore/qglobal.h>
+#include <QtGui/qtguiglobal.h>
#ifndef QT_NO_OPENGL
diff --git a/src/gui/kernel/qpaintdevicewindow.h b/src/gui/kernel/qpaintdevicewindow.h
index 1b66ed7c41..81b41dcdd5 100644
--- a/src/gui/kernel/qpaintdevicewindow.h
+++ b/src/gui/kernel/qpaintdevicewindow.h
@@ -40,6 +40,7 @@
#ifndef QPAINTDEVICEWINDOW_H
#define QPAINTDEVICEWINDOW_H
+#include <QtGui/qtguiglobal.h>
#include <QtGui/QWindow>
#include <QtGui/QPaintDevice>
diff --git a/src/gui/kernel/qpaintdevicewindow_p.h b/src/gui/kernel/qpaintdevicewindow_p.h
index 39cd1b3615..a16b83689e 100644
--- a/src/gui/kernel/qpaintdevicewindow_p.h
+++ b/src/gui/kernel/qpaintdevicewindow_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#include <QtGui/QPaintDeviceWindow>
#include <QtCore/QCoreApplication>
#include <QtGui/private/qwindow_p.h>
diff --git a/src/gui/kernel/qpalette.h b/src/gui/kernel/qpalette.h
index c130a1844b..d04fb1f0c5 100644
--- a/src/gui/kernel/qpalette.h
+++ b/src/gui/kernel/qpalette.h
@@ -40,6 +40,7 @@
#ifndef QPALETTE_H
#define QPALETTE_H
+#include <QtGui/qtguiglobal.h>
#include <QtGui/qwindowdefs.h>
#include <QtGui/qcolor.h>
#include <QtGui/qbrush.h>
diff --git a/src/gui/kernel/qpixelformat.h b/src/gui/kernel/qpixelformat.h
index a78a3b5ad3..6b2d6a6ac7 100644
--- a/src/gui/kernel/qpixelformat.h
+++ b/src/gui/kernel/qpixelformat.h
@@ -40,7 +40,7 @@
#ifndef QPIXELFORMAT_H
#define QPIXELFORMAT_H
-#include <QtCore/qglobal.h>
+#include <QtGui/qtguiglobal.h>
QT_BEGIN_NAMESPACE
diff --git a/src/gui/kernel/qplatformclipboard.h b/src/gui/kernel/qplatformclipboard.h
index c30e085d00..60733b0a9f 100644
--- a/src/gui/kernel/qplatformclipboard.h
+++ b/src/gui/kernel/qplatformclipboard.h
@@ -49,7 +49,7 @@
// source and binary incompatible with future versions of Qt.
//
-#include <QtCore/qglobal.h>
+#include <QtGui/qtguiglobal.h>
#ifndef QT_NO_CLIPBOARD
diff --git a/src/gui/kernel/qplatformcursor.cpp b/src/gui/kernel/qplatformcursor.cpp
index c644d4769a..af0214e016 100644
--- a/src/gui/kernel/qplatformcursor.cpp
+++ b/src/gui/kernel/qplatformcursor.cpp
@@ -49,16 +49,6 @@
QT_BEGIN_NAMESPACE
-QList<QPlatformCursor *> QPlatformCursorPrivate::getInstances()
-{
- QList<QPlatformCursor *> result;
- for (const QScreen *screen : qAsConst(QGuiApplicationPrivate::screen_list)) {
- if (QPlatformCursor *cursor = screen->handle()->cursor())
- result.push_back(cursor);
- }
- return result;
-}
-
/*!
\class QPlatformCursor
\since 5.0
diff --git a/src/gui/kernel/qplatformcursor.h b/src/gui/kernel/qplatformcursor.h
index 52c93c87e3..dddd9e5831 100644
--- a/src/gui/kernel/qplatformcursor.h
+++ b/src/gui/kernel/qplatformcursor.h
@@ -48,6 +48,7 @@
// source and binary incompatible with future versions of Qt.
//
+#include <QtGui/qtguiglobal.h>
#include <QtCore/QList>
#include <QtGui/QImage>
#include <QtGui/QMouseEvent>
@@ -75,13 +76,6 @@ private:
QPoint hot;
};
-class QPlatformCursor;
-
-class Q_GUI_EXPORT QPlatformCursorPrivate {
-public:
- static QList<QPlatformCursor *> getInstances();
-};
-
class Q_GUI_EXPORT QPlatformCursor : public QObject {
public:
QPlatformCursor();
@@ -95,7 +89,6 @@ public:
virtual void setPos(const QPoint &pos);
private:
- Q_DECLARE_PRIVATE(QPlatformCursor)
friend void qt_qpa_set_cursor(QWidget * w, bool force);
friend class QApplicationPrivate;
};
diff --git a/src/gui/kernel/qplatformdialoghelper.cpp b/src/gui/kernel/qplatformdialoghelper.cpp
index fe4d167078..c36186b815 100644
--- a/src/gui/kernel/qplatformdialoghelper.cpp
+++ b/src/gui/kernel/qplatformdialoghelper.cpp
@@ -156,23 +156,33 @@ public:
QString windowTitle;
};
-QFontDialogOptions::QFontDialogOptions() : d(new QFontDialogOptionsPrivate)
+QFontDialogOptions::QFontDialogOptions(QFontDialogOptionsPrivate *dd)
+ : d(dd)
{
}
-QFontDialogOptions::QFontDialogOptions(const QFontDialogOptions &rhs) : d(rhs.d)
+QFontDialogOptions::~QFontDialogOptions()
{
}
-QFontDialogOptions &QFontDialogOptions::operator=(const QFontDialogOptions &rhs)
+namespace {
+ struct FontDialogCombined : QFontDialogOptionsPrivate, QFontDialogOptions
+ {
+ FontDialogCombined() : QFontDialogOptionsPrivate(), QFontDialogOptions(this) {}
+ FontDialogCombined(const FontDialogCombined &other)
+ : QFontDialogOptionsPrivate(other), QFontDialogOptions(this) {}
+ };
+}
+
+// static
+QSharedPointer<QFontDialogOptions> QFontDialogOptions::create()
{
- if (this != &rhs)
- d = rhs.d;
- return *this;
+ return QSharedPointer<FontDialogCombined>::create();
}
-QFontDialogOptions::~QFontDialogOptions()
+QSharedPointer<QFontDialogOptions> QFontDialogOptions::clone() const
{
+ return QSharedPointer<FontDialogCombined>::create(*static_cast<const FontDialogCombined*>(this));
}
QString QFontDialogOptions::windowTitle() const
@@ -289,23 +299,33 @@ public:
QString windowTitle;
};
-QColorDialogOptions::QColorDialogOptions() : d(new QColorDialogOptionsPrivate)
+QColorDialogOptions::QColorDialogOptions(QColorDialogOptionsPrivate *dd)
+ : d(dd)
{
}
-QColorDialogOptions::QColorDialogOptions(const QColorDialogOptions &rhs) : d(rhs.d)
+QColorDialogOptions::~QColorDialogOptions()
{
}
-QColorDialogOptions &QColorDialogOptions::operator=(const QColorDialogOptions &rhs)
+namespace {
+ struct ColorDialogCombined : QColorDialogOptionsPrivate, QColorDialogOptions
+ {
+ ColorDialogCombined() : QColorDialogOptionsPrivate(), QColorDialogOptions(this) {}
+ ColorDialogCombined(const ColorDialogCombined &other)
+ : QColorDialogOptionsPrivate(other), QColorDialogOptions(this) {}
+ };
+}
+
+// static
+QSharedPointer<QColorDialogOptions> QColorDialogOptions::create()
{
- if (this != &rhs)
- d = rhs.d;
- return *this;
+ return QSharedPointer<ColorDialogCombined>::create();
}
-QColorDialogOptions::~QColorDialogOptions()
+QSharedPointer<QColorDialogOptions> QColorDialogOptions::clone() const
{
+ return QSharedPointer<ColorDialogCombined>::create(*static_cast<const ColorDialogCombined*>(this));
}
QString QColorDialogOptions::windowTitle() const
@@ -436,23 +456,32 @@ public:
QStringList supportedSchemes;
};
-QFileDialogOptions::QFileDialogOptions() : d(new QFileDialogOptionsPrivate)
+QFileDialogOptions::QFileDialogOptions(QFileDialogOptionsPrivate *dd)
+ : d(dd)
{
}
-QFileDialogOptions::QFileDialogOptions(const QFileDialogOptions &rhs) : d(rhs.d)
+QFileDialogOptions::~QFileDialogOptions()
{
}
-QFileDialogOptions &QFileDialogOptions::operator=(const QFileDialogOptions &rhs)
+namespace {
+ struct FileDialogCombined : QFileDialogOptionsPrivate, QFileDialogOptions
+ {
+ FileDialogCombined() : QFileDialogOptionsPrivate(), QFileDialogOptions(this) {}
+ FileDialogCombined(const FileDialogCombined &other) : QFileDialogOptionsPrivate(other), QFileDialogOptions(this) {}
+ };
+}
+
+// static
+QSharedPointer<QFileDialogOptions> QFileDialogOptions::create()
{
- if (this != &rhs)
- d = rhs.d;
- return *this;
+ return QSharedPointer<FileDialogCombined>::create();
}
-QFileDialogOptions::~QFileDialogOptions()
+QSharedPointer<QFileDialogOptions> QFileDialogOptions::clone() const
{
+ return QSharedPointer<FileDialogCombined>::create(*static_cast<const FileDialogCombined*>(this));
}
QString QFileDialogOptions::windowTitle() const
@@ -728,23 +757,33 @@ public:
QPlatformDialogHelper::StandardButtons buttons;
};
-QMessageDialogOptions::QMessageDialogOptions() : d(new QMessageDialogOptionsPrivate)
+QMessageDialogOptions::QMessageDialogOptions(QMessageDialogOptionsPrivate *dd)
+ : d(dd)
{
}
-QMessageDialogOptions::QMessageDialogOptions(const QMessageDialogOptions &rhs) : d(rhs.d)
+QMessageDialogOptions::~QMessageDialogOptions()
{
}
-QMessageDialogOptions &QMessageDialogOptions::operator=(const QMessageDialogOptions &rhs)
+namespace {
+ struct MessageDialogCombined : QMessageDialogOptionsPrivate, QMessageDialogOptions
+ {
+ MessageDialogCombined() : QMessageDialogOptionsPrivate(), QMessageDialogOptions(this) {}
+ MessageDialogCombined(const MessageDialogCombined &other)
+ : QMessageDialogOptionsPrivate(other), QMessageDialogOptions(this) {}
+ };
+}
+
+// static
+QSharedPointer<QMessageDialogOptions> QMessageDialogOptions::create()
{
- if (this != &rhs)
- d = rhs.d;
- return *this;
+ return QSharedPointer<MessageDialogCombined>::create();
}
-QMessageDialogOptions::~QMessageDialogOptions()
+QSharedPointer<QMessageDialogOptions> QMessageDialogOptions::clone() const
{
+ return QSharedPointer<MessageDialogCombined>::create(*static_cast<const MessageDialogCombined*>(this));
}
QString QMessageDialogOptions::windowTitle() const
diff --git a/src/gui/kernel/qplatformdialoghelper.h b/src/gui/kernel/qplatformdialoghelper.h
index 825dcf293d..6caef070e2 100644
--- a/src/gui/kernel/qplatformdialoghelper.h
+++ b/src/gui/kernel/qplatformdialoghelper.h
@@ -49,6 +49,7 @@
// source and binary incompatible with future versions of Qt.
//
+#include <QtGui/qtguiglobal.h>
#include <QtCore/QtGlobal>
#include <QtCore/QObject>
#include <QtCore/QList>
@@ -72,6 +73,8 @@ class QFontDialogOptionsPrivate;
class QFileDialogOptionsPrivate;
class QMessageDialogOptionsPrivate;
+#define QPLATFORMDIALOGHELPERS_HAS_CREATE
+
class Q_GUI_EXPORT QPlatformDialogHelper : public QObject
{
Q_OBJECT
@@ -176,6 +179,10 @@ QT_BEGIN_NAMESPACE
class Q_GUI_EXPORT QColorDialogOptions
{
Q_GADGET
+ Q_DISABLE_COPY(QColorDialogOptions)
+protected:
+ explicit QColorDialogOptions(QColorDialogOptionsPrivate *dd);
+ ~QColorDialogOptions();
public:
enum ColorDialogOption {
ShowAlphaChannel = 0x00000001,
@@ -186,12 +193,8 @@ public:
Q_DECLARE_FLAGS(ColorDialogOptions, ColorDialogOption)
Q_FLAG(ColorDialogOptions)
- QColorDialogOptions();
- QColorDialogOptions(const QColorDialogOptions &rhs);
- QColorDialogOptions &operator=(const QColorDialogOptions &rhs);
- ~QColorDialogOptions();
-
- void swap(QColorDialogOptions &other) { qSwap(d, other.d); }
+ static QSharedPointer<QColorDialogOptions> create();
+ QSharedPointer<QColorDialogOptions> clone() const;
QString windowTitle() const;
void setWindowTitle(const QString &);
@@ -211,11 +214,9 @@ public:
static void setStandardColor(int index, QRgb color);
private:
- QSharedDataPointer<QColorDialogOptionsPrivate> d;
+ QColorDialogOptionsPrivate *d;
};
-Q_DECLARE_SHARED(QColorDialogOptions)
-
class Q_GUI_EXPORT QPlatformColorDialogHelper : public QPlatformDialogHelper
{
Q_OBJECT
@@ -237,6 +238,11 @@ private:
class Q_GUI_EXPORT QFontDialogOptions
{
Q_GADGET
+ Q_DISABLE_COPY(QFontDialogOptions)
+protected:
+ explicit QFontDialogOptions(QFontDialogOptionsPrivate *dd);
+ ~QFontDialogOptions();
+
public:
enum FontDialogOption {
NoButtons = 0x00000001,
@@ -250,12 +256,8 @@ public:
Q_DECLARE_FLAGS(FontDialogOptions, FontDialogOption)
Q_FLAG(FontDialogOptions)
- QFontDialogOptions();
- QFontDialogOptions(const QFontDialogOptions &rhs);
- QFontDialogOptions &operator=(const QFontDialogOptions &rhs);
- ~QFontDialogOptions();
-
- void swap(QFontDialogOptions &other) { qSwap(d, other.d); }
+ static QSharedPointer<QFontDialogOptions> create();
+ QSharedPointer<QFontDialogOptions> clone() const;
QString windowTitle() const;
void setWindowTitle(const QString &);
@@ -266,11 +268,9 @@ public:
FontDialogOptions options() const;
private:
- QSharedDataPointer<QFontDialogOptionsPrivate> d;
+ QFontDialogOptionsPrivate *d;
};
-Q_DECLARE_SHARED(QFontDialogOptions)
-
class Q_GUI_EXPORT QPlatformFontDialogHelper : public QPlatformDialogHelper
{
Q_OBJECT
@@ -292,6 +292,11 @@ private:
class Q_GUI_EXPORT QFileDialogOptions
{
Q_GADGET
+ Q_DISABLE_COPY(QFileDialogOptions)
+protected:
+ QFileDialogOptions(QFileDialogOptionsPrivate *dd);
+ ~QFileDialogOptions();
+
public:
enum ViewMode { Detail, List };
Q_ENUM(ViewMode)
@@ -319,12 +324,8 @@ public:
Q_DECLARE_FLAGS(FileDialogOptions, FileDialogOption)
Q_FLAG(FileDialogOptions)
- QFileDialogOptions();
- QFileDialogOptions(const QFileDialogOptions &rhs);
- QFileDialogOptions &operator=(const QFileDialogOptions &rhs);
- ~QFileDialogOptions();
-
- void swap(QFileDialogOptions &other) { qSwap(d, other.d); }
+ static QSharedPointer<QFileDialogOptions> create();
+ QSharedPointer<QFileDialogOptions> clone() const;
QString windowTitle() const;
void setWindowTitle(const QString &);
@@ -383,11 +384,9 @@ public:
static QString defaultNameFilterString();
private:
- QSharedDataPointer<QFileDialogOptionsPrivate> d;
+ QFileDialogOptionsPrivate *d;
};
-Q_DECLARE_SHARED(QFileDialogOptions)
-
class Q_GUI_EXPORT QPlatformFileDialogHelper : public QPlatformDialogHelper
{
Q_OBJECT
@@ -423,17 +422,18 @@ private:
class Q_GUI_EXPORT QMessageDialogOptions
{
Q_GADGET
+ Q_DISABLE_COPY(QMessageDialogOptions)
+protected:
+ QMessageDialogOptions(QMessageDialogOptionsPrivate *dd);
+ ~QMessageDialogOptions();
+
public:
// Keep in sync with QMessageBox::Icon
enum Icon { NoIcon, Information, Warning, Critical, Question };
Q_ENUM(Icon)
- QMessageDialogOptions();
- QMessageDialogOptions(const QMessageDialogOptions &rhs);
- QMessageDialogOptions &operator=(const QMessageDialogOptions &rhs);
- ~QMessageDialogOptions();
-
- void swap(QMessageDialogOptions &other) { qSwap(d, other.d); }
+ static QSharedPointer<QMessageDialogOptions> create();
+ QSharedPointer<QMessageDialogOptions> clone() const;
QString windowTitle() const;
void setWindowTitle(const QString &);
@@ -454,11 +454,9 @@ public:
QPlatformDialogHelper::StandardButtons standardButtons() const;
private:
- QSharedDataPointer<QMessageDialogOptionsPrivate> d;
+ QMessageDialogOptionsPrivate *d;
};
-Q_DECLARE_SHARED(QMessageDialogOptions)
-
class Q_GUI_EXPORT QPlatformMessageDialogHelper : public QPlatformDialogHelper
{
Q_OBJECT
diff --git a/src/gui/kernel/qplatformdrag.h b/src/gui/kernel/qplatformdrag.h
index a9744a17ac..560f984a5b 100644
--- a/src/gui/kernel/qplatformdrag.h
+++ b/src/gui/kernel/qplatformdrag.h
@@ -49,7 +49,7 @@
// source and binary incompatible with future versions of Qt.
//
-#include <QtCore/qglobal.h>
+#include <QtGui/qtguiglobal.h>
#include <QtGui/QPixmap>
QT_BEGIN_NAMESPACE
diff --git a/src/gui/kernel/qplatformgraphicsbuffer.h b/src/gui/kernel/qplatformgraphicsbuffer.h
index 53fc551ad2..0aeef946e6 100644
--- a/src/gui/kernel/qplatformgraphicsbuffer.h
+++ b/src/gui/kernel/qplatformgraphicsbuffer.h
@@ -50,6 +50,7 @@
//
+#include <QtGui/qtguiglobal.h>
#include <QtCore/QSize>
#include <QtCore/QRect>
#include <QtGui/QPixelFormat>
diff --git a/src/gui/kernel/qplatformgraphicsbufferhelper.cpp b/src/gui/kernel/qplatformgraphicsbufferhelper.cpp
index 82a88eca04..2afb5e6ba5 100644
--- a/src/gui/kernel/qplatformgraphicsbufferhelper.cpp
+++ b/src/gui/kernel/qplatformgraphicsbufferhelper.cpp
@@ -154,14 +154,14 @@ bool QPlatformGraphicsBufferHelper::bindSWToTexture(const QPlatformGraphicsBuffe
switch (imageformat) {
case QImage::Format_ARGB32_Premultiplied:
premultiplied = true;
- // no break
+ Q_FALLTHROUGH();
case QImage::Format_RGB32:
case QImage::Format_ARGB32:
swizzle = true;
break;
case QImage::Format_RGBA8888_Premultiplied:
premultiplied = true;
- // no break
+ Q_FALLTHROUGH();
case QImage::Format_RGBX8888:
case QImage::Format_RGBA8888:
break;
diff --git a/src/gui/kernel/qplatformgraphicsbufferhelper.h b/src/gui/kernel/qplatformgraphicsbufferhelper.h
index 59fcd12fd0..5b7daff65a 100644
--- a/src/gui/kernel/qplatformgraphicsbufferhelper.h
+++ b/src/gui/kernel/qplatformgraphicsbufferhelper.h
@@ -40,6 +40,7 @@
#ifndef QPLATFORMGRAPHICSBUFFERHELPER_H
#define QPLATFORMGRAPHICSBUFFERHELPER_H
+#include <QtGui/qtguiglobal.h>
#include <QtGui/qpa/qplatformgraphicsbuffer.h>
QT_BEGIN_NAMESPACE
diff --git a/src/gui/kernel/qplatforminputcontext.h b/src/gui/kernel/qplatforminputcontext.h
index 7afa6b82f2..26d40cd2c6 100644
--- a/src/gui/kernel/qplatforminputcontext.h
+++ b/src/gui/kernel/qplatforminputcontext.h
@@ -49,6 +49,7 @@
// source and binary incompatible with future versions of Qt.
//
+#include <QtGui/qtguiglobal.h>
#include <QtGui/qinputmethod.h>
QT_BEGIN_NAMESPACE
diff --git a/src/gui/kernel/qplatforminputcontext_p.h b/src/gui/kernel/qplatforminputcontext_p.h
index 14e9dda072..c4f4b97d03 100644
--- a/src/gui/kernel/qplatforminputcontext_p.h
+++ b/src/gui/kernel/qplatforminputcontext_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#include <private/qobject_p.h>
QT_BEGIN_NAMESPACE
diff --git a/src/gui/kernel/qplatforminputcontextfactory_p.h b/src/gui/kernel/qplatforminputcontextfactory_p.h
index 4106b2fedc..881421ce49 100644
--- a/src/gui/kernel/qplatforminputcontextfactory_p.h
+++ b/src/gui/kernel/qplatforminputcontextfactory_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#include <QtCore/qstringlist.h>
QT_BEGIN_NAMESPACE
diff --git a/src/gui/kernel/qplatforminputcontextplugin_p.h b/src/gui/kernel/qplatforminputcontextplugin_p.h
index 1bb0332ac7..3f45df922e 100644
--- a/src/gui/kernel/qplatforminputcontextplugin_p.h
+++ b/src/gui/kernel/qplatforminputcontextplugin_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#include <QtCore/qplugin.h>
#include <QtCore/qfactoryinterface.h>
diff --git a/src/gui/kernel/qplatformintegration.cpp b/src/gui/kernel/qplatformintegration.cpp
index 3490e786a8..5bf0df67db 100644
--- a/src/gui/kernel/qplatformintegration.cpp
+++ b/src/gui/kernel/qplatformintegration.cpp
@@ -402,6 +402,8 @@ QVariant QPlatformIntegration::styleHint(StyleHint hint) const
return true;
case ItemViewActivateItemOnSingleClick:
return QPlatformTheme::defaultThemeHint(QPlatformTheme::ItemViewActivateItemOnSingleClick);
+ case UiEffects:
+ return QPlatformTheme::defaultThemeHint(QPlatformTheme::UiEffects);
}
return 0;
diff --git a/src/gui/kernel/qplatformintegration.h b/src/gui/kernel/qplatformintegration.h
index 6ac98c20ce..22a834f0e1 100644
--- a/src/gui/kernel/qplatformintegration.h
+++ b/src/gui/kernel/qplatformintegration.h
@@ -49,6 +49,7 @@
// source and binary incompatible with future versions of Qt.
//
+#include <QtGui/qtguiglobal.h>
#include <QtGui/qwindowdefs.h>
#include <qpa/qplatformscreen.h>
#include <QtGui/qsurfaceformat.h>
@@ -155,7 +156,8 @@ public:
MousePressAndHoldInterval,
TabFocusBehavior,
ReplayMousePressOutsidePopup,
- ItemViewActivateItemOnSingleClick
+ ItemViewActivateItemOnSingleClick,
+ UiEffects
};
virtual QVariant styleHint(StyleHint hint) const;
diff --git a/src/gui/kernel/qplatformintegrationfactory_p.h b/src/gui/kernel/qplatformintegrationfactory_p.h
index ea8c846557..22c77ce8bd 100644
--- a/src/gui/kernel/qplatformintegrationfactory_p.h
+++ b/src/gui/kernel/qplatformintegrationfactory_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#include <QtCore/qstringlist.h>
QT_BEGIN_NAMESPACE
diff --git a/src/gui/kernel/qplatformintegrationplugin.h b/src/gui/kernel/qplatformintegrationplugin.h
index 7d2a9b2a5f..f1136965b7 100644
--- a/src/gui/kernel/qplatformintegrationplugin.h
+++ b/src/gui/kernel/qplatformintegrationplugin.h
@@ -49,6 +49,7 @@
// source and binary incompatible with future versions of Qt.
//
+#include <QtGui/qtguiglobal.h>
#include <QtCore/qplugin.h>
#include <QtCore/qfactoryinterface.h>
diff --git a/src/gui/kernel/qplatformmenu.h b/src/gui/kernel/qplatformmenu.h
index bd4f4d9beb..f08f0ef494 100644
--- a/src/gui/kernel/qplatformmenu.h
+++ b/src/gui/kernel/qplatformmenu.h
@@ -49,7 +49,7 @@
// source and binary incompatible with future versions of Qt.
//
-#include <QtCore/qglobal.h>
+#include <QtGui/qtguiglobal.h>
#include <QtCore/qpointer.h>
#include <QtGui/QFont>
#include <QtGui/QKeySequence>
@@ -83,7 +83,9 @@ public:
virtual void setRole(MenuRole role) = 0;
virtual void setCheckable(bool checkable) = 0;
virtual void setChecked(bool isChecked) = 0;
+#ifndef QT_NO_SHORTCUT
virtual void setShortcut(const QKeySequence& shortcut) = 0;
+#endif
virtual void setEnabled(bool enabled) = 0;
virtual void setIconSize(int size) = 0;
virtual void setNativeContents(WId item) { Q_UNUSED(item); }
diff --git a/src/gui/kernel/qplatformnativeinterface.h b/src/gui/kernel/qplatformnativeinterface.h
index f830221c70..95d6a03dbb 100644
--- a/src/gui/kernel/qplatformnativeinterface.h
+++ b/src/gui/kernel/qplatformnativeinterface.h
@@ -49,6 +49,7 @@
// source and binary incompatible with future versions of Qt.
//
+#include <QtGui/qtguiglobal.h>
#include <QtGui/qwindowdefs.h>
#include <QtCore/QObject>
#include <QtCore/QVariant>
diff --git a/src/gui/kernel/qplatformoffscreensurface.h b/src/gui/kernel/qplatformoffscreensurface.h
index 77a8f63316..7f2e0d475b 100644
--- a/src/gui/kernel/qplatformoffscreensurface.h
+++ b/src/gui/kernel/qplatformoffscreensurface.h
@@ -49,6 +49,7 @@
// source and binary incompatible with future versions of Qt.
//
+#include <QtGui/qtguiglobal.h>
#include "qplatformsurface.h"
#include <QtCore/qscopedpointer.h>
diff --git a/src/gui/kernel/qplatformopenglcontext.h b/src/gui/kernel/qplatformopenglcontext.h
index 1a38a5fed3..f307cc14f9 100644
--- a/src/gui/kernel/qplatformopenglcontext.h
+++ b/src/gui/kernel/qplatformopenglcontext.h
@@ -49,6 +49,7 @@
// source and binary incompatible with future versions of Qt.
//
+#include <QtGui/qtguiglobal.h>
#include <QtCore/qnamespace.h>
#ifndef QT_NO_OPENGL
diff --git a/src/gui/kernel/qplatformscreen.h b/src/gui/kernel/qplatformscreen.h
index cd300c34c8..030edea880 100644
--- a/src/gui/kernel/qplatformscreen.h
+++ b/src/gui/kernel/qplatformscreen.h
@@ -49,6 +49,7 @@
// source and binary incompatible with future versions of Qt.
//
+#include <QtGui/qtguiglobal.h>
#include <QtCore/qmetatype.h>
#include <QtCore/qnamespace.h>
#include <QtCore/qcoreevent.h>
diff --git a/src/gui/kernel/qplatformscreen_p.h b/src/gui/kernel/qplatformscreen_p.h
index aa31c4db25..d5dc7b471a 100644
--- a/src/gui/kernel/qplatformscreen_p.h
+++ b/src/gui/kernel/qplatformscreen_p.h
@@ -51,6 +51,8 @@
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
+
QT_BEGIN_NAMESPACE
class QScreen;
diff --git a/src/gui/kernel/qplatformservices.h b/src/gui/kernel/qplatformservices.h
index 52b8ce7854..339bbfde3f 100644
--- a/src/gui/kernel/qplatformservices.h
+++ b/src/gui/kernel/qplatformservices.h
@@ -49,7 +49,7 @@
// source and binary incompatible with future versions of Qt.
//
-#include <QtCore/QtGlobal>
+#include <QtGui/qtguiglobal.h>
QT_BEGIN_NAMESPACE
diff --git a/src/gui/kernel/qplatformsessionmanager.h b/src/gui/kernel/qplatformsessionmanager.h
index 98c364f7fe..ca7cab389b 100644
--- a/src/gui/kernel/qplatformsessionmanager.h
+++ b/src/gui/kernel/qplatformsessionmanager.h
@@ -51,6 +51,7 @@
// source and binary incompatible with future versions of Qt.
//
+#include <QtGui/qtguiglobal.h>
#include <QtCore/qmetatype.h>
#include <QtCore/qnamespace.h>
diff --git a/src/gui/kernel/qplatformsharedgraphicscache.h b/src/gui/kernel/qplatformsharedgraphicscache.h
index 6e0ba9151f..e11d2f41a9 100644
--- a/src/gui/kernel/qplatformsharedgraphicscache.h
+++ b/src/gui/kernel/qplatformsharedgraphicscache.h
@@ -49,6 +49,7 @@
// source and binary incompatible with future versions of Qt.
//
+#include <QtGui/qtguiglobal.h>
#include <QtCore/qobject.h>
#include <QtGui/qimage.h>
diff --git a/src/gui/kernel/qplatformsurface.h b/src/gui/kernel/qplatformsurface.h
index 0bbe811803..5a1e4fe82d 100644
--- a/src/gui/kernel/qplatformsurface.h
+++ b/src/gui/kernel/qplatformsurface.h
@@ -49,6 +49,7 @@
// source and binary incompatible with future versions of Qt.
//
+#include <QtGui/qtguiglobal.h>
#include <QtCore/qnamespace.h>
#include <QtGui/qsurface.h>
#include <QtGui/qsurfaceformat.h>
diff --git a/src/gui/kernel/qplatformsystemtrayicon.h b/src/gui/kernel/qplatformsystemtrayicon.h
index dcd7225180..c52dbfbd78 100644
--- a/src/gui/kernel/qplatformsystemtrayicon.h
+++ b/src/gui/kernel/qplatformsystemtrayicon.h
@@ -41,6 +41,7 @@
#ifndef QPLATFORMSYSTEMTRAYICON_H
#define QPLATFORMSYSTEMTRAYICON_H
+#include <QtGui/qtguiglobal.h>
#include "QtCore/qobject.h"
#ifndef QT_NO_SYSTEMTRAYICON
diff --git a/src/gui/kernel/qplatformtheme.cpp b/src/gui/kernel/qplatformtheme.cpp
index 7f74959a60..9c140f1d68 100644
--- a/src/gui/kernel/qplatformtheme.cpp
+++ b/src/gui/kernel/qplatformtheme.cpp
@@ -44,6 +44,7 @@
#include <QtCore/QVariant>
#include <QtCore/QStringList>
#include <QtCore/qfileinfo.h>
+#include <qicon.h>
#include <qpalette.h>
#include <qtextformat.h>
#include <private/qiconloader_p.h>
@@ -152,6 +153,7 @@ QT_BEGIN_NAMESPACE
*/
+#ifndef QT_NO_SHORTCUT
// Table of key bindings. It must be sorted on key sequence:
// The integer value of VK_KEY | Modifier Keys (e.g., VK_META, and etc.)
// A priority of 1 indicates that this is the primary key binding when multiple are defined.
@@ -335,6 +337,7 @@ const QKeyBinding QPlatformThemePrivate::keyBindings[] = {
};
const uint QPlatformThemePrivate::numberOfKeyBindings = sizeof(QPlatformThemePrivate::keyBindings)/(sizeof(QKeyBinding));
+#endif
QPlatformThemePrivate::QPlatformThemePrivate()
: systemPalette(0)
@@ -405,14 +408,22 @@ QPixmap QPlatformTheme::standardPixmap(StandardPixmap sp, const QSizeF &size) co
return QPixmap();
}
-QPixmap QPlatformTheme::fileIconPixmap(const QFileInfo &fileInfo, const QSizeF &size,
- QPlatformTheme::IconOptions iconOptions) const
+/*!
+ \brief Return an icon for \a fileInfo, observing \a iconOptions.
+
+ This function is queried by QFileIconProvider and similar classes to obtain
+ an icon for a file. If it does not return a non-null icon, fileIconPixmap()
+ is queried for a specific size.
+
+ \since 5.8
+*/
+
+QIcon QPlatformTheme::fileIcon(const QFileInfo &fileInfo, QPlatformTheme::IconOptions iconOptions) const
{
Q_UNUSED(fileInfo);
- Q_UNUSED(size);
Q_UNUSED(iconOptions);
// TODO Should return QCommonStyle pixmaps?
- return QPixmap();
+ return QIcon();
}
QVariant QPlatformTheme::themeHint(ThemeHint hint) const
@@ -444,6 +455,8 @@ QVariant QPlatformTheme::themeHint(ThemeHint hint) const
return QGuiApplicationPrivate::platformIntegration()->styleHint(QPlatformIntegration::MousePressAndHoldInterval);
case QPlatformTheme::ItemViewActivateItemOnSingleClick:
return QGuiApplicationPrivate::platformIntegration()->styleHint(QPlatformIntegration::ItemViewActivateItemOnSingleClick);
+ case QPlatformTheme::UiEffects:
+ return QGuiApplicationPrivate::platformIntegration()->styleHint(QPlatformIntegration::UiEffects);
default:
return QPlatformTheme::defaultThemeHint(hint);
}
@@ -580,6 +593,7 @@ static inline int maybeSwapShortcut(int shortcut)
}
#endif
+#ifndef QT_NO_SHORTCUT
// mixed-mode predicate: all of these overloads are actually needed (but not all for every compiler)
struct ByStandardKey {
typedef bool result_type;
@@ -630,6 +644,7 @@ QList<QKeySequence> QPlatformTheme::keyBindings(QKeySequence::StandardKey key) c
return list;
}
+#endif
/*!
Returns the text of a standard \a button.
@@ -727,10 +742,12 @@ unsigned QPlatformThemePrivate::currentKeyPlatforms()
{
const uint keyboardScheme = QGuiApplicationPrivate::platformTheme()->themeHint(QPlatformTheme::KeyboardScheme).toInt();
unsigned result = 1u << keyboardScheme;
+#ifndef QT_NO_SHORTCUT
if (keyboardScheme == QPlatformTheme::KdeKeyboardScheme
|| keyboardScheme == QPlatformTheme::GnomeKeyboardScheme
|| keyboardScheme == QPlatformTheme::CdeKeyboardScheme)
result |= KB_X11;
+#endif
return result;
}
diff --git a/src/gui/kernel/qplatformtheme.h b/src/gui/kernel/qplatformtheme.h
index c4c7482995..686dbed4b1 100644
--- a/src/gui/kernel/qplatformtheme.h
+++ b/src/gui/kernel/qplatformtheme.h
@@ -49,12 +49,13 @@
// source and binary incompatible with future versions of Qt.
//
-#include <QtCore/QtGlobal>
+#include <QtGui/qtguiglobal.h>
#include <QtCore/QScopedPointer>
#include <QtGui/QKeySequence>
QT_BEGIN_NAMESPACE
+class QIcon;
class QIconEngine;
class QMenu;
class QMenuBar;
@@ -270,7 +271,8 @@ public:
AnimateComboUiEffect = 0x8,
AnimateTooltipUiEffect = 0x10,
FadeTooltipUiEffect = 0x20,
- AnimateToolBoxUiEffect = 0x40
+ AnimateToolBoxUiEffect = 0x40,
+ HoverEffect = 0x80
};
enum IconOption {
@@ -300,12 +302,13 @@ public:
virtual QVariant themeHint(ThemeHint hint) const;
virtual QPixmap standardPixmap(StandardPixmap sp, const QSizeF &size) const;
- virtual QPixmap fileIconPixmap(const QFileInfo &fileInfo, const QSizeF &size,
- QPlatformTheme::IconOptions iconOptions = 0) const;
-
+ virtual QIcon fileIcon(const QFileInfo &fileInfo,
+ QPlatformTheme::IconOptions iconOptions = 0) const;
virtual QIconEngine *createIconEngine(const QString &iconName) const;
+#ifndef QT_NO_SHORTCUT
virtual QList<QKeySequence> keyBindings(QKeySequence::StandardKey key) const;
+#endif
virtual QString standardButtonText(int button) const;
diff --git a/src/gui/kernel/qplatformtheme_p.h b/src/gui/kernel/qplatformtheme_p.h
index 11f9e261ef..73deb890bb 100644
--- a/src/gui/kernel/qplatformtheme_p.h
+++ b/src/gui/kernel/qplatformtheme_p.h
@@ -51,7 +51,7 @@
// We mean it.
//
-#include <QtCore/QtGlobal>
+#include <QtGui/private/qtguiglobal_p.h>
#include "private/qkeysequence_p.h"
QT_BEGIN_NAMESPACE
@@ -67,8 +67,10 @@ public:
void initializeSystemPalette();
+#ifndef QT_NO_SHORTCUT
static const QKeyBinding keyBindings[];
static const uint numberOfKeyBindings;
+#endif
static unsigned currentKeyPlatforms();
diff --git a/src/gui/kernel/qplatformthemefactory_p.h b/src/gui/kernel/qplatformthemefactory_p.h
index abd78d544d..3f77f03485 100644
--- a/src/gui/kernel/qplatformthemefactory_p.h
+++ b/src/gui/kernel/qplatformthemefactory_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#include <QtCore/qstringlist.h>
QT_BEGIN_NAMESPACE
diff --git a/src/gui/kernel/qplatformthemeplugin.h b/src/gui/kernel/qplatformthemeplugin.h
index 52aa09d1d5..7b56879940 100644
--- a/src/gui/kernel/qplatformthemeplugin.h
+++ b/src/gui/kernel/qplatformthemeplugin.h
@@ -49,6 +49,7 @@
// source and binary incompatible with future versions of Qt.
//
+#include <QtGui/qtguiglobal.h>
#include <QtCore/qplugin.h>
#include <QtCore/qfactoryinterface.h>
diff --git a/src/gui/kernel/qplatformwindow.h b/src/gui/kernel/qplatformwindow.h
index b2a19dd3d9..dcee4d2d84 100644
--- a/src/gui/kernel/qplatformwindow.h
+++ b/src/gui/kernel/qplatformwindow.h
@@ -48,6 +48,7 @@
// source and binary incompatible with future versions of Qt.
//
+#include <QtGui/qtguiglobal.h>
#include <QtCore/qscopedpointer.h>
#include <QtCore/qrect.h>
#include <QtCore/qmargins.h>
diff --git a/src/gui/kernel/qplatformwindow_p.h b/src/gui/kernel/qplatformwindow_p.h
index dc76adca86..62ecd61d9e 100644
--- a/src/gui/kernel/qplatformwindow_p.h
+++ b/src/gui/kernel/qplatformwindow_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#include <QtCore/qrect.h>
QT_BEGIN_NAMESPACE
diff --git a/src/gui/kernel/qrasterwindow.h b/src/gui/kernel/qrasterwindow.h
index 915aea598f..76312bcda2 100644
--- a/src/gui/kernel/qrasterwindow.h
+++ b/src/gui/kernel/qrasterwindow.h
@@ -40,6 +40,7 @@
#ifndef QRASTERWINDOW_H
#define QRASTERWINDOW_H
+#include <QtGui/qtguiglobal.h>
#include <QtGui/QPaintDeviceWindow>
QT_BEGIN_NAMESPACE
diff --git a/src/gui/kernel/qscreen.cpp b/src/gui/kernel/qscreen.cpp
index bc4a25a65f..1dd8fb5e67 100644
--- a/src/gui/kernel/qscreen.cpp
+++ b/src/gui/kernel/qscreen.cpp
@@ -667,6 +667,10 @@ void QScreenPrivate::updatePrimaryOrientation()
that are not part of the application, window system frames, and so
on.
+ \warning Grabbing windows that are not part of the application is
+ not supported on systems such as iOS, where sandboxing/security
+ prevents reading pixels of windows not owned by the application.
+
The grabWindow() function grabs pixels from the screen, not from
the window, i.e. if there is another window partially or entirely
over the one you grab, you get pixels from the overlying window,
diff --git a/src/gui/kernel/qscreen.h b/src/gui/kernel/qscreen.h
index af4e8f4760..98e35aff43 100644
--- a/src/gui/kernel/qscreen.h
+++ b/src/gui/kernel/qscreen.h
@@ -40,6 +40,7 @@
#ifndef QSCREEN_H
#define QSCREEN_H
+#include <QtGui/qtguiglobal.h>
#include <QtCore/QList>
#include <QtCore/QObject>
#include <QtCore/QRect>
diff --git a/src/gui/kernel/qscreen_p.h b/src/gui/kernel/qscreen_p.h
index 544c29a18f..f31658355b 100644
--- a/src/gui/kernel/qscreen_p.h
+++ b/src/gui/kernel/qscreen_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#include <QtGui/qscreen.h>
#include <qpa/qplatformscreen.h>
#include "qhighdpiscaling_p.h"
diff --git a/src/gui/kernel/qsessionmanager.h b/src/gui/kernel/qsessionmanager.h
index 54c278afbf..21100b25d9 100644
--- a/src/gui/kernel/qsessionmanager.h
+++ b/src/gui/kernel/qsessionmanager.h
@@ -40,6 +40,7 @@
#ifndef QSESSIONMANAGER_H
#define QSESSIONMANAGER_H
+#include <QtGui/qtguiglobal.h>
#include <QtCore/qobject.h>
#include <QtGui/qwindowdefs.h>
#include <QtCore/qstring.h>
diff --git a/src/gui/kernel/qsessionmanager_p.h b/src/gui/kernel/qsessionmanager_p.h
index 982fc801ff..954443430e 100644
--- a/src/gui/kernel/qsessionmanager_p.h
+++ b/src/gui/kernel/qsessionmanager_p.h
@@ -52,6 +52,7 @@
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#include <private/qobject_p.h>
#include <QtCore/qstring.h>
#include <QtCore/qstringlist.h>
diff --git a/src/gui/kernel/qshapedpixmapdndwindow_p.h b/src/gui/kernel/qshapedpixmapdndwindow_p.h
index 21cecba9e8..2c25ca7c76 100644
--- a/src/gui/kernel/qshapedpixmapdndwindow_p.h
+++ b/src/gui/kernel/qshapedpixmapdndwindow_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#include <QtGui/QRasterWindow>
#include <QtGui/QPixmap>
diff --git a/src/gui/kernel/qshortcutmap_p.h b/src/gui/kernel/qshortcutmap_p.h
index f513863e5b..8fc68229fb 100644
--- a/src/gui/kernel/qshortcutmap_p.h
+++ b/src/gui/kernel/qshortcutmap_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#include "QtGui/qkeysequence.h"
#include "QtCore/qvector.h"
#include "QtCore/qscopedpointer.h"
diff --git a/src/gui/kernel/qsimpledrag_p.h b/src/gui/kernel/qsimpledrag_p.h
index 8924b4d08f..0b8a0bc703 100644
--- a/src/gui/kernel/qsimpledrag_p.h
+++ b/src/gui/kernel/qsimpledrag_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#include <qpa/qplatformdrag.h>
#include <QtCore/QObject>
diff --git a/src/gui/kernel/qstylehints.cpp b/src/gui/kernel/qstylehints.cpp
index ecc2886a04..7ccf1d86b0 100644
--- a/src/gui/kernel/qstylehints.cpp
+++ b/src/gui/kernel/qstylehints.cpp
@@ -77,6 +77,7 @@ public:
, m_keyboardInputInterval(-1)
, m_cursorFlashTime(-1)
, m_tabFocusBehavior(-1)
+ , m_uiEffects(-1)
{}
int m_mouseDoubleClickInterval;
@@ -86,6 +87,7 @@ public:
int m_keyboardInputInterval;
int m_cursorFlashTime;
int m_tabFocusBehavior;
+ int m_uiEffects;
};
/*!
@@ -451,4 +453,34 @@ bool QStyleHints::singleClickActivation() const
return themeableHint(QPlatformTheme::ItemViewActivateItemOnSingleClick, QPlatformIntegration::ItemViewActivateItemOnSingleClick).toBool();
}
+/*!
+ \property QStyleHints::useHoverEffects
+ \brief \c true if UI elements should use hover effects. This is the
+ standard behavior on desktop platforms with a mouse pointer, whereas
+ on touch platforms the overhead of hover event delivery can be avoided.
+
+ \since 5.8
+*/
+bool QStyleHints::useHoverEffects() const
+{
+ Q_D(const QStyleHints);
+ return (d->m_uiEffects >= 0 ?
+ d->m_uiEffects :
+ themeableHint(QPlatformTheme::UiEffects, QPlatformIntegration::UiEffects).toInt()) & QPlatformTheme::HoverEffect;
+}
+
+void QStyleHints::setUseHoverEffects(bool useHoverEffects)
+{
+ Q_D(QStyleHints);
+ if (d->m_uiEffects >= 0 && useHoverEffects == bool(d->m_uiEffects & QPlatformTheme::HoverEffect))
+ return;
+ if (d->m_uiEffects == -1)
+ d->m_uiEffects = 0;
+ if (useHoverEffects)
+ d->m_uiEffects |= QPlatformTheme::HoverEffect;
+ else
+ d->m_uiEffects &= ~QPlatformTheme::HoverEffect;
+ emit useHoverEffectsChanged(useHoverEffects);
+}
+
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qstylehints.h b/src/gui/kernel/qstylehints.h
index 0b07e60579..fb55cc7ed6 100644
--- a/src/gui/kernel/qstylehints.h
+++ b/src/gui/kernel/qstylehints.h
@@ -40,6 +40,7 @@
#ifndef QSTYLEHINTS_H
#define QSTYLEHINTS_H
+#include <QtGui/qtguiglobal.h>
#include <QtCore/qobject.h>
QT_BEGIN_NAMESPACE
@@ -69,6 +70,7 @@ class Q_GUI_EXPORT QStyleHints : public QObject
Q_PROPERTY(bool useRtlExtensions READ useRtlExtensions STORED false CONSTANT FINAL)
Q_PROPERTY(Qt::TabFocusBehavior tabFocusBehavior READ tabFocusBehavior NOTIFY tabFocusBehaviorChanged FINAL)
Q_PROPERTY(bool singleClickActivation READ singleClickActivation STORED false CONSTANT FINAL)
+ Q_PROPERTY(bool useHoverEffects READ useHoverEffects WRITE setUseHoverEffects NOTIFY useHoverEffectsChanged FINAL)
public:
void setMouseDoubleClickInterval(int mouseDoubleClickInterval);
@@ -95,6 +97,8 @@ public:
Qt::TabFocusBehavior tabFocusBehavior() const;
void setTabFocusBehavior(Qt::TabFocusBehavior tabFocusBehavior);
bool singleClickActivation() const;
+ bool useHoverEffects() const;
+ void setUseHoverEffects(bool useHoverEffects);
Q_SIGNALS:
void cursorFlashTimeChanged(int cursorFlashTime);
@@ -104,6 +108,7 @@ Q_SIGNALS:
void startDragDistanceChanged(int startDragDistance);
void startDragTimeChanged(int startDragTime);
void tabFocusBehaviorChanged(Qt::TabFocusBehavior tabFocusBehavior);
+ void useHoverEffectsChanged(bool useHoverEffects);
private:
friend class QGuiApplication;
diff --git a/src/gui/kernel/qsurface.h b/src/gui/kernel/qsurface.h
index 86b800a6db..d9ccdc096d 100644
--- a/src/gui/kernel/qsurface.h
+++ b/src/gui/kernel/qsurface.h
@@ -40,6 +40,7 @@
#ifndef QSURFACE_H
#define QSURFACE_H
+#include <QtGui/qtguiglobal.h>
#include <QtCore/qnamespace.h>
#include <QtGui/qsurfaceformat.h>
#include <QtCore/qmetatype.h>
diff --git a/src/gui/kernel/qsurfaceformat.h b/src/gui/kernel/qsurfaceformat.h
index 9e8bcc91a7..246163609e 100644
--- a/src/gui/kernel/qsurfaceformat.h
+++ b/src/gui/kernel/qsurfaceformat.h
@@ -39,8 +39,9 @@
#ifndef QSURFACEFORMAT_H
#define QSURFACEFORMAT_H
-#include <QtCore/qglobal.h>
+#include <QtGui/qtguiglobal.h>
#include <QtCore/qpair.h>
+#include <QtCore/qobjectdefs.h>
QT_BEGIN_NAMESPACE
@@ -50,6 +51,7 @@ class QSurfaceFormatPrivate;
class Q_GUI_EXPORT QSurfaceFormat
{
+ Q_GADGET
public:
enum FormatOption {
StereoBuffers = 0x0001,
@@ -57,6 +59,7 @@ public:
DeprecatedFunctions = 0x0004,
ResetNotification = 0x0008
};
+ Q_ENUM(FormatOption)
Q_DECLARE_FLAGS(FormatOptions, FormatOption)
enum SwapBehavior {
@@ -65,6 +68,7 @@ public:
DoubleBuffer,
TripleBuffer
};
+ Q_ENUM(SwapBehavior)
enum RenderableType {
DefaultRenderableType = 0x0,
@@ -72,12 +76,14 @@ public:
OpenGLES = 0x2,
OpenVG = 0x4
};
+ Q_ENUM(RenderableType)
enum OpenGLContextProfile {
NoProfile,
CoreProfile,
CompatibilityProfile
};
+ Q_ENUM(OpenGLContextProfile)
QSurfaceFormat();
/*implicit*/ QSurfaceFormat(FormatOptions options);
diff --git a/src/gui/kernel/qt_gui_pch.h b/src/gui/kernel/qt_gui_pch.h
index 8d1455f6c8..db12ba1078 100644
--- a/src/gui/kernel/qt_gui_pch.h
+++ b/src/gui/kernel/qt_gui_pch.h
@@ -47,7 +47,7 @@
// from corelib/global/qt_pch.h
#if defined __cplusplus
-#include <qglobal.h>
+#include <qtguiglobal.h>
#ifdef Q_OS_WIN
diff --git a/src/gui/image/qnativeimage.cpp b/src/gui/kernel/qtguiglobal.h
index 38e67761b1..8a7409e3d9 100644
--- a/src/gui/image/qnativeimage.cpp
+++ b/src/gui/kernel/qtguiglobal.h
@@ -37,36 +37,24 @@
**
****************************************************************************/
-#include <qdebug.h>
-#include "qnativeimage_p.h"
-#include <qpa/qplatformscreen.h>
-#include "private/qguiapplication_p.h"
-#include "qscreen.h"
-
-#include "private/qpaintengine_raster_p.h"
+#ifndef QTGUIGLOBAL_H
+#define QTGUIGLOBAL_H
+#include <QtCore/qglobal.h>
+#include <QtGui/qtgui-config.h>
QT_BEGIN_NAMESPACE
-
-QNativeImage::QNativeImage(int width, int height, QImage::Format format, bool /* isTextBuffer */, QWindow *)
- : image(width, height, format)
-{
-
-}
-
-
-QNativeImage::~QNativeImage()
-{
-}
-
-QImage::Format QNativeImage::systemFormat()
-{
- if (!QGuiApplication::primaryScreen())
- return QImage::Format_Invalid;
- return QGuiApplication::primaryScreen()->handle()->format();
-}
-
+#ifndef QT_STATIC
+# if defined(QT_BUILD_GUI_LIB)
+# define Q_GUI_EXPORT Q_DECL_EXPORT
+# else
+# define Q_GUI_EXPORT Q_DECL_IMPORT
+# endif
+#else
+# define Q_GUI_EXPORT
+#endif
QT_END_NAMESPACE
+#endif // QTGUIGLOBAL_H
diff --git a/src/gui/image/qnativeimage_p.h b/src/gui/kernel/qtguiglobal_p.h
index 2398a6e2ce..d2c0b3c5d1 100644
--- a/src/gui/image/qnativeimage_p.h
+++ b/src/gui/kernel/qtguiglobal_p.h
@@ -37,8 +37,8 @@
**
****************************************************************************/
-#ifndef QNATIVEIMAGE_P_H
-#define QNATIVEIMAGE_P_H
+#ifndef QTGUIGLOBAL_P_H
+#define QTGUIGLOBAL_P_H
//
// W A R N I N G
@@ -51,34 +51,8 @@
// We mean it.
//
-#include "qimage.h"
+#include <QtGui/qtguiglobal.h>
+#include <QtCore/private/qglobal_p.h>
+#include <QtGui/private/qtgui-config_p.h>
-
-QT_BEGIN_NAMESPACE
-
-class QWindow;
-
-class QNativeImage
-{
-public:
- QNativeImage(int width, int height, QImage::Format format, bool isTextBuffer = false, QWindow *window = 0);
- ~QNativeImage();
-
- inline int width() const;
- inline int height() const;
-
- QImage image;
-
- static QImage::Format systemFormat();
-
-
-private:
- Q_DISABLE_COPY(QNativeImage)
-};
-
-inline int QNativeImage::width() const { return image.width(); }
-inline int QNativeImage::height() const { return image.height(); }
-
-QT_END_NAMESPACE
-
-#endif // QNATIVEIMAGE_P_H
+#endif // QTGUIGLOBAL_P_H
diff --git a/src/gui/kernel/qtouchdevice.h b/src/gui/kernel/qtouchdevice.h
index 243f53d4ca..0fb24e47bf 100644
--- a/src/gui/kernel/qtouchdevice.h
+++ b/src/gui/kernel/qtouchdevice.h
@@ -40,6 +40,7 @@
#ifndef QTOUCHDEVICE_H
#define QTOUCHDEVICE_H
+#include <QtGui/qtguiglobal.h>
#include <QtCore/qobject.h>
QT_BEGIN_NAMESPACE
diff --git a/src/gui/kernel/qtouchdevice_p.h b/src/gui/kernel/qtouchdevice_p.h
index b42b0507d9..203d9fca74 100644
--- a/src/gui/kernel/qtouchdevice_p.h
+++ b/src/gui/kernel/qtouchdevice_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#include <QtGui/qtouchdevice.h>
QT_BEGIN_NAMESPACE
diff --git a/src/gui/kernel/qwindow.h b/src/gui/kernel/qwindow.h
index 06bd788262..bf25cf64c9 100644
--- a/src/gui/kernel/qwindow.h
+++ b/src/gui/kernel/qwindow.h
@@ -40,6 +40,7 @@
#ifndef QWINDOW_H
#define QWINDOW_H
+#include <QtGui/qtguiglobal.h>
#include <QtCore/QObject>
#include <QtCore/QEvent>
#include <QtCore/QMargins>
diff --git a/src/gui/kernel/qwindow_p.h b/src/gui/kernel/qwindow_p.h
index 4020376feb..b8a9f5d3de 100644
--- a/src/gui/kernel/qwindow_p.h
+++ b/src/gui/kernel/qwindow_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#include <QtGui/qscreen.h>
#include <QtGui/qwindow.h>
#include <qpa/qplatformwindow.h>
diff --git a/src/gui/kernel/qwindowdefs.h b/src/gui/kernel/qwindowdefs.h
index fb6b1831af..b4f3ed4712 100644
--- a/src/gui/kernel/qwindowdefs.h
+++ b/src/gui/kernel/qwindowdefs.h
@@ -40,7 +40,7 @@
#ifndef QWINDOWDEFS_H
#define QWINDOWDEFS_H
-#include <QtCore/qglobal.h>
+#include <QtGui/qtguiglobal.h>
#include <QtCore/qobjectdefs.h>
#include <QtCore/qnamespace.h>
diff --git a/src/gui/kernel/qwindowdefs_win.h b/src/gui/kernel/qwindowdefs_win.h
index d1000856bb..b546fe305e 100644
--- a/src/gui/kernel/qwindowdefs_win.h
+++ b/src/gui/kernel/qwindowdefs_win.h
@@ -40,7 +40,7 @@
#ifndef QWINDOWDEFS_WIN_H
#define QWINDOWDEFS_WIN_H
-#include <QtCore/qglobal.h>
+#include <QtGui/qtguiglobal.h>
QT_BEGIN_NAMESPACE
@@ -111,13 +111,4 @@ typedef long HRESULT;
typedef struct tagMSG MSG;
-QT_BEGIN_NAMESPACE
-
-Q_CORE_EXPORT HINSTANCE qWinAppInst();
-Q_CORE_EXPORT HINSTANCE qWinAppPrevInst();
-Q_CORE_EXPORT int qWinAppCmdShow();
-Q_WIDGETS_EXPORT HDC qt_win_display_dc();
-
-QT_END_NAMESPACE
-
#endif // QWINDOWDEFS_WIN_H
diff --git a/src/gui/kernel/qwindowsysteminterface.cpp b/src/gui/kernel/qwindowsysteminterface.cpp
index 1b7edb1278..7c6bbc26c8 100644
--- a/src/gui/kernel/qwindowsysteminterface.cpp
+++ b/src/gui/kernel/qwindowsysteminterface.cpp
@@ -236,7 +236,7 @@ bool QWindowSystemInterface::handleShortcutEvent(QWindow *window, ulong timestam
#else
Q_UNUSED(window)
Q_UNUSED(timestamp)
- Q_UNUSED(key)
+ Q_UNUSED(keyCode)
Q_UNUSED(modifiers)
Q_UNUSED(nativeScanCode)
Q_UNUSED(nativeVirtualKey)
@@ -474,7 +474,10 @@ QList<QTouchEvent::TouchPoint>
QList<QWindowSystemInterface::TouchPoint>::const_iterator end = points.constEnd();
while (point != end) {
p.setId(point->id);
+ if (point->uniqueId >= 0)
+ p.setUniqueId(point->uniqueId);
p.setPressure(point->pressure);
+ p.setRotation(point->rotation);
states |= point->state;
p.setState(point->state);
@@ -922,6 +925,17 @@ Q_GUI_EXPORT bool qt_sendShortcutOverrideEvent(QObject *o, ulong timestamp, int
#endif
}
+namespace QTest
+{
+ Q_GUI_EXPORT QTouchDevice * createTouchDevice(QTouchDevice::DeviceType devType = QTouchDevice::TouchScreen)
+ {
+ QTouchDevice *ret = new QTouchDevice();
+ ret->setType(devType);
+ QWindowSystemInterface::registerTouchDevice(ret);
+ return ret;
+ }
+}
+
Q_GUI_EXPORT void qt_handleTouchEvent(QWindow *w, QTouchDevice *device,
const QList<QTouchEvent::TouchPoint> &points,
Qt::KeyboardModifiers mods = Qt::NoModifier)
diff --git a/src/gui/kernel/qwindowsysteminterface.h b/src/gui/kernel/qwindowsysteminterface.h
index 6bf87439b9..e7e47ac6d9 100644
--- a/src/gui/kernel/qwindowsysteminterface.h
+++ b/src/gui/kernel/qwindowsysteminterface.h
@@ -48,6 +48,7 @@
// source and binary incompatible with future versions of Qt.
//
+#include <QtGui/qtguiglobal.h>
#include <QtCore/QTime>
#include <QtGui/qwindowdefs.h>
#include <QtCore/QEvent>
@@ -117,11 +118,14 @@ public:
static void handleWheelEvent(QWindow *w, ulong timestamp, const QPointF & local, const QPointF & global, int d, Qt::Orientation o, Qt::KeyboardModifiers mods = Qt::NoModifier);
struct TouchPoint {
- TouchPoint() : id(0), pressure(0), state(Qt::TouchPointStationary) { }
+ TouchPoint() : id(0), uniqueId(-1), pressure(0), rotation(0), state(Qt::TouchPointStationary) { }
int id; // for application use
+ qint64 uniqueId; // for TUIO: object/token ID; otherwise empty
+ // TODO for TUIO 2.0: add registerPointerUniqueID(QPointerUniqueId)
QPointF normalPosition; // touch device coordinates, (0 to 1, 0 to 1)
QRectF area; // the touched area, centered at position in screen coordinates
qreal pressure; // 0 to 1
+ qreal rotation; // 0 means pointing straight up; 0 if unknown (like QTabletEvent::rotation)
Qt::TouchPointState state; //Qt::TouchPoint{Pressed|Moved|Stationary|Released}
QVector2D velocity; // in screen coordinate system, pixels / seconds
QTouchEvent::TouchPoint::InfoFlags flags;
diff --git a/src/gui/kernel/qwindowsysteminterface_p.h b/src/gui/kernel/qwindowsysteminterface_p.h
index b218c1c68c..bdbf191cbd 100644
--- a/src/gui/kernel/qwindowsysteminterface_p.h
+++ b/src/gui/kernel/qwindowsysteminterface_p.h
@@ -50,6 +50,7 @@
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#include "qwindowsysteminterface.h"
#include <QElapsedTimer>
diff --git a/src/gui/math3d/qgenericmatrix.h b/src/gui/math3d/qgenericmatrix.h
index 5e22fa6730..9a1ab54124 100644
--- a/src/gui/math3d/qgenericmatrix.h
+++ b/src/gui/math3d/qgenericmatrix.h
@@ -40,6 +40,7 @@
#ifndef QGENERICMATRIX_H
#define QGENERICMATRIX_H
+#include <QtGui/qtguiglobal.h>
#include <QtCore/qmetatype.h>
#include <QtCore/qdebug.h>
#include <QtCore/qdatastream.h>
diff --git a/src/gui/math3d/qmatrix4x4.h b/src/gui/math3d/qmatrix4x4.h
index bdcf4555d7..19540308a1 100644
--- a/src/gui/math3d/qmatrix4x4.h
+++ b/src/gui/math3d/qmatrix4x4.h
@@ -40,6 +40,7 @@
#ifndef QMATRIX4X4_H
#define QMATRIX4X4_H
+#include <QtGui/qtguiglobal.h>
#include <QtGui/qvector3d.h>
#include <QtGui/qvector4d.h>
#include <QtGui/qquaternion.h>
diff --git a/src/gui/math3d/qquaternion.h b/src/gui/math3d/qquaternion.h
index d4c91c430a..21b051e08e 100644
--- a/src/gui/math3d/qquaternion.h
+++ b/src/gui/math3d/qquaternion.h
@@ -40,6 +40,7 @@
#ifndef QQUATERNION_H
#define QQUATERNION_H
+#include <QtGui/qtguiglobal.h>
#include <QtGui/qgenericmatrix.h>
#include <QtGui/qvector3d.h>
#include <QtGui/qvector4d.h>
diff --git a/src/gui/math3d/qvector2d.h b/src/gui/math3d/qvector2d.h
index 697360bd5b..d2724c9498 100644
--- a/src/gui/math3d/qvector2d.h
+++ b/src/gui/math3d/qvector2d.h
@@ -40,6 +40,7 @@
#ifndef QVECTOR2D_H
#define QVECTOR2D_H
+#include <QtGui/qtguiglobal.h>
#include <QtCore/qpoint.h>
#include <QtCore/qmetatype.h>
diff --git a/src/gui/math3d/qvector3d.h b/src/gui/math3d/qvector3d.h
index c3b335cf7c..c1d881a735 100644
--- a/src/gui/math3d/qvector3d.h
+++ b/src/gui/math3d/qvector3d.h
@@ -40,6 +40,7 @@
#ifndef QVECTOR3D_H
#define QVECTOR3D_H
+#include <QtGui/qtguiglobal.h>
#include <QtCore/qpoint.h>
#include <QtCore/qmetatype.h>
diff --git a/src/gui/math3d/qvector4d.h b/src/gui/math3d/qvector4d.h
index 28a438f3ac..9387e8d187 100644
--- a/src/gui/math3d/qvector4d.h
+++ b/src/gui/math3d/qvector4d.h
@@ -40,6 +40,7 @@
#ifndef QVECTOR4D_H
#define QVECTOR4D_H
+#include <QtGui/qtguiglobal.h>
#include <QtCore/qpoint.h>
#include <QtCore/qmetatype.h>
diff --git a/src/gui/opengl/opengl.pri b/src/gui/opengl/opengl.pri
index b13f258fda..2c3cca6b18 100644
--- a/src/gui/opengl/opengl.pri
+++ b/src/gui/opengl/opengl.pri
@@ -1,9 +1,9 @@
# Qt gui library, opengl module
-contains(QT_CONFIG, opengl):CONFIG += opengl
-contains(QT_CONFIG, opengles2):CONFIG += opengles2
+qtConfig(opengl): CONFIG += opengl
+qtConfig(opengles2): CONFIG += opengles2
-contains(QT_CONFIG, opengl)|contains(QT_CONFIG, opengles2) {
+qtConfig(opengl(es2)?) {
HEADERS += opengl/qopengl.h \
opengl/qopengl_p.h \
@@ -22,17 +22,14 @@ contains(QT_CONFIG, opengl)|contains(QT_CONFIG, opengles2) {
opengl/qopenglpaintengine_p.h \
opengl/qopenglengineshadersource_p.h \
opengl/qopenglcustomshaderstage_p.h \
- opengl/qtriangulatingstroker_p.h \
opengl/qopengltextureglyphcache_p.h \
opengl/qopenglshadercache_p.h \
opengl/qopenglshadercache_meego_p.h \
- opengl/qtriangulator_p.h \
- opengl/qrbtree_p.h \
opengl/qopenglversionfunctions.h \
opengl/qopenglversionfunctionsfactory_p.h \
opengl/qopenglvertexarrayobject.h \
opengl/qopengldebug.h \
- opengl/qopengltextureblitter_p.h \
+ opengl/qopengltextureblitter.h \
opengl/qopengltexture.h \
opengl/qopengltexture_p.h \
opengl/qopengltexturehelper_p.h \
@@ -51,9 +48,7 @@ contains(QT_CONFIG, opengl)|contains(QT_CONFIG, opengles2) {
opengl/qopengl2pexvertexarray.cpp \
opengl/qopenglpaintengine.cpp \
opengl/qopenglcustomshaderstage.cpp \
- opengl/qtriangulatingstroker.cpp \
opengl/qopengltextureglyphcache.cpp \
- opengl/qtriangulator.cpp \
opengl/qopenglversionfunctions.cpp \
opengl/qopenglversionfunctionsfactory.cpp \
opengl/qopenglvertexarrayobject.cpp \
@@ -63,7 +58,7 @@ contains(QT_CONFIG, opengl)|contains(QT_CONFIG, opengles2) {
opengl/qopengltexturehelper.cpp \
opengl/qopenglpixeltransferoptions.cpp
- !contains(QT_CONFIG, opengles2) {
+ !qtConfig(opengles2) {
HEADERS += opengl/qopenglfunctions_1_0.h \
opengl/qopenglfunctions_1_1.h \
opengl/qopenglfunctions_1_2.h \
@@ -122,7 +117,7 @@ contains(QT_CONFIG, opengl)|contains(QT_CONFIG, opengles2) {
opengl/qopengltimerquery.cpp
}
- contains(QT_CONFIG, opengles2) {
+ qtConfig(opengles2) {
HEADERS += opengl/qopenglfunctions_es2.h
SOURCES += opengl/qopenglfunctions_es2.cpp
diff --git a/src/gui/opengl/qopengl.h b/src/gui/opengl/qopengl.h
index 5f9d78b780..c7a3e79666 100644
--- a/src/gui/opengl/qopengl.h
+++ b/src/gui/opengl/qopengl.h
@@ -40,7 +40,7 @@
#ifndef QOPENGL_H
#define QOPENGL_H
-#include <QtCore/qglobal.h>
+#include <QtGui/qtguiglobal.h>
#ifndef QT_NO_OPENGL
@@ -95,14 +95,15 @@ typedef void* GLeglImageOES;
// applications cannot target ES 3. Therefore QOpenGLFunctions and
// friends do everything dynamically and never rely on these macros.
+# ifndef GL_GLEXT_PROTOTYPES
+# define GL_GLEXT_PROTOTYPES
+# endif
+
# if defined(QT_OPENGL_ES_3_1)
# include <GLES3/gl31.h>
# elif defined(QT_OPENGL_ES_3)
# include <GLES3/gl3.h>
# else
-# ifndef GL_GLEXT_PROTOTYPES
-# define GL_GLEXT_PROTOTYPES
-# endif
# include <GLES2/gl2.h>
#endif
@@ -119,10 +120,8 @@ typedef char GLchar;
#else // non-ES2 platforms
# if defined(Q_OS_MAC)
# include <OpenGL/gl.h>
-# if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7
-# define GL_DO_NOT_WARN_IF_MULTI_GL_VERSION_HEADERS_INCLUDED
-# include <OpenGL/gl3.h>
-# endif
+# define GL_DO_NOT_WARN_IF_MULTI_GL_VERSION_HEADERS_INCLUDED
+# include <OpenGL/gl3.h>
# include <OpenGL/glext.h>
# else
# define GL_GLEXT_LEGACY // Prevents GL/gl.h from #including system glext.h
@@ -131,16 +130,11 @@ typedef char GLchar;
# endif // Q_OS_MAC
#endif // QT_OPENGL_ES_2
-// Desktops, apart from Mac OS X prior to 10.7 can support OpenGL 3.
-// Desktops, apart from Mac OS X prior to 10.9 can support OpenGL 4.
+// Desktops can support OpenGL 4.
#if !defined(QT_OPENGL_ES_2)
-# if !defined(Q_OS_MAC) || (defined(Q_OS_MAC) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7)
-# define QT_OPENGL_3
-# define QT_OPENGL_3_2
-# endif
-# if !defined(Q_OS_MAC) || (defined(Q_OS_MAC) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_9)
-# define QT_OPENGL_4
-# endif
+#define QT_OPENGL_3
+#define QT_OPENGL_3_2
+#define QT_OPENGL_4
# if !defined(Q_OS_MAC)
# define QT_OPENGL_4_3
# endif
diff --git a/src/gui/opengl/qopengl2pexvertexarray_p.h b/src/gui/opengl/qopengl2pexvertexarray_p.h
index 22397391dd..5dc060ff3d 100644
--- a/src/gui/opengl/qopengl2pexvertexarray_p.h
+++ b/src/gui/opengl/qopengl2pexvertexarray_p.h
@@ -51,6 +51,7 @@
#ifndef QOPENGL2PEXVERTEXARRAY_P_H
#define QOPENGL2PEXVERTEXARRAY_P_H
+#include <QtGui/private/qtguiglobal_p.h>
#include <QRectF>
#include <private/qdatabuffer_p.h>
diff --git a/src/gui/opengl/qopengl_p.h b/src/gui/opengl/qopengl_p.h
index 042b903625..cda062eacf 100644
--- a/src/gui/opengl/qopengl_p.h
+++ b/src/gui/opengl/qopengl_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#include <qopengl.h>
#include <private/qopenglcontext_p.h>
#include <QtCore/qset.h>
diff --git a/src/gui/opengl/qopenglbuffer.h b/src/gui/opengl/qopenglbuffer.h
index bd947bc1d8..f2dfec3bb4 100644
--- a/src/gui/opengl/qopenglbuffer.h
+++ b/src/gui/opengl/qopenglbuffer.h
@@ -40,7 +40,7 @@
#ifndef QOPENGLBUFFER_H
#define QOPENGLBUFFER_H
-#include <QtCore/qglobal.h>
+#include <QtGui/qtguiglobal.h>
#ifndef QT_NO_OPENGL
diff --git a/src/gui/opengl/qopenglcustomshaderstage_p.h b/src/gui/opengl/qopenglcustomshaderstage_p.h
index 2342991e5e..f4a71af88e 100644
--- a/src/gui/opengl/qopenglcustomshaderstage_p.h
+++ b/src/gui/opengl/qopenglcustomshaderstage_p.h
@@ -51,8 +51,8 @@
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#include <QOpenGLShaderProgram>
-#include <QtGlobal>
QT_BEGIN_NAMESPACE
diff --git a/src/gui/opengl/qopengldebug.h b/src/gui/opengl/qopengldebug.h
index 90e12fb8b1..74b2731f7e 100644
--- a/src/gui/opengl/qopengldebug.h
+++ b/src/gui/opengl/qopengldebug.h
@@ -40,7 +40,7 @@
#ifndef QOPENGLDEBUG_H
#define QOPENGLDEBUG_H
-#include <QtCore/qglobal.h>
+#include <QtGui/qtguiglobal.h>
#ifndef QT_NO_OPENGL
diff --git a/src/gui/opengl/qopenglengineshadermanager.cpp b/src/gui/opengl/qopenglengineshadermanager.cpp
index 4e3d14ba37..1d3e47f93b 100644
--- a/src/gui/opengl/qopenglengineshadermanager.cpp
+++ b/src/gui/opengl/qopenglengineshadermanager.cpp
@@ -390,7 +390,7 @@ QOpenGLEngineShaderProg *QOpenGLEngineSharedShaders::findProgramInCache(const QO
fragShader->setObjectName(QString::fromLatin1(description));
#endif
if (!fragShader->compileSourceCode(fragSource)) {
- qWarning() << "Warning:" << description << "failed to compile!";
+ qWarning("Warning: \"%s\" failed to compile!", description.constData());
break;
}
@@ -405,7 +405,7 @@ QOpenGLEngineShaderProg *QOpenGLEngineSharedShaders::findProgramInCache(const QO
vertexShader->setObjectName(QString::fromLatin1(description));
#endif
if (!vertexShader->compileSourceCode(vertexSource)) {
- qWarning() << "Warning:" << description << "failed to compile!";
+ qWarning("Warning: \"%s\" failed to compile!", description.constData());
break;
}
diff --git a/src/gui/opengl/qopenglengineshadermanager_p.h b/src/gui/opengl/qopenglengineshadermanager_p.h
index a5e190a48d..23b2ccf486 100644
--- a/src/gui/opengl/qopenglengineshadermanager_p.h
+++ b/src/gui/opengl/qopenglengineshadermanager_p.h
@@ -220,6 +220,7 @@
#ifndef QOPENGLENGINE_SHADER_MANAGER_H
#define QOPENGLENGINE_SHADER_MANAGER_H
+#include <QtGui/private/qtguiglobal_p.h>
#include <QOpenGLShader>
#include <QOpenGLShaderProgram>
#include <QPainter>
diff --git a/src/gui/opengl/qopenglengineshadersource_p.h b/src/gui/opengl/qopenglengineshadersource_p.h
index 876d2775d3..1e88ac63b5 100644
--- a/src/gui/opengl/qopenglengineshadersource_p.h
+++ b/src/gui/opengl/qopenglengineshadersource_p.h
@@ -52,6 +52,7 @@
#ifndef QOPENGL_ENGINE_SHADER_SOURCE_H
#define QOPENGL_ENGINE_SHADER_SOURCE_H
+#include <QtGui/private/qtguiglobal_p.h>
#include "qopenglengineshadermanager_p.h"
QT_BEGIN_NAMESPACE
diff --git a/src/gui/opengl/qopenglextensions_p.h b/src/gui/opengl/qopenglextensions_p.h
index 894b6f2dc6..a5f1a2cc88 100644
--- a/src/gui/opengl/qopenglextensions_p.h
+++ b/src/gui/opengl/qopenglextensions_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#include "qopenglextrafunctions.h"
QT_BEGIN_NAMESPACE
diff --git a/src/gui/opengl/qopenglextrafunctions.h b/src/gui/opengl/qopenglextrafunctions.h
index aa29d685bc..1b36068588 100644
--- a/src/gui/opengl/qopenglextrafunctions.h
+++ b/src/gui/opengl/qopenglextrafunctions.h
@@ -40,7 +40,7 @@
#ifndef QOPENGLEXTRAFUNCTIONS_H
#define QOPENGLEXTRAFUNCTIONS_H
-#include <QtCore/qglobal.h>
+#include <QtGui/qtguiglobal.h>
#ifndef QT_NO_OPENGL
diff --git a/src/gui/opengl/qopenglframebufferobject.cpp b/src/gui/opengl/qopenglframebufferobject.cpp
index 14581c89f6..e0f469cbcb 100644
--- a/src/gui/opengl/qopenglframebufferobject.cpp
+++ b/src/gui/opengl/qopenglframebufferobject.cpp
@@ -856,10 +856,8 @@ QOpenGLFramebufferObject::QOpenGLFramebufferObject(const QSize &size, GLenum tar
\sa size(), texture()
*/
QOpenGLFramebufferObject::QOpenGLFramebufferObject(int width, int height, GLenum target)
- : d_ptr(new QOpenGLFramebufferObjectPrivate)
+ : QOpenGLFramebufferObject(QSize(width, height), target)
{
- Q_D(QOpenGLFramebufferObject);
- d->init(this, QSize(width, height), NoAttachment, target, effectiveInternalFormat(0));
}
/*! \overload
@@ -883,11 +881,8 @@ QOpenGLFramebufferObject::QOpenGLFramebufferObject(const QSize &size, const QOpe
*/
QOpenGLFramebufferObject::QOpenGLFramebufferObject(int width, int height, const QOpenGLFramebufferObjectFormat &format)
- : d_ptr(new QOpenGLFramebufferObjectPrivate)
+ : QOpenGLFramebufferObject(QSize(width, height), format)
{
- Q_D(QOpenGLFramebufferObject);
- d->init(this, QSize(width, height), format.attachment(), format.textureTarget(),
- format.internalTextureFormat(), format.samples(), format.mipmap());
}
/*! \overload
diff --git a/src/gui/opengl/qopenglframebufferobject.h b/src/gui/opengl/qopenglframebufferobject.h
index b22726cafb..b9e61e9ee4 100644
--- a/src/gui/opengl/qopenglframebufferobject.h
+++ b/src/gui/opengl/qopenglframebufferobject.h
@@ -40,7 +40,7 @@
#ifndef QOPENGLFRAMEBUFFEROBJECT_H
#define QOPENGLFRAMEBUFFEROBJECT_H
-#include <QtCore/qglobal.h>
+#include <QtGui/qtguiglobal.h>
#ifndef QT_NO_OPENGL
diff --git a/src/gui/opengl/qopenglframebufferobject_p.h b/src/gui/opengl/qopenglframebufferobject_p.h
index c677b5e344..778a38b823 100644
--- a/src/gui/opengl/qopenglframebufferobject_p.h
+++ b/src/gui/opengl/qopenglframebufferobject_p.h
@@ -44,13 +44,14 @@
// W A R N I N G
// -------------
//
-// This file is not part of the Qt API. It exists for the convenience
-// of the QLibrary class. This header file may change from
-// version to version without notice, or even be removed.
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
//
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#include <qopenglframebufferobject.h>
#include <private/qopenglcontext_p.h>
#include <private/qopenglextensions_p.h>
diff --git a/src/gui/opengl/qopenglfunctions.h b/src/gui/opengl/qopenglfunctions.h
index f6cd0e553e..aad48571b3 100644
--- a/src/gui/opengl/qopenglfunctions.h
+++ b/src/gui/opengl/qopenglfunctions.h
@@ -40,7 +40,7 @@
#ifndef QOPENGLFUNCTIONS_H
#define QOPENGLFUNCTIONS_H
-#include <QtCore/qglobal.h>
+#include <QtGui/qtguiglobal.h>
#ifndef QT_NO_OPENGL
diff --git a/src/gui/opengl/qopenglfunctions_1_0.cpp b/src/gui/opengl/qopenglfunctions_1_0.cpp
index 9d5a76380a..4235c9a339 100644
--- a/src/gui/opengl/qopenglfunctions_1_0.cpp
+++ b/src/gui/opengl/qopenglfunctions_1_0.cpp
@@ -74,12 +74,14 @@ QOpenGLFunctions_1_0::QOpenGLFunctions_1_0()
QOpenGLFunctions_1_0::~QOpenGLFunctions_1_0()
{
- if (d_1_0_Core)
+ if (d_1_0_Core) {
d_1_0_Core->refs.deref();
- Q_ASSERT(d_1_0_Core->refs.load());
- if (d_1_0_Deprecated)
+ Q_ASSERT(d_1_0_Core->refs.load());
+ }
+ if (d_1_0_Deprecated) {
d_1_0_Deprecated->refs.deref();
- Q_ASSERT(d_1_0_Deprecated->refs.load());
+ Q_ASSERT(d_1_0_Deprecated->refs.load());
+ }
}
bool QOpenGLFunctions_1_0::initializeOpenGLFunctions()
diff --git a/src/gui/opengl/qopenglfunctions_1_0.h b/src/gui/opengl/qopenglfunctions_1_0.h
index 825a6255a3..8284604086 100644
--- a/src/gui/opengl/qopenglfunctions_1_0.h
+++ b/src/gui/opengl/qopenglfunctions_1_0.h
@@ -50,7 +50,7 @@
#ifndef QOPENGLVERSIONFUNCTIONS_1_0_H
#define QOPENGLVERSIONFUNCTIONS_1_0_H
-#include <QtCore/qglobal.h>
+#include <QtGui/qtguiglobal.h>
#if !defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_2)
diff --git a/src/gui/opengl/qopenglfunctions_1_1.cpp b/src/gui/opengl/qopenglfunctions_1_1.cpp
index 57385f1927..7d09bb40c1 100644
--- a/src/gui/opengl/qopenglfunctions_1_1.cpp
+++ b/src/gui/opengl/qopenglfunctions_1_1.cpp
@@ -76,18 +76,22 @@ QOpenGLFunctions_1_1::QOpenGLFunctions_1_1()
QOpenGLFunctions_1_1::~QOpenGLFunctions_1_1()
{
- if (d_1_0_Core)
+ if (d_1_0_Core) {
d_1_0_Core->refs.deref();
- Q_ASSERT(d_1_0_Core->refs.load());
- if (d_1_1_Core)
+ Q_ASSERT(d_1_0_Core->refs.load());
+ }
+ if (d_1_1_Core) {
d_1_1_Core->refs.deref();
- Q_ASSERT(d_1_1_Core->refs.load());
- if (d_1_0_Deprecated)
+ Q_ASSERT(d_1_1_Core->refs.load());
+ }
+ if (d_1_0_Deprecated) {
d_1_0_Deprecated->refs.deref();
- Q_ASSERT(d_1_0_Deprecated->refs.load());
- if (d_1_1_Deprecated)
+ Q_ASSERT(d_1_0_Deprecated->refs.load());
+ }
+ if (d_1_1_Deprecated) {
d_1_1_Deprecated->refs.deref();
- Q_ASSERT(d_1_1_Deprecated->refs.load());
+ Q_ASSERT(d_1_1_Deprecated->refs.load());
+ }
}
bool QOpenGLFunctions_1_1::initializeOpenGLFunctions()
diff --git a/src/gui/opengl/qopenglfunctions_1_1.h b/src/gui/opengl/qopenglfunctions_1_1.h
index f312258f00..052d3e93bd 100644
--- a/src/gui/opengl/qopenglfunctions_1_1.h
+++ b/src/gui/opengl/qopenglfunctions_1_1.h
@@ -50,7 +50,7 @@
#ifndef QOPENGLVERSIONFUNCTIONS_1_1_H
#define QOPENGLVERSIONFUNCTIONS_1_1_H
-#include <QtCore/qglobal.h>
+#include <QtGui/qtguiglobal.h>
#if !defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_2)
diff --git a/src/gui/opengl/qopenglfunctions_1_2.cpp b/src/gui/opengl/qopenglfunctions_1_2.cpp
index 9eaa13862d..94a9d64660 100644
--- a/src/gui/opengl/qopenglfunctions_1_2.cpp
+++ b/src/gui/opengl/qopenglfunctions_1_2.cpp
@@ -78,24 +78,30 @@ QOpenGLFunctions_1_2::QOpenGLFunctions_1_2()
QOpenGLFunctions_1_2::~QOpenGLFunctions_1_2()
{
- if (d_1_0_Core)
+ if (d_1_0_Core) {
d_1_0_Core->refs.deref();
- Q_ASSERT(d_1_0_Core->refs.load());
- if (d_1_1_Core)
+ Q_ASSERT(d_1_0_Core->refs.load());
+ }
+ if (d_1_1_Core) {
d_1_1_Core->refs.deref();
- Q_ASSERT(d_1_1_Core->refs.load());
- if (d_1_2_Core)
+ Q_ASSERT(d_1_1_Core->refs.load());
+ }
+ if (d_1_2_Core) {
d_1_2_Core->refs.deref();
- Q_ASSERT(d_1_2_Core->refs.load());
- if (d_1_0_Deprecated)
+ Q_ASSERT(d_1_2_Core->refs.load());
+ }
+ if (d_1_0_Deprecated) {
d_1_0_Deprecated->refs.deref();
- Q_ASSERT(d_1_0_Deprecated->refs.load());
- if (d_1_1_Deprecated)
+ Q_ASSERT(d_1_0_Deprecated->refs.load());
+ }
+ if (d_1_1_Deprecated) {
d_1_1_Deprecated->refs.deref();
- Q_ASSERT(d_1_1_Deprecated->refs.load());
- if (d_1_2_Deprecated)
+ Q_ASSERT(d_1_1_Deprecated->refs.load());
+ }
+ if (d_1_2_Deprecated) {
d_1_2_Deprecated->refs.deref();
- Q_ASSERT(d_1_2_Deprecated->refs.load());
+ Q_ASSERT(d_1_2_Deprecated->refs.load());
+ }
}
bool QOpenGLFunctions_1_2::initializeOpenGLFunctions()
diff --git a/src/gui/opengl/qopenglfunctions_1_2.h b/src/gui/opengl/qopenglfunctions_1_2.h
index fd4e7f74f9..6b36500a79 100644
--- a/src/gui/opengl/qopenglfunctions_1_2.h
+++ b/src/gui/opengl/qopenglfunctions_1_2.h
@@ -50,7 +50,7 @@
#ifndef QOPENGLVERSIONFUNCTIONS_1_2_H
#define QOPENGLVERSIONFUNCTIONS_1_2_H
-#include <QtCore/qglobal.h>
+#include <QtGui/qtguiglobal.h>
#if !defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_2)
diff --git a/src/gui/opengl/qopenglfunctions_1_3.cpp b/src/gui/opengl/qopenglfunctions_1_3.cpp
index 6211997302..972ef9ff70 100644
--- a/src/gui/opengl/qopenglfunctions_1_3.cpp
+++ b/src/gui/opengl/qopenglfunctions_1_3.cpp
@@ -80,30 +80,38 @@ QOpenGLFunctions_1_3::QOpenGLFunctions_1_3()
QOpenGLFunctions_1_3::~QOpenGLFunctions_1_3()
{
- if (d_1_0_Core)
+ if (d_1_0_Core) {
d_1_0_Core->refs.deref();
- Q_ASSERT(d_1_0_Core->refs.load());
- if (d_1_1_Core)
+ Q_ASSERT(d_1_0_Core->refs.load());
+ }
+ if (d_1_1_Core) {
d_1_1_Core->refs.deref();
- Q_ASSERT(d_1_1_Core->refs.load());
- if (d_1_2_Core)
+ Q_ASSERT(d_1_1_Core->refs.load());
+ }
+ if (d_1_2_Core) {
d_1_2_Core->refs.deref();
- Q_ASSERT(d_1_2_Core->refs.load());
- if (d_1_3_Core)
+ Q_ASSERT(d_1_2_Core->refs.load());
+ }
+ if (d_1_3_Core) {
d_1_3_Core->refs.deref();
- Q_ASSERT(d_1_3_Core->refs.load());
- if (d_1_0_Deprecated)
+ Q_ASSERT(d_1_3_Core->refs.load());
+ }
+ if (d_1_0_Deprecated) {
d_1_0_Deprecated->refs.deref();
- Q_ASSERT(d_1_0_Deprecated->refs.load());
- if (d_1_1_Deprecated)
+ Q_ASSERT(d_1_0_Deprecated->refs.load());
+ }
+ if (d_1_1_Deprecated) {
d_1_1_Deprecated->refs.deref();
- Q_ASSERT(d_1_1_Deprecated->refs.load());
- if (d_1_2_Deprecated)
+ Q_ASSERT(d_1_1_Deprecated->refs.load());
+ }
+ if (d_1_2_Deprecated) {
d_1_2_Deprecated->refs.deref();
- Q_ASSERT(d_1_2_Deprecated->refs.load());
- if (d_1_3_Deprecated)
+ Q_ASSERT(d_1_2_Deprecated->refs.load());
+ }
+ if (d_1_3_Deprecated) {
d_1_3_Deprecated->refs.deref();
- Q_ASSERT(d_1_3_Deprecated->refs.load());
+ Q_ASSERT(d_1_3_Deprecated->refs.load());
+ }
}
bool QOpenGLFunctions_1_3::initializeOpenGLFunctions()
diff --git a/src/gui/opengl/qopenglfunctions_1_3.h b/src/gui/opengl/qopenglfunctions_1_3.h
index a8509c46c5..3ed5851d5d 100644
--- a/src/gui/opengl/qopenglfunctions_1_3.h
+++ b/src/gui/opengl/qopenglfunctions_1_3.h
@@ -50,7 +50,7 @@
#ifndef QOPENGLVERSIONFUNCTIONS_1_3_H
#define QOPENGLVERSIONFUNCTIONS_1_3_H
-#include <QtCore/qglobal.h>
+#include <QtGui/qtguiglobal.h>
#if !defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_2)
diff --git a/src/gui/opengl/qopenglfunctions_1_4.cpp b/src/gui/opengl/qopenglfunctions_1_4.cpp
index 5ff2c24014..4b78253301 100644
--- a/src/gui/opengl/qopenglfunctions_1_4.cpp
+++ b/src/gui/opengl/qopenglfunctions_1_4.cpp
@@ -82,36 +82,46 @@ QOpenGLFunctions_1_4::QOpenGLFunctions_1_4()
QOpenGLFunctions_1_4::~QOpenGLFunctions_1_4()
{
- if (d_1_0_Core)
+ if (d_1_0_Core) {
d_1_0_Core->refs.deref();
- Q_ASSERT(d_1_0_Core->refs.load());
- if (d_1_1_Core)
+ Q_ASSERT(d_1_0_Core->refs.load());
+ }
+ if (d_1_1_Core) {
d_1_1_Core->refs.deref();
- Q_ASSERT(d_1_1_Core->refs.load());
- if (d_1_2_Core)
+ Q_ASSERT(d_1_1_Core->refs.load());
+ }
+ if (d_1_2_Core) {
d_1_2_Core->refs.deref();
- Q_ASSERT(d_1_2_Core->refs.load());
- if (d_1_3_Core)
+ Q_ASSERT(d_1_2_Core->refs.load());
+ }
+ if (d_1_3_Core) {
d_1_3_Core->refs.deref();
- Q_ASSERT(d_1_3_Core->refs.load());
- if (d_1_4_Core)
+ Q_ASSERT(d_1_3_Core->refs.load());
+ }
+ if (d_1_4_Core) {
d_1_4_Core->refs.deref();
- Q_ASSERT(d_1_4_Core->refs.load());
- if (d_1_0_Deprecated)
+ Q_ASSERT(d_1_4_Core->refs.load());
+ }
+ if (d_1_0_Deprecated) {
d_1_0_Deprecated->refs.deref();
- Q_ASSERT(d_1_0_Deprecated->refs.load());
- if (d_1_1_Deprecated)
+ Q_ASSERT(d_1_0_Deprecated->refs.load());
+ }
+ if (d_1_1_Deprecated) {
d_1_1_Deprecated->refs.deref();
- Q_ASSERT(d_1_1_Deprecated->refs.load());
- if (d_1_2_Deprecated)
+ Q_ASSERT(d_1_1_Deprecated->refs.load());
+ }
+ if (d_1_2_Deprecated) {
d_1_2_Deprecated->refs.deref();
- Q_ASSERT(d_1_2_Deprecated->refs.load());
- if (d_1_3_Deprecated)
+ Q_ASSERT(d_1_2_Deprecated->refs.load());
+ }
+ if (d_1_3_Deprecated) {
d_1_3_Deprecated->refs.deref();
- Q_ASSERT(d_1_3_Deprecated->refs.load());
- if (d_1_4_Deprecated)
+ Q_ASSERT(d_1_3_Deprecated->refs.load());
+ }
+ if (d_1_4_Deprecated) {
d_1_4_Deprecated->refs.deref();
- Q_ASSERT(d_1_4_Deprecated->refs.load());
+ Q_ASSERT(d_1_4_Deprecated->refs.load());
+ }
}
bool QOpenGLFunctions_1_4::initializeOpenGLFunctions()
diff --git a/src/gui/opengl/qopenglfunctions_1_4.h b/src/gui/opengl/qopenglfunctions_1_4.h
index eeb99dbb1b..849fad6744 100644
--- a/src/gui/opengl/qopenglfunctions_1_4.h
+++ b/src/gui/opengl/qopenglfunctions_1_4.h
@@ -50,7 +50,7 @@
#ifndef QOPENGLVERSIONFUNCTIONS_1_4_H
#define QOPENGLVERSIONFUNCTIONS_1_4_H
-#include <QtCore/qglobal.h>
+#include <QtGui/qtguiglobal.h>
#if !defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_2)
diff --git a/src/gui/opengl/qopenglfunctions_1_5.cpp b/src/gui/opengl/qopenglfunctions_1_5.cpp
index d07f1decec..2a0820d0cb 100644
--- a/src/gui/opengl/qopenglfunctions_1_5.cpp
+++ b/src/gui/opengl/qopenglfunctions_1_5.cpp
@@ -83,39 +83,50 @@ QOpenGLFunctions_1_5::QOpenGLFunctions_1_5()
QOpenGLFunctions_1_5::~QOpenGLFunctions_1_5()
{
- if (d_1_0_Core)
+ if (d_1_0_Core) {
d_1_0_Core->refs.deref();
- Q_ASSERT(d_1_0_Core->refs.load());
- if (d_1_1_Core)
+ Q_ASSERT(d_1_0_Core->refs.load());
+ }
+ if (d_1_1_Core) {
d_1_1_Core->refs.deref();
- Q_ASSERT(d_1_1_Core->refs.load());
- if (d_1_2_Core)
+ Q_ASSERT(d_1_1_Core->refs.load());
+ }
+ if (d_1_2_Core) {
d_1_2_Core->refs.deref();
- Q_ASSERT(d_1_2_Core->refs.load());
- if (d_1_3_Core)
+ Q_ASSERT(d_1_2_Core->refs.load());
+ }
+ if (d_1_3_Core) {
d_1_3_Core->refs.deref();
- Q_ASSERT(d_1_3_Core->refs.load());
- if (d_1_4_Core)
+ Q_ASSERT(d_1_3_Core->refs.load());
+ }
+ if (d_1_4_Core) {
d_1_4_Core->refs.deref();
- Q_ASSERT(d_1_4_Core->refs.load());
- if (d_1_5_Core)
+ Q_ASSERT(d_1_4_Core->refs.load());
+ }
+ if (d_1_5_Core) {
d_1_5_Core->refs.deref();
- Q_ASSERT(d_1_5_Core->refs.load());
- if (d_1_0_Deprecated)
+ Q_ASSERT(d_1_5_Core->refs.load());
+ }
+ if (d_1_0_Deprecated) {
d_1_0_Deprecated->refs.deref();
- Q_ASSERT(d_1_0_Deprecated->refs.load());
- if (d_1_1_Deprecated)
+ Q_ASSERT(d_1_0_Deprecated->refs.load());
+ }
+ if (d_1_1_Deprecated) {
d_1_1_Deprecated->refs.deref();
- Q_ASSERT(d_1_1_Deprecated->refs.load());
- if (d_1_2_Deprecated)
+ Q_ASSERT(d_1_1_Deprecated->refs.load());
+ }
+ if (d_1_2_Deprecated) {
d_1_2_Deprecated->refs.deref();
- Q_ASSERT(d_1_2_Deprecated->refs.load());
- if (d_1_3_Deprecated)
+ Q_ASSERT(d_1_2_Deprecated->refs.load());
+ }
+ if (d_1_3_Deprecated) {
d_1_3_Deprecated->refs.deref();
- Q_ASSERT(d_1_3_Deprecated->refs.load());
- if (d_1_4_Deprecated)
+ Q_ASSERT(d_1_3_Deprecated->refs.load());
+ }
+ if (d_1_4_Deprecated) {
d_1_4_Deprecated->refs.deref();
- Q_ASSERT(d_1_4_Deprecated->refs.load());
+ Q_ASSERT(d_1_4_Deprecated->refs.load());
+ }
}
bool QOpenGLFunctions_1_5::initializeOpenGLFunctions()
diff --git a/src/gui/opengl/qopenglfunctions_1_5.h b/src/gui/opengl/qopenglfunctions_1_5.h
index d5f23c146b..18914a8957 100644
--- a/src/gui/opengl/qopenglfunctions_1_5.h
+++ b/src/gui/opengl/qopenglfunctions_1_5.h
@@ -50,7 +50,7 @@
#ifndef QOPENGLVERSIONFUNCTIONS_1_5_H
#define QOPENGLVERSIONFUNCTIONS_1_5_H
-#include <QtCore/qglobal.h>
+#include <QtGui/qtguiglobal.h>
#if !defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_2)
diff --git a/src/gui/opengl/qopenglfunctions_2_0.cpp b/src/gui/opengl/qopenglfunctions_2_0.cpp
index b7dc8ef458..c175b13c5b 100644
--- a/src/gui/opengl/qopenglfunctions_2_0.cpp
+++ b/src/gui/opengl/qopenglfunctions_2_0.cpp
@@ -85,42 +85,54 @@ QOpenGLFunctions_2_0::QOpenGLFunctions_2_0()
QOpenGLFunctions_2_0::~QOpenGLFunctions_2_0()
{
- if (d_1_0_Core)
+ if (d_1_0_Core) {
d_1_0_Core->refs.deref();
- Q_ASSERT(d_1_0_Core->refs.load());
- if (d_1_1_Core)
+ Q_ASSERT(d_1_0_Core->refs.load());
+ }
+ if (d_1_1_Core) {
d_1_1_Core->refs.deref();
- Q_ASSERT(d_1_1_Core->refs.load());
- if (d_1_2_Core)
+ Q_ASSERT(d_1_1_Core->refs.load());
+ }
+ if (d_1_2_Core) {
d_1_2_Core->refs.deref();
- Q_ASSERT(d_1_2_Core->refs.load());
- if (d_1_3_Core)
+ Q_ASSERT(d_1_2_Core->refs.load());
+ }
+ if (d_1_3_Core) {
d_1_3_Core->refs.deref();
- Q_ASSERT(d_1_3_Core->refs.load());
- if (d_1_4_Core)
+ Q_ASSERT(d_1_3_Core->refs.load());
+ }
+ if (d_1_4_Core) {
d_1_4_Core->refs.deref();
- Q_ASSERT(d_1_4_Core->refs.load());
- if (d_1_5_Core)
+ Q_ASSERT(d_1_4_Core->refs.load());
+ }
+ if (d_1_5_Core) {
d_1_5_Core->refs.deref();
- Q_ASSERT(d_1_5_Core->refs.load());
- if (d_2_0_Core)
+ Q_ASSERT(d_1_5_Core->refs.load());
+ }
+ if (d_2_0_Core) {
d_2_0_Core->refs.deref();
- Q_ASSERT(d_2_0_Core->refs.load());
- if (d_1_0_Deprecated)
+ Q_ASSERT(d_2_0_Core->refs.load());
+ }
+ if (d_1_0_Deprecated) {
d_1_0_Deprecated->refs.deref();
- Q_ASSERT(d_1_0_Deprecated->refs.load());
- if (d_1_1_Deprecated)
+ Q_ASSERT(d_1_0_Deprecated->refs.load());
+ }
+ if (d_1_1_Deprecated) {
d_1_1_Deprecated->refs.deref();
- Q_ASSERT(d_1_1_Deprecated->refs.load());
- if (d_1_2_Deprecated)
+ Q_ASSERT(d_1_1_Deprecated->refs.load());
+ }
+ if (d_1_2_Deprecated) {
d_1_2_Deprecated->refs.deref();
- Q_ASSERT(d_1_2_Deprecated->refs.load());
- if (d_1_3_Deprecated)
+ Q_ASSERT(d_1_2_Deprecated->refs.load());
+ }
+ if (d_1_3_Deprecated) {
d_1_3_Deprecated->refs.deref();
- Q_ASSERT(d_1_3_Deprecated->refs.load());
- if (d_1_4_Deprecated)
+ Q_ASSERT(d_1_3_Deprecated->refs.load());
+ }
+ if (d_1_4_Deprecated) {
d_1_4_Deprecated->refs.deref();
- Q_ASSERT(d_1_4_Deprecated->refs.load());
+ Q_ASSERT(d_1_4_Deprecated->refs.load());
+ }
}
bool QOpenGLFunctions_2_0::initializeOpenGLFunctions()
diff --git a/src/gui/opengl/qopenglfunctions_2_0.h b/src/gui/opengl/qopenglfunctions_2_0.h
index 81b7274a93..74a91e0ff0 100644
--- a/src/gui/opengl/qopenglfunctions_2_0.h
+++ b/src/gui/opengl/qopenglfunctions_2_0.h
@@ -50,7 +50,7 @@
#ifndef QOPENGLVERSIONFUNCTIONS_2_0_H
#define QOPENGLVERSIONFUNCTIONS_2_0_H
-#include <QtCore/qglobal.h>
+#include <QtGui/qtguiglobal.h>
#if !defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_2)
diff --git a/src/gui/opengl/qopenglfunctions_2_1.cpp b/src/gui/opengl/qopenglfunctions_2_1.cpp
index e756685d10..4e77efd121 100644
--- a/src/gui/opengl/qopenglfunctions_2_1.cpp
+++ b/src/gui/opengl/qopenglfunctions_2_1.cpp
@@ -86,45 +86,58 @@ QOpenGLFunctions_2_1::QOpenGLFunctions_2_1()
QOpenGLFunctions_2_1::~QOpenGLFunctions_2_1()
{
- if (d_1_0_Core)
+ if (d_1_0_Core) {
d_1_0_Core->refs.deref();
- Q_ASSERT(d_1_0_Core->refs.load());
- if (d_1_1_Core)
+ Q_ASSERT(d_1_0_Core->refs.load());
+ }
+ if (d_1_1_Core) {
d_1_1_Core->refs.deref();
- Q_ASSERT(d_1_1_Core->refs.load());
- if (d_1_2_Core)
+ Q_ASSERT(d_1_1_Core->refs.load());
+ }
+ if (d_1_2_Core) {
d_1_2_Core->refs.deref();
- Q_ASSERT(d_1_2_Core->refs.load());
- if (d_1_3_Core)
+ Q_ASSERT(d_1_2_Core->refs.load());
+ }
+ if (d_1_3_Core) {
d_1_3_Core->refs.deref();
- Q_ASSERT(d_1_3_Core->refs.load());
- if (d_1_4_Core)
+ Q_ASSERT(d_1_3_Core->refs.load());
+ }
+ if (d_1_4_Core) {
d_1_4_Core->refs.deref();
- Q_ASSERT(d_1_4_Core->refs.load());
- if (d_1_5_Core)
+ Q_ASSERT(d_1_4_Core->refs.load());
+ }
+ if (d_1_5_Core) {
d_1_5_Core->refs.deref();
- Q_ASSERT(d_1_5_Core->refs.load());
- if (d_2_0_Core)
+ Q_ASSERT(d_1_5_Core->refs.load());
+ }
+ if (d_2_0_Core) {
d_2_0_Core->refs.deref();
- Q_ASSERT(d_2_0_Core->refs.load());
- if (d_2_1_Core)
+ Q_ASSERT(d_2_0_Core->refs.load());
+ }
+ if (d_2_1_Core) {
d_2_1_Core->refs.deref();
- Q_ASSERT(d_2_1_Core->refs.load());
- if (d_1_0_Deprecated)
+ Q_ASSERT(d_2_1_Core->refs.load());
+ }
+ if (d_1_0_Deprecated) {
d_1_0_Deprecated->refs.deref();
- Q_ASSERT(d_1_0_Deprecated->refs.load());
- if (d_1_1_Deprecated)
+ Q_ASSERT(d_1_0_Deprecated->refs.load());
+ }
+ if (d_1_1_Deprecated) {
d_1_1_Deprecated->refs.deref();
- Q_ASSERT(d_1_1_Deprecated->refs.load());
- if (d_1_2_Deprecated)
+ Q_ASSERT(d_1_1_Deprecated->refs.load());
+ }
+ if (d_1_2_Deprecated) {
d_1_2_Deprecated->refs.deref();
- Q_ASSERT(d_1_2_Deprecated->refs.load());
- if (d_1_3_Deprecated)
+ Q_ASSERT(d_1_2_Deprecated->refs.load());
+ }
+ if (d_1_3_Deprecated) {
d_1_3_Deprecated->refs.deref();
- Q_ASSERT(d_1_3_Deprecated->refs.load());
- if (d_1_4_Deprecated)
+ Q_ASSERT(d_1_3_Deprecated->refs.load());
+ }
+ if (d_1_4_Deprecated) {
d_1_4_Deprecated->refs.deref();
- Q_ASSERT(d_1_4_Deprecated->refs.load());
+ Q_ASSERT(d_1_4_Deprecated->refs.load());
+ }
}
bool QOpenGLFunctions_2_1::initializeOpenGLFunctions()
diff --git a/src/gui/opengl/qopenglfunctions_2_1.h b/src/gui/opengl/qopenglfunctions_2_1.h
index 7bac5af9da..e9212640f7 100644
--- a/src/gui/opengl/qopenglfunctions_2_1.h
+++ b/src/gui/opengl/qopenglfunctions_2_1.h
@@ -50,7 +50,7 @@
#ifndef QOPENGLVERSIONFUNCTIONS_2_1_H
#define QOPENGLVERSIONFUNCTIONS_2_1_H
-#include <QtCore/qglobal.h>
+#include <QtGui/qtguiglobal.h>
#if !defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_2)
diff --git a/src/gui/opengl/qopenglfunctions_3_0.cpp b/src/gui/opengl/qopenglfunctions_3_0.cpp
index ee7f92855d..09e3ad09ef 100644
--- a/src/gui/opengl/qopenglfunctions_3_0.cpp
+++ b/src/gui/opengl/qopenglfunctions_3_0.cpp
@@ -88,48 +88,62 @@ QOpenGLFunctions_3_0::QOpenGLFunctions_3_0()
QOpenGLFunctions_3_0::~QOpenGLFunctions_3_0()
{
- if (d_1_0_Core)
+ if (d_1_0_Core) {
d_1_0_Core->refs.deref();
- Q_ASSERT(d_1_0_Core->refs.load());
- if (d_1_1_Core)
+ Q_ASSERT(d_1_0_Core->refs.load());
+ }
+ if (d_1_1_Core) {
d_1_1_Core->refs.deref();
- Q_ASSERT(d_1_1_Core->refs.load());
- if (d_1_2_Core)
+ Q_ASSERT(d_1_1_Core->refs.load());
+ }
+ if (d_1_2_Core) {
d_1_2_Core->refs.deref();
- Q_ASSERT(d_1_2_Core->refs.load());
- if (d_1_3_Core)
+ Q_ASSERT(d_1_2_Core->refs.load());
+ }
+ if (d_1_3_Core) {
d_1_3_Core->refs.deref();
- Q_ASSERT(d_1_3_Core->refs.load());
- if (d_1_4_Core)
+ Q_ASSERT(d_1_3_Core->refs.load());
+ }
+ if (d_1_4_Core) {
d_1_4_Core->refs.deref();
- Q_ASSERT(d_1_4_Core->refs.load());
- if (d_1_5_Core)
+ Q_ASSERT(d_1_4_Core->refs.load());
+ }
+ if (d_1_5_Core) {
d_1_5_Core->refs.deref();
- Q_ASSERT(d_1_5_Core->refs.load());
- if (d_2_0_Core)
+ Q_ASSERT(d_1_5_Core->refs.load());
+ }
+ if (d_2_0_Core) {
d_2_0_Core->refs.deref();
- Q_ASSERT(d_2_0_Core->refs.load());
- if (d_2_1_Core)
+ Q_ASSERT(d_2_0_Core->refs.load());
+ }
+ if (d_2_1_Core) {
d_2_1_Core->refs.deref();
- Q_ASSERT(d_2_1_Core->refs.load());
- if (d_3_0_Core)
+ Q_ASSERT(d_2_1_Core->refs.load());
+ }
+ if (d_3_0_Core) {
d_3_0_Core->refs.deref();
- Q_ASSERT(d_3_0_Core->refs.load());
- if (d_1_0_Deprecated)
+ Q_ASSERT(d_3_0_Core->refs.load());
+ }
+ if (d_1_0_Deprecated) {
d_1_0_Deprecated->refs.deref();
- Q_ASSERT(d_1_0_Deprecated->refs.load());
- if (d_1_1_Deprecated)
+ Q_ASSERT(d_1_0_Deprecated->refs.load());
+ }
+ if (d_1_1_Deprecated) {
d_1_1_Deprecated->refs.deref();
- Q_ASSERT(d_1_1_Deprecated->refs.load());
- if (d_1_2_Deprecated)
+ Q_ASSERT(d_1_1_Deprecated->refs.load());
+ }
+ if (d_1_2_Deprecated) {
d_1_2_Deprecated->refs.deref();
- Q_ASSERT(d_1_2_Deprecated->refs.load());
- if (d_1_3_Deprecated)
+ Q_ASSERT(d_1_2_Deprecated->refs.load());
+ }
+ if (d_1_3_Deprecated) {
d_1_3_Deprecated->refs.deref();
- Q_ASSERT(d_1_3_Deprecated->refs.load());
- if (d_1_4_Deprecated)
+ Q_ASSERT(d_1_3_Deprecated->refs.load());
+ }
+ if (d_1_4_Deprecated) {
d_1_4_Deprecated->refs.deref();
- Q_ASSERT(d_1_4_Deprecated->refs.load());
+ Q_ASSERT(d_1_4_Deprecated->refs.load());
+ }
}
bool QOpenGLFunctions_3_0::initializeOpenGLFunctions()
diff --git a/src/gui/opengl/qopenglfunctions_3_0.h b/src/gui/opengl/qopenglfunctions_3_0.h
index da8d5ec5ff..1082d869d1 100644
--- a/src/gui/opengl/qopenglfunctions_3_0.h
+++ b/src/gui/opengl/qopenglfunctions_3_0.h
@@ -50,7 +50,7 @@
#ifndef QOPENGLVERSIONFUNCTIONS_3_0_H
#define QOPENGLVERSIONFUNCTIONS_3_0_H
-#include <QtCore/qglobal.h>
+#include <QtGui/qtguiglobal.h>
#if !defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_2)
diff --git a/src/gui/opengl/qopenglfunctions_3_1.cpp b/src/gui/opengl/qopenglfunctions_3_1.cpp
index a459ddf244..9328f5ca89 100644
--- a/src/gui/opengl/qopenglfunctions_3_1.cpp
+++ b/src/gui/opengl/qopenglfunctions_3_1.cpp
@@ -82,36 +82,46 @@ QOpenGLFunctions_3_1::QOpenGLFunctions_3_1()
QOpenGLFunctions_3_1::~QOpenGLFunctions_3_1()
{
- if (d_1_0_Core)
+ if (d_1_0_Core) {
d_1_0_Core->refs.deref();
- Q_ASSERT(d_1_0_Core->refs.load());
- if (d_1_1_Core)
+ Q_ASSERT(d_1_0_Core->refs.load());
+ }
+ if (d_1_1_Core) {
d_1_1_Core->refs.deref();
- Q_ASSERT(d_1_1_Core->refs.load());
- if (d_1_2_Core)
+ Q_ASSERT(d_1_1_Core->refs.load());
+ }
+ if (d_1_2_Core) {
d_1_2_Core->refs.deref();
- Q_ASSERT(d_1_2_Core->refs.load());
- if (d_1_3_Core)
+ Q_ASSERT(d_1_2_Core->refs.load());
+ }
+ if (d_1_3_Core) {
d_1_3_Core->refs.deref();
- Q_ASSERT(d_1_3_Core->refs.load());
- if (d_1_4_Core)
+ Q_ASSERT(d_1_3_Core->refs.load());
+ }
+ if (d_1_4_Core) {
d_1_4_Core->refs.deref();
- Q_ASSERT(d_1_4_Core->refs.load());
- if (d_1_5_Core)
+ Q_ASSERT(d_1_4_Core->refs.load());
+ }
+ if (d_1_5_Core) {
d_1_5_Core->refs.deref();
- Q_ASSERT(d_1_5_Core->refs.load());
- if (d_2_0_Core)
+ Q_ASSERT(d_1_5_Core->refs.load());
+ }
+ if (d_2_0_Core) {
d_2_0_Core->refs.deref();
- Q_ASSERT(d_2_0_Core->refs.load());
- if (d_2_1_Core)
+ Q_ASSERT(d_2_0_Core->refs.load());
+ }
+ if (d_2_1_Core) {
d_2_1_Core->refs.deref();
- Q_ASSERT(d_2_1_Core->refs.load());
- if (d_3_0_Core)
+ Q_ASSERT(d_2_1_Core->refs.load());
+ }
+ if (d_3_0_Core) {
d_3_0_Core->refs.deref();
- Q_ASSERT(d_3_0_Core->refs.load());
- if (d_3_1_Core)
+ Q_ASSERT(d_3_0_Core->refs.load());
+ }
+ if (d_3_1_Core) {
d_3_1_Core->refs.deref();
- Q_ASSERT(d_3_1_Core->refs.load());
+ Q_ASSERT(d_3_1_Core->refs.load());
+ }
}
bool QOpenGLFunctions_3_1::initializeOpenGLFunctions()
diff --git a/src/gui/opengl/qopenglfunctions_3_1.h b/src/gui/opengl/qopenglfunctions_3_1.h
index d5957381e9..2691dd29e7 100644
--- a/src/gui/opengl/qopenglfunctions_3_1.h
+++ b/src/gui/opengl/qopenglfunctions_3_1.h
@@ -50,7 +50,7 @@
#ifndef QOPENGLVERSIONFUNCTIONS_3_1_H
#define QOPENGLVERSIONFUNCTIONS_3_1_H
-#include <QtCore/qglobal.h>
+#include <QtGui/qtguiglobal.h>
#if !defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_2)
diff --git a/src/gui/opengl/qopenglfunctions_3_2_compatibility.cpp b/src/gui/opengl/qopenglfunctions_3_2_compatibility.cpp
index 09402db09a..b90a123bfe 100644
--- a/src/gui/opengl/qopenglfunctions_3_2_compatibility.cpp
+++ b/src/gui/opengl/qopenglfunctions_3_2_compatibility.cpp
@@ -90,54 +90,70 @@ QOpenGLFunctions_3_2_Compatibility::QOpenGLFunctions_3_2_Compatibility()
QOpenGLFunctions_3_2_Compatibility::~QOpenGLFunctions_3_2_Compatibility()
{
- if (d_1_0_Core)
+ if (d_1_0_Core) {
d_1_0_Core->refs.deref();
- Q_ASSERT(d_1_0_Core->refs.load());
- if (d_1_1_Core)
+ Q_ASSERT(d_1_0_Core->refs.load());
+ }
+ if (d_1_1_Core) {
d_1_1_Core->refs.deref();
- Q_ASSERT(d_1_1_Core->refs.load());
- if (d_1_2_Core)
+ Q_ASSERT(d_1_1_Core->refs.load());
+ }
+ if (d_1_2_Core) {
d_1_2_Core->refs.deref();
- Q_ASSERT(d_1_2_Core->refs.load());
- if (d_1_3_Core)
+ Q_ASSERT(d_1_2_Core->refs.load());
+ }
+ if (d_1_3_Core) {
d_1_3_Core->refs.deref();
- Q_ASSERT(d_1_3_Core->refs.load());
- if (d_1_4_Core)
+ Q_ASSERT(d_1_3_Core->refs.load());
+ }
+ if (d_1_4_Core) {
d_1_4_Core->refs.deref();
- Q_ASSERT(d_1_4_Core->refs.load());
- if (d_1_5_Core)
+ Q_ASSERT(d_1_4_Core->refs.load());
+ }
+ if (d_1_5_Core) {
d_1_5_Core->refs.deref();
- Q_ASSERT(d_1_5_Core->refs.load());
- if (d_2_0_Core)
+ Q_ASSERT(d_1_5_Core->refs.load());
+ }
+ if (d_2_0_Core) {
d_2_0_Core->refs.deref();
- Q_ASSERT(d_2_0_Core->refs.load());
- if (d_2_1_Core)
+ Q_ASSERT(d_2_0_Core->refs.load());
+ }
+ if (d_2_1_Core) {
d_2_1_Core->refs.deref();
- Q_ASSERT(d_2_1_Core->refs.load());
- if (d_3_0_Core)
+ Q_ASSERT(d_2_1_Core->refs.load());
+ }
+ if (d_3_0_Core) {
d_3_0_Core->refs.deref();
- Q_ASSERT(d_3_0_Core->refs.load());
- if (d_3_1_Core)
+ Q_ASSERT(d_3_0_Core->refs.load());
+ }
+ if (d_3_1_Core) {
d_3_1_Core->refs.deref();
- Q_ASSERT(d_3_1_Core->refs.load());
- if (d_3_2_Core)
+ Q_ASSERT(d_3_1_Core->refs.load());
+ }
+ if (d_3_2_Core) {
d_3_2_Core->refs.deref();
- Q_ASSERT(d_3_2_Core->refs.load());
- if (d_1_0_Deprecated)
+ Q_ASSERT(d_3_2_Core->refs.load());
+ }
+ if (d_1_0_Deprecated) {
d_1_0_Deprecated->refs.deref();
- Q_ASSERT(d_1_0_Deprecated->refs.load());
- if (d_1_1_Deprecated)
+ Q_ASSERT(d_1_0_Deprecated->refs.load());
+ }
+ if (d_1_1_Deprecated) {
d_1_1_Deprecated->refs.deref();
- Q_ASSERT(d_1_1_Deprecated->refs.load());
- if (d_1_2_Deprecated)
+ Q_ASSERT(d_1_1_Deprecated->refs.load());
+ }
+ if (d_1_2_Deprecated) {
d_1_2_Deprecated->refs.deref();
- Q_ASSERT(d_1_2_Deprecated->refs.load());
- if (d_1_3_Deprecated)
+ Q_ASSERT(d_1_2_Deprecated->refs.load());
+ }
+ if (d_1_3_Deprecated) {
d_1_3_Deprecated->refs.deref();
- Q_ASSERT(d_1_3_Deprecated->refs.load());
- if (d_1_4_Deprecated)
+ Q_ASSERT(d_1_3_Deprecated->refs.load());
+ }
+ if (d_1_4_Deprecated) {
d_1_4_Deprecated->refs.deref();
- Q_ASSERT(d_1_4_Deprecated->refs.load());
+ Q_ASSERT(d_1_4_Deprecated->refs.load());
+ }
}
bool QOpenGLFunctions_3_2_Compatibility::initializeOpenGLFunctions()
diff --git a/src/gui/opengl/qopenglfunctions_3_2_compatibility.h b/src/gui/opengl/qopenglfunctions_3_2_compatibility.h
index 44fa6759e5..9f34190721 100644
--- a/src/gui/opengl/qopenglfunctions_3_2_compatibility.h
+++ b/src/gui/opengl/qopenglfunctions_3_2_compatibility.h
@@ -50,7 +50,7 @@
#ifndef QOPENGLVERSIONFUNCTIONS_3_2_COMPATIBILITY_H
#define QOPENGLVERSIONFUNCTIONS_3_2_COMPATIBILITY_H
-#include <QtCore/qglobal.h>
+#include <QtGui/qtguiglobal.h>
#if !defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_2)
diff --git a/src/gui/opengl/qopenglfunctions_3_2_core.cpp b/src/gui/opengl/qopenglfunctions_3_2_core.cpp
index 177dc9e25d..02c0c78b01 100644
--- a/src/gui/opengl/qopenglfunctions_3_2_core.cpp
+++ b/src/gui/opengl/qopenglfunctions_3_2_core.cpp
@@ -83,39 +83,50 @@ QOpenGLFunctions_3_2_Core::QOpenGLFunctions_3_2_Core()
QOpenGLFunctions_3_2_Core::~QOpenGLFunctions_3_2_Core()
{
- if (d_1_0_Core)
+ if (d_1_0_Core) {
d_1_0_Core->refs.deref();
- Q_ASSERT(d_1_0_Core->refs.load());
- if (d_1_1_Core)
+ Q_ASSERT(d_1_0_Core->refs.load());
+ }
+ if (d_1_1_Core) {
d_1_1_Core->refs.deref();
- Q_ASSERT(d_1_1_Core->refs.load());
- if (d_1_2_Core)
+ Q_ASSERT(d_1_1_Core->refs.load());
+ }
+ if (d_1_2_Core) {
d_1_2_Core->refs.deref();
- Q_ASSERT(d_1_2_Core->refs.load());
- if (d_1_3_Core)
+ Q_ASSERT(d_1_2_Core->refs.load());
+ }
+ if (d_1_3_Core) {
d_1_3_Core->refs.deref();
- Q_ASSERT(d_1_3_Core->refs.load());
- if (d_1_4_Core)
+ Q_ASSERT(d_1_3_Core->refs.load());
+ }
+ if (d_1_4_Core) {
d_1_4_Core->refs.deref();
- Q_ASSERT(d_1_4_Core->refs.load());
- if (d_1_5_Core)
+ Q_ASSERT(d_1_4_Core->refs.load());
+ }
+ if (d_1_5_Core) {
d_1_5_Core->refs.deref();
- Q_ASSERT(d_1_5_Core->refs.load());
- if (d_2_0_Core)
+ Q_ASSERT(d_1_5_Core->refs.load());
+ }
+ if (d_2_0_Core) {
d_2_0_Core->refs.deref();
- Q_ASSERT(d_2_0_Core->refs.load());
- if (d_2_1_Core)
+ Q_ASSERT(d_2_0_Core->refs.load());
+ }
+ if (d_2_1_Core) {
d_2_1_Core->refs.deref();
- Q_ASSERT(d_2_1_Core->refs.load());
- if (d_3_0_Core)
+ Q_ASSERT(d_2_1_Core->refs.load());
+ }
+ if (d_3_0_Core) {
d_3_0_Core->refs.deref();
- Q_ASSERT(d_3_0_Core->refs.load());
- if (d_3_1_Core)
+ Q_ASSERT(d_3_0_Core->refs.load());
+ }
+ if (d_3_1_Core) {
d_3_1_Core->refs.deref();
- Q_ASSERT(d_3_1_Core->refs.load());
- if (d_3_2_Core)
+ Q_ASSERT(d_3_1_Core->refs.load());
+ }
+ if (d_3_2_Core) {
d_3_2_Core->refs.deref();
- Q_ASSERT(d_3_2_Core->refs.load());
+ Q_ASSERT(d_3_2_Core->refs.load());
+ }
}
bool QOpenGLFunctions_3_2_Core::initializeOpenGLFunctions()
diff --git a/src/gui/opengl/qopenglfunctions_3_2_core.h b/src/gui/opengl/qopenglfunctions_3_2_core.h
index 36f959c04b..2d5ee14bee 100644
--- a/src/gui/opengl/qopenglfunctions_3_2_core.h
+++ b/src/gui/opengl/qopenglfunctions_3_2_core.h
@@ -50,7 +50,7 @@
#ifndef QOPENGLVERSIONFUNCTIONS_3_2_CORE_H
#define QOPENGLVERSIONFUNCTIONS_3_2_CORE_H
-#include <QtCore/qglobal.h>
+#include <QtGui/qtguiglobal.h>
#if !defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_2)
diff --git a/src/gui/opengl/qopenglfunctions_3_3_compatibility.cpp b/src/gui/opengl/qopenglfunctions_3_3_compatibility.cpp
index 110a49ea53..c585f0fc7c 100644
--- a/src/gui/opengl/qopenglfunctions_3_3_compatibility.cpp
+++ b/src/gui/opengl/qopenglfunctions_3_3_compatibility.cpp
@@ -91,60 +91,78 @@ QOpenGLFunctions_3_3_Compatibility::QOpenGLFunctions_3_3_Compatibility()
QOpenGLFunctions_3_3_Compatibility::~QOpenGLFunctions_3_3_Compatibility()
{
- if (d_1_0_Core)
+ if (d_1_0_Core) {
d_1_0_Core->refs.deref();
- Q_ASSERT(d_1_0_Core->refs.load());
- if (d_1_1_Core)
+ Q_ASSERT(d_1_0_Core->refs.load());
+ }
+ if (d_1_1_Core) {
d_1_1_Core->refs.deref();
- Q_ASSERT(d_1_1_Core->refs.load());
- if (d_1_2_Core)
+ Q_ASSERT(d_1_1_Core->refs.load());
+ }
+ if (d_1_2_Core) {
d_1_2_Core->refs.deref();
- Q_ASSERT(d_1_2_Core->refs.load());
- if (d_1_3_Core)
+ Q_ASSERT(d_1_2_Core->refs.load());
+ }
+ if (d_1_3_Core) {
d_1_3_Core->refs.deref();
- Q_ASSERT(d_1_3_Core->refs.load());
- if (d_1_4_Core)
+ Q_ASSERT(d_1_3_Core->refs.load());
+ }
+ if (d_1_4_Core) {
d_1_4_Core->refs.deref();
- Q_ASSERT(d_1_4_Core->refs.load());
- if (d_1_5_Core)
+ Q_ASSERT(d_1_4_Core->refs.load());
+ }
+ if (d_1_5_Core) {
d_1_5_Core->refs.deref();
- Q_ASSERT(d_1_5_Core->refs.load());
- if (d_2_0_Core)
+ Q_ASSERT(d_1_5_Core->refs.load());
+ }
+ if (d_2_0_Core) {
d_2_0_Core->refs.deref();
- Q_ASSERT(d_2_0_Core->refs.load());
- if (d_2_1_Core)
+ Q_ASSERT(d_2_0_Core->refs.load());
+ }
+ if (d_2_1_Core) {
d_2_1_Core->refs.deref();
- Q_ASSERT(d_2_1_Core->refs.load());
- if (d_3_0_Core)
+ Q_ASSERT(d_2_1_Core->refs.load());
+ }
+ if (d_3_0_Core) {
d_3_0_Core->refs.deref();
- Q_ASSERT(d_3_0_Core->refs.load());
- if (d_3_1_Core)
+ Q_ASSERT(d_3_0_Core->refs.load());
+ }
+ if (d_3_1_Core) {
d_3_1_Core->refs.deref();
- Q_ASSERT(d_3_1_Core->refs.load());
- if (d_3_2_Core)
+ Q_ASSERT(d_3_1_Core->refs.load());
+ }
+ if (d_3_2_Core) {
d_3_2_Core->refs.deref();
- Q_ASSERT(d_3_2_Core->refs.load());
- if (d_3_3_Core)
+ Q_ASSERT(d_3_2_Core->refs.load());
+ }
+ if (d_3_3_Core) {
d_3_3_Core->refs.deref();
- Q_ASSERT(d_3_3_Core->refs.load());
- if (d_1_0_Deprecated)
+ Q_ASSERT(d_3_3_Core->refs.load());
+ }
+ if (d_1_0_Deprecated) {
d_1_0_Deprecated->refs.deref();
- Q_ASSERT(d_1_0_Deprecated->refs.load());
- if (d_1_1_Deprecated)
+ Q_ASSERT(d_1_0_Deprecated->refs.load());
+ }
+ if (d_1_1_Deprecated) {
d_1_1_Deprecated->refs.deref();
- Q_ASSERT(d_1_1_Deprecated->refs.load());
- if (d_1_2_Deprecated)
+ Q_ASSERT(d_1_1_Deprecated->refs.load());
+ }
+ if (d_1_2_Deprecated) {
d_1_2_Deprecated->refs.deref();
- Q_ASSERT(d_1_2_Deprecated->refs.load());
- if (d_1_3_Deprecated)
+ Q_ASSERT(d_1_2_Deprecated->refs.load());
+ }
+ if (d_1_3_Deprecated) {
d_1_3_Deprecated->refs.deref();
- Q_ASSERT(d_1_3_Deprecated->refs.load());
- if (d_1_4_Deprecated)
+ Q_ASSERT(d_1_3_Deprecated->refs.load());
+ }
+ if (d_1_4_Deprecated) {
d_1_4_Deprecated->refs.deref();
- Q_ASSERT(d_1_4_Deprecated->refs.load());
- if (d_3_3_Deprecated)
+ Q_ASSERT(d_1_4_Deprecated->refs.load());
+ }
+ if (d_3_3_Deprecated) {
d_3_3_Deprecated->refs.deref();
- Q_ASSERT(d_3_3_Deprecated->refs.load());
+ Q_ASSERT(d_3_3_Deprecated->refs.load());
+ }
}
bool QOpenGLFunctions_3_3_Compatibility::initializeOpenGLFunctions()
diff --git a/src/gui/opengl/qopenglfunctions_3_3_compatibility.h b/src/gui/opengl/qopenglfunctions_3_3_compatibility.h
index 126cc16858..a5c0cab63c 100644
--- a/src/gui/opengl/qopenglfunctions_3_3_compatibility.h
+++ b/src/gui/opengl/qopenglfunctions_3_3_compatibility.h
@@ -50,7 +50,7 @@
#ifndef QOPENGLVERSIONFUNCTIONS_3_3_COMPATIBILITY_H
#define QOPENGLVERSIONFUNCTIONS_3_3_COMPATIBILITY_H
-#include <QtCore/qglobal.h>
+#include <QtGui/qtguiglobal.h>
#if !defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_2)
diff --git a/src/gui/opengl/qopenglfunctions_3_3_core.cpp b/src/gui/opengl/qopenglfunctions_3_3_core.cpp
index 2e706724d9..7779d92b6a 100644
--- a/src/gui/opengl/qopenglfunctions_3_3_core.cpp
+++ b/src/gui/opengl/qopenglfunctions_3_3_core.cpp
@@ -84,42 +84,54 @@ QOpenGLFunctions_3_3_Core::QOpenGLFunctions_3_3_Core()
QOpenGLFunctions_3_3_Core::~QOpenGLFunctions_3_3_Core()
{
- if (d_1_0_Core)
+ if (d_1_0_Core) {
d_1_0_Core->refs.deref();
- Q_ASSERT(d_1_0_Core->refs.load());
- if (d_1_1_Core)
+ Q_ASSERT(d_1_0_Core->refs.load());
+ }
+ if (d_1_1_Core) {
d_1_1_Core->refs.deref();
- Q_ASSERT(d_1_1_Core->refs.load());
- if (d_1_2_Core)
+ Q_ASSERT(d_1_1_Core->refs.load());
+ }
+ if (d_1_2_Core) {
d_1_2_Core->refs.deref();
- Q_ASSERT(d_1_2_Core->refs.load());
- if (d_1_3_Core)
+ Q_ASSERT(d_1_2_Core->refs.load());
+ }
+ if (d_1_3_Core) {
d_1_3_Core->refs.deref();
- Q_ASSERT(d_1_3_Core->refs.load());
- if (d_1_4_Core)
+ Q_ASSERT(d_1_3_Core->refs.load());
+ }
+ if (d_1_4_Core) {
d_1_4_Core->refs.deref();
- Q_ASSERT(d_1_4_Core->refs.load());
- if (d_1_5_Core)
+ Q_ASSERT(d_1_4_Core->refs.load());
+ }
+ if (d_1_5_Core) {
d_1_5_Core->refs.deref();
- Q_ASSERT(d_1_5_Core->refs.load());
- if (d_2_0_Core)
+ Q_ASSERT(d_1_5_Core->refs.load());
+ }
+ if (d_2_0_Core) {
d_2_0_Core->refs.deref();
- Q_ASSERT(d_2_0_Core->refs.load());
- if (d_2_1_Core)
+ Q_ASSERT(d_2_0_Core->refs.load());
+ }
+ if (d_2_1_Core) {
d_2_1_Core->refs.deref();
- Q_ASSERT(d_2_1_Core->refs.load());
- if (d_3_0_Core)
+ Q_ASSERT(d_2_1_Core->refs.load());
+ }
+ if (d_3_0_Core) {
d_3_0_Core->refs.deref();
- Q_ASSERT(d_3_0_Core->refs.load());
- if (d_3_1_Core)
+ Q_ASSERT(d_3_0_Core->refs.load());
+ }
+ if (d_3_1_Core) {
d_3_1_Core->refs.deref();
- Q_ASSERT(d_3_1_Core->refs.load());
- if (d_3_2_Core)
+ Q_ASSERT(d_3_1_Core->refs.load());
+ }
+ if (d_3_2_Core) {
d_3_2_Core->refs.deref();
- Q_ASSERT(d_3_2_Core->refs.load());
- if (d_3_3_Core)
+ Q_ASSERT(d_3_2_Core->refs.load());
+ }
+ if (d_3_3_Core) {
d_3_3_Core->refs.deref();
- Q_ASSERT(d_3_3_Core->refs.load());
+ Q_ASSERT(d_3_3_Core->refs.load());
+ }
}
bool QOpenGLFunctions_3_3_Core::initializeOpenGLFunctions()
diff --git a/src/gui/opengl/qopenglfunctions_3_3_core.h b/src/gui/opengl/qopenglfunctions_3_3_core.h
index 15a62802ab..4f0132d959 100644
--- a/src/gui/opengl/qopenglfunctions_3_3_core.h
+++ b/src/gui/opengl/qopenglfunctions_3_3_core.h
@@ -50,7 +50,7 @@
#ifndef QOPENGLVERSIONFUNCTIONS_3_3_CORE_H
#define QOPENGLVERSIONFUNCTIONS_3_3_CORE_H
-#include <QtCore/qglobal.h>
+#include <QtGui/qtguiglobal.h>
#if !defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_2)
diff --git a/src/gui/opengl/qopenglfunctions_4_0_compatibility.cpp b/src/gui/opengl/qopenglfunctions_4_0_compatibility.cpp
index 14fb168c94..b5c423ef0c 100644
--- a/src/gui/opengl/qopenglfunctions_4_0_compatibility.cpp
+++ b/src/gui/opengl/qopenglfunctions_4_0_compatibility.cpp
@@ -92,63 +92,82 @@ QOpenGLFunctions_4_0_Compatibility::QOpenGLFunctions_4_0_Compatibility()
QOpenGLFunctions_4_0_Compatibility::~QOpenGLFunctions_4_0_Compatibility()
{
- if (d_1_0_Core)
+ if (d_1_0_Core) {
d_1_0_Core->refs.deref();
- Q_ASSERT(d_1_0_Core->refs.load());
- if (d_1_1_Core)
+ Q_ASSERT(d_1_0_Core->refs.load());
+ }
+ if (d_1_1_Core) {
d_1_1_Core->refs.deref();
- Q_ASSERT(d_1_1_Core->refs.load());
- if (d_1_2_Core)
+ Q_ASSERT(d_1_1_Core->refs.load());
+ }
+ if (d_1_2_Core) {
d_1_2_Core->refs.deref();
- Q_ASSERT(d_1_2_Core->refs.load());
- if (d_1_3_Core)
+ Q_ASSERT(d_1_2_Core->refs.load());
+ }
+ if (d_1_3_Core) {
d_1_3_Core->refs.deref();
- Q_ASSERT(d_1_3_Core->refs.load());
- if (d_1_4_Core)
+ Q_ASSERT(d_1_3_Core->refs.load());
+ }
+ if (d_1_4_Core) {
d_1_4_Core->refs.deref();
- Q_ASSERT(d_1_4_Core->refs.load());
- if (d_1_5_Core)
+ Q_ASSERT(d_1_4_Core->refs.load());
+ }
+ if (d_1_5_Core) {
d_1_5_Core->refs.deref();
- Q_ASSERT(d_1_5_Core->refs.load());
- if (d_2_0_Core)
+ Q_ASSERT(d_1_5_Core->refs.load());
+ }
+ if (d_2_0_Core) {
d_2_0_Core->refs.deref();
- Q_ASSERT(d_2_0_Core->refs.load());
- if (d_2_1_Core)
+ Q_ASSERT(d_2_0_Core->refs.load());
+ }
+ if (d_2_1_Core) {
d_2_1_Core->refs.deref();
- Q_ASSERT(d_2_1_Core->refs.load());
- if (d_3_0_Core)
+ Q_ASSERT(d_2_1_Core->refs.load());
+ }
+ if (d_3_0_Core) {
d_3_0_Core->refs.deref();
- Q_ASSERT(d_3_0_Core->refs.load());
- if (d_3_1_Core)
+ Q_ASSERT(d_3_0_Core->refs.load());
+ }
+ if (d_3_1_Core) {
d_3_1_Core->refs.deref();
- Q_ASSERT(d_3_1_Core->refs.load());
- if (d_3_2_Core)
+ Q_ASSERT(d_3_1_Core->refs.load());
+ }
+ if (d_3_2_Core) {
d_3_2_Core->refs.deref();
- Q_ASSERT(d_3_2_Core->refs.load());
- if (d_3_3_Core)
+ Q_ASSERT(d_3_2_Core->refs.load());
+ }
+ if (d_3_3_Core) {
d_3_3_Core->refs.deref();
- Q_ASSERT(d_3_3_Core->refs.load());
- if (d_4_0_Core)
+ Q_ASSERT(d_3_3_Core->refs.load());
+ }
+ if (d_4_0_Core) {
d_4_0_Core->refs.deref();
- Q_ASSERT(d_4_0_Core->refs.load());
- if (d_1_0_Deprecated)
+ Q_ASSERT(d_4_0_Core->refs.load());
+ }
+ if (d_1_0_Deprecated) {
d_1_0_Deprecated->refs.deref();
- Q_ASSERT(d_1_0_Deprecated->refs.load());
- if (d_1_1_Deprecated)
+ Q_ASSERT(d_1_0_Deprecated->refs.load());
+ }
+ if (d_1_1_Deprecated) {
d_1_1_Deprecated->refs.deref();
- Q_ASSERT(d_1_1_Deprecated->refs.load());
- if (d_1_2_Deprecated)
+ Q_ASSERT(d_1_1_Deprecated->refs.load());
+ }
+ if (d_1_2_Deprecated) {
d_1_2_Deprecated->refs.deref();
- Q_ASSERT(d_1_2_Deprecated->refs.load());
- if (d_1_3_Deprecated)
+ Q_ASSERT(d_1_2_Deprecated->refs.load());
+ }
+ if (d_1_3_Deprecated) {
d_1_3_Deprecated->refs.deref();
- Q_ASSERT(d_1_3_Deprecated->refs.load());
- if (d_1_4_Deprecated)
+ Q_ASSERT(d_1_3_Deprecated->refs.load());
+ }
+ if (d_1_4_Deprecated) {
d_1_4_Deprecated->refs.deref();
- Q_ASSERT(d_1_4_Deprecated->refs.load());
- if (d_3_3_Deprecated)
+ Q_ASSERT(d_1_4_Deprecated->refs.load());
+ }
+ if (d_3_3_Deprecated) {
d_3_3_Deprecated->refs.deref();
- Q_ASSERT(d_3_3_Deprecated->refs.load());
+ Q_ASSERT(d_3_3_Deprecated->refs.load());
+ }
}
bool QOpenGLFunctions_4_0_Compatibility::initializeOpenGLFunctions()
diff --git a/src/gui/opengl/qopenglfunctions_4_0_compatibility.h b/src/gui/opengl/qopenglfunctions_4_0_compatibility.h
index 9ca6eb8a36..1fa5e8a361 100644
--- a/src/gui/opengl/qopenglfunctions_4_0_compatibility.h
+++ b/src/gui/opengl/qopenglfunctions_4_0_compatibility.h
@@ -50,7 +50,7 @@
#ifndef QOPENGLVERSIONFUNCTIONS_4_0_COMPATIBILITY_H
#define QOPENGLVERSIONFUNCTIONS_4_0_COMPATIBILITY_H
-#include <QtCore/qglobal.h>
+#include <QtGui/qtguiglobal.h>
#if !defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_2)
diff --git a/src/gui/opengl/qopenglfunctions_4_0_core.cpp b/src/gui/opengl/qopenglfunctions_4_0_core.cpp
index 6dc94153c8..4e4e8cc547 100644
--- a/src/gui/opengl/qopenglfunctions_4_0_core.cpp
+++ b/src/gui/opengl/qopenglfunctions_4_0_core.cpp
@@ -85,45 +85,58 @@ QOpenGLFunctions_4_0_Core::QOpenGLFunctions_4_0_Core()
QOpenGLFunctions_4_0_Core::~QOpenGLFunctions_4_0_Core()
{
- if (d_1_0_Core)
+ if (d_1_0_Core) {
d_1_0_Core->refs.deref();
- Q_ASSERT(d_1_0_Core->refs.load());
- if (d_1_1_Core)
+ Q_ASSERT(d_1_0_Core->refs.load());
+ }
+ if (d_1_1_Core) {
d_1_1_Core->refs.deref();
- Q_ASSERT(d_1_1_Core->refs.load());
- if (d_1_2_Core)
+ Q_ASSERT(d_1_1_Core->refs.load());
+ }
+ if (d_1_2_Core) {
d_1_2_Core->refs.deref();
- Q_ASSERT(d_1_2_Core->refs.load());
- if (d_1_3_Core)
+ Q_ASSERT(d_1_2_Core->refs.load());
+ }
+ if (d_1_3_Core) {
d_1_3_Core->refs.deref();
- Q_ASSERT(d_1_3_Core->refs.load());
- if (d_1_4_Core)
+ Q_ASSERT(d_1_3_Core->refs.load());
+ }
+ if (d_1_4_Core) {
d_1_4_Core->refs.deref();
- Q_ASSERT(d_1_4_Core->refs.load());
- if (d_1_5_Core)
+ Q_ASSERT(d_1_4_Core->refs.load());
+ }
+ if (d_1_5_Core) {
d_1_5_Core->refs.deref();
- Q_ASSERT(d_1_5_Core->refs.load());
- if (d_2_0_Core)
+ Q_ASSERT(d_1_5_Core->refs.load());
+ }
+ if (d_2_0_Core) {
d_2_0_Core->refs.deref();
- Q_ASSERT(d_2_0_Core->refs.load());
- if (d_2_1_Core)
+ Q_ASSERT(d_2_0_Core->refs.load());
+ }
+ if (d_2_1_Core) {
d_2_1_Core->refs.deref();
- Q_ASSERT(d_2_1_Core->refs.load());
- if (d_3_0_Core)
+ Q_ASSERT(d_2_1_Core->refs.load());
+ }
+ if (d_3_0_Core) {
d_3_0_Core->refs.deref();
- Q_ASSERT(d_3_0_Core->refs.load());
- if (d_3_1_Core)
+ Q_ASSERT(d_3_0_Core->refs.load());
+ }
+ if (d_3_1_Core) {
d_3_1_Core->refs.deref();
- Q_ASSERT(d_3_1_Core->refs.load());
- if (d_3_2_Core)
+ Q_ASSERT(d_3_1_Core->refs.load());
+ }
+ if (d_3_2_Core) {
d_3_2_Core->refs.deref();
- Q_ASSERT(d_3_2_Core->refs.load());
- if (d_3_3_Core)
+ Q_ASSERT(d_3_2_Core->refs.load());
+ }
+ if (d_3_3_Core) {
d_3_3_Core->refs.deref();
- Q_ASSERT(d_3_3_Core->refs.load());
- if (d_4_0_Core)
+ Q_ASSERT(d_3_3_Core->refs.load());
+ }
+ if (d_4_0_Core) {
d_4_0_Core->refs.deref();
- Q_ASSERT(d_4_0_Core->refs.load());
+ Q_ASSERT(d_4_0_Core->refs.load());
+ }
}
bool QOpenGLFunctions_4_0_Core::initializeOpenGLFunctions()
diff --git a/src/gui/opengl/qopenglfunctions_4_0_core.h b/src/gui/opengl/qopenglfunctions_4_0_core.h
index c3e1e9ce5a..8fd2af2d04 100644
--- a/src/gui/opengl/qopenglfunctions_4_0_core.h
+++ b/src/gui/opengl/qopenglfunctions_4_0_core.h
@@ -50,7 +50,7 @@
#ifndef QOPENGLVERSIONFUNCTIONS_4_0_CORE_H
#define QOPENGLVERSIONFUNCTIONS_4_0_CORE_H
-#include <QtCore/qglobal.h>
+#include <QtGui/qtguiglobal.h>
#if !defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_2)
diff --git a/src/gui/opengl/qopenglfunctions_4_1_compatibility.cpp b/src/gui/opengl/qopenglfunctions_4_1_compatibility.cpp
index 293409ddef..72c60c74b7 100644
--- a/src/gui/opengl/qopenglfunctions_4_1_compatibility.cpp
+++ b/src/gui/opengl/qopenglfunctions_4_1_compatibility.cpp
@@ -93,66 +93,86 @@ QOpenGLFunctions_4_1_Compatibility::QOpenGLFunctions_4_1_Compatibility()
QOpenGLFunctions_4_1_Compatibility::~QOpenGLFunctions_4_1_Compatibility()
{
- if (d_1_0_Core)
+ if (d_1_0_Core) {
d_1_0_Core->refs.deref();
- Q_ASSERT(d_1_0_Core->refs.load());
- if (d_1_1_Core)
+ Q_ASSERT(d_1_0_Core->refs.load());
+ }
+ if (d_1_1_Core) {
d_1_1_Core->refs.deref();
- Q_ASSERT(d_1_1_Core->refs.load());
- if (d_1_2_Core)
+ Q_ASSERT(d_1_1_Core->refs.load());
+ }
+ if (d_1_2_Core) {
d_1_2_Core->refs.deref();
- Q_ASSERT(d_1_2_Core->refs.load());
- if (d_1_3_Core)
+ Q_ASSERT(d_1_2_Core->refs.load());
+ }
+ if (d_1_3_Core) {
d_1_3_Core->refs.deref();
- Q_ASSERT(d_1_3_Core->refs.load());
- if (d_1_4_Core)
+ Q_ASSERT(d_1_3_Core->refs.load());
+ }
+ if (d_1_4_Core) {
d_1_4_Core->refs.deref();
- Q_ASSERT(d_1_4_Core->refs.load());
- if (d_1_5_Core)
+ Q_ASSERT(d_1_4_Core->refs.load());
+ }
+ if (d_1_5_Core) {
d_1_5_Core->refs.deref();
- Q_ASSERT(d_1_5_Core->refs.load());
- if (d_2_0_Core)
+ Q_ASSERT(d_1_5_Core->refs.load());
+ }
+ if (d_2_0_Core) {
d_2_0_Core->refs.deref();
- Q_ASSERT(d_2_0_Core->refs.load());
- if (d_2_1_Core)
+ Q_ASSERT(d_2_0_Core->refs.load());
+ }
+ if (d_2_1_Core) {
d_2_1_Core->refs.deref();
- Q_ASSERT(d_2_1_Core->refs.load());
- if (d_3_0_Core)
+ Q_ASSERT(d_2_1_Core->refs.load());
+ }
+ if (d_3_0_Core) {
d_3_0_Core->refs.deref();
- Q_ASSERT(d_3_0_Core->refs.load());
- if (d_3_1_Core)
+ Q_ASSERT(d_3_0_Core->refs.load());
+ }
+ if (d_3_1_Core) {
d_3_1_Core->refs.deref();
- Q_ASSERT(d_3_1_Core->refs.load());
- if (d_3_2_Core)
+ Q_ASSERT(d_3_1_Core->refs.load());
+ }
+ if (d_3_2_Core) {
d_3_2_Core->refs.deref();
- Q_ASSERT(d_3_2_Core->refs.load());
- if (d_3_3_Core)
+ Q_ASSERT(d_3_2_Core->refs.load());
+ }
+ if (d_3_3_Core) {
d_3_3_Core->refs.deref();
- Q_ASSERT(d_3_3_Core->refs.load());
- if (d_4_0_Core)
+ Q_ASSERT(d_3_3_Core->refs.load());
+ }
+ if (d_4_0_Core) {
d_4_0_Core->refs.deref();
- Q_ASSERT(d_4_0_Core->refs.load());
- if (d_4_1_Core)
+ Q_ASSERT(d_4_0_Core->refs.load());
+ }
+ if (d_4_1_Core) {
d_4_1_Core->refs.deref();
- Q_ASSERT(d_4_1_Core->refs.load());
- if (d_1_0_Deprecated)
+ Q_ASSERT(d_4_1_Core->refs.load());
+ }
+ if (d_1_0_Deprecated) {
d_1_0_Deprecated->refs.deref();
- Q_ASSERT(d_1_0_Deprecated->refs.load());
- if (d_1_1_Deprecated)
+ Q_ASSERT(d_1_0_Deprecated->refs.load());
+ }
+ if (d_1_1_Deprecated) {
d_1_1_Deprecated->refs.deref();
- Q_ASSERT(d_1_1_Deprecated->refs.load());
- if (d_1_2_Deprecated)
+ Q_ASSERT(d_1_1_Deprecated->refs.load());
+ }
+ if (d_1_2_Deprecated) {
d_1_2_Deprecated->refs.deref();
- Q_ASSERT(d_1_2_Deprecated->refs.load());
- if (d_1_3_Deprecated)
+ Q_ASSERT(d_1_2_Deprecated->refs.load());
+ }
+ if (d_1_3_Deprecated) {
d_1_3_Deprecated->refs.deref();
- Q_ASSERT(d_1_3_Deprecated->refs.load());
- if (d_1_4_Deprecated)
+ Q_ASSERT(d_1_3_Deprecated->refs.load());
+ }
+ if (d_1_4_Deprecated) {
d_1_4_Deprecated->refs.deref();
- Q_ASSERT(d_1_4_Deprecated->refs.load());
- if (d_3_3_Deprecated)
+ Q_ASSERT(d_1_4_Deprecated->refs.load());
+ }
+ if (d_3_3_Deprecated) {
d_3_3_Deprecated->refs.deref();
- Q_ASSERT(d_3_3_Deprecated->refs.load());
+ Q_ASSERT(d_3_3_Deprecated->refs.load());
+ }
}
bool QOpenGLFunctions_4_1_Compatibility::initializeOpenGLFunctions()
diff --git a/src/gui/opengl/qopenglfunctions_4_1_compatibility.h b/src/gui/opengl/qopenglfunctions_4_1_compatibility.h
index e06803f0aa..a284f8e6d3 100644
--- a/src/gui/opengl/qopenglfunctions_4_1_compatibility.h
+++ b/src/gui/opengl/qopenglfunctions_4_1_compatibility.h
@@ -50,7 +50,7 @@
#ifndef QOPENGLVERSIONFUNCTIONS_4_1_COMPATIBILITY_H
#define QOPENGLVERSIONFUNCTIONS_4_1_COMPATIBILITY_H
-#include <QtCore/qglobal.h>
+#include <QtGui/qtguiglobal.h>
#if !defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_2)
diff --git a/src/gui/opengl/qopenglfunctions_4_1_core.cpp b/src/gui/opengl/qopenglfunctions_4_1_core.cpp
index ff3d191781..5a1e1eb42f 100644
--- a/src/gui/opengl/qopenglfunctions_4_1_core.cpp
+++ b/src/gui/opengl/qopenglfunctions_4_1_core.cpp
@@ -86,48 +86,62 @@ QOpenGLFunctions_4_1_Core::QOpenGLFunctions_4_1_Core()
QOpenGLFunctions_4_1_Core::~QOpenGLFunctions_4_1_Core()
{
- if (d_1_0_Core)
+ if (d_1_0_Core) {
d_1_0_Core->refs.deref();
- Q_ASSERT(d_1_0_Core->refs.load());
- if (d_1_1_Core)
+ Q_ASSERT(d_1_0_Core->refs.load());
+ }
+ if (d_1_1_Core) {
d_1_1_Core->refs.deref();
- Q_ASSERT(d_1_1_Core->refs.load());
- if (d_1_2_Core)
+ Q_ASSERT(d_1_1_Core->refs.load());
+ }
+ if (d_1_2_Core) {
d_1_2_Core->refs.deref();
- Q_ASSERT(d_1_2_Core->refs.load());
- if (d_1_3_Core)
+ Q_ASSERT(d_1_2_Core->refs.load());
+ }
+ if (d_1_3_Core) {
d_1_3_Core->refs.deref();
- Q_ASSERT(d_1_3_Core->refs.load());
- if (d_1_4_Core)
+ Q_ASSERT(d_1_3_Core->refs.load());
+ }
+ if (d_1_4_Core) {
d_1_4_Core->refs.deref();
- Q_ASSERT(d_1_4_Core->refs.load());
- if (d_1_5_Core)
+ Q_ASSERT(d_1_4_Core->refs.load());
+ }
+ if (d_1_5_Core) {
d_1_5_Core->refs.deref();
- Q_ASSERT(d_1_5_Core->refs.load());
- if (d_2_0_Core)
+ Q_ASSERT(d_1_5_Core->refs.load());
+ }
+ if (d_2_0_Core) {
d_2_0_Core->refs.deref();
- Q_ASSERT(d_2_0_Core->refs.load());
- if (d_2_1_Core)
+ Q_ASSERT(d_2_0_Core->refs.load());
+ }
+ if (d_2_1_Core) {
d_2_1_Core->refs.deref();
- Q_ASSERT(d_2_1_Core->refs.load());
- if (d_3_0_Core)
+ Q_ASSERT(d_2_1_Core->refs.load());
+ }
+ if (d_3_0_Core) {
d_3_0_Core->refs.deref();
- Q_ASSERT(d_3_0_Core->refs.load());
- if (d_3_1_Core)
+ Q_ASSERT(d_3_0_Core->refs.load());
+ }
+ if (d_3_1_Core) {
d_3_1_Core->refs.deref();
- Q_ASSERT(d_3_1_Core->refs.load());
- if (d_3_2_Core)
+ Q_ASSERT(d_3_1_Core->refs.load());
+ }
+ if (d_3_2_Core) {
d_3_2_Core->refs.deref();
- Q_ASSERT(d_3_2_Core->refs.load());
- if (d_3_3_Core)
+ Q_ASSERT(d_3_2_Core->refs.load());
+ }
+ if (d_3_3_Core) {
d_3_3_Core->refs.deref();
- Q_ASSERT(d_3_3_Core->refs.load());
- if (d_4_0_Core)
+ Q_ASSERT(d_3_3_Core->refs.load());
+ }
+ if (d_4_0_Core) {
d_4_0_Core->refs.deref();
- Q_ASSERT(d_4_0_Core->refs.load());
- if (d_4_1_Core)
+ Q_ASSERT(d_4_0_Core->refs.load());
+ }
+ if (d_4_1_Core) {
d_4_1_Core->refs.deref();
- Q_ASSERT(d_4_1_Core->refs.load());
+ Q_ASSERT(d_4_1_Core->refs.load());
+ }
}
bool QOpenGLFunctions_4_1_Core::initializeOpenGLFunctions()
diff --git a/src/gui/opengl/qopenglfunctions_4_1_core.h b/src/gui/opengl/qopenglfunctions_4_1_core.h
index 17d922e261..d35db3c839 100644
--- a/src/gui/opengl/qopenglfunctions_4_1_core.h
+++ b/src/gui/opengl/qopenglfunctions_4_1_core.h
@@ -50,7 +50,7 @@
#ifndef QOPENGLVERSIONFUNCTIONS_4_1_CORE_H
#define QOPENGLVERSIONFUNCTIONS_4_1_CORE_H
-#include <QtCore/qglobal.h>
+#include <QtGui/qtguiglobal.h>
#if !defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_2)
diff --git a/src/gui/opengl/qopenglfunctions_4_2_compatibility.cpp b/src/gui/opengl/qopenglfunctions_4_2_compatibility.cpp
index 58527e92b5..8398ef0948 100644
--- a/src/gui/opengl/qopenglfunctions_4_2_compatibility.cpp
+++ b/src/gui/opengl/qopenglfunctions_4_2_compatibility.cpp
@@ -94,69 +94,90 @@ QOpenGLFunctions_4_2_Compatibility::QOpenGLFunctions_4_2_Compatibility()
QOpenGLFunctions_4_2_Compatibility::~QOpenGLFunctions_4_2_Compatibility()
{
- if (d_1_0_Core)
+ if (d_1_0_Core) {
d_1_0_Core->refs.deref();
- Q_ASSERT(d_1_0_Core->refs.load());
- if (d_1_1_Core)
+ Q_ASSERT(d_1_0_Core->refs.load());
+ }
+ if (d_1_1_Core) {
d_1_1_Core->refs.deref();
- Q_ASSERT(d_1_1_Core->refs.load());
- if (d_1_2_Core)
+ Q_ASSERT(d_1_1_Core->refs.load());
+ }
+ if (d_1_2_Core) {
d_1_2_Core->refs.deref();
- Q_ASSERT(d_1_2_Core->refs.load());
- if (d_1_3_Core)
+ Q_ASSERT(d_1_2_Core->refs.load());
+ }
+ if (d_1_3_Core) {
d_1_3_Core->refs.deref();
- Q_ASSERT(d_1_3_Core->refs.load());
- if (d_1_4_Core)
+ Q_ASSERT(d_1_3_Core->refs.load());
+ }
+ if (d_1_4_Core) {
d_1_4_Core->refs.deref();
- Q_ASSERT(d_1_4_Core->refs.load());
- if (d_1_5_Core)
+ Q_ASSERT(d_1_4_Core->refs.load());
+ }
+ if (d_1_5_Core) {
d_1_5_Core->refs.deref();
- Q_ASSERT(d_1_5_Core->refs.load());
- if (d_2_0_Core)
+ Q_ASSERT(d_1_5_Core->refs.load());
+ }
+ if (d_2_0_Core) {
d_2_0_Core->refs.deref();
- Q_ASSERT(d_2_0_Core->refs.load());
- if (d_2_1_Core)
+ Q_ASSERT(d_2_0_Core->refs.load());
+ }
+ if (d_2_1_Core) {
d_2_1_Core->refs.deref();
- Q_ASSERT(d_2_1_Core->refs.load());
- if (d_3_0_Core)
+ Q_ASSERT(d_2_1_Core->refs.load());
+ }
+ if (d_3_0_Core) {
d_3_0_Core->refs.deref();
- Q_ASSERT(d_3_0_Core->refs.load());
- if (d_3_1_Core)
+ Q_ASSERT(d_3_0_Core->refs.load());
+ }
+ if (d_3_1_Core) {
d_3_1_Core->refs.deref();
- Q_ASSERT(d_3_1_Core->refs.load());
- if (d_3_2_Core)
+ Q_ASSERT(d_3_1_Core->refs.load());
+ }
+ if (d_3_2_Core) {
d_3_2_Core->refs.deref();
- Q_ASSERT(d_3_2_Core->refs.load());
- if (d_3_3_Core)
+ Q_ASSERT(d_3_2_Core->refs.load());
+ }
+ if (d_3_3_Core) {
d_3_3_Core->refs.deref();
- Q_ASSERT(d_3_3_Core->refs.load());
- if (d_4_0_Core)
+ Q_ASSERT(d_3_3_Core->refs.load());
+ }
+ if (d_4_0_Core) {
d_4_0_Core->refs.deref();
- Q_ASSERT(d_4_0_Core->refs.load());
- if (d_4_1_Core)
+ Q_ASSERT(d_4_0_Core->refs.load());
+ }
+ if (d_4_1_Core) {
d_4_1_Core->refs.deref();
- Q_ASSERT(d_4_1_Core->refs.load());
- if (d_4_2_Core)
+ Q_ASSERT(d_4_1_Core->refs.load());
+ }
+ if (d_4_2_Core) {
d_4_2_Core->refs.deref();
- Q_ASSERT(d_4_2_Core->refs.load());
- if (d_1_0_Deprecated)
+ Q_ASSERT(d_4_2_Core->refs.load());
+ }
+ if (d_1_0_Deprecated) {
d_1_0_Deprecated->refs.deref();
- Q_ASSERT(d_1_0_Deprecated->refs.load());
- if (d_1_1_Deprecated)
+ Q_ASSERT(d_1_0_Deprecated->refs.load());
+ }
+ if (d_1_1_Deprecated) {
d_1_1_Deprecated->refs.deref();
- Q_ASSERT(d_1_1_Deprecated->refs.load());
- if (d_1_2_Deprecated)
+ Q_ASSERT(d_1_1_Deprecated->refs.load());
+ }
+ if (d_1_2_Deprecated) {
d_1_2_Deprecated->refs.deref();
- Q_ASSERT(d_1_2_Deprecated->refs.load());
- if (d_1_3_Deprecated)
+ Q_ASSERT(d_1_2_Deprecated->refs.load());
+ }
+ if (d_1_3_Deprecated) {
d_1_3_Deprecated->refs.deref();
- Q_ASSERT(d_1_3_Deprecated->refs.load());
- if (d_1_4_Deprecated)
+ Q_ASSERT(d_1_3_Deprecated->refs.load());
+ }
+ if (d_1_4_Deprecated) {
d_1_4_Deprecated->refs.deref();
- Q_ASSERT(d_1_4_Deprecated->refs.load());
- if (d_3_3_Deprecated)
+ Q_ASSERT(d_1_4_Deprecated->refs.load());
+ }
+ if (d_3_3_Deprecated) {
d_3_3_Deprecated->refs.deref();
- Q_ASSERT(d_3_3_Deprecated->refs.load());
+ Q_ASSERT(d_3_3_Deprecated->refs.load());
+ }
}
bool QOpenGLFunctions_4_2_Compatibility::initializeOpenGLFunctions()
diff --git a/src/gui/opengl/qopenglfunctions_4_2_compatibility.h b/src/gui/opengl/qopenglfunctions_4_2_compatibility.h
index cb95c39936..7b45859984 100644
--- a/src/gui/opengl/qopenglfunctions_4_2_compatibility.h
+++ b/src/gui/opengl/qopenglfunctions_4_2_compatibility.h
@@ -50,7 +50,7 @@
#ifndef QOPENGLVERSIONFUNCTIONS_4_2_COMPATIBILITY_H
#define QOPENGLVERSIONFUNCTIONS_4_2_COMPATIBILITY_H
-#include <QtCore/qglobal.h>
+#include <QtGui/qtguiglobal.h>
#if !defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_2)
diff --git a/src/gui/opengl/qopenglfunctions_4_2_core.cpp b/src/gui/opengl/qopenglfunctions_4_2_core.cpp
index b929abcf6a..fdfb4db455 100644
--- a/src/gui/opengl/qopenglfunctions_4_2_core.cpp
+++ b/src/gui/opengl/qopenglfunctions_4_2_core.cpp
@@ -87,51 +87,66 @@ QOpenGLFunctions_4_2_Core::QOpenGLFunctions_4_2_Core()
QOpenGLFunctions_4_2_Core::~QOpenGLFunctions_4_2_Core()
{
- if (d_1_0_Core)
+ if (d_1_0_Core) {
d_1_0_Core->refs.deref();
- Q_ASSERT(d_1_0_Core->refs.load());
- if (d_1_1_Core)
+ Q_ASSERT(d_1_0_Core->refs.load());
+ }
+ if (d_1_1_Core) {
d_1_1_Core->refs.deref();
- Q_ASSERT(d_1_1_Core->refs.load());
- if (d_1_2_Core)
+ Q_ASSERT(d_1_1_Core->refs.load());
+ }
+ if (d_1_2_Core) {
d_1_2_Core->refs.deref();
- Q_ASSERT(d_1_2_Core->refs.load());
- if (d_1_3_Core)
+ Q_ASSERT(d_1_2_Core->refs.load());
+ }
+ if (d_1_3_Core) {
d_1_3_Core->refs.deref();
- Q_ASSERT(d_1_3_Core->refs.load());
- if (d_1_4_Core)
+ Q_ASSERT(d_1_3_Core->refs.load());
+ }
+ if (d_1_4_Core) {
d_1_4_Core->refs.deref();
- Q_ASSERT(d_1_4_Core->refs.load());
- if (d_1_5_Core)
+ Q_ASSERT(d_1_4_Core->refs.load());
+ }
+ if (d_1_5_Core) {
d_1_5_Core->refs.deref();
- Q_ASSERT(d_1_5_Core->refs.load());
- if (d_2_0_Core)
+ Q_ASSERT(d_1_5_Core->refs.load());
+ }
+ if (d_2_0_Core) {
d_2_0_Core->refs.deref();
- Q_ASSERT(d_2_0_Core->refs.load());
- if (d_2_1_Core)
+ Q_ASSERT(d_2_0_Core->refs.load());
+ }
+ if (d_2_1_Core) {
d_2_1_Core->refs.deref();
- Q_ASSERT(d_2_1_Core->refs.load());
- if (d_3_0_Core)
+ Q_ASSERT(d_2_1_Core->refs.load());
+ }
+ if (d_3_0_Core) {
d_3_0_Core->refs.deref();
- Q_ASSERT(d_3_0_Core->refs.load());
- if (d_3_1_Core)
+ Q_ASSERT(d_3_0_Core->refs.load());
+ }
+ if (d_3_1_Core) {
d_3_1_Core->refs.deref();
- Q_ASSERT(d_3_1_Core->refs.load());
- if (d_3_2_Core)
+ Q_ASSERT(d_3_1_Core->refs.load());
+ }
+ if (d_3_2_Core) {
d_3_2_Core->refs.deref();
- Q_ASSERT(d_3_2_Core->refs.load());
- if (d_3_3_Core)
+ Q_ASSERT(d_3_2_Core->refs.load());
+ }
+ if (d_3_3_Core) {
d_3_3_Core->refs.deref();
- Q_ASSERT(d_3_3_Core->refs.load());
- if (d_4_0_Core)
+ Q_ASSERT(d_3_3_Core->refs.load());
+ }
+ if (d_4_0_Core) {
d_4_0_Core->refs.deref();
- Q_ASSERT(d_4_0_Core->refs.load());
- if (d_4_1_Core)
+ Q_ASSERT(d_4_0_Core->refs.load());
+ }
+ if (d_4_1_Core) {
d_4_1_Core->refs.deref();
- Q_ASSERT(d_4_1_Core->refs.load());
- if (d_4_2_Core)
+ Q_ASSERT(d_4_1_Core->refs.load());
+ }
+ if (d_4_2_Core) {
d_4_2_Core->refs.deref();
- Q_ASSERT(d_4_2_Core->refs.load());
+ Q_ASSERT(d_4_2_Core->refs.load());
+ }
}
bool QOpenGLFunctions_4_2_Core::initializeOpenGLFunctions()
diff --git a/src/gui/opengl/qopenglfunctions_4_2_core.h b/src/gui/opengl/qopenglfunctions_4_2_core.h
index 14b748b3f5..80bb33e7d8 100644
--- a/src/gui/opengl/qopenglfunctions_4_2_core.h
+++ b/src/gui/opengl/qopenglfunctions_4_2_core.h
@@ -50,7 +50,7 @@
#ifndef QOPENGLVERSIONFUNCTIONS_4_2_CORE_H
#define QOPENGLVERSIONFUNCTIONS_4_2_CORE_H
-#include <QtCore/qglobal.h>
+#include <QtGui/qtguiglobal.h>
#if !defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_2)
diff --git a/src/gui/opengl/qopenglfunctions_4_3_compatibility.cpp b/src/gui/opengl/qopenglfunctions_4_3_compatibility.cpp
index a9f15083ad..19e67c6331 100644
--- a/src/gui/opengl/qopenglfunctions_4_3_compatibility.cpp
+++ b/src/gui/opengl/qopenglfunctions_4_3_compatibility.cpp
@@ -95,72 +95,94 @@ QOpenGLFunctions_4_3_Compatibility::QOpenGLFunctions_4_3_Compatibility()
QOpenGLFunctions_4_3_Compatibility::~QOpenGLFunctions_4_3_Compatibility()
{
- if (d_1_0_Core)
+ if (d_1_0_Core) {
d_1_0_Core->refs.deref();
- Q_ASSERT(d_1_0_Core->refs.load());
- if (d_1_1_Core)
+ Q_ASSERT(d_1_0_Core->refs.load());
+ }
+ if (d_1_1_Core) {
d_1_1_Core->refs.deref();
- Q_ASSERT(d_1_1_Core->refs.load());
- if (d_1_2_Core)
+ Q_ASSERT(d_1_1_Core->refs.load());
+ }
+ if (d_1_2_Core) {
d_1_2_Core->refs.deref();
- Q_ASSERT(d_1_2_Core->refs.load());
- if (d_1_3_Core)
+ Q_ASSERT(d_1_2_Core->refs.load());
+ }
+ if (d_1_3_Core) {
d_1_3_Core->refs.deref();
- Q_ASSERT(d_1_3_Core->refs.load());
- if (d_1_4_Core)
+ Q_ASSERT(d_1_3_Core->refs.load());
+ }
+ if (d_1_4_Core) {
d_1_4_Core->refs.deref();
- Q_ASSERT(d_1_4_Core->refs.load());
- if (d_1_5_Core)
+ Q_ASSERT(d_1_4_Core->refs.load());
+ }
+ if (d_1_5_Core) {
d_1_5_Core->refs.deref();
- Q_ASSERT(d_1_5_Core->refs.load());
- if (d_2_0_Core)
+ Q_ASSERT(d_1_5_Core->refs.load());
+ }
+ if (d_2_0_Core) {
d_2_0_Core->refs.deref();
- Q_ASSERT(d_2_0_Core->refs.load());
- if (d_2_1_Core)
+ Q_ASSERT(d_2_0_Core->refs.load());
+ }
+ if (d_2_1_Core) {
d_2_1_Core->refs.deref();
- Q_ASSERT(d_2_1_Core->refs.load());
- if (d_3_0_Core)
+ Q_ASSERT(d_2_1_Core->refs.load());
+ }
+ if (d_3_0_Core) {
d_3_0_Core->refs.deref();
- Q_ASSERT(d_3_0_Core->refs.load());
- if (d_3_1_Core)
+ Q_ASSERT(d_3_0_Core->refs.load());
+ }
+ if (d_3_1_Core) {
d_3_1_Core->refs.deref();
- Q_ASSERT(d_3_1_Core->refs.load());
- if (d_3_2_Core)
+ Q_ASSERT(d_3_1_Core->refs.load());
+ }
+ if (d_3_2_Core) {
d_3_2_Core->refs.deref();
- Q_ASSERT(d_3_2_Core->refs.load());
- if (d_3_3_Core)
+ Q_ASSERT(d_3_2_Core->refs.load());
+ }
+ if (d_3_3_Core) {
d_3_3_Core->refs.deref();
- Q_ASSERT(d_3_3_Core->refs.load());
- if (d_4_0_Core)
+ Q_ASSERT(d_3_3_Core->refs.load());
+ }
+ if (d_4_0_Core) {
d_4_0_Core->refs.deref();
- Q_ASSERT(d_4_0_Core->refs.load());
- if (d_4_1_Core)
+ Q_ASSERT(d_4_0_Core->refs.load());
+ }
+ if (d_4_1_Core) {
d_4_1_Core->refs.deref();
- Q_ASSERT(d_4_1_Core->refs.load());
- if (d_4_2_Core)
+ Q_ASSERT(d_4_1_Core->refs.load());
+ }
+ if (d_4_2_Core) {
d_4_2_Core->refs.deref();
- Q_ASSERT(d_4_2_Core->refs.load());
- if (d_4_3_Core)
+ Q_ASSERT(d_4_2_Core->refs.load());
+ }
+ if (d_4_3_Core) {
d_4_3_Core->refs.deref();
- Q_ASSERT(d_4_3_Core->refs.load());
- if (d_1_0_Deprecated)
+ Q_ASSERT(d_4_3_Core->refs.load());
+ }
+ if (d_1_0_Deprecated) {
d_1_0_Deprecated->refs.deref();
- Q_ASSERT(d_1_0_Deprecated->refs.load());
- if (d_1_1_Deprecated)
+ Q_ASSERT(d_1_0_Deprecated->refs.load());
+ }
+ if (d_1_1_Deprecated) {
d_1_1_Deprecated->refs.deref();
- Q_ASSERT(d_1_1_Deprecated->refs.load());
- if (d_1_2_Deprecated)
+ Q_ASSERT(d_1_1_Deprecated->refs.load());
+ }
+ if (d_1_2_Deprecated) {
d_1_2_Deprecated->refs.deref();
- Q_ASSERT(d_1_2_Deprecated->refs.load());
- if (d_1_3_Deprecated)
+ Q_ASSERT(d_1_2_Deprecated->refs.load());
+ }
+ if (d_1_3_Deprecated) {
d_1_3_Deprecated->refs.deref();
- Q_ASSERT(d_1_3_Deprecated->refs.load());
- if (d_1_4_Deprecated)
+ Q_ASSERT(d_1_3_Deprecated->refs.load());
+ }
+ if (d_1_4_Deprecated) {
d_1_4_Deprecated->refs.deref();
- Q_ASSERT(d_1_4_Deprecated->refs.load());
- if (d_3_3_Deprecated)
+ Q_ASSERT(d_1_4_Deprecated->refs.load());
+ }
+ if (d_3_3_Deprecated) {
d_3_3_Deprecated->refs.deref();
- Q_ASSERT(d_3_3_Deprecated->refs.load());
+ Q_ASSERT(d_3_3_Deprecated->refs.load());
+ }
}
bool QOpenGLFunctions_4_3_Compatibility::initializeOpenGLFunctions()
diff --git a/src/gui/opengl/qopenglfunctions_4_3_compatibility.h b/src/gui/opengl/qopenglfunctions_4_3_compatibility.h
index 33d3065500..515467a38d 100644
--- a/src/gui/opengl/qopenglfunctions_4_3_compatibility.h
+++ b/src/gui/opengl/qopenglfunctions_4_3_compatibility.h
@@ -50,7 +50,7 @@
#ifndef QOPENGLVERSIONFUNCTIONS_4_3_COMPATIBILITY_H
#define QOPENGLVERSIONFUNCTIONS_4_3_COMPATIBILITY_H
-#include <QtCore/qglobal.h>
+#include <QtGui/qtguiglobal.h>
#if !defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_2)
diff --git a/src/gui/opengl/qopenglfunctions_4_3_core.cpp b/src/gui/opengl/qopenglfunctions_4_3_core.cpp
index d3f988ba0d..95e2d7bc43 100644
--- a/src/gui/opengl/qopenglfunctions_4_3_core.cpp
+++ b/src/gui/opengl/qopenglfunctions_4_3_core.cpp
@@ -88,54 +88,70 @@ QOpenGLFunctions_4_3_Core::QOpenGLFunctions_4_3_Core()
QOpenGLFunctions_4_3_Core::~QOpenGLFunctions_4_3_Core()
{
- if (d_1_0_Core)
+ if (d_1_0_Core) {
d_1_0_Core->refs.deref();
- Q_ASSERT(d_1_0_Core->refs.load());
- if (d_1_1_Core)
+ Q_ASSERT(d_1_0_Core->refs.load());
+ }
+ if (d_1_1_Core) {
d_1_1_Core->refs.deref();
- Q_ASSERT(d_1_1_Core->refs.load());
- if (d_1_2_Core)
+ Q_ASSERT(d_1_1_Core->refs.load());
+ }
+ if (d_1_2_Core) {
d_1_2_Core->refs.deref();
- Q_ASSERT(d_1_2_Core->refs.load());
- if (d_1_3_Core)
+ Q_ASSERT(d_1_2_Core->refs.load());
+ }
+ if (d_1_3_Core) {
d_1_3_Core->refs.deref();
- Q_ASSERT(d_1_3_Core->refs.load());
- if (d_1_4_Core)
+ Q_ASSERT(d_1_3_Core->refs.load());
+ }
+ if (d_1_4_Core) {
d_1_4_Core->refs.deref();
- Q_ASSERT(d_1_4_Core->refs.load());
- if (d_1_5_Core)
+ Q_ASSERT(d_1_4_Core->refs.load());
+ }
+ if (d_1_5_Core) {
d_1_5_Core->refs.deref();
- Q_ASSERT(d_1_5_Core->refs.load());
- if (d_2_0_Core)
+ Q_ASSERT(d_1_5_Core->refs.load());
+ }
+ if (d_2_0_Core) {
d_2_0_Core->refs.deref();
- Q_ASSERT(d_2_0_Core->refs.load());
- if (d_2_1_Core)
+ Q_ASSERT(d_2_0_Core->refs.load());
+ }
+ if (d_2_1_Core) {
d_2_1_Core->refs.deref();
- Q_ASSERT(d_2_1_Core->refs.load());
- if (d_3_0_Core)
+ Q_ASSERT(d_2_1_Core->refs.load());
+ }
+ if (d_3_0_Core) {
d_3_0_Core->refs.deref();
- Q_ASSERT(d_3_0_Core->refs.load());
- if (d_3_1_Core)
+ Q_ASSERT(d_3_0_Core->refs.load());
+ }
+ if (d_3_1_Core) {
d_3_1_Core->refs.deref();
- Q_ASSERT(d_3_1_Core->refs.load());
- if (d_3_2_Core)
+ Q_ASSERT(d_3_1_Core->refs.load());
+ }
+ if (d_3_2_Core) {
d_3_2_Core->refs.deref();
- Q_ASSERT(d_3_2_Core->refs.load());
- if (d_3_3_Core)
+ Q_ASSERT(d_3_2_Core->refs.load());
+ }
+ if (d_3_3_Core) {
d_3_3_Core->refs.deref();
- Q_ASSERT(d_3_3_Core->refs.load());
- if (d_4_0_Core)
+ Q_ASSERT(d_3_3_Core->refs.load());
+ }
+ if (d_4_0_Core) {
d_4_0_Core->refs.deref();
- Q_ASSERT(d_4_0_Core->refs.load());
- if (d_4_1_Core)
+ Q_ASSERT(d_4_0_Core->refs.load());
+ }
+ if (d_4_1_Core) {
d_4_1_Core->refs.deref();
- Q_ASSERT(d_4_1_Core->refs.load());
- if (d_4_2_Core)
+ Q_ASSERT(d_4_1_Core->refs.load());
+ }
+ if (d_4_2_Core) {
d_4_2_Core->refs.deref();
- Q_ASSERT(d_4_2_Core->refs.load());
- if (d_4_3_Core)
+ Q_ASSERT(d_4_2_Core->refs.load());
+ }
+ if (d_4_3_Core) {
d_4_3_Core->refs.deref();
- Q_ASSERT(d_4_3_Core->refs.load());
+ Q_ASSERT(d_4_3_Core->refs.load());
+ }
}
bool QOpenGLFunctions_4_3_Core::initializeOpenGLFunctions()
diff --git a/src/gui/opengl/qopenglfunctions_4_3_core.h b/src/gui/opengl/qopenglfunctions_4_3_core.h
index 7e18292bb0..4a700c36d7 100644
--- a/src/gui/opengl/qopenglfunctions_4_3_core.h
+++ b/src/gui/opengl/qopenglfunctions_4_3_core.h
@@ -50,7 +50,7 @@
#ifndef QOPENGLVERSIONFUNCTIONS_4_3_CORE_H
#define QOPENGLVERSIONFUNCTIONS_4_3_CORE_H
-#include <QtCore/qglobal.h>
+#include <QtGui/qtguiglobal.h>
#if !defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_2)
diff --git a/src/gui/opengl/qopenglfunctions_4_4_compatibility.cpp b/src/gui/opengl/qopenglfunctions_4_4_compatibility.cpp
index 8cbb94c1a1..a33efd0b95 100644
--- a/src/gui/opengl/qopenglfunctions_4_4_compatibility.cpp
+++ b/src/gui/opengl/qopenglfunctions_4_4_compatibility.cpp
@@ -95,75 +95,98 @@ QOpenGLFunctions_4_4_Compatibility::QOpenGLFunctions_4_4_Compatibility()
QOpenGLFunctions_4_4_Compatibility::~QOpenGLFunctions_4_4_Compatibility()
{
- if (d_1_0_Core)
+ if (d_1_0_Core) {
d_1_0_Core->refs.deref();
- Q_ASSERT(d_1_0_Core->refs.load());
- if (d_1_1_Core)
+ Q_ASSERT(d_1_0_Core->refs.load());
+ }
+ if (d_1_1_Core) {
d_1_1_Core->refs.deref();
- Q_ASSERT(d_1_1_Core->refs.load());
- if (d_1_2_Core)
+ Q_ASSERT(d_1_1_Core->refs.load());
+ }
+ if (d_1_2_Core) {
d_1_2_Core->refs.deref();
- Q_ASSERT(d_1_2_Core->refs.load());
- if (d_1_3_Core)
+ Q_ASSERT(d_1_2_Core->refs.load());
+ }
+ if (d_1_3_Core) {
d_1_3_Core->refs.deref();
- Q_ASSERT(d_1_3_Core->refs.load());
- if (d_1_4_Core)
+ Q_ASSERT(d_1_3_Core->refs.load());
+ }
+ if (d_1_4_Core) {
d_1_4_Core->refs.deref();
- Q_ASSERT(d_1_4_Core->refs.load());
- if (d_1_5_Core)
+ Q_ASSERT(d_1_4_Core->refs.load());
+ }
+ if (d_1_5_Core) {
d_1_5_Core->refs.deref();
- Q_ASSERT(d_1_5_Core->refs.load());
- if (d_2_0_Core)
+ Q_ASSERT(d_1_5_Core->refs.load());
+ }
+ if (d_2_0_Core) {
d_2_0_Core->refs.deref();
- Q_ASSERT(d_2_0_Core->refs.load());
- if (d_2_1_Core)
+ Q_ASSERT(d_2_0_Core->refs.load());
+ }
+ if (d_2_1_Core) {
d_2_1_Core->refs.deref();
- Q_ASSERT(d_2_1_Core->refs.load());
- if (d_3_0_Core)
+ Q_ASSERT(d_2_1_Core->refs.load());
+ }
+ if (d_3_0_Core) {
d_3_0_Core->refs.deref();
- Q_ASSERT(d_3_0_Core->refs.load());
- if (d_3_1_Core)
+ Q_ASSERT(d_3_0_Core->refs.load());
+ }
+ if (d_3_1_Core) {
d_3_1_Core->refs.deref();
- Q_ASSERT(d_3_1_Core->refs.load());
- if (d_3_2_Core)
+ Q_ASSERT(d_3_1_Core->refs.load());
+ }
+ if (d_3_2_Core) {
d_3_2_Core->refs.deref();
- Q_ASSERT(d_3_2_Core->refs.load());
- if (d_3_3_Core)
+ Q_ASSERT(d_3_2_Core->refs.load());
+ }
+ if (d_3_3_Core) {
d_3_3_Core->refs.deref();
- Q_ASSERT(d_3_3_Core->refs.load());
- if (d_4_0_Core)
+ Q_ASSERT(d_3_3_Core->refs.load());
+ }
+ if (d_4_0_Core) {
d_4_0_Core->refs.deref();
- Q_ASSERT(d_4_0_Core->refs.load());
- if (d_4_1_Core)
+ Q_ASSERT(d_4_0_Core->refs.load());
+ }
+ if (d_4_1_Core) {
d_4_1_Core->refs.deref();
- Q_ASSERT(d_4_1_Core->refs.load());
- if (d_4_2_Core)
+ Q_ASSERT(d_4_1_Core->refs.load());
+ }
+ if (d_4_2_Core) {
d_4_2_Core->refs.deref();
- Q_ASSERT(d_4_2_Core->refs.load());
- if (d_4_3_Core)
+ Q_ASSERT(d_4_2_Core->refs.load());
+ }
+ if (d_4_3_Core) {
d_4_3_Core->refs.deref();
- Q_ASSERT(d_4_3_Core->refs.load());
- if (d_4_4_Core)
+ Q_ASSERT(d_4_3_Core->refs.load());
+ }
+ if (d_4_4_Core) {
d_4_4_Core->refs.deref();
- Q_ASSERT(d_4_4_Core->refs.load());
- if (d_1_0_Deprecated)
+ Q_ASSERT(d_4_4_Core->refs.load());
+ }
+ if (d_1_0_Deprecated) {
d_1_0_Deprecated->refs.deref();
- Q_ASSERT(d_1_0_Deprecated->refs.load());
- if (d_1_1_Deprecated)
+ Q_ASSERT(d_1_0_Deprecated->refs.load());
+ }
+ if (d_1_1_Deprecated) {
d_1_1_Deprecated->refs.deref();
- Q_ASSERT(d_1_1_Deprecated->refs.load());
- if (d_1_2_Deprecated)
+ Q_ASSERT(d_1_1_Deprecated->refs.load());
+ }
+ if (d_1_2_Deprecated) {
d_1_2_Deprecated->refs.deref();
- Q_ASSERT(d_1_2_Deprecated->refs.load());
- if (d_1_3_Deprecated)
+ Q_ASSERT(d_1_2_Deprecated->refs.load());
+ }
+ if (d_1_3_Deprecated) {
d_1_3_Deprecated->refs.deref();
- Q_ASSERT(d_1_3_Deprecated->refs.load());
- if (d_1_4_Deprecated)
+ Q_ASSERT(d_1_3_Deprecated->refs.load());
+ }
+ if (d_1_4_Deprecated) {
d_1_4_Deprecated->refs.deref();
- Q_ASSERT(d_1_4_Deprecated->refs.load());
- if (d_3_3_Deprecated)
+ Q_ASSERT(d_1_4_Deprecated->refs.load());
+ }
+ if (d_3_3_Deprecated) {
d_3_3_Deprecated->refs.deref();
- Q_ASSERT(d_3_3_Deprecated->refs.load());
+ Q_ASSERT(d_3_3_Deprecated->refs.load());
+ }
}
bool QOpenGLFunctions_4_4_Compatibility::initializeOpenGLFunctions()
diff --git a/src/gui/opengl/qopenglfunctions_4_4_compatibility.h b/src/gui/opengl/qopenglfunctions_4_4_compatibility.h
index d369ff27ff..f2d640cdaf 100644
--- a/src/gui/opengl/qopenglfunctions_4_4_compatibility.h
+++ b/src/gui/opengl/qopenglfunctions_4_4_compatibility.h
@@ -50,7 +50,7 @@
#ifndef QOPENGLVERSIONFUNCTIONS_4_4_COMPATIBILITY_H
#define QOPENGLVERSIONFUNCTIONS_4_4_COMPATIBILITY_H
-#include <QtCore/qglobal.h>
+#include <QtGui/qtguiglobal.h>
#if !defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_2)
diff --git a/src/gui/opengl/qopenglfunctions_4_4_core.cpp b/src/gui/opengl/qopenglfunctions_4_4_core.cpp
index 95bfc3a438..019a70087a 100644
--- a/src/gui/opengl/qopenglfunctions_4_4_core.cpp
+++ b/src/gui/opengl/qopenglfunctions_4_4_core.cpp
@@ -89,57 +89,74 @@ QOpenGLFunctions_4_4_Core::QOpenGLFunctions_4_4_Core()
QOpenGLFunctions_4_4_Core::~QOpenGLFunctions_4_4_Core()
{
- if (d_1_0_Core)
+ if (d_1_0_Core) {
d_1_0_Core->refs.deref();
- Q_ASSERT(d_1_0_Core->refs.load());
- if (d_1_1_Core)
+ Q_ASSERT(d_1_0_Core->refs.load());
+ }
+ if (d_1_1_Core) {
d_1_1_Core->refs.deref();
- Q_ASSERT(d_1_1_Core->refs.load());
- if (d_1_2_Core)
+ Q_ASSERT(d_1_1_Core->refs.load());
+ }
+ if (d_1_2_Core) {
d_1_2_Core->refs.deref();
- Q_ASSERT(d_1_2_Core->refs.load());
- if (d_1_3_Core)
+ Q_ASSERT(d_1_2_Core->refs.load());
+ }
+ if (d_1_3_Core) {
d_1_3_Core->refs.deref();
- Q_ASSERT(d_1_3_Core->refs.load());
- if (d_1_4_Core)
+ Q_ASSERT(d_1_3_Core->refs.load());
+ }
+ if (d_1_4_Core) {
d_1_4_Core->refs.deref();
- Q_ASSERT(d_1_4_Core->refs.load());
- if (d_1_5_Core)
+ Q_ASSERT(d_1_4_Core->refs.load());
+ }
+ if (d_1_5_Core) {
d_1_5_Core->refs.deref();
- Q_ASSERT(d_1_5_Core->refs.load());
- if (d_2_0_Core)
+ Q_ASSERT(d_1_5_Core->refs.load());
+ }
+ if (d_2_0_Core) {
d_2_0_Core->refs.deref();
- Q_ASSERT(d_2_0_Core->refs.load());
- if (d_2_1_Core)
+ Q_ASSERT(d_2_0_Core->refs.load());
+ }
+ if (d_2_1_Core) {
d_2_1_Core->refs.deref();
- Q_ASSERT(d_2_1_Core->refs.load());
- if (d_3_0_Core)
+ Q_ASSERT(d_2_1_Core->refs.load());
+ }
+ if (d_3_0_Core) {
d_3_0_Core->refs.deref();
- Q_ASSERT(d_3_0_Core->refs.load());
- if (d_3_1_Core)
+ Q_ASSERT(d_3_0_Core->refs.load());
+ }
+ if (d_3_1_Core) {
d_3_1_Core->refs.deref();
- Q_ASSERT(d_3_1_Core->refs.load());
- if (d_3_2_Core)
+ Q_ASSERT(d_3_1_Core->refs.load());
+ }
+ if (d_3_2_Core) {
d_3_2_Core->refs.deref();
- Q_ASSERT(d_3_2_Core->refs.load());
- if (d_3_3_Core)
+ Q_ASSERT(d_3_2_Core->refs.load());
+ }
+ if (d_3_3_Core) {
d_3_3_Core->refs.deref();
- Q_ASSERT(d_3_3_Core->refs.load());
- if (d_4_0_Core)
+ Q_ASSERT(d_3_3_Core->refs.load());
+ }
+ if (d_4_0_Core) {
d_4_0_Core->refs.deref();
- Q_ASSERT(d_4_0_Core->refs.load());
- if (d_4_1_Core)
+ Q_ASSERT(d_4_0_Core->refs.load());
+ }
+ if (d_4_1_Core) {
d_4_1_Core->refs.deref();
- Q_ASSERT(d_4_1_Core->refs.load());
- if (d_4_2_Core)
+ Q_ASSERT(d_4_1_Core->refs.load());
+ }
+ if (d_4_2_Core) {
d_4_2_Core->refs.deref();
- Q_ASSERT(d_4_2_Core->refs.load());
- if (d_4_3_Core)
+ Q_ASSERT(d_4_2_Core->refs.load());
+ }
+ if (d_4_3_Core) {
d_4_3_Core->refs.deref();
- Q_ASSERT(d_4_3_Core->refs.load());
- if (d_4_4_Core)
+ Q_ASSERT(d_4_3_Core->refs.load());
+ }
+ if (d_4_4_Core) {
d_4_4_Core->refs.deref();
- Q_ASSERT(d_4_4_Core->refs.load());
+ Q_ASSERT(d_4_4_Core->refs.load());
+ }
}
bool QOpenGLFunctions_4_4_Core::initializeOpenGLFunctions()
diff --git a/src/gui/opengl/qopenglfunctions_4_4_core.h b/src/gui/opengl/qopenglfunctions_4_4_core.h
index e508478c50..bcb7383a9e 100644
--- a/src/gui/opengl/qopenglfunctions_4_4_core.h
+++ b/src/gui/opengl/qopenglfunctions_4_4_core.h
@@ -50,7 +50,7 @@
#ifndef QOPENGLVERSIONFUNCTIONS_4_4_CORE_H
#define QOPENGLVERSIONFUNCTIONS_4_4_CORE_H
-#include <QtCore/qglobal.h>
+#include <QtGui/qtguiglobal.h>
#if !defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_2)
diff --git a/src/gui/opengl/qopenglfunctions_4_5_compatibility.cpp b/src/gui/opengl/qopenglfunctions_4_5_compatibility.cpp
index 81ee8559a5..f9d2bb9ceb 100644
--- a/src/gui/opengl/qopenglfunctions_4_5_compatibility.cpp
+++ b/src/gui/opengl/qopenglfunctions_4_5_compatibility.cpp
@@ -97,81 +97,106 @@ QOpenGLFunctions_4_5_Compatibility::QOpenGLFunctions_4_5_Compatibility()
QOpenGLFunctions_4_5_Compatibility::~QOpenGLFunctions_4_5_Compatibility()
{
- if (d_1_0_Core)
+ if (d_1_0_Core) {
d_1_0_Core->refs.deref();
- Q_ASSERT(d_1_0_Core->refs.load());
- if (d_1_1_Core)
+ Q_ASSERT(d_1_0_Core->refs.load());
+ }
+ if (d_1_1_Core) {
d_1_1_Core->refs.deref();
- Q_ASSERT(d_1_1_Core->refs.load());
- if (d_1_2_Core)
+ Q_ASSERT(d_1_1_Core->refs.load());
+ }
+ if (d_1_2_Core) {
d_1_2_Core->refs.deref();
- Q_ASSERT(d_1_2_Core->refs.load());
- if (d_1_3_Core)
+ Q_ASSERT(d_1_2_Core->refs.load());
+ }
+ if (d_1_3_Core) {
d_1_3_Core->refs.deref();
- Q_ASSERT(d_1_3_Core->refs.load());
- if (d_1_4_Core)
+ Q_ASSERT(d_1_3_Core->refs.load());
+ }
+ if (d_1_4_Core) {
d_1_4_Core->refs.deref();
- Q_ASSERT(d_1_4_Core->refs.load());
- if (d_1_5_Core)
+ Q_ASSERT(d_1_4_Core->refs.load());
+ }
+ if (d_1_5_Core) {
d_1_5_Core->refs.deref();
- Q_ASSERT(d_1_5_Core->refs.load());
- if (d_2_0_Core)
+ Q_ASSERT(d_1_5_Core->refs.load());
+ }
+ if (d_2_0_Core) {
d_2_0_Core->refs.deref();
- Q_ASSERT(d_2_0_Core->refs.load());
- if (d_2_1_Core)
+ Q_ASSERT(d_2_0_Core->refs.load());
+ }
+ if (d_2_1_Core) {
d_2_1_Core->refs.deref();
- Q_ASSERT(d_2_1_Core->refs.load());
- if (d_3_0_Core)
+ Q_ASSERT(d_2_1_Core->refs.load());
+ }
+ if (d_3_0_Core) {
d_3_0_Core->refs.deref();
- Q_ASSERT(d_3_0_Core->refs.load());
- if (d_3_1_Core)
+ Q_ASSERT(d_3_0_Core->refs.load());
+ }
+ if (d_3_1_Core) {
d_3_1_Core->refs.deref();
- Q_ASSERT(d_3_1_Core->refs.load());
- if (d_3_2_Core)
+ Q_ASSERT(d_3_1_Core->refs.load());
+ }
+ if (d_3_2_Core) {
d_3_2_Core->refs.deref();
- Q_ASSERT(d_3_2_Core->refs.load());
- if (d_3_3_Core)
+ Q_ASSERT(d_3_2_Core->refs.load());
+ }
+ if (d_3_3_Core) {
d_3_3_Core->refs.deref();
- Q_ASSERT(d_3_3_Core->refs.load());
- if (d_4_0_Core)
+ Q_ASSERT(d_3_3_Core->refs.load());
+ }
+ if (d_4_0_Core) {
d_4_0_Core->refs.deref();
- Q_ASSERT(d_4_0_Core->refs.load());
- if (d_4_1_Core)
+ Q_ASSERT(d_4_0_Core->refs.load());
+ }
+ if (d_4_1_Core) {
d_4_1_Core->refs.deref();
- Q_ASSERT(d_4_1_Core->refs.load());
- if (d_4_2_Core)
+ Q_ASSERT(d_4_1_Core->refs.load());
+ }
+ if (d_4_2_Core) {
d_4_2_Core->refs.deref();
- Q_ASSERT(d_4_2_Core->refs.load());
- if (d_4_3_Core)
+ Q_ASSERT(d_4_2_Core->refs.load());
+ }
+ if (d_4_3_Core) {
d_4_3_Core->refs.deref();
- Q_ASSERT(d_4_3_Core->refs.load());
- if (d_4_4_Core)
+ Q_ASSERT(d_4_3_Core->refs.load());
+ }
+ if (d_4_4_Core) {
d_4_4_Core->refs.deref();
- Q_ASSERT(d_4_4_Core->refs.load());
- if (d_4_5_Core)
+ Q_ASSERT(d_4_4_Core->refs.load());
+ }
+ if (d_4_5_Core) {
d_4_5_Core->refs.deref();
- Q_ASSERT(d_4_5_Core->refs.load());
- if (d_1_0_Deprecated)
+ Q_ASSERT(d_4_5_Core->refs.load());
+ }
+ if (d_1_0_Deprecated) {
d_1_0_Deprecated->refs.deref();
- Q_ASSERT(d_1_0_Deprecated->refs.load());
- if (d_1_1_Deprecated)
+ Q_ASSERT(d_1_0_Deprecated->refs.load());
+ }
+ if (d_1_1_Deprecated) {
d_1_1_Deprecated->refs.deref();
- Q_ASSERT(d_1_1_Deprecated->refs.load());
- if (d_1_2_Deprecated)
+ Q_ASSERT(d_1_1_Deprecated->refs.load());
+ }
+ if (d_1_2_Deprecated) {
d_1_2_Deprecated->refs.deref();
- Q_ASSERT(d_1_2_Deprecated->refs.load());
- if (d_1_3_Deprecated)
+ Q_ASSERT(d_1_2_Deprecated->refs.load());
+ }
+ if (d_1_3_Deprecated) {
d_1_3_Deprecated->refs.deref();
- Q_ASSERT(d_1_3_Deprecated->refs.load());
- if (d_1_4_Deprecated)
+ Q_ASSERT(d_1_3_Deprecated->refs.load());
+ }
+ if (d_1_4_Deprecated) {
d_1_4_Deprecated->refs.deref();
- Q_ASSERT(d_1_4_Deprecated->refs.load());
- if (d_3_3_Deprecated)
+ Q_ASSERT(d_1_4_Deprecated->refs.load());
+ }
+ if (d_3_3_Deprecated) {
d_3_3_Deprecated->refs.deref();
- Q_ASSERT(d_3_3_Deprecated->refs.load());
- if (d_4_5_Deprecated)
+ Q_ASSERT(d_3_3_Deprecated->refs.load());
+ }
+ if (d_4_5_Deprecated) {
d_4_5_Deprecated->refs.deref();
- Q_ASSERT(d_4_5_Deprecated->refs.load());
+ Q_ASSERT(d_4_5_Deprecated->refs.load());
+ }
}
bool QOpenGLFunctions_4_5_Compatibility::initializeOpenGLFunctions()
diff --git a/src/gui/opengl/qopenglfunctions_4_5_compatibility.h b/src/gui/opengl/qopenglfunctions_4_5_compatibility.h
index 1c50dafd65..b164538686 100644
--- a/src/gui/opengl/qopenglfunctions_4_5_compatibility.h
+++ b/src/gui/opengl/qopenglfunctions_4_5_compatibility.h
@@ -50,7 +50,7 @@
#ifndef QOPENGLVERSIONFUNCTIONS_4_5_COMPATIBILITY_H
#define QOPENGLVERSIONFUNCTIONS_4_5_COMPATIBILITY_H
-#include <QtCore/qglobal.h>
+#include <QtGui/qtguiglobal.h>
#if !defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_2)
diff --git a/src/gui/opengl/qopenglfunctions_4_5_core.cpp b/src/gui/opengl/qopenglfunctions_4_5_core.cpp
index 2fdb9ef855..27c0223cf9 100644
--- a/src/gui/opengl/qopenglfunctions_4_5_core.cpp
+++ b/src/gui/opengl/qopenglfunctions_4_5_core.cpp
@@ -90,60 +90,78 @@ QOpenGLFunctions_4_5_Core::QOpenGLFunctions_4_5_Core()
QOpenGLFunctions_4_5_Core::~QOpenGLFunctions_4_5_Core()
{
- if (d_1_0_Core)
+ if (d_1_0_Core) {
d_1_0_Core->refs.deref();
- Q_ASSERT(d_1_0_Core->refs.load());
- if (d_1_1_Core)
+ Q_ASSERT(d_1_0_Core->refs.load());
+ }
+ if (d_1_1_Core) {
d_1_1_Core->refs.deref();
- Q_ASSERT(d_1_1_Core->refs.load());
- if (d_1_2_Core)
+ Q_ASSERT(d_1_1_Core->refs.load());
+ }
+ if (d_1_2_Core) {
d_1_2_Core->refs.deref();
- Q_ASSERT(d_1_2_Core->refs.load());
- if (d_1_3_Core)
+ Q_ASSERT(d_1_2_Core->refs.load());
+ }
+ if (d_1_3_Core) {
d_1_3_Core->refs.deref();
- Q_ASSERT(d_1_3_Core->refs.load());
- if (d_1_4_Core)
+ Q_ASSERT(d_1_3_Core->refs.load());
+ }
+ if (d_1_4_Core) {
d_1_4_Core->refs.deref();
- Q_ASSERT(d_1_4_Core->refs.load());
- if (d_1_5_Core)
+ Q_ASSERT(d_1_4_Core->refs.load());
+ }
+ if (d_1_5_Core) {
d_1_5_Core->refs.deref();
- Q_ASSERT(d_1_5_Core->refs.load());
- if (d_2_0_Core)
+ Q_ASSERT(d_1_5_Core->refs.load());
+ }
+ if (d_2_0_Core) {
d_2_0_Core->refs.deref();
- Q_ASSERT(d_2_0_Core->refs.load());
- if (d_2_1_Core)
+ Q_ASSERT(d_2_0_Core->refs.load());
+ }
+ if (d_2_1_Core) {
d_2_1_Core->refs.deref();
- Q_ASSERT(d_2_1_Core->refs.load());
- if (d_3_0_Core)
+ Q_ASSERT(d_2_1_Core->refs.load());
+ }
+ if (d_3_0_Core) {
d_3_0_Core->refs.deref();
- Q_ASSERT(d_3_0_Core->refs.load());
- if (d_3_1_Core)
+ Q_ASSERT(d_3_0_Core->refs.load());
+ }
+ if (d_3_1_Core) {
d_3_1_Core->refs.deref();
- Q_ASSERT(d_3_1_Core->refs.load());
- if (d_3_2_Core)
+ Q_ASSERT(d_3_1_Core->refs.load());
+ }
+ if (d_3_2_Core) {
d_3_2_Core->refs.deref();
- Q_ASSERT(d_3_2_Core->refs.load());
- if (d_3_3_Core)
+ Q_ASSERT(d_3_2_Core->refs.load());
+ }
+ if (d_3_3_Core) {
d_3_3_Core->refs.deref();
- Q_ASSERT(d_3_3_Core->refs.load());
- if (d_4_0_Core)
+ Q_ASSERT(d_3_3_Core->refs.load());
+ }
+ if (d_4_0_Core) {
d_4_0_Core->refs.deref();
- Q_ASSERT(d_4_0_Core->refs.load());
- if (d_4_1_Core)
+ Q_ASSERT(d_4_0_Core->refs.load());
+ }
+ if (d_4_1_Core) {
d_4_1_Core->refs.deref();
- Q_ASSERT(d_4_1_Core->refs.load());
- if (d_4_2_Core)
+ Q_ASSERT(d_4_1_Core->refs.load());
+ }
+ if (d_4_2_Core) {
d_4_2_Core->refs.deref();
- Q_ASSERT(d_4_2_Core->refs.load());
- if (d_4_3_Core)
+ Q_ASSERT(d_4_2_Core->refs.load());
+ }
+ if (d_4_3_Core) {
d_4_3_Core->refs.deref();
- Q_ASSERT(d_4_3_Core->refs.load());
- if (d_4_4_Core)
+ Q_ASSERT(d_4_3_Core->refs.load());
+ }
+ if (d_4_4_Core) {
d_4_4_Core->refs.deref();
- Q_ASSERT(d_4_4_Core->refs.load());
- if (d_4_5_Core)
+ Q_ASSERT(d_4_4_Core->refs.load());
+ }
+ if (d_4_5_Core) {
d_4_5_Core->refs.deref();
- Q_ASSERT(d_4_5_Core->refs.load());
+ Q_ASSERT(d_4_5_Core->refs.load());
+ }
}
bool QOpenGLFunctions_4_5_Core::initializeOpenGLFunctions()
diff --git a/src/gui/opengl/qopenglfunctions_4_5_core.h b/src/gui/opengl/qopenglfunctions_4_5_core.h
index b086e63917..0940d8cf61 100644
--- a/src/gui/opengl/qopenglfunctions_4_5_core.h
+++ b/src/gui/opengl/qopenglfunctions_4_5_core.h
@@ -50,7 +50,7 @@
#ifndef QOPENGLVERSIONFUNCTIONS_4_5_CORE_H
#define QOPENGLVERSIONFUNCTIONS_4_5_CORE_H
-#include <QtCore/qglobal.h>
+#include <QtGui/qtguiglobal.h>
#if !defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_2)
diff --git a/src/gui/opengl/qopenglfunctions_es2.h b/src/gui/opengl/qopenglfunctions_es2.h
index 45cb329a87..3b7d2806ea 100644
--- a/src/gui/opengl/qopenglfunctions_es2.h
+++ b/src/gui/opengl/qopenglfunctions_es2.h
@@ -40,7 +40,7 @@
#ifndef QOPENGLVERSIONFUNCTIONS_ES2_H
#define QOPENGLVERSIONFUNCTIONS_ES2_H
-#include <QtCore/qglobal.h>
+#include <QtGui/qtguiglobal.h>
#if defined(QT_OPENGL_ES_2) || defined(Q_QDOC)
diff --git a/src/gui/opengl/qopenglgradientcache_p.h b/src/gui/opengl/qopenglgradientcache_p.h
index 12423452f2..a2ed85c061 100644
--- a/src/gui/opengl/qopenglgradientcache_p.h
+++ b/src/gui/opengl/qopenglgradientcache_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#include <QMultiHash>
#include <QObject>
#include <private/qopenglcontext_p.h>
diff --git a/src/gui/opengl/qopenglpaintdevice.cpp b/src/gui/opengl/qopenglpaintdevice.cpp
index 75f09d6031..e539ee0e31 100644
--- a/src/gui/opengl/qopenglpaintdevice.cpp
+++ b/src/gui/opengl/qopenglpaintdevice.cpp
@@ -137,7 +137,7 @@ QOpenGLPaintDevice::QOpenGLPaintDevice(const QSize &size)
\sa QOpenGLContext::currentContext()
*/
QOpenGLPaintDevice::QOpenGLPaintDevice(int width, int height)
- : d_ptr(new QOpenGLPaintDevicePrivate(QSize(width, height)))
+ : QOpenGLPaintDevice(QSize(width, height))
{
}
diff --git a/src/gui/opengl/qopenglpaintdevice.h b/src/gui/opengl/qopenglpaintdevice.h
index dffa68c29e..27b7fba84f 100644
--- a/src/gui/opengl/qopenglpaintdevice.h
+++ b/src/gui/opengl/qopenglpaintdevice.h
@@ -40,7 +40,7 @@
#ifndef QOPENGLPAINTDEVICE_H
#define QOPENGLPAINTDEVICE_H
-#include <QtCore/qglobal.h>
+#include <QtGui/qtguiglobal.h>
#ifndef QT_NO_OPENGL
diff --git a/src/gui/opengl/qopenglpaintdevice_p.h b/src/gui/opengl/qopenglpaintdevice_p.h
index 78e6b7a464..3683ebebac 100644
--- a/src/gui/opengl/qopenglpaintdevice_p.h
+++ b/src/gui/opengl/qopenglpaintdevice_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#include <qopenglpaintdevice.h>
QT_BEGIN_NAMESPACE
diff --git a/src/gui/opengl/qopenglpaintengine.cpp b/src/gui/opengl/qopenglpaintengine.cpp
index d93871c99b..5c05a05d80 100644
--- a/src/gui/opengl/qopenglpaintengine.cpp
+++ b/src/gui/opengl/qopenglpaintengine.cpp
@@ -1012,11 +1012,11 @@ void QOpenGL2PaintEngineExPrivate::fillStencilWithVertexArray(const float *data,
funcs.glStencilMask(0xff); // Enable stencil writes
if (dirtyStencilRegion.intersects(currentScissorBounds)) {
- QVector<QRect> clearRegion = dirtyStencilRegion.intersected(currentScissorBounds).rects();
+ const QRegion clearRegion = dirtyStencilRegion.intersected(currentScissorBounds);
funcs.glClearStencil(0); // Clear to zero
- for (int i = 0; i < clearRegion.size(); ++i) {
+ for (const QRect &rect : clearRegion) {
#ifndef QT_GL_NO_SCISSOR_TEST
- setScissor(clearRegion.at(i));
+ setScissor(rect);
#endif
funcs.glClear(GL_STENCIL_BUFFER_BIT);
}
diff --git a/src/gui/opengl/qopenglpaintengine_p.h b/src/gui/opengl/qopenglpaintengine_p.h
index c9f328203c..807efb1ec2 100644
--- a/src/gui/opengl/qopenglpaintengine_p.h
+++ b/src/gui/opengl/qopenglpaintengine_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#include <QDebug>
#include <qopenglpaintdevice.h>
diff --git a/src/gui/opengl/qopenglpixeltransferoptions.h b/src/gui/opengl/qopenglpixeltransferoptions.h
index 81aa588ae4..2fc52b82d8 100644
--- a/src/gui/opengl/qopenglpixeltransferoptions.h
+++ b/src/gui/opengl/qopenglpixeltransferoptions.h
@@ -40,7 +40,7 @@
#ifndef QOPENGLPIXELUPLOADOPTIONS_H
#define QOPENGLPIXELUPLOADOPTIONS_H
-#include <QtCore/qglobal.h>
+#include <QtGui/qtguiglobal.h>
#if !defined(QT_NO_OPENGL)
diff --git a/src/gui/opengl/qopenglqueryhelper_p.h b/src/gui/opengl/qopenglqueryhelper_p.h
index be36c32217..60dbf9c743 100644
--- a/src/gui/opengl/qopenglqueryhelper_p.h
+++ b/src/gui/opengl/qopenglqueryhelper_p.h
@@ -51,7 +51,7 @@
// We mean it.
//
-#include <QtCore/qglobal.h>
+#include <QtGui/private/qtguiglobal_p.h>
#if !defined(QT_OPENGL_ES_2)
diff --git a/src/gui/opengl/qopenglshadercache_p.h b/src/gui/opengl/qopenglshadercache_p.h
index 5070874d83..b4d1d64721 100644
--- a/src/gui/opengl/qopenglshadercache_p.h
+++ b/src/gui/opengl/qopenglshadercache_p.h
@@ -51,7 +51,7 @@
#ifndef QOPENGLSHADERCACHE_P_H
#define QOPENGLSHADERCACHE_P_H
-#include <QtCore/qglobal.h>
+#include <QtGui/private/qtguiglobal_p.h>
#if defined(QT_MEEGO_EXPERIMENTAL_SHADERCACHE) && defined(QT_OPENGL_ES_2)
# include "qopenglshadercache_meego_p.h"
diff --git a/src/gui/opengl/qopenglshaderprogram.cpp b/src/gui/opengl/qopenglshaderprogram.cpp
index 4134513210..f076e10e20 100644
--- a/src/gui/opengl/qopenglshaderprogram.cpp
+++ b/src/gui/opengl/qopenglshaderprogram.cpp
@@ -337,9 +337,10 @@ bool QOpenGLShaderPrivate::compile(QOpenGLShader *q)
// Dump the source code if we got it
if (sourceCodeBuffer) {
- qWarning("*** Problematic %s shader source code ***", type);
- qWarning() << qPrintable(QString::fromLatin1(sourceCodeBuffer));
- qWarning("***");
+ qWarning("*** Problematic %s shader source code ***\n"
+ "%ls\n"
+ "***",
+ type, qUtf16Printable(QString::fromLatin1(sourceCodeBuffer)));
}
// Cleanup
@@ -1215,8 +1216,7 @@ int QOpenGLShaderProgram::attributeLocation(const char *name) const
if (d->linked && d->programGuard && d->programGuard->id()) {
return d->glfuncs->glGetAttribLocation(d->programGuard->id(), name);
} else {
- qWarning() << "QOpenGLShaderProgram::attributeLocation(" << name
- << "): shader program is not linked";
+ qWarning("QOpenGLShaderProgram::attributeLocation(%s): shader program is not linked", name);
return -1;
}
}
@@ -1479,7 +1479,7 @@ void QOpenGLShaderProgram::setAttributeValue
Q_D(QOpenGLShaderProgram);
Q_UNUSED(d);
if (rows < 1 || rows > 4) {
- qWarning() << "QOpenGLShaderProgram::setAttributeValue: rows" << rows << "not supported";
+ qWarning("QOpenGLShaderProgram::setAttributeValue: rows %d not supported", rows);
return;
}
if (location != -1) {
@@ -1891,8 +1891,7 @@ int QOpenGLShaderProgram::uniformLocation(const char *name) const
if (d->linked && d->programGuard && d->programGuard->id()) {
return d->glfuncs->glGetUniformLocation(d->programGuard->id(), name);
} else {
- qWarning() << "QOpenGLShaderProgram::uniformLocation(" << name
- << "): shader program is not linked";
+ qWarning("QOpenGLShaderProgram::uniformLocation(%s): shader program is not linked", name);
return -1;
}
}
@@ -2819,7 +2818,7 @@ void QOpenGLShaderProgram::setUniformValueArray(int location, const GLfloat *val
else if (tupleSize == 4)
d->glfuncs->glUniform4fv(location, count, values);
else
- qWarning() << "QOpenGLShaderProgram::setUniformValue: size" << tupleSize << "not supported";
+ qWarning("QOpenGLShaderProgram::setUniformValue: size %d not supported", tupleSize);
}
}
diff --git a/src/gui/opengl/qopenglshaderprogram.h b/src/gui/opengl/qopenglshaderprogram.h
index da20228e51..2da359c535 100644
--- a/src/gui/opengl/qopenglshaderprogram.h
+++ b/src/gui/opengl/qopenglshaderprogram.h
@@ -40,7 +40,7 @@
#ifndef QOPENGLSHADERPROGRAM_H
#define QOPENGLSHADERPROGRAM_H
-#include <QtCore/qglobal.h>
+#include <QtGui/qtguiglobal.h>
#ifndef QT_NO_OPENGL
diff --git a/src/gui/opengl/qopengltexture.cpp b/src/gui/opengl/qopengltexture.cpp
index 1db61b7ca1..0a46eea85d 100644
--- a/src/gui/opengl/qopengltexture.cpp
+++ b/src/gui/opengl/qopengltexture.cpp
@@ -2216,7 +2216,7 @@ QOpenGLTexture::QOpenGLTexture(Target target)
OpenGL context.
*/
QOpenGLTexture::QOpenGLTexture(const QImage& image, MipMapGeneration genMipMaps)
- : d_ptr(new QOpenGLTexturePrivate(QOpenGLTexture::Target2D, this))
+ : QOpenGLTexture(QOpenGLTexture::Target2D)
{
setData(image, genMipMaps);
}
diff --git a/src/gui/opengl/qopengltexture.h b/src/gui/opengl/qopengltexture.h
index 8c32fcef26..0a948488a6 100644
--- a/src/gui/opengl/qopengltexture.h
+++ b/src/gui/opengl/qopengltexture.h
@@ -40,7 +40,7 @@
#ifndef QOPENGLABSTRACTTEXTURE_H
#define QOPENGLABSTRACTTEXTURE_H
-#include <QtCore/qglobal.h>
+#include <QtGui/qtguiglobal.h>
#ifndef QT_NO_OPENGL
diff --git a/src/gui/opengl/qopengltexture_p.h b/src/gui/opengl/qopengltexture_p.h
index e9ada026ed..9914316bb4 100644
--- a/src/gui/opengl/qopengltexture_p.h
+++ b/src/gui/opengl/qopengltexture_p.h
@@ -53,6 +53,7 @@
#ifndef QT_NO_OPENGL
+#include <QtGui/private/qtguiglobal_p.h>
#include "private/qobject_p.h"
#include "qopengltexture.h"
#include "qopengl.h"
diff --git a/src/gui/opengl/qopengltextureblitter.cpp b/src/gui/opengl/qopengltextureblitter.cpp
index 18ff0c4acf..858fc0d857 100644
--- a/src/gui/opengl/qopengltextureblitter.cpp
+++ b/src/gui/opengl/qopengltextureblitter.cpp
@@ -37,7 +37,7 @@
**
****************************************************************************/
-#include "qopengltextureblitter_p.h"
+#include "qopengltextureblitter.h"
#include <QtGui/QOpenGLBuffer>
#include <QtGui/QOpenGLShaderProgram>
@@ -51,6 +51,49 @@
QT_BEGIN_NAMESPACE
+/*!
+ \class QOpenGLTextureBlitter
+ \brief The QOpenGLTextureBlitter class provides a convenient way to draw textured quads via OpenGL.
+ \since 5.8
+ \ingroup painting-3D
+ \inmodule QtGui
+
+ Drawing textured quads, in order to get the contents of a texture
+ onto the screen, is a common operation when developing 2D user
+ interfaces. QOpenGLTextureBlitter provides a convenience class to
+ avoid repeating vertex data, shader sources, buffer and program
+ management and matrix calculations.
+
+ For example, a QOpenGLWidget subclass can do the following to draw
+ the contents rendered into a framebuffer at the pixel position \c{(x, y)}:
+
+ \code
+ void OpenGLWidget::initializeGL()
+ {
+ m_blitter.create();
+ m_fbo = new QOpenGLFramebufferObject(size);
+ }
+
+ void OpenGLWidget::paintGL()
+ {
+ m_fbo->bind();
+ // update offscreen content
+ m_fbo->release();
+
+ m_blitter.bind();
+ const QRect targetRect(QPoint(x, y), m_fbo->size());
+ const QMatrix4x4 target = QOpenGLTextureBlitter::targetTransform(targetRect, QRect(QPoint(0, 0), m_fbo->size()));
+ m_blitter.blit(m_fbo->texture(), target, QOpenGLTextureBlitter::OriginBottomLeft);
+ m_blitter.release();
+ }
+ \endcode
+
+ The blitter implements GLSL shaders both for GLSL 1.00 (suitable
+ for OpenGL (ES) 2.x and compatibility profiles of newer OpenGL
+ versions) and version 150 (suitable for core profile contexts with
+ OpenGL 3.2 and newer).
+ */
+
static const char vertex_shader150[] =
"#version 150 core\n"
"in vec3 vertexCoord;"
@@ -309,16 +352,44 @@ bool QOpenGLTextureBlitterPrivate::buildProgram(ProgramIndex idx, const char *vs
return true;
}
+/*!
+ Constructs a new QOpenGLTextureBlitter instance.
+
+ \note no graphics resources are initialized in the
+ constructor. This makes it safe to place plain
+ QOpenGLTextureBlitter members into classes because the actual
+ initialization that depends on the OpenGL context happens only in
+ create().
+ */
QOpenGLTextureBlitter::QOpenGLTextureBlitter()
: d_ptr(new QOpenGLTextureBlitterPrivate)
{
}
+/*!
+ Destructs the instance.
+
+ \note When the OpenGL context - or a context sharing resources
+ with it - that was current when calling create() is not current,
+ graphics resources will not be released. Therefore, it is
+ recommended to call destroy() manually instead of relying on the
+ destructor to perform OpenGL resource cleanup.
+ */
QOpenGLTextureBlitter::~QOpenGLTextureBlitter()
{
destroy();
}
+/*!
+ Initializes the graphics resources used by the blitter.
+
+ \return \c true if successful, \c false if there was a
+ failure. Failures can occur when there is no OpenGL context
+ current on the current thread, or when shader compilation fails
+ for some reason.
+
+ \sa isCreated(), destroy()
+ */
bool QOpenGLTextureBlitter::create()
{
QOpenGLContext *currentContext = QOpenGLContext::currentContext();
@@ -358,12 +429,26 @@ bool QOpenGLTextureBlitter::create()
return true;
}
+/*!
+ \return \c true if create() was called and succeeded. \c false otherwise.
+
+ \sa create(), destroy()
+ */
bool QOpenGLTextureBlitter::isCreated() const
{
Q_D(const QOpenGLTextureBlitter);
return d->programs[QOpenGLTextureBlitterPrivate::TEXTURE_2D].glProgram;
}
+/*!
+ Frees all graphics resources held by the blitter. Assumes that
+ the OpenGL context, or another context sharing resources with it,
+ that was current on the thread when invoking create() is current.
+
+ The function has no effect when the blitter is not in created state.
+
+ \sa create()
+ */
void QOpenGLTextureBlitter::destroy()
{
if (!isCreated())
@@ -376,12 +461,29 @@ void QOpenGLTextureBlitter::destroy()
d->vao.reset();
}
+/*!
+ \return \c true when bind() accepts \c GL_TEXTURE_EXTERNAL_OES as
+ its target argument.
+
+ \sa bind(), blit()
+ */
bool QOpenGLTextureBlitter::supportsExternalOESTarget() const
{
QOpenGLContext *ctx = QOpenGLContext::currentContext();
return ctx && ctx->isOpenGLES() && ctx->hasExtension("GL_OES_EGL_image_external");
}
+/*!
+ Binds the graphics resources used by the blitter. This must be
+ called before calling blit(). Code modifying the OpenGL state
+ should be avoided between the call to bind() and blit() because
+ otherwise conflicts may arise.
+
+ \a target is the texture target for the source texture and must be
+ either \c GL_TEXTURE_2D or \c GL_OES_EGL_image_external.
+
+ \sa release(), blit()
+ */
void QOpenGLTextureBlitter::bind(GLenum target)
{
Q_D(QOpenGLTextureBlitter);
@@ -404,6 +506,11 @@ void QOpenGLTextureBlitter::bind(GLenum target)
d->textureBuffer.release();
}
+/*!
+ Unbinds the graphics resources used by the blitter.
+
+ \sa bind()
+ */
void QOpenGLTextureBlitter::release()
{
Q_D(QOpenGLTextureBlitter);
@@ -412,18 +519,65 @@ void QOpenGLTextureBlitter::release()
d->vao->release();
}
-void QOpenGLTextureBlitter::setSwizzleRB(bool swizzle)
+/*!
+ Sets whether swizzling is enabled for the red and blue color channels to
+ \a swizzle. An BGRA to RGBA conversion (occurring in the shader on
+ the GPU, instead of a slow CPU-side transformation) can be useful
+ when the source texture contains data from a QImage with a format
+ like QImage::Format_ARGB32 which maps to BGRA on little endian
+ systems.
+
+ By default the red-blue swizzle is disabled since this is what a
+ texture attached to an framebuffer object or a texture based on a
+ byte ordered QImage format (like QImage::Format_RGBA8888) needs.
+ */
+void QOpenGLTextureBlitter::setRedBlueSwizzle(bool swizzle)
{
Q_D(QOpenGLTextureBlitter);
d->swizzle = swizzle;
}
+/*!
+ Changes the opacity to \a opacity. The default opacity is 1.0.
+
+ \note the blitter does not alter the blend state. It is up to the
+ caller of blit() to ensure the correct blend settings are active.
+
+ */
void QOpenGLTextureBlitter::setOpacity(float opacity)
{
Q_D(QOpenGLTextureBlitter);
d->opacity = opacity;
}
+/*!
+ \enum QOpenGLTextureBlitter::Origin
+
+ \value OriginBottomLeft Indicates that the data in the texture
+ follows the OpenGL convention of coordinate systems, meaning Y is
+ running from bottom to top.
+
+ \value OriginTopLeft Indicates that the data in the texture has Y
+ running from top to bottom, which is typical with regular,
+ unflipped image data.
+
+ \sa blit()
+ */
+
+/*!
+ Performs the blit with the source texture \a texture.
+
+ \a targetTransform specifies the transformation applied. This is
+ usually generated by the targetTransform() helper function.
+
+ \a sourceOrigin specifies if the image data needs flipping. When
+ \a texture corresponds to a texture attached to an FBO pass
+ OriginBottomLeft. On the other hand, when \a texture is based on
+ unflipped image data, pass OriginTopLeft. This is more efficient
+ than using QImage::mirrored().
+
+ \sa targetTransform(), Origin, bind()
+ */
void QOpenGLTextureBlitter::blit(GLuint texture,
const QMatrix4x4 &targetTransform,
Origin sourceOrigin)
@@ -432,6 +586,19 @@ void QOpenGLTextureBlitter::blit(GLuint texture,
d->blit(texture,targetTransform, sourceOrigin);
}
+/*!
+ Performs the blit with the source texture \a texture.
+
+ \a targetTransform specifies the transformation applied. This is
+ usually generated by the targetTransform() helper function.
+
+ \a sourceTransform specifies the transformation applied to the
+ source. This allows using only a sub-rect of the source
+ texture. This is usually generated by the sourceTransform() helper
+ function.
+
+ \sa sourceTransform(), targetTransform(), Origin, bind()
+ */
void QOpenGLTextureBlitter::blit(GLuint texture,
const QMatrix4x4 &targetTransform,
const QMatrix3x3 &sourceTransform)
@@ -440,6 +607,18 @@ void QOpenGLTextureBlitter::blit(GLuint texture,
d->blit(texture, targetTransform, sourceTransform);
}
+/*!
+ Calculates a target transform suitable for blit().
+
+ \a target is the target rectangle in pixels. \a viewport describes
+ the source dimensions and will in most cases be set to (0, 0,
+ image width, image height).
+
+ For unscaled output the size of \a target and \a viewport should
+ match.
+
+ \sa blit()
+ */
QMatrix4x4 QOpenGLTextureBlitter::targetTransform(const QRectF &target,
const QRect &viewport)
{
@@ -460,6 +639,17 @@ QMatrix4x4 QOpenGLTextureBlitter::targetTransform(const QRectF &target,
return matrix;
}
+/*!
+ Calculates a 3x3 matrix suitable as the input to blit(). This is
+ used when only a part of the texture is to be used in the blit.
+
+ \a subTexture is the desired source rectangle in pixels, \a
+ textureSize is the full width and height of the texture data. \a
+ origin specifies the orientation of the image data when it comes
+ to the Y axis.
+
+ \sa blit(), Origin
+ */
QMatrix3x3 QOpenGLTextureBlitter::sourceTransform(const QRectF &subTexture,
const QSize &textureSize,
Origin origin)
diff --git a/src/gui/opengl/qopengltextureblitter_p.h b/src/gui/opengl/qopengltextureblitter.h
index 5d39a3e8fa..2f7c6b1a0a 100644
--- a/src/gui/opengl/qopengltextureblitter_p.h
+++ b/src/gui/opengl/qopengltextureblitter.h
@@ -37,28 +37,21 @@
**
****************************************************************************/
-#ifndef QOPENGLTEXTUREBLITTER_P_H
-#define QOPENGLTEXTUREBLITTER_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
+#ifndef QOPENGLTEXTUREBLITTER_H
+#define QOPENGLTEXTUREBLITTER_H
+
+#include <QtGui/qtguiglobal.h>
+
+#ifndef QT_NO_OPENGL
#include <QtGui/qopengl.h>
#include <QtGui/QMatrix3x3>
+#include <QtGui/QMatrix4x4>
QT_BEGIN_NAMESPACE
class QOpenGLTextureBlitterPrivate;
-
class Q_GUI_EXPORT QOpenGLTextureBlitter
{
public:
@@ -79,7 +72,7 @@ public:
void bind(GLenum target = GL_TEXTURE_2D);
void release();
- void setSwizzleRB(bool swizzle);
+ void setRedBlueSwizzle(bool swizzle);
void setOpacity(float opacity);
void blit(GLuint texture, const QMatrix4x4 &targetTransform, Origin sourceOrigin);
@@ -96,4 +89,6 @@ private:
QT_END_NAMESPACE
-#endif //QOPENGLTEXTUREBLITTER_P_H
+#endif
+
+#endif //QOPENGLTEXTUREBLITTER_H
diff --git a/src/gui/opengl/qopengltexturecache_p.h b/src/gui/opengl/qopengltexturecache_p.h
index aedc8e7e47..c68b068739 100644
--- a/src/gui/opengl/qopengltexturecache_p.h
+++ b/src/gui/opengl/qopengltexturecache_p.h
@@ -51,6 +51,7 @@
#ifndef QOPENGLTEXTURECACHE_P_H
#define QOPENGLTEXTURECACHE_P_H
+#include <QtGui/private/qtguiglobal_p.h>
#include <QHash>
#include <QObject>
#include <QCache>
diff --git a/src/gui/opengl/qopengltextureglyphcache_p.h b/src/gui/opengl/qopengltextureglyphcache_p.h
index 6cd7667d78..6a1550dbed 100644
--- a/src/gui/opengl/qopengltextureglyphcache_p.h
+++ b/src/gui/opengl/qopengltextureglyphcache_p.h
@@ -44,13 +44,14 @@
// W A R N I N G
// -------------
//
-// This file is not part of the Qt API. It exists for the convenience
-// of the QLibrary class. This header file may change from
-// version to version without notice, or even be removed.
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
//
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#include <private/qtextureglyphcache_p.h>
#include <private/qopenglcontext_p.h>
#include <qopenglshaderprogram.h>
diff --git a/src/gui/opengl/qopengltexturehelper_p.h b/src/gui/opengl/qopengltexturehelper_p.h
index 6b26527269..00f6f9e5aa 100644
--- a/src/gui/opengl/qopengltexturehelper_p.h
+++ b/src/gui/opengl/qopengltexturehelper_p.h
@@ -51,7 +51,7 @@
// We mean it.
//
-#include <QtCore/qglobal.h>
+#include <QtGui/private/qtguiglobal_p.h>
#ifndef QT_NO_OPENGL
diff --git a/src/gui/opengl/qopengltimerquery.h b/src/gui/opengl/qopengltimerquery.h
index 80e52a4c99..7b9ab850e2 100644
--- a/src/gui/opengl/qopengltimerquery.h
+++ b/src/gui/opengl/qopengltimerquery.h
@@ -40,7 +40,7 @@
#ifndef QOPENGLTIMERQUERY_H
#define QOPENGLTIMERQUERY_H
-#include <QtCore/qglobal.h>
+#include <QtGui/qtguiglobal.h>
#if !defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_2)
diff --git a/src/gui/opengl/qopenglversionfunctions.h b/src/gui/opengl/qopenglversionfunctions.h
index 7f991b1955..63209cf392 100644
--- a/src/gui/opengl/qopenglversionfunctions.h
+++ b/src/gui/opengl/qopenglversionfunctions.h
@@ -50,7 +50,7 @@
#ifndef QOPENGLVERSIONFUNCTIONS_H
#define QOPENGLVERSIONFUNCTIONS_H
-#include <QtCore/qglobal.h>
+#include <QtGui/qtguiglobal.h>
#ifndef QT_NO_OPENGL
diff --git a/src/gui/opengl/qopenglversionfunctionsfactory_p.h b/src/gui/opengl/qopenglversionfunctionsfactory_p.h
index 0af2e4d572..469a9cc624 100644
--- a/src/gui/opengl/qopenglversionfunctionsfactory_p.h
+++ b/src/gui/opengl/qopenglversionfunctionsfactory_p.h
@@ -60,9 +60,10 @@
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
+
#ifndef QT_NO_OPENGL
-#include <QtCore/QtGlobal>
#include <QtGui/qopenglcontext.h>
QT_BEGIN_NAMESPACE
diff --git a/src/gui/opengl/qopenglvertexarrayobject.h b/src/gui/opengl/qopenglvertexarrayobject.h
index 228c29fce7..a8153ea40b 100644
--- a/src/gui/opengl/qopenglvertexarrayobject.h
+++ b/src/gui/opengl/qopenglvertexarrayobject.h
@@ -40,7 +40,7 @@
#ifndef QOPENGLVERTEXARRAYOBJECT_H
#define QOPENGLVERTEXARRAYOBJECT_H
-#include <QtCore/qglobal.h>
+#include <QtGui/qtguiglobal.h>
#ifndef QT_NO_OPENGL
diff --git a/src/gui/painting/painting.pri b/src/gui/painting/painting.pri
index 283b6643b9..a61865a0b6 100644
--- a/src/gui/painting/painting.pri
+++ b/src/gui/painting/painting.pri
@@ -42,6 +42,7 @@ HEADERS += \
painting/qpolygonclipper_p.h \
painting/qrasterdefs_p.h \
painting/qrasterizer_p.h \
+ painting/qrbtree_p.h \
painting/qregion.h \
painting/qrgb.h \
painting/qrgba64.h \
@@ -49,6 +50,8 @@ HEADERS += \
painting/qstroker_p.h \
painting/qtextureglyphcache_p.h \
painting/qtransform.h \
+ painting/qtriangulatingstroker_p.h \
+ painting/qtriangulator_p.h \
painting/qplatformbackingstore.h \
painting/qpathsimplifier_p.h
@@ -60,7 +63,6 @@ SOURCES += \
painting/qblittable.cpp \
painting/qbrush.cpp \
painting/qcolor.cpp \
- painting/qcolor_p.cpp \
painting/qcompositionfunctions.cpp \
painting/qcosmeticstroker.cpp \
painting/qcssutil.cpp \
@@ -92,9 +94,16 @@ SOURCES += \
painting/qstroker.cpp \
painting/qtextureglyphcache.cpp \
painting/qtransform.cpp \
+ painting/qtriangulatingstroker.cpp \
+ painting/qtriangulator.cpp \
painting/qplatformbackingstore.cpp \
painting/qpathsimplifier.cpp
+darwin {
+ HEADERS += painting/qcoregraphics_p.h
+ SOURCES += painting/qcoregraphics.mm
+}
+
SSE2_SOURCES += painting/qdrawhelper_sse2.cpp
SSSE3_SOURCES += painting/qdrawhelper_ssse3.cpp
SSE4_1_SOURCES += painting/qdrawhelper_sse4.cpp \
@@ -104,8 +113,8 @@ AVX2_SOURCES += painting/qdrawhelper_avx2.cpp
NEON_SOURCES += painting/qdrawhelper_neon.cpp painting/qimagescale_neon.cpp
NEON_HEADERS += painting/qdrawhelper_neon_p.h
NEON_ASM += ../3rdparty/pixman/pixman-arm-neon-asm.S painting/qdrawhelper_neon_asm.S
-!ios:contains(QT_ARCH, "arm"): CONFIG+=no_clang_integrated_as
-!ios:!contains(QT_ARCH, "arm64"): DEFINES += ENABLE_PIXMAN_DRAWHELPERS
+!uikit:contains(QT_ARCH, "arm"): CONFIG += no_clang_integrated_as
+!uikit:!contains(QT_ARCH, "arm64"): DEFINES += ENABLE_PIXMAN_DRAWHELPERS
MIPS_DSP_SOURCES += painting/qdrawhelper_mips_dsp.cpp
MIPS_DSP_HEADERS += painting/qdrawhelper_mips_dsp_p.h painting/qt_mips_asm_dsp_p.h
diff --git a/src/gui/painting/qbackingstore.h b/src/gui/painting/qbackingstore.h
index 886cf29f0e..2ba6e1c906 100644
--- a/src/gui/painting/qbackingstore.h
+++ b/src/gui/painting/qbackingstore.h
@@ -40,6 +40,7 @@
#ifndef QBACKINGSTORE_H
#define QBACKINGSTORE_H
+#include <QtGui/qtguiglobal.h>
#include <QtCore/qrect.h>
#include <QtGui/qwindow.h>
diff --git a/src/gui/painting/qbezier_p.h b/src/gui/painting/qbezier_p.h
index c4e14a18cb..f8a91e9ef3 100644
--- a/src/gui/painting/qbezier_p.h
+++ b/src/gui/painting/qbezier_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#include "QtCore/qpoint.h"
#include "QtCore/qline.h"
#include "QtCore/qrect.h"
diff --git a/src/gui/painting/qblendfunctions_p.h b/src/gui/painting/qblendfunctions_p.h
index d21765bcde..7ee04987fe 100644
--- a/src/gui/painting/qblendfunctions_p.h
+++ b/src/gui/painting/qblendfunctions_p.h
@@ -40,6 +40,7 @@
#ifndef QBLENDFUNCTIONS_P_H
#define QBLENDFUNCTIONS_P_H
+#include <QtGui/private/qtguiglobal_p.h>
#include <qmath.h>
#include "qdrawhelper_p.h"
diff --git a/src/gui/painting/qblittable_p.h b/src/gui/painting/qblittable_p.h
index 8df56f6d0c..24440c3c61 100644
--- a/src/gui/painting/qblittable_p.h
+++ b/src/gui/painting/qblittable_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#include <QtCore/qsize.h>
#include <QtGui/private/qpixmap_blitter_p.h>
diff --git a/src/gui/painting/qbrush.cpp b/src/gui/painting/qbrush.cpp
index 3a296ac40c..acea5682d1 100644
--- a/src/gui/painting/qbrush.cpp
+++ b/src/gui/painting/qbrush.cpp
@@ -458,13 +458,8 @@ QBrush::QBrush(const QImage &image)
*/
QBrush::QBrush(Qt::BrushStyle style)
+ : QBrush(QColor(Qt::black), style)
{
- if (qbrush_check_type(style))
- init(Qt::black, style);
- else {
- d.reset(nullBrushInstance());
- d->ref.ref();
- }
}
/*!
@@ -491,13 +486,8 @@ QBrush::QBrush(const QColor &color, Qt::BrushStyle style)
\sa setColor(), setStyle()
*/
QBrush::QBrush(Qt::GlobalColor color, Qt::BrushStyle style)
+ : QBrush(QColor(color), style)
{
- if (qbrush_check_type(style))
- init(color, style);
- else {
- d.reset(nullBrushInstance());
- d->ref.ref();
- }
}
/*!
@@ -579,11 +569,20 @@ void QBrush::cleanUp(QBrushData *x)
QBrushDataPointerDeleter::deleteData(x);
}
+static Q_DECL_CONSTEXPR inline bool use_same_brushdata(Qt::BrushStyle lhs, Qt::BrushStyle rhs)
+{
+ return lhs == rhs // includes Qt::TexturePattern
+ || (lhs >= Qt::NoBrush && lhs <= Qt::DiagCrossPattern && rhs >= Qt::NoBrush && rhs <= Qt::DiagCrossPattern)
+ || (lhs >= Qt::LinearGradientPattern && lhs <= Qt::ConicalGradientPattern && rhs >= Qt::LinearGradientPattern && rhs <= Qt::ConicalGradientPattern)
+ ;
+}
void QBrush::detach(Qt::BrushStyle newStyle)
{
- if (newStyle == d->style && d->ref.load() == 1)
+ if (use_same_brushdata(newStyle, d->style) && d->ref.load() == 1) {
+ d->style = newStyle;
return;
+ }
QScopedPointer<QBrushData> x;
switch(newStyle) {
@@ -1673,13 +1672,8 @@ QLinearGradient::QLinearGradient(const QPointF &start, const QPointF &finalStop)
\sa QGradient::setColorAt(), QGradient::setStops()
*/
QLinearGradient::QLinearGradient(qreal xStart, qreal yStart, qreal xFinalStop, qreal yFinalStop)
+ : QLinearGradient(QPointF(xStart, yStart), QPointF(xFinalStop, yFinalStop))
{
- m_type = LinearGradient;
- m_spread = PadSpread;
- m_data.linear.x1 = xStart;
- m_data.linear.y1 = yStart;
- m_data.linear.x2 = xFinalStop;
- m_data.linear.y2 = yFinalStop;
}
@@ -1882,19 +1876,8 @@ QRadialGradient::QRadialGradient(const QPointF &center, qreal radius)
*/
QRadialGradient::QRadialGradient(qreal cx, qreal cy, qreal radius, qreal fx, qreal fy)
+ : QRadialGradient(QPointF(cx, cy), radius, QPointF(fx, fy))
{
- m_type = RadialGradient;
- m_spread = PadSpread;
- m_data.radial.cx = cx;
- m_data.radial.cy = cy;
- m_data.radial.cradius = radius;
-
- QPointF adapted_focal = qt_radial_gradient_adapt_focal_point(QPointF(cx, cy),
- radius,
- QPointF(fx, fy));
-
- m_data.radial.fx = adapted_focal.x();
- m_data.radial.fy = adapted_focal.y();
}
/*!
@@ -1904,14 +1887,8 @@ QRadialGradient::QRadialGradient(qreal cx, qreal cy, qreal radius, qreal fx, qre
\sa QGradient::setColorAt(), QGradient::setStops()
*/
QRadialGradient::QRadialGradient(qreal cx, qreal cy, qreal radius)
+ : QRadialGradient(QPointF(cx, cy), radius)
{
- m_type = RadialGradient;
- m_spread = PadSpread;
- m_data.radial.cx = cx;
- m_data.radial.cy = cy;
- m_data.radial.cradius = radius;
- m_data.radial.fx = cx;
- m_data.radial.fy = cy;
}
@@ -2211,12 +2188,8 @@ QConicalGradient::QConicalGradient(const QPointF &center, qreal angle)
*/
QConicalGradient::QConicalGradient(qreal cx, qreal cy, qreal angle)
+ : QConicalGradient(QPointF(cx, cy), angle)
{
- m_type = ConicalGradient;
- m_spread = PadSpread;
- m_data.conical.cx = cx;
- m_data.conical.cy = cy;
- m_data.conical.angle = angle;
}
diff --git a/src/gui/painting/qbrush.h b/src/gui/painting/qbrush.h
index 568c06ef84..e5cff9cc9b 100644
--- a/src/gui/painting/qbrush.h
+++ b/src/gui/painting/qbrush.h
@@ -40,6 +40,7 @@
#ifndef QBRUSH_H
#define QBRUSH_H
+#include <QtGui/qtguiglobal.h>
#include <QtCore/qpair.h>
#include <QtCore/qpoint.h>
#include <QtCore/qvector.h>
diff --git a/src/gui/painting/qcolor.cpp b/src/gui/painting/qcolor.cpp
index 0d24fd94f5..650ba0187e 100644
--- a/src/gui/painting/qcolor.cpp
+++ b/src/gui/painting/qcolor.cpp
@@ -43,6 +43,9 @@
#include "qdatastream.h"
#include "qvariant.h"
#include "qdebug.h"
+#include "private/qtools_p.h"
+
+#include <algorithm>
#include <stdio.h>
#include <limits.h>
@@ -50,6 +53,326 @@
QT_BEGIN_NAMESPACE
/*!
+ \internal
+ If s[0..1] is a valid hex number, returns its integer value,
+ otherwise returns -1.
+ */
+static inline int hex2int(const char *s)
+{
+ const int hi = QtMiscUtils::fromHex(s[0]);
+ if (hi < 0)
+ return -1;
+ const int lo = QtMiscUtils::fromHex(s[1]);
+ if (lo < 0)
+ return -1;
+ return (hi << 4) | lo;
+}
+
+/*!
+ \internal
+ If s is a valid hex digit, returns its integer value,
+ multiplied by 0x11, otherwise returns -1.
+ */
+static inline int hex2int(char s)
+{
+ const int h = QtMiscUtils::fromHex(s);
+ return h < 0 ? h : (h << 4) | h;
+}
+
+bool qt_get_hex_rgb(const char *name, QRgb *rgb)
+{
+ if (name[0] != '#')
+ return false;
+ name++;
+ int len = qstrlen(name);
+ int a, r, g, b;
+ a = 255;
+ if (len == 12) {
+ r = hex2int(name);
+ g = hex2int(name + 4);
+ b = hex2int(name + 8);
+ } else if (len == 9) {
+ r = hex2int(name);
+ g = hex2int(name + 3);
+ b = hex2int(name + 6);
+ } else if (len == 8) {
+ a = hex2int(name);
+ r = hex2int(name + 2);
+ g = hex2int(name + 4);
+ b = hex2int(name + 6);
+ } else if (len == 6) {
+ r = hex2int(name);
+ g = hex2int(name + 2);
+ b = hex2int(name + 4);
+ } else if (len == 3) {
+ r = hex2int(name[0]);
+ g = hex2int(name[1]);
+ b = hex2int(name[2]);
+ } else {
+ r = g = b = -1;
+ }
+ if ((uint)r > 255 || (uint)g > 255 || (uint)b > 255 || (uint)a > 255) {
+ *rgb = 0;
+ return false;
+ }
+ *rgb = qRgba(r, g ,b, a);
+ return true;
+}
+
+bool qt_get_hex_rgb(const QChar *str, int len, QRgb *rgb)
+{
+ if (len > 13)
+ return false;
+ char tmp[16];
+ for (int i = 0; i < len; ++i)
+ tmp[i] = str[i].toLatin1();
+ tmp[len] = 0;
+ return qt_get_hex_rgb(tmp, rgb);
+}
+
+#ifndef QT_NO_COLORNAMES
+
+/*
+ CSS color names = SVG 1.0 color names + transparent (rgba(0,0,0,0))
+*/
+
+#ifdef rgb
+# undef rgb
+#endif
+#define rgb(r,g,b) (0xff000000 | (r << 16) | (g << 8) | b)
+
+static const struct RGBData {
+ const char name[21];
+ uint value;
+} rgbTbl[] = {
+ { "aliceblue", rgb(240, 248, 255) },
+ { "antiquewhite", rgb(250, 235, 215) },
+ { "aqua", rgb( 0, 255, 255) },
+ { "aquamarine", rgb(127, 255, 212) },
+ { "azure", rgb(240, 255, 255) },
+ { "beige", rgb(245, 245, 220) },
+ { "bisque", rgb(255, 228, 196) },
+ { "black", rgb( 0, 0, 0) },
+ { "blanchedalmond", rgb(255, 235, 205) },
+ { "blue", rgb( 0, 0, 255) },
+ { "blueviolet", rgb(138, 43, 226) },
+ { "brown", rgb(165, 42, 42) },
+ { "burlywood", rgb(222, 184, 135) },
+ { "cadetblue", rgb( 95, 158, 160) },
+ { "chartreuse", rgb(127, 255, 0) },
+ { "chocolate", rgb(210, 105, 30) },
+ { "coral", rgb(255, 127, 80) },
+ { "cornflowerblue", rgb(100, 149, 237) },
+ { "cornsilk", rgb(255, 248, 220) },
+ { "crimson", rgb(220, 20, 60) },
+ { "cyan", rgb( 0, 255, 255) },
+ { "darkblue", rgb( 0, 0, 139) },
+ { "darkcyan", rgb( 0, 139, 139) },
+ { "darkgoldenrod", rgb(184, 134, 11) },
+ { "darkgray", rgb(169, 169, 169) },
+ { "darkgreen", rgb( 0, 100, 0) },
+ { "darkgrey", rgb(169, 169, 169) },
+ { "darkkhaki", rgb(189, 183, 107) },
+ { "darkmagenta", rgb(139, 0, 139) },
+ { "darkolivegreen", rgb( 85, 107, 47) },
+ { "darkorange", rgb(255, 140, 0) },
+ { "darkorchid", rgb(153, 50, 204) },
+ { "darkred", rgb(139, 0, 0) },
+ { "darksalmon", rgb(233, 150, 122) },
+ { "darkseagreen", rgb(143, 188, 143) },
+ { "darkslateblue", rgb( 72, 61, 139) },
+ { "darkslategray", rgb( 47, 79, 79) },
+ { "darkslategrey", rgb( 47, 79, 79) },
+ { "darkturquoise", rgb( 0, 206, 209) },
+ { "darkviolet", rgb(148, 0, 211) },
+ { "deeppink", rgb(255, 20, 147) },
+ { "deepskyblue", rgb( 0, 191, 255) },
+ { "dimgray", rgb(105, 105, 105) },
+ { "dimgrey", rgb(105, 105, 105) },
+ { "dodgerblue", rgb( 30, 144, 255) },
+ { "firebrick", rgb(178, 34, 34) },
+ { "floralwhite", rgb(255, 250, 240) },
+ { "forestgreen", rgb( 34, 139, 34) },
+ { "fuchsia", rgb(255, 0, 255) },
+ { "gainsboro", rgb(220, 220, 220) },
+ { "ghostwhite", rgb(248, 248, 255) },
+ { "gold", rgb(255, 215, 0) },
+ { "goldenrod", rgb(218, 165, 32) },
+ { "gray", rgb(128, 128, 128) },
+ { "green", rgb( 0, 128, 0) },
+ { "greenyellow", rgb(173, 255, 47) },
+ { "grey", rgb(128, 128, 128) },
+ { "honeydew", rgb(240, 255, 240) },
+ { "hotpink", rgb(255, 105, 180) },
+ { "indianred", rgb(205, 92, 92) },
+ { "indigo", rgb( 75, 0, 130) },
+ { "ivory", rgb(255, 255, 240) },
+ { "khaki", rgb(240, 230, 140) },
+ { "lavender", rgb(230, 230, 250) },
+ { "lavenderblush", rgb(255, 240, 245) },
+ { "lawngreen", rgb(124, 252, 0) },
+ { "lemonchiffon", rgb(255, 250, 205) },
+ { "lightblue", rgb(173, 216, 230) },
+ { "lightcoral", rgb(240, 128, 128) },
+ { "lightcyan", rgb(224, 255, 255) },
+ { "lightgoldenrodyellow", rgb(250, 250, 210) },
+ { "lightgray", rgb(211, 211, 211) },
+ { "lightgreen", rgb(144, 238, 144) },
+ { "lightgrey", rgb(211, 211, 211) },
+ { "lightpink", rgb(255, 182, 193) },
+ { "lightsalmon", rgb(255, 160, 122) },
+ { "lightseagreen", rgb( 32, 178, 170) },
+ { "lightskyblue", rgb(135, 206, 250) },
+ { "lightslategray", rgb(119, 136, 153) },
+ { "lightslategrey", rgb(119, 136, 153) },
+ { "lightsteelblue", rgb(176, 196, 222) },
+ { "lightyellow", rgb(255, 255, 224) },
+ { "lime", rgb( 0, 255, 0) },
+ { "limegreen", rgb( 50, 205, 50) },
+ { "linen", rgb(250, 240, 230) },
+ { "magenta", rgb(255, 0, 255) },
+ { "maroon", rgb(128, 0, 0) },
+ { "mediumaquamarine", rgb(102, 205, 170) },
+ { "mediumblue", rgb( 0, 0, 205) },
+ { "mediumorchid", rgb(186, 85, 211) },
+ { "mediumpurple", rgb(147, 112, 219) },
+ { "mediumseagreen", rgb( 60, 179, 113) },
+ { "mediumslateblue", rgb(123, 104, 238) },
+ { "mediumspringgreen", rgb( 0, 250, 154) },
+ { "mediumturquoise", rgb( 72, 209, 204) },
+ { "mediumvioletred", rgb(199, 21, 133) },
+ { "midnightblue", rgb( 25, 25, 112) },
+ { "mintcream", rgb(245, 255, 250) },
+ { "mistyrose", rgb(255, 228, 225) },
+ { "moccasin", rgb(255, 228, 181) },
+ { "navajowhite", rgb(255, 222, 173) },
+ { "navy", rgb( 0, 0, 128) },
+ { "oldlace", rgb(253, 245, 230) },
+ { "olive", rgb(128, 128, 0) },
+ { "olivedrab", rgb(107, 142, 35) },
+ { "orange", rgb(255, 165, 0) },
+ { "orangered", rgb(255, 69, 0) },
+ { "orchid", rgb(218, 112, 214) },
+ { "palegoldenrod", rgb(238, 232, 170) },
+ { "palegreen", rgb(152, 251, 152) },
+ { "paleturquoise", rgb(175, 238, 238) },
+ { "palevioletred", rgb(219, 112, 147) },
+ { "papayawhip", rgb(255, 239, 213) },
+ { "peachpuff", rgb(255, 218, 185) },
+ { "peru", rgb(205, 133, 63) },
+ { "pink", rgb(255, 192, 203) },
+ { "plum", rgb(221, 160, 221) },
+ { "powderblue", rgb(176, 224, 230) },
+ { "purple", rgb(128, 0, 128) },
+ { "red", rgb(255, 0, 0) },
+ { "rosybrown", rgb(188, 143, 143) },
+ { "royalblue", rgb( 65, 105, 225) },
+ { "saddlebrown", rgb(139, 69, 19) },
+ { "salmon", rgb(250, 128, 114) },
+ { "sandybrown", rgb(244, 164, 96) },
+ { "seagreen", rgb( 46, 139, 87) },
+ { "seashell", rgb(255, 245, 238) },
+ { "sienna", rgb(160, 82, 45) },
+ { "silver", rgb(192, 192, 192) },
+ { "skyblue", rgb(135, 206, 235) },
+ { "slateblue", rgb(106, 90, 205) },
+ { "slategray", rgb(112, 128, 144) },
+ { "slategrey", rgb(112, 128, 144) },
+ { "snow", rgb(255, 250, 250) },
+ { "springgreen", rgb( 0, 255, 127) },
+ { "steelblue", rgb( 70, 130, 180) },
+ { "tan", rgb(210, 180, 140) },
+ { "teal", rgb( 0, 128, 128) },
+ { "thistle", rgb(216, 191, 216) },
+ { "tomato", rgb(255, 99, 71) },
+ { "transparent", 0 },
+ { "turquoise", rgb( 64, 224, 208) },
+ { "violet", rgb(238, 130, 238) },
+ { "wheat", rgb(245, 222, 179) },
+ { "white", rgb(255, 255, 255) },
+ { "whitesmoke", rgb(245, 245, 245) },
+ { "yellow", rgb(255, 255, 0) },
+ { "yellowgreen", rgb(154, 205, 50) }
+};
+
+static const int rgbTblSize = sizeof(rgbTbl) / sizeof(RGBData);
+
+#undef rgb
+
+#if defined(Q_CC_MSVC) && _MSC_VER < 1600
+inline bool operator<(const RGBData &data1, const RGBData &data2)
+{ return qstrcmp(data1.name, data2.name) < 0; }
+#endif
+
+inline bool operator<(const char *name, const RGBData &data)
+{ return qstrcmp(name, data.name) < 0; }
+inline bool operator<(const RGBData &data, const char *name)
+{ return qstrcmp(data.name, name) < 0; }
+
+static bool get_named_rgb(const char *name_no_space, QRgb *rgb)
+{
+ const RGBData *r = std::lower_bound(rgbTbl, rgbTbl + rgbTblSize, name_no_space);
+ if ((r != rgbTbl + rgbTblSize) && !(name_no_space < *r)) {
+ *rgb = r->value;
+ return true;
+ }
+ return false;
+}
+
+bool qt_get_named_rgb(const char *name, QRgb* rgb)
+{
+ int len = int(strlen(name));
+ if (len > 255)
+ return false;
+ char name_no_space[256];
+ int pos = 0;
+ for (int i = 0; i < len; i++) {
+ if (name[i] != '\t' && name[i] != ' ')
+ name_no_space[pos++] = QChar::toLower(name[i]);
+ }
+ name_no_space[pos] = 0;
+
+ return get_named_rgb(name_no_space, rgb);
+}
+
+bool qt_get_named_rgb(const QChar *name, int len, QRgb *rgb)
+{
+ if (len > 255)
+ return false;
+ char name_no_space[256];
+ int pos = 0;
+ for (int i = 0; i < len; i++) {
+ if (name[i] != QLatin1Char('\t') && name[i] != QLatin1Char(' '))
+ name_no_space[pos++] = name[i].toLower().toLatin1();
+ }
+ name_no_space[pos] = 0;
+ return get_named_rgb(name_no_space, rgb);
+}
+
+QStringList qt_get_colornames()
+{
+ int i = 0;
+ QStringList lst;
+ lst.reserve(rgbTblSize);
+ for (i = 0; i < rgbTblSize; i++)
+ lst << QLatin1String(rgbTbl[i].name);
+ return lst;
+}
+
+#else
+
+bool qt_get_named_rgb(const char *, QRgb*)
+{
+ return false;
+}
+
+QStringList qt_get_colornames()
+{
+ return QStringList();
+}
+#endif // QT_NO_COLORNAMES
+
+/*!
\class QColor
\brief The QColor class provides colors based on RGB, HSV or CMYK values.
@@ -261,7 +584,7 @@ QT_BEGIN_NAMESPACE
alpha-channel to feature \l {QColor#Alpha-Blended
Drawing}{alpha-blended drawing}.
- \sa QPalette, QBrush, QApplication::setColorSpec()
+ \sa QPalette, QBrush
*/
#define QCOLOR_INT_RANGE_CHECK(fn, var) \
diff --git a/src/gui/painting/qcolor.h b/src/gui/painting/qcolor.h
index 6338eedd22..6cf3a8e262 100644
--- a/src/gui/painting/qcolor.h
+++ b/src/gui/painting/qcolor.h
@@ -40,6 +40,7 @@
#ifndef QCOLOR_H
#define QCOLOR_H
+#include <QtGui/qtguiglobal.h>
#include <QtGui/qrgb.h>
#include <QtCore/qnamespace.h>
#include <QtCore/qstringlist.h>
@@ -263,6 +264,7 @@ private:
friend Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QColor &);
#endif
};
+Q_DECLARE_TYPEINFO(QColor, QT_VERSION >= QT_VERSION_CHECK(6,0,0) ? Q_MOVABLE_TYPE : Q_RELOCATABLE_TYPE);
inline QColor::QColor() Q_DECL_NOTHROW
{ invalidate(); }
diff --git a/src/gui/painting/qcolor_p.cpp b/src/gui/painting/qcolor_p.cpp
deleted file mode 100644
index 773e4096ee..0000000000
--- a/src/gui/painting/qcolor_p.cpp
+++ /dev/null
@@ -1,381 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qglobal.h"
-#include "qrgb.h"
-#include "qstringlist.h"
-#include "private/qtools_p.h"
-
-#include <algorithm>
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \internal
- If s[0..1] is a valid hex number, returns its integer value,
- otherwise returns -1.
- */
-static inline int hex2int(const char *s)
-{
- const int hi = QtMiscUtils::fromHex(s[0]);
- if (hi < 0)
- return -1;
- const int lo = QtMiscUtils::fromHex(s[1]);
- if (lo < 0)
- return -1;
- return (hi << 4) | lo;
-}
-
-/*!
- \internal
- If s is a valid hex digit, returns its integer value,
- multiplied by 0x11, otherwise returns -1.
- */
-static inline int hex2int(char s)
-{
- const int h = QtMiscUtils::fromHex(s);
- return h < 0 ? h : (h << 4) | h;
-}
-
-bool qt_get_hex_rgb(const char *name, QRgb *rgb)
-{
- if(name[0] != '#')
- return false;
- name++;
- int len = qstrlen(name);
- int a, r, g, b;
- a = 255;
- if (len == 12) {
- r = hex2int(name);
- g = hex2int(name + 4);
- b = hex2int(name + 8);
- } else if (len == 9) {
- r = hex2int(name);
- g = hex2int(name + 3);
- b = hex2int(name + 6);
- } else if (len == 8) {
- a = hex2int(name);
- r = hex2int(name + 2);
- g = hex2int(name + 4);
- b = hex2int(name + 6);
- } else if (len == 6) {
- r = hex2int(name);
- g = hex2int(name + 2);
- b = hex2int(name + 4);
- } else if (len == 3) {
- r = hex2int(name[0]);
- g = hex2int(name[1]);
- b = hex2int(name[2]);
- } else {
- r = g = b = -1;
- }
- if ((uint)r > 255 || (uint)g > 255 || (uint)b > 255 || (uint)a > 255) {
- *rgb = 0;
- return false;
- }
- *rgb = qRgba(r, g ,b, a);
- return true;
-}
-
-bool qt_get_hex_rgb(const QChar *str, int len, QRgb *rgb)
-{
- if (len > 13)
- return false;
- char tmp[16];
- for(int i = 0; i < len; ++i)
- tmp[i] = str[i].toLatin1();
- tmp[len] = 0;
- return qt_get_hex_rgb(tmp, rgb);
-}
-
-#ifndef QT_NO_COLORNAMES
-
-/*
- CSS color names = SVG 1.0 color names + transparent (rgba(0,0,0,0))
-*/
-
-#ifdef rgb
-# undef rgb
-#endif
-#define rgb(r,g,b) (0xff000000 | (r << 16) | (g << 8) | b)
-
-static const struct RGBData {
- const char name[21];
- uint value;
-} rgbTbl[] = {
- { "aliceblue", rgb(240, 248, 255) },
- { "antiquewhite", rgb(250, 235, 215) },
- { "aqua", rgb( 0, 255, 255) },
- { "aquamarine", rgb(127, 255, 212) },
- { "azure", rgb(240, 255, 255) },
- { "beige", rgb(245, 245, 220) },
- { "bisque", rgb(255, 228, 196) },
- { "black", rgb( 0, 0, 0) },
- { "blanchedalmond", rgb(255, 235, 205) },
- { "blue", rgb( 0, 0, 255) },
- { "blueviolet", rgb(138, 43, 226) },
- { "brown", rgb(165, 42, 42) },
- { "burlywood", rgb(222, 184, 135) },
- { "cadetblue", rgb( 95, 158, 160) },
- { "chartreuse", rgb(127, 255, 0) },
- { "chocolate", rgb(210, 105, 30) },
- { "coral", rgb(255, 127, 80) },
- { "cornflowerblue", rgb(100, 149, 237) },
- { "cornsilk", rgb(255, 248, 220) },
- { "crimson", rgb(220, 20, 60) },
- { "cyan", rgb( 0, 255, 255) },
- { "darkblue", rgb( 0, 0, 139) },
- { "darkcyan", rgb( 0, 139, 139) },
- { "darkgoldenrod", rgb(184, 134, 11) },
- { "darkgray", rgb(169, 169, 169) },
- { "darkgreen", rgb( 0, 100, 0) },
- { "darkgrey", rgb(169, 169, 169) },
- { "darkkhaki", rgb(189, 183, 107) },
- { "darkmagenta", rgb(139, 0, 139) },
- { "darkolivegreen", rgb( 85, 107, 47) },
- { "darkorange", rgb(255, 140, 0) },
- { "darkorchid", rgb(153, 50, 204) },
- { "darkred", rgb(139, 0, 0) },
- { "darksalmon", rgb(233, 150, 122) },
- { "darkseagreen", rgb(143, 188, 143) },
- { "darkslateblue", rgb( 72, 61, 139) },
- { "darkslategray", rgb( 47, 79, 79) },
- { "darkslategrey", rgb( 47, 79, 79) },
- { "darkturquoise", rgb( 0, 206, 209) },
- { "darkviolet", rgb(148, 0, 211) },
- { "deeppink", rgb(255, 20, 147) },
- { "deepskyblue", rgb( 0, 191, 255) },
- { "dimgray", rgb(105, 105, 105) },
- { "dimgrey", rgb(105, 105, 105) },
- { "dodgerblue", rgb( 30, 144, 255) },
- { "firebrick", rgb(178, 34, 34) },
- { "floralwhite", rgb(255, 250, 240) },
- { "forestgreen", rgb( 34, 139, 34) },
- { "fuchsia", rgb(255, 0, 255) },
- { "gainsboro", rgb(220, 220, 220) },
- { "ghostwhite", rgb(248, 248, 255) },
- { "gold", rgb(255, 215, 0) },
- { "goldenrod", rgb(218, 165, 32) },
- { "gray", rgb(128, 128, 128) },
- { "green", rgb( 0, 128, 0) },
- { "greenyellow", rgb(173, 255, 47) },
- { "grey", rgb(128, 128, 128) },
- { "honeydew", rgb(240, 255, 240) },
- { "hotpink", rgb(255, 105, 180) },
- { "indianred", rgb(205, 92, 92) },
- { "indigo", rgb( 75, 0, 130) },
- { "ivory", rgb(255, 255, 240) },
- { "khaki", rgb(240, 230, 140) },
- { "lavender", rgb(230, 230, 250) },
- { "lavenderblush", rgb(255, 240, 245) },
- { "lawngreen", rgb(124, 252, 0) },
- { "lemonchiffon", rgb(255, 250, 205) },
- { "lightblue", rgb(173, 216, 230) },
- { "lightcoral", rgb(240, 128, 128) },
- { "lightcyan", rgb(224, 255, 255) },
- { "lightgoldenrodyellow", rgb(250, 250, 210) },
- { "lightgray", rgb(211, 211, 211) },
- { "lightgreen", rgb(144, 238, 144) },
- { "lightgrey", rgb(211, 211, 211) },
- { "lightpink", rgb(255, 182, 193) },
- { "lightsalmon", rgb(255, 160, 122) },
- { "lightseagreen", rgb( 32, 178, 170) },
- { "lightskyblue", rgb(135, 206, 250) },
- { "lightslategray", rgb(119, 136, 153) },
- { "lightslategrey", rgb(119, 136, 153) },
- { "lightsteelblue", rgb(176, 196, 222) },
- { "lightyellow", rgb(255, 255, 224) },
- { "lime", rgb( 0, 255, 0) },
- { "limegreen", rgb( 50, 205, 50) },
- { "linen", rgb(250, 240, 230) },
- { "magenta", rgb(255, 0, 255) },
- { "maroon", rgb(128, 0, 0) },
- { "mediumaquamarine", rgb(102, 205, 170) },
- { "mediumblue", rgb( 0, 0, 205) },
- { "mediumorchid", rgb(186, 85, 211) },
- { "mediumpurple", rgb(147, 112, 219) },
- { "mediumseagreen", rgb( 60, 179, 113) },
- { "mediumslateblue", rgb(123, 104, 238) },
- { "mediumspringgreen", rgb( 0, 250, 154) },
- { "mediumturquoise", rgb( 72, 209, 204) },
- { "mediumvioletred", rgb(199, 21, 133) },
- { "midnightblue", rgb( 25, 25, 112) },
- { "mintcream", rgb(245, 255, 250) },
- { "mistyrose", rgb(255, 228, 225) },
- { "moccasin", rgb(255, 228, 181) },
- { "navajowhite", rgb(255, 222, 173) },
- { "navy", rgb( 0, 0, 128) },
- { "oldlace", rgb(253, 245, 230) },
- { "olive", rgb(128, 128, 0) },
- { "olivedrab", rgb(107, 142, 35) },
- { "orange", rgb(255, 165, 0) },
- { "orangered", rgb(255, 69, 0) },
- { "orchid", rgb(218, 112, 214) },
- { "palegoldenrod", rgb(238, 232, 170) },
- { "palegreen", rgb(152, 251, 152) },
- { "paleturquoise", rgb(175, 238, 238) },
- { "palevioletred", rgb(219, 112, 147) },
- { "papayawhip", rgb(255, 239, 213) },
- { "peachpuff", rgb(255, 218, 185) },
- { "peru", rgb(205, 133, 63) },
- { "pink", rgb(255, 192, 203) },
- { "plum", rgb(221, 160, 221) },
- { "powderblue", rgb(176, 224, 230) },
- { "purple", rgb(128, 0, 128) },
- { "red", rgb(255, 0, 0) },
- { "rosybrown", rgb(188, 143, 143) },
- { "royalblue", rgb( 65, 105, 225) },
- { "saddlebrown", rgb(139, 69, 19) },
- { "salmon", rgb(250, 128, 114) },
- { "sandybrown", rgb(244, 164, 96) },
- { "seagreen", rgb( 46, 139, 87) },
- { "seashell", rgb(255, 245, 238) },
- { "sienna", rgb(160, 82, 45) },
- { "silver", rgb(192, 192, 192) },
- { "skyblue", rgb(135, 206, 235) },
- { "slateblue", rgb(106, 90, 205) },
- { "slategray", rgb(112, 128, 144) },
- { "slategrey", rgb(112, 128, 144) },
- { "snow", rgb(255, 250, 250) },
- { "springgreen", rgb( 0, 255, 127) },
- { "steelblue", rgb( 70, 130, 180) },
- { "tan", rgb(210, 180, 140) },
- { "teal", rgb( 0, 128, 128) },
- { "thistle", rgb(216, 191, 216) },
- { "tomato", rgb(255, 99, 71) },
- { "transparent", 0 },
- { "turquoise", rgb( 64, 224, 208) },
- { "violet", rgb(238, 130, 238) },
- { "wheat", rgb(245, 222, 179) },
- { "white", rgb(255, 255, 255) },
- { "whitesmoke", rgb(245, 245, 245) },
- { "yellow", rgb(255, 255, 0) },
- { "yellowgreen", rgb(154, 205, 50) }
-};
-
-static const int rgbTblSize = sizeof(rgbTbl) / sizeof(RGBData);
-
-#undef rgb
-
-#if defined(Q_CC_MSVC) && _MSC_VER < 1600
-inline bool operator<(const RGBData &data1, const RGBData &data2)
-{ return qstrcmp(data1.name, data2.name) < 0; }
-#endif
-
-inline bool operator<(const char *name, const RGBData &data)
-{ return qstrcmp(name, data.name) < 0; }
-inline bool operator<(const RGBData &data, const char *name)
-{ return qstrcmp(data.name, name) < 0; }
-
-static bool get_named_rgb(const char *name_no_space, QRgb *rgb)
-{
- const RGBData *r = std::lower_bound(rgbTbl, rgbTbl + rgbTblSize, name_no_space);
- if ((r != rgbTbl + rgbTblSize) && !(name_no_space < *r)) {
- *rgb = r->value;
- return true;
- }
- return false;
-}
-
-bool qt_get_named_rgb(const char *name, QRgb* rgb)
-{
- int len = int(strlen(name));
- if(len > 255)
- return false;
- char name_no_space[256];
- int pos = 0;
- for(int i = 0; i < len; i++) {
- if(name[i] != '\t' && name[i] != ' ')
- name_no_space[pos++] = QChar::toLower(name[i]);
- }
- name_no_space[pos] = 0;
-
- return get_named_rgb(name_no_space, rgb);
-}
-
-bool qt_get_named_rgb(const QChar *name, int len, QRgb *rgb)
-{
- if(len > 255)
- return false;
- char name_no_space[256];
- int pos = 0;
- for(int i = 0; i < len; i++) {
- if(name[i] != QLatin1Char('\t') && name[i] != QLatin1Char(' '))
- name_no_space[pos++] = name[i].toLower().toLatin1();
- }
- name_no_space[pos] = 0;
- return get_named_rgb(name_no_space, rgb);
-}
-
-
-uint qt_get_rgb_val(const char *name)
-{
- QRgb r = 0;
- qt_get_named_rgb(name,&r);
- return r;
-}
-
-QStringList qt_get_colornames()
-{
- int i = 0;
- QStringList lst;
- lst.reserve(rgbTblSize);
- for (i = 0; i < rgbTblSize; i++)
- lst << QLatin1String(rgbTbl[i].name);
- return lst;
-}
-
-#else
-
-bool qt_get_named_rgb(const char *, QRgb*)
-{
- return false;
-}
-
-uint qt_get_rgb_val(const char *)
-{
- return 0;
-}
-QStringList qt_get_colornames()
-{
- return QStringList();
-}
-#endif // QT_NO_COLORNAMES
-
-QT_END_NAMESPACE
diff --git a/src/gui/painting/qcolor_p.h b/src/gui/painting/qcolor_p.h
index 75bc888952..b5e92e2ea2 100644
--- a/src/gui/painting/qcolor_p.h
+++ b/src/gui/painting/qcolor_p.h
@@ -51,13 +51,12 @@
// We mean it.
//
-#include "QtCore/qglobal.h"
+#include <QtGui/private/qtguiglobal_p.h>
#include "QtGui/qrgb.h"
#include "QtCore/qstringlist.h"
QT_BEGIN_NAMESPACE
-uint qt_get_rgb_val(const char *name);
bool qt_get_named_rgb(const char *, QRgb*);
bool qt_get_named_rgb(const QChar *, int len, QRgb*);
bool qt_get_hex_rgb(const char *, QRgb *);
diff --git a/src/gui/painting/qcompositionfunctions.cpp b/src/gui/painting/qcompositionfunctions.cpp
index 9312ee9540..6d2cb9aadb 100644
--- a/src/gui/painting/qcompositionfunctions.cpp
+++ b/src/gui/painting/qcompositionfunctions.cpp
@@ -87,6 +87,36 @@ QT_BEGIN_NAMESPACE
}\
}
+#if defined __SSE2__
+# define LOAD(ptr) _mm_loadl_epi64(reinterpret_cast<const __m128i *>(ptr))
+#ifdef Q_PROCESSOR_X86_64
+# define CONVERT(value) _mm_cvtsi64_si128(value)
+#else
+# define CONVERT(value) LOAD(&value)
+#endif
+# define STORE(ptr, value) _mm_storel_epi64(reinterpret_cast<__m128i *>(ptr), value)
+# define ADD(p, q) _mm_add_epi32(p, q)
+# define ALPHA(c) _mm_shufflelo_epi16(c, _MM_SHUFFLE(3, 3, 3, 3))
+# define CONST(n) _mm_shufflelo_epi16(_mm_cvtsi32_si128(n), _MM_SHUFFLE(0, 0, 0, 0))
+# define INVALPHA(c) _mm_sub_epi32(CONST(65535), ALPHA(c))
+#elif defined __ARM_NEON__
+# define LOAD(ptr) vreinterpret_u16_u64(vld1_u64(reinterpret_cast<const uint64_t *>(ptr)))
+# define CONVERT(value) vreinterpret_u16_u64(vmov_n_u64(value))
+# define STORE(ptr, value) vst1_u64(reinterpret_cast<uint64_t *>(ptr), vreinterpret_u64_u16(value))
+# define ADD(p, q) vadd_u16(p, q)
+# define ALPHA(c) vdup_lane_u16(c, 3)
+# define CONST(n) vdup_n_u16(n)
+# define INVALPHA(c) vmvn_u16(ALPHA(c))
+#else
+# define LOAD(ptr) *ptr
+# define CONVERT(value) value
+# define STORE(ptr, value) *ptr = value
+# define ADD(p, q) (p + q)
+# define ALPHA(c) (c).alpha()
+# define CONST(n) n
+# define INVALPHA(c) (65535 - ALPHA(c))
+#endif
+
void QT_FASTCALL comp_func_solid_Clear(uint *dest, int length, uint, uint const_alpha)
{
comp_func_Clear_impl(dest, length, const_alpha);
@@ -99,7 +129,7 @@ void QT_FASTCALL comp_func_solid_Clear_rgb64(QRgba64 *dest, int length, QRgba64,
else {
int ialpha = 255 - const_alpha;
for (int i = 0; i < length; ++i) {
- dest[i] = multiplyAlpha255(dest[i], ialpha);
+ STORE(&dest[i], multiplyAlpha255(LOAD(&dest[i]), ialpha));
}
}
}
@@ -116,7 +146,7 @@ void QT_FASTCALL comp_func_Clear_rgb64(QRgba64 *dest, const QRgba64 *, int lengt
else {
int ialpha = 255 - const_alpha;
for (int i = 0; i < length; ++i) {
- dest[i] = multiplyAlpha255(dest[i], ialpha);
+ STORE(&dest[i], multiplyAlpha255(LOAD(&dest[i]), ialpha));
}
}
}
@@ -146,9 +176,9 @@ void QT_FASTCALL comp_func_solid_Source_rgb64(QRgba64 *dest, int length, QRgba64
qt_memfill64((quint64*)dest, color, length);
else {
int ialpha = 255 - const_alpha;
- color = multiplyAlpha255(color, const_alpha);
+ auto c = multiplyAlpha255(CONVERT(color), const_alpha);
for (int i = 0; i < length; ++i) {
- dest[i] = color + multiplyAlpha255(dest[i], ialpha);
+ STORE(&dest[i], ADD(c, multiplyAlpha255(LOAD(&dest[i]), ialpha)));
}
}
}
@@ -174,7 +204,7 @@ void QT_FASTCALL comp_func_Source_rgb64(QRgba64 *Q_DECL_RESTRICT dest, const QRg
else {
int ialpha = 255 - const_alpha;
for (int i = 0; i < length; ++i) {
- dest[i] = interpolate255(src[i], const_alpha, dest[i], ialpha);
+ STORE(&dest[i], interpolate255(LOAD(&src[i]), const_alpha, LOAD(&dest[i]), ialpha));
}
}
}
@@ -221,10 +251,12 @@ void QT_FASTCALL comp_func_solid_SourceOver_rgb64(QRgba64 *dest, int length, QRg
if (const_alpha == 255 && color.isOpaque()) {
qt_memfill64((quint64*)dest, color, length);
} else {
+ auto c = CONVERT(color);
if (const_alpha != 255)
- color = multiplyAlpha255(color, const_alpha);
+ c = multiplyAlpha255(c, const_alpha);
+ auto cAlpha = INVALPHA(c);
for (int i = 0; i < length; ++i) {
- dest[i] = color + multiplyAlpha65535(dest[i], 65535 - color.alpha());
+ STORE(&dest[i], ADD(c, multiplyAlpha65535(LOAD(&dest[i]), cAlpha)));
}
}
}
@@ -258,12 +290,12 @@ void QT_FASTCALL comp_func_SourceOver_rgb64(QRgba64 *Q_DECL_RESTRICT dest, const
if (s.isOpaque())
dest[i] = s;
else if (!s.isTransparent())
- dest[i] = s + multiplyAlpha65535(dest[i], 65535 - s.alpha());
+ STORE(&dest[i], ADD(CONVERT(s), multiplyAlpha65535(LOAD(&dest[i]), 65535 - s.alpha())));
}
} else {
for (int i = 0; i < length; ++i) {
- QRgba64 s = multiplyAlpha255(src[i], const_alpha);
- dest[i] = s + multiplyAlpha65535(dest[i], 65535 - s.alpha());
+ auto s = multiplyAlpha255(LOAD(&src[i]), const_alpha);
+ STORE(&dest[i], ADD(s, multiplyAlpha65535(LOAD(&dest[i]), INVALPHA(s))));
}
}
}
@@ -287,11 +319,12 @@ void QT_FASTCALL comp_func_solid_DestinationOver(uint *dest, int length, uint co
void QT_FASTCALL comp_func_solid_DestinationOver_rgb64(QRgba64 *dest, int length, QRgba64 color, uint const_alpha)
{
+ auto c = CONVERT(color);
if (const_alpha != 255)
- color = multiplyAlpha255(color, const_alpha);
+ c = multiplyAlpha255(c, const_alpha);
for (int i = 0; i < length; ++i) {
- QRgba64 d = dest[i];
- dest[i] = d + multiplyAlpha65535(color, 65535 - d.alpha());
+ auto d = LOAD(&dest[i]);
+ STORE(&dest[i], ADD(d, multiplyAlpha65535(c, INVALPHA(d))));
}
}
@@ -318,14 +351,14 @@ void QT_FASTCALL comp_func_DestinationOver_rgb64(QRgba64 *Q_DECL_RESTRICT dest,
{
if (const_alpha == 255) {
for (int i = 0; i < length; ++i) {
- QRgba64 d = dest[i];
- dest[i] = d + multiplyAlpha65535(src[i], 65535 - d.alpha());
+ auto d = LOAD(&dest[i]);
+ STORE(&dest[i], ADD(d, multiplyAlpha65535(LOAD(&src[i]), INVALPHA(d))));
}
} else {
for (int i = 0; i < length; ++i) {
- QRgba64 d = dest[i];
- QRgba64 s = multiplyAlpha255(src[i], const_alpha);
- dest[i] = d + multiplyAlpha65535(s, 65535 - d.alpha());
+ auto d = LOAD(&dest[i]);
+ auto s = multiplyAlpha255(LOAD(&src[i]), const_alpha);
+ STORE(&dest[i], ADD(d, multiplyAlpha65535(s, INVALPHA(d))));
}
}
}
@@ -393,15 +426,15 @@ void QT_FASTCALL comp_func_SourceIn_rgb64(QRgba64 *Q_DECL_RESTRICT dest, const Q
{
if (const_alpha == 255) {
for (int i = 0; i < length; ++i) {
- dest[i] = multiplyAlpha65535(src[i], dest[i].alpha());
+ STORE(&dest[i], multiplyAlpha65535(LOAD(&src[i]), dest[i].alpha()));
}
} else {
uint ca = const_alpha * 257;
- uint cia = 65535 - ca;
+ auto cia = CONST(65535 - ca);
for (int i = 0; i < length; ++i) {
- QRgba64 d = dest[i];
- QRgba64 s = multiplyAlpha65535(src[i], ca);
- dest[i] = interpolate65535(s, d.alpha(), d, cia);
+ auto d = LOAD(&dest[i]);
+ auto s = multiplyAlpha65535(LOAD(&src[i]), ca);
+ STORE(&dest[i], interpolate65535(s, ALPHA(d), d, cia));
}
}
}
@@ -431,7 +464,7 @@ void QT_FASTCALL comp_func_solid_DestinationIn_rgb64(QRgba64 *dest, int length,
if (const_alpha != 255)
a = qt_div_65535(a * ca64k) + 65535 - ca64k;
for (int i = 0; i < length; ++i) {
- dest[i] = multiplyAlpha65535(dest[i], a);
+ STORE(&dest[i], multiplyAlpha65535(LOAD(&dest[i]), a));
}
}
@@ -885,14 +918,19 @@ void QT_FASTCALL comp_func_solid_Plus(uint *dest, int length, uint color, uint c
void QT_FASTCALL comp_func_solid_Plus_rgb64(QRgba64 *dest, int length, QRgba64 color, uint const_alpha)
{
+ auto b = CONVERT(color);
if (const_alpha == 255) {
for (int i = 0; i < length; ++i) {
- dest[i] = addWithSaturation(dest[i], color);
+ auto a = LOAD(&dest[i]);
+ a = addWithSaturation(a, b);
+ STORE(&dest[i], a);
}
} else {
for (int i = 0; i < length; ++i) {
- QRgba64 d = addWithSaturation(dest[i], color);
- dest[i] = interpolate255(d, const_alpha, dest[i], 255 - const_alpha);
+ auto a = LOAD(&dest[i]);
+ auto d = addWithSaturation(a, b);
+ a = interpolate255(d, const_alpha, a, 255 - const_alpha);
+ STORE(&dest[i], a);
}
}
}
@@ -924,12 +962,18 @@ void QT_FASTCALL comp_func_Plus_rgb64(QRgba64 *Q_DECL_RESTRICT dest, const QRgba
{
if (const_alpha == 255) {
for (int i = 0; i < length; ++i) {
- dest[i] = addWithSaturation(dest[i], src[i]);
+ auto a = LOAD(&dest[i]);
+ auto b = LOAD(&src[i]);
+ a = addWithSaturation(a, b);
+ STORE(&dest[i], a);
}
} else {
for (int i = 0; i < length; ++i) {
- QRgba64 d = addWithSaturation(dest[i], src[i]);
- dest[i] = interpolate255(d, const_alpha, dest[i], 255 - const_alpha);
+ auto a = LOAD(&dest[i]);
+ auto b = LOAD(&src[i]);
+ auto d = addWithSaturation(a, b);
+ a = interpolate255(d, const_alpha, a, 255 - const_alpha);
+ STORE(&dest[i], a);
}
}
}
diff --git a/src/gui/painting/qcoregraphics.mm b/src/gui/painting/qcoregraphics.mm
new file mode 100644
index 0000000000..6af12c19d8
--- /dev/null
+++ b/src/gui/painting/qcoregraphics.mm
@@ -0,0 +1,565 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the QtGui module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL21$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qcoregraphics_p.h"
+
+#include <private/qcore_mac_p.h>
+#include <qpa/qplatformpixmap.h>
+#include <QtGui/qicon.h>
+#include <QtGui/private/qpaintengine_p.h>
+#include <QtCore/qdebug.h>
+#include <QtCore/qcoreapplication.h>
+
+QT_BEGIN_NAMESPACE
+
+// ---------------------- Images ----------------------
+
+CGImageRef qt_mac_toCGImage(const QImage &inImage)
+{
+ CGImageRef cgImage = inImage.toCGImage();
+ if (cgImage)
+ return cgImage;
+
+ // Convert image data to a known-good format if the fast conversion fails.
+ return inImage.convertToFormat(QImage::Format_ARGB32_Premultiplied).toCGImage();
+}
+
+CGImageRef qt_mac_toCGImageMask(const QImage &image)
+{
+ static const auto deleter = [](void *image, const void *, size_t) { delete static_cast<QImage *>(image); };
+ QCFType<CGDataProviderRef> dataProvider =
+ CGDataProviderCreateWithData(new QImage(image), image.bits(),
+ image.byteCount(), deleter);
+
+ return CGImageMaskCreate(image.width(), image.height(), 8, image.depth(),
+ image.bytesPerLine(), dataProvider, NULL, false);
+}
+
+OSStatus qt_mac_drawCGImage(CGContextRef inContext, const CGRect *inBounds, CGImageRef inImage)
+{
+ // Verbatim copy if HIViewDrawCGImage (as shown on Carbon-Dev)
+ OSStatus err = noErr;
+
+#ifdef Q_OS_MACOS
+ require_action(inContext != NULL, InvalidContext, err = paramErr);
+ require_action(inBounds != NULL, InvalidBounds, err = paramErr);
+ require_action(inImage != NULL, InvalidImage, err = paramErr);
+#endif
+
+ CGContextSaveGState( inContext );
+ CGContextTranslateCTM (inContext, 0, inBounds->origin.y + CGRectGetMaxY(*inBounds));
+ CGContextScaleCTM(inContext, 1, -1);
+
+ CGContextDrawImage(inContext, *inBounds, inImage);
+
+ CGContextRestoreGState(inContext);
+
+#ifdef Q_OS_MACOS
+InvalidImage:
+InvalidBounds:
+InvalidContext:
+#endif
+ return err;
+}
+
+QImage qt_mac_toQImage(CGImageRef image)
+{
+ const size_t w = CGImageGetWidth(image),
+ h = CGImageGetHeight(image);
+ QImage ret(w, h, QImage::Format_ARGB32_Premultiplied);
+ ret.fill(Qt::transparent);
+ CGRect rect = CGRectMake(0, 0, w, h);
+ QMacCGContext ctx(&ret);
+ qt_mac_drawCGImage(ctx, &rect, image);
+ return ret;
+}
+
+#ifdef Q_OS_MACOS
+
+QT_END_NAMESPACE
+
+@interface NSGraphicsContext (QtAdditions)
+
++ (NSGraphicsContext *)qt_graphicsContextWithCGContext:(CGContextRef)graphicsPort flipped:(BOOL)initialFlippedState;
+
+@end
+
+@implementation NSGraphicsContext (QtAdditions)
+
++ (NSGraphicsContext *)qt_graphicsContextWithCGContext:(CGContextRef)graphicsPort flipped:(BOOL)initialFlippedState
+{
+#if QT_MAC_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_10_10, __IPHONE_NA)
+ if (QT_PREPEND_NAMESPACE(QSysInfo::MacintoshVersion) >= QT_PREPEND_NAMESPACE(QSysInfo::MV_10_10))
+ return [self graphicsContextWithCGContext:graphicsPort flipped:initialFlippedState];
+#endif
+ return [self graphicsContextWithGraphicsPort:graphicsPort flipped:initialFlippedState];
+}
+
+@end
+
+QT_BEGIN_NAMESPACE
+
+static NSImage *qt_mac_cgimage_to_nsimage(CGImageRef image)
+{
+ NSImage *newImage = [[NSImage alloc] initWithCGImage:image size:NSZeroSize];
+ return newImage;
+}
+
+NSImage *qt_mac_create_nsimage(const QPixmap &pm)
+{
+ if (pm.isNull())
+ return 0;
+ QImage image = pm.toImage();
+ CGImageRef cgImage = qt_mac_toCGImage(image);
+ NSImage *nsImage = qt_mac_cgimage_to_nsimage(cgImage);
+ CGImageRelease(cgImage);
+ return nsImage;
+}
+
+NSImage *qt_mac_create_nsimage(const QIcon &icon)
+{
+ if (icon.isNull())
+ return nil;
+
+ NSImage *nsImage = [[NSImage alloc] init];
+ foreach (QSize size, icon.availableSizes()) {
+ QPixmap pm = icon.pixmap(size);
+ QImage image = pm.toImage();
+ CGImageRef cgImage = qt_mac_toCGImage(image);
+ NSBitmapImageRep *imageRep = [[NSBitmapImageRep alloc] initWithCGImage:cgImage];
+ [nsImage addRepresentation:imageRep];
+ [imageRep release];
+ CGImageRelease(cgImage);
+ }
+ return nsImage;
+}
+
+QPixmap qt_mac_toQPixmap(const NSImage *image, const QSizeF &size)
+{
+ const NSSize pixmapSize = NSMakeSize(size.width(), size.height());
+ QPixmap pixmap(pixmapSize.width, pixmapSize.height);
+ pixmap.fill(Qt::transparent);
+ [image setSize:pixmapSize];
+ const NSRect iconRect = NSMakeRect(0, 0, pixmapSize.width, pixmapSize.height);
+ QMacCGContext ctx(&pixmap);
+ if (!ctx)
+ return QPixmap();
+ NSGraphicsContext *gc = [NSGraphicsContext qt_graphicsContextWithCGContext:ctx flipped:YES];
+ if (!gc)
+ return QPixmap();
+ [NSGraphicsContext saveGraphicsState];
+ [NSGraphicsContext setCurrentContext:gc];
+ [image drawInRect:iconRect fromRect:iconRect operation:NSCompositeSourceOver fraction:1.0 respectFlipped:YES hints:nil];
+ [NSGraphicsContext restoreGraphicsState];
+ return pixmap;
+}
+
+#endif // Q_OS_MACOS
+
+// ---------------------- Colors and Brushes ----------------------
+
+QColor qt_mac_toQColor(CGColorRef color)
+{
+ QColor qtColor;
+ CGColorSpaceModel model = CGColorSpaceGetModel(CGColorGetColorSpace(color));
+ const CGFloat *components = CGColorGetComponents(color);
+ if (model == kCGColorSpaceModelRGB) {
+ qtColor.setRgbF(components[0], components[1], components[2], components[3]);
+ } else if (model == kCGColorSpaceModelCMYK) {
+ qtColor.setCmykF(components[0], components[1], components[2], components[3]);
+ } else if (model == kCGColorSpaceModelMonochrome) {
+ qtColor.setRgbF(components[0], components[0], components[0], components[1]);
+ } else {
+ // Colorspace we can't deal with.
+ qWarning("Qt: qt_mac_toQColor: cannot convert from colorspace model: %d", model);
+ Q_ASSERT(false);
+ }
+ return qtColor;
+}
+
+#ifdef Q_OS_MACOS
+QColor qt_mac_toQColor(const NSColor *color)
+{
+ QColor qtColor;
+ NSString *colorSpace = [color colorSpaceName];
+ if (colorSpace == NSDeviceCMYKColorSpace) {
+ CGFloat cyan, magenta, yellow, black, alpha;
+ [color getCyan:&cyan magenta:&magenta yellow:&yellow black:&black alpha:&alpha];
+ qtColor.setCmykF(cyan, magenta, yellow, black, alpha);
+ } else {
+ NSColor *tmpColor;
+ tmpColor = [color colorUsingColorSpaceName:NSDeviceRGBColorSpace];
+ CGFloat red, green, blue, alpha;
+ [tmpColor getRed:&red green:&green blue:&blue alpha:&alpha];
+ qtColor.setRgbF(red, green, blue, alpha);
+ }
+ return qtColor;
+}
+#endif
+
+QBrush qt_mac_toQBrush(CGColorRef color)
+{
+ QBrush qtBrush;
+ CGColorSpaceModel model = CGColorSpaceGetModel(CGColorGetColorSpace(color));
+ if (model == kCGColorSpaceModelPattern) {
+ // Colorspace we can't deal with; the color is drawn directly using a callback.
+ qWarning("Qt: qt_mac_toQBrush: cannot convert from colorspace model: %d", model);
+ Q_ASSERT(false);
+ } else {
+ qtBrush.setStyle(Qt::SolidPattern);
+ qtBrush.setColor(qt_mac_toQColor(color));
+ }
+ return qtBrush;
+}
+
+#ifdef Q_OS_MACOS
+static bool qt_mac_isSystemColorOrInstance(const NSColor *color, NSString *colorNameComponent, NSString *className)
+{
+ // We specifically do not want isKindOfClass: here
+ if ([color.className isEqualToString:className]) // NSPatternColorSpace
+ return true;
+ if ([color.catalogNameComponent isEqualToString:@"System"] &&
+ [color.colorNameComponent isEqualToString:colorNameComponent] &&
+ [color.colorSpaceName isEqualToString:NSNamedColorSpace])
+ return true;
+ return false;
+}
+
+QBrush qt_mac_toQBrush(const NSColor *color, QPalette::ColorGroup colorGroup)
+{
+ QBrush qtBrush;
+
+ // QTBUG-49773: This calls NSDrawMenuItemBackground to render a 1 by n gradient; could use HITheme
+ if ([color.className isEqualToString:@"NSMenuItemHighlightColor"]) {
+ qWarning("Qt: qt_mac_toQBrush: cannot convert from NSMenuItemHighlightColor");
+ return qtBrush;
+ }
+
+ // Not a catalog color or a manifestation of System.windowBackgroundColor;
+ // only retrieved from NSWindow.backgroundColor directly
+ if ([color.className isEqualToString:@"NSMetalPatternColor"]) {
+ // NSTexturedBackgroundWindowMask, could theoretically handle this without private API by
+ // creating a window with the appropriate properties and then calling NSWindow.backgroundColor.patternImage,
+ // which returns a texture sized 1 by (window height, including frame), backed by a CGPattern
+ // which follows the window key state... probably need to allow QBrush to store a function pointer
+ // like CGPattern does
+ qWarning("Qt: qt_mac_toQBrush: cannot convert from NSMetalPatternColor");
+ return qtBrush;
+ }
+
+ // No public API to get these colors/stops;
+ // both accurately obtained through runtime object inspection on OS X 10.11
+ // (the NSColor object has NSGradient i-vars for both color groups)
+ if (qt_mac_isSystemColorOrInstance(color, @"_sourceListBackgroundColor", @"NSSourceListBackgroundColor")) {
+ QLinearGradient gradient;
+ if (colorGroup == QPalette::Active) {
+ gradient.setColorAt(0, QColor(233, 237, 242));
+ gradient.setColorAt(0.5, QColor(225, 229, 235));
+ gradient.setColorAt(1, QColor(209, 216, 224));
+ } else {
+ gradient.setColorAt(0, QColor(248, 248, 248));
+ gradient.setColorAt(0.5, QColor(240, 240, 240));
+ gradient.setColorAt(1, QColor(235, 235, 235));
+ }
+ return QBrush(gradient);
+ }
+
+ // A couple colors are special... they are actually instances of NSGradientPatternColor, which
+ // override set/setFill/setStroke to instead initialize an internal color
+ // ([NSColor colorWithCalibratedWhite:0.909804 alpha:1.000000]) while still returning the
+ // ruled lines pattern image (from OS X 10.4) to the user from -[NSColor patternImage]
+ // (and providing no public API to get the underlying color without this insanity)
+ if (qt_mac_isSystemColorOrInstance(color, @"controlColor", @"NSGradientPatternColor") ||
+ qt_mac_isSystemColorOrInstance(color, @"windowBackgroundColor", @"NSGradientPatternColor")) {
+ qtBrush.setStyle(Qt::SolidPattern);
+ qtBrush.setColor(qt_mac_toQColor(color.CGColor));
+ return qtBrush;
+ }
+
+ if (NSColor *patternColor = [color colorUsingColorSpaceName:NSPatternColorSpace]) {
+ NSImage *patternImage = patternColor.patternImage;
+ const QSizeF sz(patternImage.size.width, patternImage.size.height);
+ // FIXME: QBrush is not resolution independent (QTBUG-49774)
+ qtBrush.setTexture(qt_mac_toQPixmap(patternImage, sz));
+ } else {
+ qtBrush.setStyle(Qt::SolidPattern);
+ qtBrush.setColor(qt_mac_toQColor(color));
+ }
+ return qtBrush;
+}
+#endif
+
+// ---------------------- Color Management ----------------------
+
+static CGColorSpaceRef m_genericColorSpace = 0;
+static QHash<uint32_t, CGColorSpaceRef> m_displayColorSpaceHash;
+static bool m_postRoutineRegistered = false;
+
+static void qt_mac_cleanUpMacColorSpaces()
+{
+ if (m_genericColorSpace) {
+ CFRelease(m_genericColorSpace);
+ m_genericColorSpace = 0;
+ }
+ QHash<uint32_t, CGColorSpaceRef>::const_iterator it = m_displayColorSpaceHash.constBegin();
+ while (it != m_displayColorSpaceHash.constEnd()) {
+ if (it.value())
+ CFRelease(it.value());
+ ++it;
+ }
+ m_displayColorSpaceHash.clear();
+}
+
+static CGColorSpaceRef qt_mac_displayColorSpace(const QWindow *window)
+{
+ CGColorSpaceRef colorSpace = 0;
+ uint32_t displayID = 0;
+
+#ifdef Q_OS_MACOS
+ if (window == 0) {
+ displayID = CGMainDisplayID();
+ } else {
+ displayID = CGMainDisplayID();
+ /*
+ ### get correct display
+ const QRect &qrect = window->geometry();
+ CGRect rect = CGRectMake(qrect.x(), qrect.y(), qrect.width(), qrect.height());
+ CGDisplayCount throwAway;
+ CGDisplayErr dErr = CGGetDisplaysWithRect(rect, 1, &displayID, &throwAway);
+ if (dErr != kCGErrorSuccess)
+ return macDisplayColorSpace(0); // fall back on main display
+ */
+ }
+ if ((colorSpace = m_displayColorSpaceHash.value(displayID)))
+ return colorSpace;
+
+ colorSpace = CGDisplayCopyColorSpace(displayID);
+#else
+ Q_UNUSED(window);
+#endif
+
+ if (colorSpace == 0)
+ colorSpace = CGColorSpaceCreateDeviceRGB();
+
+ m_displayColorSpaceHash.insert(displayID, colorSpace);
+ if (!m_postRoutineRegistered) {
+ m_postRoutineRegistered = true;
+ qAddPostRoutine(qt_mac_cleanUpMacColorSpaces);
+ }
+ return colorSpace;
+}
+
+CGColorSpaceRef qt_mac_colorSpaceForDeviceType(const QPaintDevice *paintDevice)
+{
+ Q_UNUSED(paintDevice);
+
+ // FIXME: Move logic into each paint device once Qt has support for color spaces
+ return qt_mac_displayColorSpace(0);
+
+ // The following code seems to take care of QWidget, but in reality doesn't, as
+ // qt_mac_displayColorSpace ignores the argument and always uses the main display.
+#if 0
+ bool isWidget = (paintDevice->devType() == QInternal::Widget);
+ return qt_mac_displayColorSpace(isWidget ? static_cast<const QWidget *>(paintDevice)->window() : 0);
+#endif
+}
+
+CGColorSpaceRef qt_mac_genericColorSpace()
+{
+#if 0
+ if (!m_genericColorSpace) {
+ if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_4) {
+ m_genericColorSpace = CGColorSpaceCreateWithName(kCGColorSpaceGenericRGB);
+ } else
+ {
+ m_genericColorSpace = CGColorSpaceCreateDeviceRGB();
+ }
+ if (!m_postRoutineRegistered) {
+ m_postRoutineRegistered = true;
+ qAddPostRoutine(QCoreGraphicsPaintEngine::cleanUpMacColorSpaces);
+ }
+ }
+ return m_genericColorSpace;
+#else
+ // Just return the main display colorspace for the moment.
+ return qt_mac_displayColorSpace(0);
+#endif
+}
+
+// ---------------------- Geometry Helpers ----------------------
+
+void qt_mac_clip_cg(CGContextRef hd, const QRegion &rgn, CGAffineTransform *orig_xform)
+{
+ CGAffineTransform old_xform = CGAffineTransformIdentity;
+ if (orig_xform) { //setup xforms
+ old_xform = CGContextGetCTM(hd);
+ CGContextConcatCTM(hd, CGAffineTransformInvert(old_xform));
+ CGContextConcatCTM(hd, *orig_xform);
+ }
+
+ //do the clipping
+ CGContextBeginPath(hd);
+ if (rgn.isEmpty()) {
+ CGContextAddRect(hd, CGRectMake(0, 0, 0, 0));
+ } else {
+ for (const QRect &r : rgn) {
+ CGRect mac_r = CGRectMake(r.x(), r.y(), r.width(), r.height());
+ CGContextAddRect(hd, mac_r);
+ }
+ }
+ CGContextClip(hd);
+
+ if (orig_xform) {//reset xforms
+ CGContextConcatCTM(hd, CGAffineTransformInvert(CGContextGetCTM(hd)));
+ CGContextConcatCTM(hd, old_xform);
+ }
+}
+
+// move to QRegion?
+void qt_mac_scale_region(QRegion *region, qreal scaleFactor)
+{
+ if (!region || !region->rectCount())
+ return;
+
+ QVector<QRect> scaledRects;
+ scaledRects.reserve(region->rectCount());
+
+ for (const QRect &rect : *region)
+ scaledRects.append(QRect(rect.topLeft() * scaleFactor, rect.size() * scaleFactor));
+
+ region->setRects(&scaledRects[0], scaledRects.count());
+}
+
+// ---------------------- QMacCGContext ----------------------
+
+QMacCGContext::QMacCGContext(QPaintDevice *paintDevice) : context(0)
+{
+ // In Qt 5, QWidget and QPixmap (and QImage) paint devices are all QImages under the hood.
+ QImage *image = 0;
+ if (paintDevice->devType() == QInternal::Image) {
+ image = static_cast<QImage *>(paintDevice);
+ } else if (paintDevice->devType() == QInternal::Pixmap) {
+
+ const QPixmap *pm = static_cast<const QPixmap*>(paintDevice);
+ QPlatformPixmap *data = const_cast<QPixmap *>(pm)->data_ptr().data();
+ if (data && data->classId() == QPlatformPixmap::RasterClass) {
+ image = data->buffer();
+ } else {
+ qDebug("QMacCGContext: Unsupported pixmap class");
+ }
+ } else if (paintDevice->devType() == QInternal::Widget) {
+ // TODO test: image = static_cast<QImage *>(static_cast<const QWidget *>(paintDevice)->backingStore()->paintDevice());
+ qDebug("QMacCGContext: not implemented: Widget class");
+ }
+
+ if (!image)
+ return; // Context type not supported.
+
+ CGColorSpaceRef colorspace = qt_mac_colorSpaceForDeviceType(paintDevice);
+ uint flags = kCGImageAlphaPremultipliedFirst;
+ flags |= kCGBitmapByteOrder32Host;
+
+ context = CGBitmapContextCreate(image->bits(), image->width(), image->height(),
+ 8, image->bytesPerLine(), colorspace, flags);
+ CGContextTranslateCTM(context, 0, image->height());
+ CGContextScaleCTM(context, 1, -1);
+}
+
+QMacCGContext::QMacCGContext(QPainter *painter) : context(0)
+{
+ QPaintEngine *paintEngine = painter->paintEngine();
+
+ // Handle the case of QMacPrintEngine, which has an internal QCoreGraphicsPaintEngine
+ while (QPaintEngine *aggregateEngine = QPaintEnginePrivate::get(paintEngine)->aggregateEngine())
+ paintEngine = aggregateEngine;
+
+ paintEngine->syncState();
+
+ if (Qt::HANDLE handle = QPaintEnginePrivate::get(paintEngine)->nativeHandle()) {
+ context = static_cast<CGContextRef>(handle);
+ return;
+ }
+
+ int devType = painter->device()->devType();
+ if (paintEngine->type() == QPaintEngine::Raster
+ && (devType == QInternal::Widget ||
+ devType == QInternal::Pixmap ||
+ devType == QInternal::Image)) {
+
+ CGColorSpaceRef colorspace = qt_mac_colorSpaceForDeviceType(paintEngine->paintDevice());
+ uint flags = kCGImageAlphaPremultipliedFirst;
+#ifdef kCGBitmapByteOrder32Host //only needed because CGImage.h added symbols in the minor version
+ flags |= kCGBitmapByteOrder32Host;
+#endif
+ const QImage *image = static_cast<const QImage *>(paintEngine->paintDevice());
+
+ context = CGBitmapContextCreate((void *)image->bits(), image->width(), image->height(),
+ 8, image->bytesPerLine(), colorspace, flags);
+
+ // Invert y axis
+ CGContextTranslateCTM(context, 0, image->height());
+ CGContextScaleCTM(context, 1, -1);
+
+ const qreal devicePixelRatio = image->devicePixelRatio();
+
+ if (devType == QInternal::Widget) {
+ // Set the clip rect which is an intersection of the system clip
+ // and the painter clip. To make matters more interesting these
+ // are in device pixels and device-independent pixels, respectively.
+ QRegion clip = painter->paintEngine()->systemClip(); // get system clip in device pixels
+ QTransform native = painter->deviceTransform(); // get device transform. dx/dy is in device pixels
+
+ if (painter->hasClipping()) {
+ QRegion r = painter->clipRegion(); // get painter clip, which is in device-independent pixels
+ qt_mac_scale_region(&r, devicePixelRatio); // scale painter clip to device pixels
+ r.translate(native.dx(), native.dy());
+ if (clip.isEmpty())
+ clip = r;
+ else
+ clip &= r;
+ }
+ qt_mac_clip_cg(context, clip, 0); // clip in device pixels
+
+ // Scale the context so that painting happens in device-independent pixels
+ CGContextScaleCTM(context, devicePixelRatio, devicePixelRatio);
+ CGContextTranslateCTM(context, native.dx() / devicePixelRatio, native.dy() / devicePixelRatio);
+ } else {
+ // Scale to paint in device-independent pixels
+ CGContextScaleCTM(context, devicePixelRatio, devicePixelRatio);
+ }
+ } else {
+ qDebug() << "QMacCGContext:: Unsupported painter devtype type" << devType;
+ }
+}
+
+QT_END_NAMESPACE
diff --git a/src/gui/painting/qcoregraphics_p.h b/src/gui/painting/qcoregraphics_p.h
new file mode 100644
index 0000000000..ab2579387e
--- /dev/null
+++ b/src/gui/painting/qcoregraphics_p.h
@@ -0,0 +1,121 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the QtGui module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL21$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QCOREGRAPHICS_P_H
+#define QCOREGRAPHICS_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtGui/private/qtguiglobal_p.h>
+#include <QtGui/qregion.h>
+#include <QtGui/qpalette.h>
+
+#include <CoreGraphics/CoreGraphics.h>
+#ifdef Q_OS_MACOS
+#include <AppKit/AppKit.h>
+#endif
+
+QT_BEGIN_NAMESPACE
+
+#ifdef Q_OS_MACOS
+Q_GUI_EXPORT NSImage *qt_mac_create_nsimage(const QPixmap &pm);
+Q_GUI_EXPORT NSImage *qt_mac_create_nsimage(const QIcon &icon);
+Q_GUI_EXPORT QPixmap qt_mac_toQPixmap(const NSImage *image, const QSizeF &size);
+#endif
+Q_GUI_EXPORT CGImageRef qt_mac_toCGImage(const QImage &qImage);
+Q_GUI_EXPORT CGImageRef qt_mac_toCGImageMask(const QImage &qImage);
+Q_GUI_EXPORT QImage qt_mac_toQImage(CGImageRef image);
+
+Q_GUI_EXPORT OSStatus qt_mac_drawCGImage(CGContextRef inContext, const CGRect *inBounds, CGImageRef inImage);
+
+Q_GUI_EXPORT CGColorSpaceRef qt_mac_genericColorSpace();
+Q_GUI_EXPORT CGColorSpaceRef qt_mac_colorSpaceForDeviceType(const QPaintDevice *paintDevice);
+
+Q_GUI_EXPORT void qt_mac_clip_cg(CGContextRef hd, const QRegion &rgn, CGAffineTransform *orig_xform);
+
+#ifdef Q_OS_MACOS
+Q_GUI_EXPORT QColor qt_mac_toQColor(const NSColor *color);
+Q_GUI_EXPORT QBrush qt_mac_toQBrush(const NSColor *color, QPalette::ColorGroup colorGroup = QPalette::Normal);
+#endif
+Q_GUI_EXPORT QColor qt_mac_toQColor(CGColorRef color);
+Q_GUI_EXPORT QBrush qt_mac_toQBrush(CGColorRef color);
+
+class Q_GUI_EXPORT QMacCGContext
+{
+public:
+ inline QMacCGContext() { context = 0; }
+ QMacCGContext(QPaintDevice *pdev);
+ QMacCGContext(QPainter *p);
+ inline QMacCGContext(CGContextRef cg, bool takeOwnership = false) {
+ context = cg;
+ if (!takeOwnership)
+ CGContextRetain(context);
+ }
+ inline QMacCGContext(const QMacCGContext &copy) : context(0) { *this = copy; }
+ inline ~QMacCGContext() {
+ if (context)
+ CGContextRelease(context);
+ }
+ inline bool isNull() const { return context; }
+ inline operator CGContextRef() { return context; }
+ inline QMacCGContext &operator=(const QMacCGContext &copy) {
+ if (context)
+ CGContextRelease(context);
+ context = copy.context;
+ CGContextRetain(context);
+ return *this;
+ }
+ inline QMacCGContext &operator=(CGContextRef cg) {
+ if (context)
+ CGContextRelease(context);
+ context = cg;
+ CGContextRetain(context); //we do not take ownership
+ return *this;
+ }
+
+private:
+ CGContextRef context;
+};
+
+QT_END_NAMESPACE
+
+#endif // QCOREGRAPHICS_P_H
diff --git a/src/gui/painting/qcosmeticstroker_p.h b/src/gui/painting/qcosmeticstroker_p.h
index b22e2c2cf5..68f4e00cdc 100644
--- a/src/gui/painting/qcosmeticstroker_p.h
+++ b/src/gui/painting/qcosmeticstroker_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#include <private/qdrawhelper_p.h>
#include <private/qvectorpath_p.h>
#include <private/qpaintengine_raster_p.h>
diff --git a/src/gui/painting/qcssutil.cpp b/src/gui/painting/qcssutil.cpp
index a826532b43..2d514e14e0 100644
--- a/src/gui/painting/qcssutil.cpp
+++ b/src/gui/painting/qcssutil.cpp
@@ -197,7 +197,7 @@ void qDrawEdge(QPainter *p, qreal x1, qreal y1, qreal x2, qreal y2, qreal dw1, q
if ((style == BorderStyle_Outset && (edge == TopEdge || edge == LeftEdge))
|| (style == BorderStyle_Inset && (edge == BottomEdge || edge == RightEdge)))
c = c.color().lighter();
- // fall through!
+ Q_FALLTHROUGH();
case BorderStyle_Solid: {
p->setPen(Qt::NoPen);
p->setBrush(c);
diff --git a/src/gui/painting/qdatabuffer_p.h b/src/gui/painting/qdatabuffer_p.h
index f5a3fa1432..77b5be0c4c 100644
--- a/src/gui/painting/qdatabuffer_p.h
+++ b/src/gui/painting/qdatabuffer_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#include "QtCore/qbytearray.h"
#include <stdlib.h>
diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp
index 867eb76200..c1a49b7d9a 100644
--- a/src/gui/painting/qdrawhelper.cpp
+++ b/src/gui/painting/qdrawhelper.cpp
@@ -168,7 +168,7 @@ template<> Q_DECL_CONSTEXPR QPixelLayout::BPP bitsPerPixel<QImage::Format_ARGB66
template<QImage::Format Format>
static const uint *QT_FASTCALL convertToRGB32(uint *buffer, const uint *src, int count,
- const QPixelLayout *, const QRgb *)
+ const QVector<QRgb> *, QDitherInfo *)
{
Q_CONSTEXPR uint redMask = ((1 << redWidth<Format>()) - 1);
Q_CONSTEXPR uint greenMask = ((1 << greenWidth<Format>()) - 1);
@@ -198,7 +198,7 @@ static const uint *QT_FASTCALL convertToRGB32(uint *buffer, const uint *src, int
template<QImage::Format Format>
static const QRgba64 *QT_FASTCALL convertToRGB64(QRgba64 *buffer, const uint *src, int count,
- const QPixelLayout *, const QRgb *)
+ const QVector<QRgb> *, QDitherInfo *)
{
Q_CONSTEXPR uint redMask = ((1 << redWidth<Format>()) - 1);
Q_CONSTEXPR uint greenMask = ((1 << greenWidth<Format>()) - 1);
@@ -228,7 +228,7 @@ static const QRgba64 *QT_FASTCALL convertToRGB64(QRgba64 *buffer, const uint *sr
template<QImage::Format Format>
static const uint *QT_FASTCALL convertARGBPMToARGB32PM(uint *buffer, const uint *src, int count,
- const QPixelLayout *, const QRgb *)
+ const QVector<QRgb> *, QDitherInfo *)
{
Q_CONSTEXPR uint alphaMask = ((1 << alphaWidth<Format>()) - 1);
Q_CONSTEXPR uint redMask = ((1 << redWidth<Format>()) - 1);
@@ -282,7 +282,7 @@ static const uint *QT_FASTCALL convertARGBPMToARGB32PM(uint *buffer, const uint
template<QImage::Format Format>
static const QRgba64 *QT_FASTCALL convertARGBPMToARGB64PM(QRgba64 *buffer, const uint *src, int count,
- const QPixelLayout *, const QRgb *)
+ const QVector<QRgb> *, QDitherInfo *)
{
Q_CONSTEXPR uint alphaMask = ((1 << alphaWidth<Format>()) - 1);
Q_CONSTEXPR uint redMask = ((1 << redWidth<Format>()) - 1);
@@ -336,48 +336,110 @@ static const QRgba64 *QT_FASTCALL convertARGBPMToARGB64PM(QRgba64 *buffer, const
template<QImage::Format Format, bool fromRGB>
static const uint *QT_FASTCALL convertRGBFromARGB32PM(uint *buffer, const uint *src, int count,
- const QPixelLayout *, const QRgb *)
+ const QVector<QRgb> *, QDitherInfo *dither)
{
- Q_CONSTEXPR uint rMask = ((1 << redWidth<Format>()) - 1);
- Q_CONSTEXPR uint gMask = ((1 << greenWidth<Format>()) - 1);
- Q_CONSTEXPR uint bMask = ((1 << blueWidth<Format>()) - 1);
+ Q_CONSTEXPR uchar rWidth = redWidth<Format>();
+ Q_CONSTEXPR uchar gWidth = greenWidth<Format>();
+ Q_CONSTEXPR uchar bWidth = blueWidth<Format>();
- Q_CONSTEXPR uchar rRightShift = 24 - redWidth<Format>();
- Q_CONSTEXPR uchar gRightShift = 16 - greenWidth<Format>();
- Q_CONSTEXPR uchar bRightShift = 8 - blueWidth<Format>();
+ // RGB32 -> RGB888 is not a precision loss.
+ if (!dither || (rWidth == 8 && gWidth == 8 && bWidth == 8)) {
+ Q_CONSTEXPR uint rMask = (1 << rWidth) - 1;
+ Q_CONSTEXPR uint gMask = (1 << gWidth) - 1;
+ Q_CONSTEXPR uint bMask = (1 << bWidth) - 1;
- for (int i = 0; i < count; ++i) {
- const uint c = fromRGB ? src[i] : qUnpremultiply(src[i]);
- const uint r = ((c >> rRightShift) & rMask) << redShift<Format>();
- const uint g = ((c >> gRightShift) & gMask) << greenShift<Format>();
- const uint b = ((c >> bRightShift) & bMask) << blueShift<Format>();
- buffer[i] = r | g | b;
+ Q_CONSTEXPR uchar rRightShift = 24 - rWidth;
+ Q_CONSTEXPR uchar gRightShift = 16 - gWidth;
+ Q_CONSTEXPR uchar bRightShift = 8 - bWidth;
+
+ for (int i = 0; i < count; ++i) {
+ const uint c = fromRGB ? src[i] : qUnpremultiply(src[i]);
+ const uint r = ((c >> rRightShift) & rMask) << redShift<Format>();
+ const uint g = ((c >> gRightShift) & gMask) << greenShift<Format>();
+ const uint b = ((c >> bRightShift) & bMask) << blueShift<Format>();
+ buffer[i] = r | g | b;
+ }
+ } else {
+ // We do ordered dither by using a rounding conversion, but instead of
+ // adding half of input precision, we add the adjusted result from the
+ // bayer matrix before narrowing.
+ // Note: Rounding conversion in itself is different from the naive
+ // conversion we do above for non-dithering.
+ const uint *bayer_line = qt_bayer_matrix[dither->y & 15];
+ for (int i = 0; i < count; ++i) {
+ const uint c = fromRGB ? src[i] : qUnpremultiply(src[i]);
+ const int d = bayer_line[(dither->x + i) & 15];
+ const int dr = d - ((d + 1) >> rWidth);
+ const int dg = d - ((d + 1) >> gWidth);
+ const int db = d - ((d + 1) >> bWidth);
+ int r = qRed(c);
+ int g = qGreen(c);
+ int b = qBlue(c);
+ r = (r + ((dr - r) >> rWidth) + 1) >> (8 - rWidth);
+ g = (g + ((dg - g) >> gWidth) + 1) >> (8 - gWidth);
+ b = (b + ((db - b) >> bWidth) + 1) >> (8 - bWidth);
+ buffer[i] = (r << redShift<Format>())
+ | (g << greenShift<Format>())
+ | (b << blueShift<Format>());
+ }
}
return buffer;
}
template<QImage::Format Format, bool fromRGB>
static const uint *QT_FASTCALL convertARGBPMFromARGB32PM(uint *buffer, const uint *src, int count,
- const QPixelLayout *, const QRgb *)
+ const QVector<QRgb> *, QDitherInfo *dither)
{
- Q_CONSTEXPR uint aMask = ((1 << alphaWidth<Format>()) - 1);
- Q_CONSTEXPR uint rMask = ((1 << redWidth<Format>()) - 1);
- Q_CONSTEXPR uint gMask = ((1 << greenWidth<Format>()) - 1);
- Q_CONSTEXPR uint bMask = ((1 << blueWidth<Format>()) - 1);
+ Q_CONSTEXPR uchar aWidth = alphaWidth<Format>();
+ Q_CONSTEXPR uchar rWidth = redWidth<Format>();
+ Q_CONSTEXPR uchar gWidth = greenWidth<Format>();
+ Q_CONSTEXPR uchar bWidth = blueWidth<Format>();
- Q_CONSTEXPR uchar aRightShift = 32 - alphaWidth<Format>();
- Q_CONSTEXPR uchar rRightShift = 24 - redWidth<Format>();
- Q_CONSTEXPR uchar gRightShift = 16 - greenWidth<Format>();
- Q_CONSTEXPR uchar bRightShift = 8 - blueWidth<Format>();
+ if (!dither) {
+ Q_CONSTEXPR uint aMask = (1 << aWidth) - 1;
+ Q_CONSTEXPR uint rMask = (1 << rWidth) - 1;
+ Q_CONSTEXPR uint gMask = (1 << gWidth) - 1;
+ Q_CONSTEXPR uint bMask = (1 << bWidth) - 1;
- Q_CONSTEXPR uint aOpaque = (0xff & aMask) << alphaShift<Format>();
- for (int i = 0; i < count; ++i) {
- const uint c = src[i];
- const uint a = fromRGB ? aOpaque : (((c >> aRightShift) & aMask) << alphaShift<Format>());
- const uint r = ((c >> rRightShift) & rMask) << redShift<Format>();
- const uint g = ((c >> gRightShift) & gMask) << greenShift<Format>();
- const uint b = ((c >> bRightShift) & bMask) << blueShift<Format>();
- buffer[i] = a | r | g | b;
+ Q_CONSTEXPR uchar aRightShift = 32 - aWidth;
+ Q_CONSTEXPR uchar rRightShift = 24 - rWidth;
+ Q_CONSTEXPR uchar gRightShift = 16 - gWidth;
+ Q_CONSTEXPR uchar bRightShift = 8 - bWidth;
+
+ Q_CONSTEXPR uint aOpaque = aMask << alphaShift<Format>();
+ for (int i = 0; i < count; ++i) {
+ const uint c = src[i];
+ const uint a = fromRGB ? aOpaque : (((c >> aRightShift) & aMask) << alphaShift<Format>());
+ const uint r = ((c >> rRightShift) & rMask) << redShift<Format>();
+ const uint g = ((c >> gRightShift) & gMask) << greenShift<Format>();
+ const uint b = ((c >> bRightShift) & bMask) << blueShift<Format>();
+ buffer[i] = a | r | g | b;
+ }
+ } else {
+ const uint *bayer_line = qt_bayer_matrix[dither->y & 15];
+ for (int i = 0; i < count; ++i) {
+ const uint c = src[i];
+ const int d = bayer_line[(dither->x + i) & 15];
+ const int da = d - ((d + 1) >> aWidth);
+ const int dr = d - ((d + 1) >> rWidth);
+ const int dg = d - ((d + 1) >> gWidth);
+ const int db = d - ((d + 1) >> bWidth);
+ int a = qAlpha(c);
+ int r = qRed(c);
+ int g = qGreen(c);
+ int b = qBlue(c);
+ if (fromRGB)
+ a = (1 << aWidth) - 1;
+ else
+ a = (a + ((da - a) >> aWidth) + 1) >> (8 - aWidth);
+ r = (r + ((dr - r) >> rWidth) + 1) >> (8 - rWidth);
+ g = (g + ((dg - g) >> gWidth) + 1) >> (8 - gWidth);
+ b = (b + ((db - b) >> bWidth) + 1) >> (8 - bWidth);
+ buffer[i] = (a << alphaShift<Format>())
+ | (r << redShift<Format>())
+ | (g << greenShift<Format>())
+ | (b << blueShift<Format>());
+ }
}
return buffer;
}
@@ -418,35 +480,35 @@ template<QImage::Format Format> Q_DECL_CONSTEXPR static inline QPixelLayout pixe
// To convert in place, let 'dest' and 'src' be the same.
static const uint *QT_FASTCALL convertIndexedToARGB32PM(uint *buffer, const uint *src, int count,
- const QPixelLayout *, const QRgb *clut)
+ const QVector<QRgb> *clut, QDitherInfo *)
{
for (int i = 0; i < count; ++i)
- buffer[i] = qPremultiply(clut[src[i]]);
+ buffer[i] = qPremultiply(clut->at(src[i]));
return buffer;
}
static const QRgba64 *QT_FASTCALL convertIndexedToARGB64PM(QRgba64 *buffer, const uint *src, int count,
- const QPixelLayout *, const QRgb *clut)
+ const QVector<QRgb> *clut, QDitherInfo *)
{
for (int i = 0; i < count; ++i)
- buffer[i] = QRgba64::fromArgb32(clut[src[i]]).premultiplied();
+ buffer[i] = QRgba64::fromArgb32(clut->at(src[i])).premultiplied();
return buffer;
}
static const uint *QT_FASTCALL convertPassThrough(uint *, const uint *src, int,
- const QPixelLayout *, const QRgb *)
+ const QVector<QRgb> *, QDitherInfo *)
{
return src;
}
static const uint *QT_FASTCALL convertARGB32ToARGB32PM(uint *buffer, const uint *src, int count,
- const QPixelLayout *, const QRgb *)
+ const QVector<QRgb> *, QDitherInfo *)
{
return qt_convertARGB32ToARGB32PM(buffer, src, count);
}
static const uint *QT_FASTCALL convertRGBA8888PMToARGB32PM(uint *buffer, const uint *src, int count,
- const QPixelLayout *, const QRgb *)
+ const QVector<QRgb> *, QDitherInfo *)
{
for (int i = 0; i < count; ++i)
buffer[i] = RGBA2ARGB(src[i]);
@@ -454,13 +516,13 @@ static const uint *QT_FASTCALL convertRGBA8888PMToARGB32PM(uint *buffer, const u
}
static const uint *QT_FASTCALL convertRGBA8888ToARGB32PM(uint *buffer, const uint *src, int count,
- const QPixelLayout *, const QRgb *)
+ const QVector<QRgb> *, QDitherInfo *)
{
return qt_convertRGBA8888ToARGB32PM(buffer, src, count);
}
static const uint *QT_FASTCALL convertAlpha8ToRGB32(uint *buffer, const uint *src, int count,
- const QPixelLayout *, const QRgb *)
+ const QVector<QRgb> *, QDitherInfo *)
{
for (int i = 0; i < count; ++i)
buffer[i] = qRgba(0, 0, 0, src[i]);
@@ -468,7 +530,7 @@ static const uint *QT_FASTCALL convertAlpha8ToRGB32(uint *buffer, const uint *sr
}
static const uint *QT_FASTCALL convertGrayscale8ToRGB32(uint *buffer, const uint *src, int count,
- const QPixelLayout *, const QRgb *)
+ const QVector<QRgb> *, QDitherInfo *)
{
for (int i = 0; i < count; ++i)
buffer[i] = qRgb(src[i], src[i], src[i]);
@@ -476,7 +538,7 @@ static const uint *QT_FASTCALL convertGrayscale8ToRGB32(uint *buffer, const uint
}
static const QRgba64 *QT_FASTCALL convertAlpha8ToRGB64(QRgba64 *buffer, const uint *src, int count,
- const QPixelLayout *, const QRgb *)
+ const QVector<QRgb> *, QDitherInfo *)
{
for (int i = 0; i < count; ++i)
buffer[i] = QRgba64::fromRgba(0, 0, 0, src[i]);
@@ -484,7 +546,7 @@ static const QRgba64 *QT_FASTCALL convertAlpha8ToRGB64(QRgba64 *buffer, const ui
}
static const QRgba64 *QT_FASTCALL convertGrayscale8ToRGB64(QRgba64 *buffer, const uint *src, int count,
- const QPixelLayout *, const QRgb *)
+ const QVector<QRgb> *, QDitherInfo *)
{
for (int i = 0; i < count; ++i)
buffer[i] = QRgba64::fromRgba(src[i], src[i], src[i], 255);
@@ -492,7 +554,7 @@ static const QRgba64 *QT_FASTCALL convertGrayscale8ToRGB64(QRgba64 *buffer, cons
}
static const uint *QT_FASTCALL convertARGB32FromARGB32PM(uint *buffer, const uint *src, int count,
- const QPixelLayout *, const QRgb *)
+ const QVector<QRgb> *, QDitherInfo *)
{
for (int i = 0; i < count; ++i)
buffer[i] = qUnpremultiply(src[i]);
@@ -500,7 +562,7 @@ static const uint *QT_FASTCALL convertARGB32FromARGB32PM(uint *buffer, const uin
}
static const uint *QT_FASTCALL convertRGBA8888PMFromARGB32PM(uint *buffer, const uint *src, int count,
- const QPixelLayout *, const QRgb *)
+ const QVector<QRgb> *, QDitherInfo *)
{
for (int i = 0; i < count; ++i)
buffer[i] = ARGB2RGBA(src[i]);
@@ -551,7 +613,7 @@ static inline void qConvertARGB32PMToARGB64PM_sse2(QRgba64 *buffer, const uint *
#endif
static const QRgba64 *QT_FASTCALL convertRGB32ToRGB64(QRgba64 *buffer, const uint *src, int count,
- const QPixelLayout *, const QRgb *)
+ const QVector<QRgb> *, QDitherInfo *)
{
#ifdef __SSE2__
qConvertARGB32PMToARGB64PM_sse2<false, true>(buffer, src, count);
@@ -563,7 +625,7 @@ static const QRgba64 *QT_FASTCALL convertRGB32ToRGB64(QRgba64 *buffer, const uin
}
static const QRgba64 *QT_FASTCALL convertARGB32ToARGB64PM(QRgba64 *buffer, const uint *src, int count,
- const QPixelLayout *, const QRgb *)
+ const QVector<QRgb> *, QDitherInfo *)
{
#ifdef __SSE2__
qConvertARGB32PMToARGB64PM_sse2<false, false>(buffer, src, count);
@@ -577,7 +639,7 @@ static const QRgba64 *QT_FASTCALL convertARGB32ToARGB64PM(QRgba64 *buffer, const
}
static const QRgba64 *QT_FASTCALL convertARGB32PMToARGB64PM(QRgba64 *buffer, const uint *src, int count,
- const QPixelLayout *, const QRgb *)
+ const QVector<QRgb> *, QDitherInfo *)
{
#ifdef __SSE2__
qConvertARGB32PMToARGB64PM_sse2<false, false>(buffer, src, count);
@@ -589,7 +651,7 @@ static const QRgba64 *QT_FASTCALL convertARGB32PMToARGB64PM(QRgba64 *buffer, con
}
static const QRgba64 *QT_FASTCALL convertRGBA8888ToARGB64PM(QRgba64 *buffer, const uint *src, int count,
- const QPixelLayout *, const QRgb *)
+ const QVector<QRgb> *, QDitherInfo *)
{
#ifdef __SSE2__
qConvertARGB32PMToARGB64PM_sse2<true, false>(buffer, src, count);
@@ -603,7 +665,7 @@ static const QRgba64 *QT_FASTCALL convertRGBA8888ToARGB64PM(QRgba64 *buffer, con
}
static const QRgba64 *QT_FASTCALL convertRGBA8888PMToARGB64PM(QRgba64 *buffer, const uint *src, int count,
- const QPixelLayout *, const QRgb *)
+ const QVector<QRgb> *, QDitherInfo *)
{
#ifdef __SSE2__
qConvertARGB32PMToARGB64PM_sse2<true, false>(buffer, src, count);
@@ -615,7 +677,7 @@ static const QRgba64 *QT_FASTCALL convertRGBA8888PMToARGB64PM(QRgba64 *buffer, c
}
static const uint *QT_FASTCALL convertRGBA8888FromARGB32PM(uint *buffer, const uint *src, int count,
- const QPixelLayout *, const QRgb *)
+ const QVector<QRgb> *, QDitherInfo *)
{
for (int i = 0; i < count; ++i)
buffer[i] = ARGB2RGBA(qUnpremultiply(src[i]));
@@ -623,7 +685,7 @@ static const uint *QT_FASTCALL convertRGBA8888FromARGB32PM(uint *buffer, const u
}
static const uint *QT_FASTCALL convertRGBXFromRGB32(uint *buffer, const uint *src, int count,
- const QPixelLayout *, const QRgb *)
+ const QVector<QRgb> *, QDitherInfo *)
{
for (int i = 0; i < count; ++i)
buffer[i] = ARGB2RGBA(0xff000000 | src[i]);
@@ -631,7 +693,7 @@ static const uint *QT_FASTCALL convertRGBXFromRGB32(uint *buffer, const uint *sr
}
static const uint *QT_FASTCALL convertRGBXFromARGB32PM(uint *buffer, const uint *src, int count,
- const QPixelLayout *, const QRgb *)
+ const QVector<QRgb> *, QDitherInfo *)
{
for (int i = 0; i < count; ++i)
buffer[i] = ARGB2RGBA(0xff000000 | qUnpremultiply(src[i]));
@@ -640,10 +702,28 @@ static const uint *QT_FASTCALL convertRGBXFromARGB32PM(uint *buffer, const uint
template<QtPixelOrder PixelOrder>
static const uint *QT_FASTCALL convertA2RGB30PMToARGB32PM(uint *buffer, const uint *src, int count,
- const QPixelLayout *, const QRgb *)
+ const QVector<QRgb> *, QDitherInfo *dither)
{
- for (int i = 0; i < count; ++i)
- buffer[i] = qConvertA2rgb30ToArgb32<PixelOrder>(src[i]);
+ if (!dither) {
+ for (int i = 0; i < count; ++i)
+ buffer[i] = qConvertA2rgb30ToArgb32<PixelOrder>(src[i]);
+ } else {
+ for (int i = 0; i < count; ++i) {
+ const uint c = src[i];
+ short d10 = (qt_bayer_matrix[dither->y & 15][(dither->x + i) & 15] << 2);
+ short a10 = (c >> 30) * 0x155;
+ short r10 = ((c >> 20) & 0x3ff);
+ short g10 = ((c >> 10) & 0x3ff);
+ short b10 = (c & 0x3ff);
+ if (PixelOrder == PixelOrderBGR)
+ std::swap(r10, b10);
+ short a8 = (a10 + ((d10 - a10) >> 8)) >> 2;
+ short r8 = (r10 + ((d10 - r10) >> 8)) >> 2;
+ short g8 = (g10 + ((d10 - g10) >> 8)) >> 2;
+ short b8 = (b10 + ((d10 - b10) >> 8)) >> 2;
+ buffer[i] = qRgba(r8, g8, b8, a8);
+ }
+ }
return buffer;
}
@@ -693,7 +773,7 @@ static inline void qConvertA2RGB30PMToARGB64PM_sse2(QRgba64 *buffer, const uint
template<QtPixelOrder PixelOrder>
static const QRgba64 *QT_FASTCALL convertA2RGB30PMToARGB64PM(QRgba64 *buffer, const uint *src, int count,
- const QPixelLayout *, const QRgb *)
+ const QVector<QRgb> *, QDitherInfo *)
{
#ifdef __SSE2__
qConvertA2RGB30PMToARGB64PM_sse2<PixelOrder>(buffer, src, count);
@@ -706,7 +786,7 @@ static const QRgba64 *QT_FASTCALL convertA2RGB30PMToARGB64PM(QRgba64 *buffer, co
template<QtPixelOrder PixelOrder>
static const uint *QT_FASTCALL convertA2RGB30PMFromARGB32PM(uint *buffer, const uint *src, int count,
- const QPixelLayout *, const QRgb *)
+ const QVector<QRgb> *, QDitherInfo *)
{
for (int i = 0; i < count; ++i)
buffer[i] = qConvertArgb32ToA2rgb30<PixelOrder>(src[i]);
@@ -715,7 +795,7 @@ static const uint *QT_FASTCALL convertA2RGB30PMFromARGB32PM(uint *buffer, const
template<QtPixelOrder PixelOrder>
static const uint *QT_FASTCALL convertRGB30FromRGB32(uint *buffer, const uint *src, int count,
- const QPixelLayout *, const QRgb *)
+ const QVector<QRgb> *, QDitherInfo *)
{
for (int i = 0; i < count; ++i)
buffer[i] = qConvertRgb32ToRgb30<PixelOrder>(src[i]);
@@ -724,7 +804,7 @@ static const uint *QT_FASTCALL convertRGB30FromRGB32(uint *buffer, const uint *s
template<QtPixelOrder PixelOrder>
static const uint *QT_FASTCALL convertRGB30FromARGB32PM(uint *buffer, const uint *src, int count,
- const QPixelLayout *, const QRgb *)
+ const QVector<QRgb> *, QDitherInfo *)
{
for (int i = 0; i < count; ++i)
buffer[i] = qConvertRgb32ToRgb30<PixelOrder>(qUnpremultiply(src[i]));
@@ -732,7 +812,7 @@ static const uint *QT_FASTCALL convertRGB30FromARGB32PM(uint *buffer, const uint
}
static const uint *QT_FASTCALL convertAlpha8FromARGB32PM(uint *buffer, const uint *src, int count,
- const QPixelLayout *, const QRgb *)
+ const QVector<QRgb> *, QDitherInfo *)
{
for (int i = 0; i < count; ++i)
buffer[i] = qAlpha(src[i]);
@@ -740,7 +820,7 @@ static const uint *QT_FASTCALL convertAlpha8FromARGB32PM(uint *buffer, const uin
}
static const uint *QT_FASTCALL convertGrayscale8FromRGB32(uint *buffer, const uint *src, int count,
- const QPixelLayout *, const QRgb *)
+ const QVector<QRgb> *, QDitherInfo *)
{
for (int i = 0; i < count; ++i)
buffer[i] = qGray(src[i]);
@@ -748,7 +828,7 @@ static const uint *QT_FASTCALL convertGrayscale8FromRGB32(uint *buffer, const ui
}
static const uint *QT_FASTCALL convertGrayscale8FromARGB32PM(uint *buffer, const uint *src, int count,
- const QPixelLayout *, const QRgb *)
+ const QVector<QRgb> *, QDitherInfo *)
{
for (int i = 0; i < count; ++i)
buffer[i] = qGray(qUnpremultiply(src[i]));
@@ -1037,7 +1117,7 @@ static uint *QT_FASTCALL destFetch(uint *buffer, QRasterBuffer *rasterBuffer, in
{
const QPixelLayout *layout = &qPixelLayouts[rasterBuffer->format];
const uint *ptr = qFetchPixels[layout->bpp](buffer, rasterBuffer->scanLine(y), x, length);
- return const_cast<uint *>(layout->convertToARGB32PM(buffer, ptr, length, layout, 0));
+ return const_cast<uint *>(layout->convertToARGB32PM(buffer, ptr, length, 0, 0));
}
static QRgba64 *QT_FASTCALL destFetch64(QRgba64 *buffer, QRasterBuffer *rasterBuffer, int x, int y, int length)
@@ -1045,14 +1125,14 @@ static QRgba64 *QT_FASTCALL destFetch64(QRgba64 *buffer, QRasterBuffer *rasterBu
const QPixelLayout *layout = &qPixelLayouts[rasterBuffer->format];
uint buffer32[buffer_size];
const uint *ptr = qFetchPixels[layout->bpp](buffer32, rasterBuffer->scanLine(y), x, length);
- return const_cast<QRgba64 *>(layout->convertToARGB64PM(buffer, ptr, length, layout, 0));
+ return const_cast<QRgba64 *>(layout->convertToARGB64PM(buffer, ptr, length, 0, 0));
}
static QRgba64 *QT_FASTCALL destFetch64uint32(QRgba64 *buffer, QRasterBuffer *rasterBuffer, int x, int y, int length)
{
const QPixelLayout *layout = &qPixelLayouts[rasterBuffer->format];
const uint *src = ((const uint *)rasterBuffer->scanLine(y)) + x;
- return const_cast<QRgba64 *>(layout->convertToARGB64PM(buffer, src, length, layout, 0));
+ return const_cast<QRgba64 *>(layout->convertToARGB64PM(buffer, src, length, 0, 0));
}
static DestFetchProc destFetchProc[QImage::NImageFormats] =
@@ -1219,9 +1299,9 @@ static void QT_FASTCALL destStore(QRasterBuffer *rasterBuffer, int x, int y, con
int l = qMin(length, buffer_size);
const uint *ptr = 0;
if (!layout->premultiplied && !layout->alphaWidth)
- ptr = layout->convertFromRGB32(buf, buffer, l, layout, 0);
+ ptr = layout->convertFromRGB32(buf, buffer, l, 0, 0);
else
- ptr = layout->convertFromARGB32PM(buf, buffer, l, layout, 0);
+ ptr = layout->convertFromARGB32PM(buf, buffer, l, 0, 0);
store(dest, ptr, x, l);
length -= l;
buffer += l;
@@ -1247,9 +1327,9 @@ static void QT_FASTCALL destStore64(QRasterBuffer *rasterBuffer, int x, int y, c
const uint *ptr = 0;
convertFromRgb64(buf, buffer, l);
if (!layout->premultiplied && !layout->alphaWidth)
- ptr = layout->convertFromRGB32(buf, buf, l, layout, 0);
+ ptr = layout->convertFromRGB32(buf, buf, l, 0, 0);
else
- ptr = layout->convertFromARGB32PM(buf, buf, l, layout, 0);
+ ptr = layout->convertFromARGB32PM(buf, buf, l, 0, 0);
store(dest, ptr, x, l);
length -= l;
buffer += l;
@@ -1436,8 +1516,7 @@ static const uint *QT_FASTCALL fetchUntransformed(uint *buffer, const Operator *
{
const QPixelLayout *layout = &qPixelLayouts[data->texture.format];
const uint *ptr = qFetchPixels[layout->bpp](buffer, data->texture.scanLine(y), x, length);
- const QRgb *clut = data->texture.colorTable ? data->texture.colorTable->constData() : 0;
- return layout->convertToARGB32PM(buffer, ptr, length, layout, clut);
+ return layout->convertToARGB32PM(buffer, ptr, length, data->texture.colorTable, 0);
}
static const uint *QT_FASTCALL fetchUntransformedARGB32PM(uint *, const Operator *,
@@ -1465,14 +1544,13 @@ static const QRgba64 *QT_FASTCALL fetchUntransformed64(QRgba64 *buffer, const Op
const QSpanData *data, int y, int x, int length)
{
const QPixelLayout *layout = &qPixelLayouts[data->texture.format];
- const QRgb *clut = data->texture.colorTable ? data->texture.colorTable->constData() : 0;
if (layout->bpp != QPixelLayout::BPP32) {
uint buffer32[buffer_size];
const uint *ptr = qFetchPixels[layout->bpp](buffer32, data->texture.scanLine(y), x, length);
- return layout->convertToARGB64PM(buffer, ptr, length, layout, clut);
+ return layout->convertToARGB64PM(buffer, ptr, length, data->texture.colorTable, 0);
} else {
const uint *src = (const uint *)data->texture.scanLine(y) + x;
- return layout->convertToARGB64PM(buffer, src, length, layout, clut);
+ return layout->convertToARGB64PM(buffer, src, length, data->texture.colorTable, 0);
}
}
@@ -1639,8 +1717,7 @@ static const uint *QT_FASTCALL fetchTransformed(uint *buffer, const Operator *,
++b;
}
}
- const QRgb *clut = data->texture.colorTable ? data->texture.colorTable->constData() : 0;
- return layout->convertToARGB32PM(buffer, buffer, length, layout, clut);
+ return layout->convertToARGB32PM(buffer, buffer, length, data->texture.colorTable, 0);
}
template<TextureBlendType blendType> /* either BlendTransformed or BlendTransformedTiled */
@@ -1655,7 +1732,7 @@ static const QRgba64 *QT_FASTCALL fetchTransformed64(QRgba64 *buffer, const Oper
const QPixelLayout *layout = &qPixelLayouts[data->texture.format];
FetchPixelFunc fetch = qFetchPixel[layout->bpp];
- const QRgb *clut = data->texture.colorTable ? data->texture.colorTable->constData() : 0;
+ const QVector<QRgb> *clut = data->texture.colorTable;
uint buffer32[buffer_size];
QRgba64 *b = buffer;
@@ -1672,7 +1749,7 @@ static const QRgba64 *QT_FASTCALL fetchTransformed64(QRgba64 *buffer, const Oper
int i = 0, j = 0;
while (i < length) {
if (j == buffer_size) {
- layout->convertToARGB64PM(b, buffer32, buffer_size, layout, clut);
+ layout->convertToARGB64PM(b, buffer32, buffer_size, clut, 0);
b += buffer_size;
j = 0;
}
@@ -1695,7 +1772,7 @@ static const QRgba64 *QT_FASTCALL fetchTransformed64(QRgba64 *buffer, const Oper
++i; ++j;
}
if (j > 0) {
- layout->convertToARGB64PM(b, buffer32, j, layout, clut);
+ layout->convertToARGB64PM(b, buffer32, j, clut, 0);
b += j;
}
} else {
@@ -1710,7 +1787,7 @@ static const QRgba64 *QT_FASTCALL fetchTransformed64(QRgba64 *buffer, const Oper
int i = 0, j = 0;
while (i < length) {
if (j == buffer_size) {
- layout->convertToARGB64PM(b, buffer32, buffer_size, layout, clut);
+ layout->convertToARGB64PM(b, buffer32, buffer_size, clut, 0);
b += buffer_size;
j = 0;
}
@@ -1741,7 +1818,7 @@ static const QRgba64 *QT_FASTCALL fetchTransformed64(QRgba64 *buffer, const Oper
++i; ++j;
}
if (j > 0) {
- layout->convertToARGB64PM(b, buffer32, j, layout, clut);
+ layout->convertToARGB64PM(b, buffer32, j, clut, 0);
b += j;
}
}
@@ -1750,9 +1827,9 @@ static const QRgba64 *QT_FASTCALL fetchTransformed64(QRgba64 *buffer, const Oper
/** \internal
interpolate 4 argb pixels with the distx and disty factor.
- distx and disty bust be between 0 and 16
+ distx and disty must be between 0 and 16
*/
-static inline uint interpolate_4_pixels_16(uint tl, uint tr, uint bl, uint br, int distx, int disty)
+static inline uint interpolate_4_pixels_16(uint tl, uint tr, uint bl, uint br, uint distx, uint disty)
{
uint distxy = distx * disty;
//idistx * disty = (16-distx) * disty = 16*disty - distxy
@@ -2099,30 +2176,30 @@ static const uint * QT_FASTCALL fetchTransformedBilinearARGB32PM(uint *buffer, c
fetchTransformedBilinear_pixelBounds<blendType>(image_height, image_y1, image_y2, y1, y2);
const uint *s1 = (const uint *)data->texture.scanLine(y1);
const uint *s2 = (const uint *)data->texture.scanLine(y2);
- int disty = (fy & 0x0000ffff) >> 12;
+ const int disty8 = (fy & 0x0000ffff) >> 8;
+ const int disty4 = (disty8 + 0x08) >> 4;
if (blendType != BlendTransformedBilinearTiled) {
#define BILINEAR_DOWNSCALE_BOUNDS_PROLOG \
+ const qint64 min_fx = qint64(image_x1) * fixed_scale; \
+ const qint64 max_fx = qint64(image_x2) * fixed_scale; \
while (b < end) { \
int x1 = (fx >> 16); \
int x2; \
fetchTransformedBilinear_pixelBounds<blendType>(image_width, image_x1, image_x2, x1, x2); \
if (x1 != x2) \
break; \
- uint tl = s1[x1]; \
- uint tr = s1[x2]; \
- uint bl = s2[x1]; \
- uint br = s2[x2]; \
- int distx = (fx & 0x0000ffff) >> 12; \
- *b = interpolate_4_pixels_16(tl, tr, bl, br, distx, disty); \
+ uint top = s1[x1]; \
+ uint bot = s2[x1]; \
+ *b = INTERPOLATE_PIXEL_256(top, 256 - disty8, bot, disty8); \
fx += fdx; \
++b; \
} \
- uint *boundedEnd; \
+ uint *boundedEnd = end; \
if (fdx > 0) \
- boundedEnd = qMin(end, buffer + uint((image_x2 - (fx >> 16)) / data->m11)); \
- else \
- boundedEnd = qMin(end, buffer + uint((image_x1 - (fx >> 16)) / data->m11)); \
+ boundedEnd = qMin(boundedEnd, b + (max_fx - fx) / fdx); \
+ else if (fdx < 0) \
+ boundedEnd = qMin(boundedEnd, b + (min_fx - fx) / fdx); \
boundedEnd -= 3;
#if defined(__SSE2__)
@@ -2130,8 +2207,9 @@ static const uint * QT_FASTCALL fetchTransformedBilinearARGB32PM(uint *buffer, c
const __m128i colorMask = _mm_set1_epi32(0x00ff00ff);
const __m128i v_256 = _mm_set1_epi16(256);
- const __m128i v_disty = _mm_set1_epi16(disty);
+ const __m128i v_disty = _mm_set1_epi16(disty4);
const __m128i v_fdx = _mm_set1_epi32(fdx*4);
+ const __m128i v_fx_r = _mm_set1_epi32(0x8);
__m128i v_fx = _mm_setr_epi32(fx, fx + fdx, fx + fdx + fdx, fx + fdx + fdx + fdx);
while (b < boundedEnd) {
@@ -2145,7 +2223,8 @@ static const uint * QT_FASTCALL fetchTransformedBilinearARGB32PM(uint *buffer, c
const __m128i bl = _mm_setr_epi32(s2[offset0], s2[offset1], s2[offset2], s2[offset3]);
const __m128i br = _mm_setr_epi32(s2[offset0 + 1], s2[offset1 + 1], s2[offset2 + 1], s2[offset3 + 1]);
- __m128i v_distx = _mm_srli_epi16(v_fx, 12);
+ __m128i v_distx = _mm_srli_epi16(v_fx, 8);
+ v_distx = _mm_srli_epi16(_mm_add_epi32(v_distx, v_fx_r), 4);
v_distx = _mm_shufflehi_epi16(v_distx, _MM_SHUFFLE(2,2,0,0));
v_distx = _mm_shufflelo_epi16(v_distx, _MM_SHUFFLE(2,2,0,0));
@@ -2160,48 +2239,49 @@ static const uint * QT_FASTCALL fetchTransformedBilinearARGB32PM(uint *buffer, c
const int16x8_t colorMask = vdupq_n_s16(0x00ff);
const int16x8_t invColorMask = vmvnq_s16(colorMask);
const int16x8_t v_256 = vdupq_n_s16(256);
- const int16x8_t v_disty = vdupq_n_s16(disty);
+ const int16x8_t v_disty = vdupq_n_s16(disty4);
const int16x8_t v_disty_ = vshlq_n_s16(v_disty, 4);
int32x4_t v_fdx = vdupq_n_s32(fdx*4);
- ptrdiff_t secondLine = reinterpret_cast<const uint *>(s2) - reinterpret_cast<const uint *>(s1);
-
- union Vect_buffer { int32x4_t vect; quint32 i[4]; };
- Vect_buffer v_fx;
-
- for (int i = 0; i < 4; i++) {
- v_fx.i[i] = fx;
- fx += fdx;
- }
+ int32x4_t v_fx = vmovq_n_s32(fx);
+ v_fx = vsetq_lane_s32(fx + fdx, v_fx, 1);
+ v_fx = vsetq_lane_s32(fx + fdx * 2, v_fx, 2);
+ v_fx = vsetq_lane_s32(fx + fdx * 3, v_fx, 3);
const int32x4_t v_ffff_mask = vdupq_n_s32(0x0000ffff);
+ const int32x4_t v_fx_r = vdupq_n_s32(0x0800);
while (b < boundedEnd) {
+ uint32x4x2_t v_top, v_bot;
- Vect_buffer tl, tr, bl, br;
-
- Vect_buffer v_fx_shifted;
- v_fx_shifted.vect = vshrq_n_s32(v_fx.vect, 16);
-
- int32x4_t v_distx = vshrq_n_s32(vandq_s32(v_fx.vect, v_ffff_mask), 12);
-
- for (int i = 0; i < 4; i++) {
- int x1 = v_fx_shifted.i[i];
- const uint *addr_tl = reinterpret_cast<const uint *>(s1) + x1;
- const uint *addr_tr = addr_tl + 1;
- tl.i[i] = *addr_tl;
- tr.i[i] = *addr_tr;
- bl.i[i] = *(addr_tl+secondLine);
- br.i[i] = *(addr_tr+secondLine);
- }
+ int x1 = (fx >> 16);
+ fx += fdx;
+ v_top = vld2q_lane_u32(s1 + x1, v_top, 0);
+ v_bot = vld2q_lane_u32(s2 + x1, v_bot, 0);
+ x1 = (fx >> 16);
+ fx += fdx;
+ v_top = vld2q_lane_u32(s1 + x1, v_top, 1);
+ v_bot = vld2q_lane_u32(s2 + x1, v_bot, 1);
+ x1 = (fx >> 16);
+ fx += fdx;
+ v_top = vld2q_lane_u32(s1 + x1, v_top, 2);
+ v_bot = vld2q_lane_u32(s2 + x1, v_bot, 2);
+ x1 = (fx >> 16);
+ fx += fdx;
+ v_top = vld2q_lane_u32(s1 + x1, v_top, 3);
+ v_bot = vld2q_lane_u32(s2 + x1, v_bot, 3);
+ int32x4_t v_distx = vshrq_n_s32(vaddq_s32(vandq_s32(v_fx, v_ffff_mask), v_fx_r), 12);
v_distx = vorrq_s32(v_distx, vshlq_n_s32(v_distx, 16));
- interpolate_4_pixels_16_neon(vreinterpretq_s16_s32(tl.vect), vreinterpretq_s16_s32(tr.vect), vreinterpretq_s16_s32(bl.vect), vreinterpretq_s16_s32(br.vect), vreinterpretq_s16_s32(v_distx), v_disty, v_disty_, colorMask, invColorMask, v_256, b);
+ interpolate_4_pixels_16_neon(
+ vreinterpretq_s16_u32(v_top.val[0]), vreinterpretq_s16_u32(v_top.val[1]),
+ vreinterpretq_s16_u32(v_bot.val[0]), vreinterpretq_s16_u32(v_bot.val[1]),
+ vreinterpretq_s16_s32(v_distx), v_disty, v_disty_,
+ colorMask, invColorMask, v_256, b);
b+=4;
- v_fx.vect = vaddq_s32(v_fx.vect, v_fdx);
+ v_fx = vaddq_s32(v_fx, v_fdx);
}
- fx = v_fx.i[0];
#endif
}
@@ -2213,8 +2293,14 @@ static const uint * QT_FASTCALL fetchTransformedBilinearARGB32PM(uint *buffer, c
uint tr = s1[x2];
uint bl = s2[x1];
uint br = s2[x2];
- int distx = (fx & 0x0000ffff) >> 12;
- *b = interpolate_4_pixels_16(tl, tr, bl, br, distx, disty);
+#if defined(__SSE2__) || defined(__ARM_NEON__)
+ // The optimized interpolate_4_pixels are faster than interpolate_4_pixels_16.
+ int distx8 = (fx & 0x0000ffff) >> 8;
+ *b = interpolate_4_pixels(tl, tr, bl, br, distx8, disty8);
+#else
+ int distx4 = ((fx & 0x0000ffff) + 0x0800) >> 12;
+ *b = interpolate_4_pixels_16(tl, tr, bl, br, distx4, disty4);
+#endif
fx += fdx;
++b;
}
@@ -2253,6 +2339,10 @@ static const uint * QT_FASTCALL fetchTransformedBilinearARGB32PM(uint *buffer, c
if (blendType != BlendTransformedBilinearTiled) {
#define BILINEAR_ROTATE_BOUNDS_PROLOG \
+ const qint64 min_fx = qint64(image_x1) * fixed_scale; \
+ const qint64 max_fx = qint64(image_x2) * fixed_scale; \
+ const qint64 min_fy = qint64(image_y1) * fixed_scale; \
+ const qint64 max_fy = qint64(image_y2) * fixed_scale; \
while (b < end) { \
int x1 = (fx >> 16); \
int x2; \
@@ -2275,7 +2365,15 @@ static const uint * QT_FASTCALL fetchTransformedBilinearARGB32PM(uint *buffer, c
fy += fdy; \
++b; \
} \
- uint *boundedEnd = end - 3; \
+ uint *boundedEnd = end; \
+ if (fdx > 0) \
+ boundedEnd = qMin(boundedEnd, b + (max_fx - fx) / fdx); \
+ else if (fdx < 0) \
+ boundedEnd = qMin(boundedEnd, b + (min_fx - fx) / fdx); \
+ if (fdy > 0) \
+ boundedEnd = qMin(boundedEnd, b + (max_fy - fy) / fdy); \
+ else if (fdy < 0) \
+ boundedEnd = qMin(boundedEnd, b + (min_fy - fy) / fdy); \
boundedEnd -= 3;
#if defined(__SSE2__)
@@ -2285,6 +2383,7 @@ static const uint * QT_FASTCALL fetchTransformedBilinearARGB32PM(uint *buffer, c
const __m128i v_256 = _mm_set1_epi16(256);
const __m128i v_fdx = _mm_set1_epi32(fdx*4);
const __m128i v_fdy = _mm_set1_epi32(fdy*4);
+ const __m128i v_fxy_r = _mm_set1_epi32(0x8);
__m128i v_fx = _mm_setr_epi32(fx, fx + fdx, fx + fdx + fdx, fx + fdx + fdx + fdx);
__m128i v_fy = _mm_setr_epi32(fy, fy + fdy, fy + fdy + fdy, fy + fdy + fdy + fdy);
@@ -2293,15 +2392,6 @@ static const uint * QT_FASTCALL fetchTransformedBilinearARGB32PM(uint *buffer, c
const __m128i vbpl = _mm_shufflelo_epi16(_mm_cvtsi32_si128(bytesPerLine/4), _MM_SHUFFLE(0, 0, 0, 0));
while (b < boundedEnd) {
- if (fdx > 0 && (short)_mm_extract_epi16(v_fx, 7) >= image_x2)
- break;
- if (fdx < 0 && (short)_mm_extract_epi16(v_fx, 7) < image_x1)
- break;
- if (fdy > 0 && (short)_mm_extract_epi16(v_fy, 7) >= image_y2)
- break;
- if (fdy < 0 && (short)_mm_extract_epi16(v_fy, 7) < image_y1)
- break;
-
const __m128i vy = _mm_packs_epi32(_mm_srli_epi32(v_fy, 16), _mm_setzero_si128());
// 4x16bit * 4x16bit -> 4x32bit
__m128i offset = _mm_unpacklo_epi16(_mm_mullo_epi16(vy, vbpl), _mm_mulhi_epi16(vy, vbpl));
@@ -2317,8 +2407,10 @@ static const uint * QT_FASTCALL fetchTransformedBilinearARGB32PM(uint *buffer, c
const __m128i bl = _mm_setr_epi32(bottomData[offset0], bottomData[offset1], bottomData[offset2], bottomData[offset3]);
const __m128i br = _mm_setr_epi32(bottomData[offset0 + 1], bottomData[offset1 + 1], bottomData[offset2 + 1], bottomData[offset3 + 1]);
- __m128i v_distx = _mm_srli_epi16(v_fx, 12);
- __m128i v_disty = _mm_srli_epi16(v_fy, 12);
+ __m128i v_distx = _mm_srli_epi16(v_fx, 8);
+ __m128i v_disty = _mm_srli_epi16(v_fy, 8);
+ v_distx = _mm_srli_epi16(_mm_add_epi32(v_distx, v_fxy_r), 4);
+ v_disty = _mm_srli_epi16(_mm_add_epi32(v_disty, v_fxy_r), 4);
v_distx = _mm_shufflehi_epi16(v_distx, _MM_SHUFFLE(2,2,0,0));
v_distx = _mm_shufflelo_epi16(v_distx, _MM_SHUFFLE(2,2,0,0));
v_disty = _mm_shufflehi_epi16(v_disty, _MM_SHUFFLE(2,2,0,0));
@@ -2331,6 +2423,81 @@ static const uint * QT_FASTCALL fetchTransformedBilinearARGB32PM(uint *buffer, c
}
fx = _mm_cvtsi128_si32(v_fx);
fy = _mm_cvtsi128_si32(v_fy);
+#elif defined(__ARM_NEON__)
+ BILINEAR_ROTATE_BOUNDS_PROLOG
+
+ const int16x8_t colorMask = vdupq_n_s16(0x00ff);
+ const int16x8_t invColorMask = vmvnq_s16(colorMask);
+ const int16x8_t v_256 = vdupq_n_s16(256);
+ int32x4_t v_fdx = vdupq_n_s32(fdx * 4);
+ int32x4_t v_fdy = vdupq_n_s32(fdy * 4);
+
+ const uchar *textureData = data->texture.imageData;
+ const int bytesPerLine = data->texture.bytesPerLine;
+
+ int32x4_t v_fx = vmovq_n_s32(fx);
+ int32x4_t v_fy = vmovq_n_s32(fy);
+ v_fx = vsetq_lane_s32(fx + fdx, v_fx, 1);
+ v_fy = vsetq_lane_s32(fy + fdy, v_fy, 1);
+ v_fx = vsetq_lane_s32(fx + fdx * 2, v_fx, 2);
+ v_fy = vsetq_lane_s32(fy + fdy * 2, v_fy, 2);
+ v_fx = vsetq_lane_s32(fx + fdx * 3, v_fx, 3);
+ v_fy = vsetq_lane_s32(fy + fdy * 3, v_fy, 3);
+
+ const int32x4_t v_ffff_mask = vdupq_n_s32(0x0000ffff);
+ const int32x4_t v_round = vdupq_n_s32(0x0800);
+
+ while (b < boundedEnd) {
+ uint32x4x2_t v_top, v_bot;
+
+ int x1 = (fx >> 16);
+ int y1 = (fy >> 16);
+ fx += fdx; fy += fdy;
+ const uchar *sl = textureData + bytesPerLine * y1;
+ const uint *s1 = reinterpret_cast<const uint *>(sl);
+ const uint *s2 = reinterpret_cast<const uint *>(sl + bytesPerLine);
+ v_top = vld2q_lane_u32(s1 + x1, v_top, 0);
+ v_bot = vld2q_lane_u32(s2 + x1, v_bot, 0);
+ x1 = (fx >> 16);
+ y1 = (fy >> 16);
+ fx += fdx; fy += fdy;
+ sl = textureData + bytesPerLine * y1;
+ s1 = reinterpret_cast<const uint *>(sl);
+ s2 = reinterpret_cast<const uint *>(sl + bytesPerLine);
+ v_top = vld2q_lane_u32(s1 + x1, v_top, 1);
+ v_bot = vld2q_lane_u32(s2 + x1, v_bot, 1);
+ x1 = (fx >> 16);
+ y1 = (fy >> 16);
+ fx += fdx; fy += fdy;
+ sl = textureData + bytesPerLine * y1;
+ s1 = reinterpret_cast<const uint *>(sl);
+ s2 = reinterpret_cast<const uint *>(sl + bytesPerLine);
+ v_top = vld2q_lane_u32(s1 + x1, v_top, 2);
+ v_bot = vld2q_lane_u32(s2 + x1, v_bot, 2);
+ x1 = (fx >> 16);
+ y1 = (fy >> 16);
+ fx += fdx; fy += fdy;
+ sl = textureData + bytesPerLine * y1;
+ s1 = reinterpret_cast<const uint *>(sl);
+ s2 = reinterpret_cast<const uint *>(sl + bytesPerLine);
+ v_top = vld2q_lane_u32(s1 + x1, v_top, 3);
+ v_bot = vld2q_lane_u32(s2 + x1, v_bot, 3);
+
+ int32x4_t v_distx = vshrq_n_s32(vaddq_s32(vandq_s32(v_fx, v_ffff_mask), v_round), 12);
+ int32x4_t v_disty = vshrq_n_s32(vaddq_s32(vandq_s32(v_fy, v_ffff_mask), v_round), 12);
+ v_distx = vorrq_s32(v_distx, vshlq_n_s32(v_distx, 16));
+ v_disty = vorrq_s32(v_disty, vshlq_n_s32(v_disty, 16));
+ int16x8_t v_disty_ = vshlq_n_s16(vreinterpretq_s16_s32(v_disty), 4);
+
+ interpolate_4_pixels_16_neon(
+ vreinterpretq_s16_u32(v_top.val[0]), vreinterpretq_s16_u32(v_top.val[1]),
+ vreinterpretq_s16_u32(v_bot.val[0]), vreinterpretq_s16_u32(v_bot.val[1]),
+ vreinterpretq_s16_s32(v_distx), vreinterpretq_s16_s32(v_disty),
+ v_disty_, colorMask, invColorMask, v_256, b);
+ b += 4;
+ v_fx = vaddq_s32(v_fx, v_fdx);
+ v_fy = vaddq_s32(v_fy, v_fdy);
+ }
#endif
}
@@ -2357,8 +2524,8 @@ static const uint * QT_FASTCALL fetchTransformedBilinearARGB32PM(uint *buffer, c
int disty = (fy & 0x0000ffff) >> 8;
*b = interpolate_4_pixels(tl, tr, bl, br, distx, disty);
#else
- int distx = (fx & 0x0000ffff) >> 12;
- int disty = (fy & 0x0000ffff) >> 12;
+ int distx = ((fx & 0x0000ffff) + 0x0800) >> 12;
+ int disty = ((fy & 0x0000ffff) + 0x0800) >> 12;
*b = interpolate_4_pixels_16(tl, tr, bl, br, distx, disty);
#endif
@@ -2423,7 +2590,7 @@ static const uint *QT_FASTCALL fetchTransformedBilinear(uint *buffer, const Oper
const QSpanData *data, int y, int x, int length)
{
const QPixelLayout *layout = &qPixelLayouts[data->texture.format];
- const QRgb *clut = data->texture.colorTable ? data->texture.colorTable->constData() : 0;
+ const QVector<QRgb> *clut = data->texture.colorTable;
int image_width = data->texture.width;
int image_height = data->texture.height;
@@ -2479,9 +2646,9 @@ static const uint *QT_FASTCALL fetchTransformedBilinear(uint *buffer, const Oper
int len2 = qMin(x, count - len1);
ptr1 = fetch(buf1, s1, x, len1);
- ptr1 = layout->convertToARGB32PM(buf1, ptr1, len1, layout, clut);
+ ptr1 = layout->convertToARGB32PM(buf1, ptr1, len1, clut, 0);
ptr2 = fetch(buf2, s2, x, len1);
- ptr2 = layout->convertToARGB32PM(buf2, ptr2, len1, layout, clut);
+ ptr2 = layout->convertToARGB32PM(buf2, ptr2, len1, clut, 0);
for (int i = 0; i < len1; ++i) {
uint t = ptr1[i];
uint b = ptr2[i];
@@ -2491,9 +2658,9 @@ static const uint *QT_FASTCALL fetchTransformedBilinear(uint *buffer, const Oper
if (len2) {
ptr1 = fetch(buf1 + len1, s1, 0, len2);
- ptr1 = layout->convertToARGB32PM(buf1 + len1, ptr1, len2, layout, clut);
+ ptr1 = layout->convertToARGB32PM(buf1 + len1, ptr1, len2, clut, 0);
ptr2 = fetch(buf2 + len1, s2, 0, len2);
- ptr2 = layout->convertToARGB32PM(buf2 + len1, ptr2, len2, layout, clut);
+ ptr2 = layout->convertToARGB32PM(buf2 + len1, ptr2, len2, clut, 0);
for (int i = 0; i < len2; ++i) {
uint t = ptr1[i];
uint b = ptr2[i];
@@ -2512,9 +2679,9 @@ static const uint *QT_FASTCALL fetchTransformedBilinear(uint *buffer, const Oper
int leading = start - x;
ptr1 = fetch(buf1 + leading, s1, start, len);
- ptr1 = layout->convertToARGB32PM(buf1 + leading, ptr1, len, layout, clut);
+ ptr1 = layout->convertToARGB32PM(buf1 + leading, ptr1, len, clut, 0);
ptr2 = fetch(buf2 + leading, s2, start, len);
- ptr2 = layout->convertToARGB32PM(buf2 + leading, ptr2, len, layout, clut);
+ ptr2 = layout->convertToARGB32PM(buf2 + leading, ptr2, len, clut, 0);
for (int i = 0; i < len; ++i) {
uint t = ptr1[i];
@@ -2576,8 +2743,8 @@ static const uint *QT_FASTCALL fetchTransformedBilinear(uint *buffer, const Oper
fx += fdx;
}
- layout->convertToARGB32PM(buf1, buf1, len * 2, layout, clut);
- layout->convertToARGB32PM(buf2, buf2, len * 2, layout, clut);
+ layout->convertToARGB32PM(buf1, buf1, len * 2, clut, 0);
+ layout->convertToARGB32PM(buf2, buf2, len * 2, clut, 0);
if ((fdx < 0 && fdx > -(fixed_scale / 8)) || std::abs(data->m22) < (1./8.)) { // scale up more than 8x
int disty = (fy & 0x0000ffff) >> 8;
@@ -2587,13 +2754,13 @@ static const uint *QT_FASTCALL fetchTransformedBilinear(uint *buffer, const Oper
fracX += fdx;
}
} else { //scale down
- int disty = (fy & 0x0000ffff) >> 12;
+ int disty = ((fy & 0x0000ffff) + 0x0800) >> 12;
for (int i = 0; i < len; ++i) {
uint tl = buf1[i * 2 + 0];
uint tr = buf1[i * 2 + 1];
uint bl = buf2[i * 2 + 0];
uint br = buf2[i * 2 + 1];
- int distx = (fracX & 0x0000ffff) >> 12;
+ int distx = ((fracX & 0x0000ffff) + 0x0800) >> 12;
b[i] = interpolate_4_pixels_16(tl, tr, bl, br, distx, disty);
fracX += fdx;
}
@@ -2638,8 +2805,8 @@ static const uint *QT_FASTCALL fetchTransformedBilinear(uint *buffer, const Oper
fx += fdx;
fy += fdy;
}
- layout->convertToARGB32PM(buf1, buf1, len * 2, layout, clut);
- layout->convertToARGB32PM(buf2, buf2, len * 2, layout, clut);
+ layout->convertToARGB32PM(buf1, buf1, len * 2, clut, 0);
+ layout->convertToARGB32PM(buf2, buf2, len * 2, clut, 0);
if (std::abs(data->m11) > 8 || std::abs(data->m22) > 8) {
//if we are zooming more than 8 times, we use 8bit precision for the position.
@@ -2659,8 +2826,8 @@ static const uint *QT_FASTCALL fetchTransformedBilinear(uint *buffer, const Oper
uint bl = buf2[i * 2 + 0];
uint br = buf2[i * 2 + 1];
- int distx = (fracX & 0x0000ffff) >> 12;
- int disty = (fracY & 0x0000ffff) >> 12;
+ int distx = ((fracX & 0x0000ffff) + 0x0800) >> 12;
+ int disty = ((fracY & 0x0000ffff) + 0x0800) >> 12;
b[i] = interpolate_4_pixels_16(tl, tr, bl, br, distx, disty);
fracX += fdx;
@@ -2730,8 +2897,8 @@ static const uint *QT_FASTCALL fetchTransformedBilinear(uint *buffer, const Oper
fw += fdw;
}
- layout->convertToARGB32PM(buf1, buf1, len * 2, layout, clut);
- layout->convertToARGB32PM(buf2, buf2, len * 2, layout, clut);
+ layout->convertToARGB32PM(buf1, buf1, len * 2, clut, 0);
+ layout->convertToARGB32PM(buf2, buf2, len * 2, clut, 0);
for (int i = 0; i < len; ++i) {
int distx = distxs[i];
@@ -2752,7 +2919,7 @@ static const QRgba64 *QT_FASTCALL fetchTransformedBilinear64(QRgba64 *buffer, co
const QSpanData *data, int y, int x, int length)
{
const QPixelLayout *layout = &qPixelLayouts[data->texture.format];
- const QRgb *clut = data->texture.colorTable ? data->texture.colorTable->constData() : 0;
+ const QVector<QRgb> *clut = data->texture.colorTable;
int image_width = data->texture.width;
int image_height = data->texture.height;
@@ -2808,10 +2975,8 @@ static const QRgba64 *QT_FASTCALL fetchTransformedBilinear64(QRgba64 *buffer, co
fetchTransformedBilinear_pixelBounds<blendType>(image_width, image_x1, image_x2, x1, x2);
if (x1 != x2)
break;
- sbuf1[i * 2 + 0] = ((const uint*)s1)[x1];
- sbuf1[i * 2 + 1] = ((const uint*)s1)[x2];
- sbuf2[i * 2 + 0] = ((const uint*)s2)[x1];
- sbuf2[i * 2 + 1] = ((const uint*)s2)[x2];
+ sbuf1[i * 2 + 0] = sbuf1[i * 2 + 1] = ((const uint*)s1)[x1];
+ sbuf2[i * 2 + 0] = sbuf2[i * 2 + 1] = ((const uint*)s2)[x1];
fx += fdx;
}
int fastLen;
@@ -2869,9 +3034,9 @@ static const QRgba64 *QT_FASTCALL fetchTransformedBilinear64(QRgba64 *buffer, co
fx += fdx;
}
- layout->convertToARGB64PM(buf1, sbuf1, len * 2, layout, clut);
+ layout->convertToARGB64PM(buf1, sbuf1, len * 2, clut, 0);
if (disty)
- layout->convertToARGB64PM(buf2, sbuf2, len * 2, layout, clut);
+ layout->convertToARGB64PM(buf2, sbuf2, len * 2, clut, 0);
for (int i = 0; i < len; ++i) {
int distx = (fracX & 0x0000ffff);
@@ -2930,6 +3095,16 @@ static const QRgba64 *QT_FASTCALL fetchTransformedBilinear64(QRgba64 *buffer, co
fx += fdx;
fy += fdy;
}
+ int fastLen = len;
+ if (fdx > 0)
+ fastLen = qMin(fastLen, int((qint64(image_x2) * fixed_scale - fx) / fdx));
+ else if (fdx < 0)
+ fastLen = qMin(fastLen, int((qint64(image_x1) * fixed_scale - fx) / fdx));
+ if (fdy > 0)
+ fastLen = qMin(fastLen, int((qint64(image_y2) * fixed_scale - fy) / fdy));
+ else if (fdy < 0)
+ fastLen = qMin(fastLen, int((qint64(image_y1) * fixed_scale - fy) / fdy));
+ fastLen -= 3;
const __m128i v_fdx = _mm_set1_epi32(fdx*4);
const __m128i v_fdy = _mm_set1_epi32(fdy*4);
@@ -2939,15 +3114,7 @@ static const QRgba64 *QT_FASTCALL fetchTransformedBilinear64(QRgba64 *buffer, co
const uchar *s1 = data->texture.imageData;
const uchar *s2 = s1 + bytesPerLine;
const __m128i vbpl = _mm_shufflelo_epi16(_mm_cvtsi32_si128(bytesPerLine/4), _MM_SHUFFLE(0, 0, 0, 0));
- for (; i < len-3; i+=4) {
- if (fdx > 0 && (short)_mm_extract_epi16(v_fx, 7) >= image_x2)
- break;
- if (fdx < 0 && (short)_mm_extract_epi16(v_fx, 7) < image_x1)
- break;
- if (fdy > 0 && (short)_mm_extract_epi16(v_fy, 7) >= image_y2)
- break;
- if (fdy < 0 && (short)_mm_extract_epi16(v_fy, 7) < image_y1)
- break;
+ for (; i < fastLen; i += 4) {
const __m128i vy = _mm_packs_epi32(_mm_srai_epi32(v_fy, 16), _mm_setzero_si128());
__m128i voffset = _mm_unpacklo_epi16(_mm_mullo_epi16(vy, vbpl), _mm_mulhi_epu16(vy, vbpl));
voffset = _mm_add_epi32(voffset, _mm_srli_epi32(v_fx, 16));
@@ -3007,8 +3174,8 @@ static const QRgba64 *QT_FASTCALL fetchTransformedBilinear64(QRgba64 *buffer, co
fx += fdx;
fy += fdy;
}
- layout->convertToARGB64PM(buf1, sbuf1, len * 2, layout, clut);
- layout->convertToARGB64PM(buf2, sbuf2, len * 2, layout, clut);
+ layout->convertToARGB64PM(buf1, sbuf1, len * 2, clut, 0);
+ layout->convertToARGB64PM(buf2, sbuf2, len * 2, clut, 0);
for (int i = 0; i < len; ++i) {
int distx = (fracX & 0x0000ffff);
@@ -3079,8 +3246,8 @@ static const QRgba64 *QT_FASTCALL fetchTransformedBilinear64(QRgba64 *buffer, co
fw += fdw;
}
- layout->convertToARGB64PM(buf1, sbuf1, len * 2, layout, clut);
- layout->convertToARGB64PM(buf2, sbuf2, len * 2, layout, clut);
+ layout->convertToARGB64PM(buf1, sbuf1, len * 2, clut, 0);
+ layout->convertToARGB64PM(buf2, sbuf2, len * 2, clut, 0);
for (int i = 0; i < len; ++i) {
int distx = distxs[i];
@@ -3096,342 +3263,72 @@ static const QRgba64 *QT_FASTCALL fetchTransformedBilinear64(QRgba64 *buffer, co
return buffer;
}
-static SourceFetchProc sourceFetch[NBlendTypes][QImage::NImageFormats] = {
- // Untransformed
- {
- 0, // Invalid
- fetchUntransformed, // Mono
- fetchUntransformed, // MonoLsb
- fetchUntransformed, // Indexed8
- fetchUntransformedARGB32PM, // RGB32
- fetchUntransformed, // ARGB32
- fetchUntransformedARGB32PM, // ARGB32_Premultiplied
- fetchUntransformedRGB16, // RGB16
- fetchUntransformed, // ARGB8565_Premultiplied
- fetchUntransformed, // RGB666
- fetchUntransformed, // ARGB6666_Premultiplied
- fetchUntransformed, // RGB555
- fetchUntransformed, // ARGB8555_Premultiplied
- fetchUntransformed, // RGB888
- fetchUntransformed, // RGB444
- fetchUntransformed, // ARGB4444_Premultiplied
- fetchUntransformed, // RGBX8888
- fetchUntransformed, // RGBA8888
- fetchUntransformed, // RGBA8888_Premultiplied
- fetchUntransformed, // Format_BGR30
- fetchUntransformed, // Format_A2BGR30_Premultiplied
- fetchUntransformed, // Format_RGB30
- fetchUntransformed, // Format_A2RGB30_Premultiplied
- fetchUntransformed, // Alpha8
- fetchUntransformed, // Grayscale8
- },
- // Tiled
- {
- 0, // Invalid
- fetchUntransformed, // Mono
- fetchUntransformed, // MonoLsb
- fetchUntransformed, // Indexed8
- fetchUntransformedARGB32PM, // RGB32
- fetchUntransformed, // ARGB32
- fetchUntransformedARGB32PM, // ARGB32_Premultiplied
- fetchUntransformedRGB16, // RGB16
- fetchUntransformed, // ARGB8565_Premultiplied
- fetchUntransformed, // RGB666
- fetchUntransformed, // ARGB6666_Premultiplied
- fetchUntransformed, // RGB555
- fetchUntransformed, // ARGB8555_Premultiplied
- fetchUntransformed, // RGB888
- fetchUntransformed, // RGB444
- fetchUntransformed, // ARGB4444_Premultiplied
- fetchUntransformed, // RGBX8888
- fetchUntransformed, // RGBA8888
- fetchUntransformed, // RGBA8888_Premultiplied
- fetchUntransformed, // BGR30
- fetchUntransformed, // A2BGR30_Premultiplied
- fetchUntransformed, // RGB30
- fetchUntransformed, // A2RGB30_Premultiplied
- fetchUntransformed, // Alpha8
- fetchUntransformed, // Grayscale8
- },
- // Transformed
- {
- 0, // Invalid
- fetchTransformed<BlendTransformed>, // Mono
- fetchTransformed<BlendTransformed>, // MonoLsb
- fetchTransformed<BlendTransformed>, // Indexed8
- fetchTransformedARGB32PM<BlendTransformed>, // RGB32
- fetchTransformed<BlendTransformed>, // ARGB32
- fetchTransformedARGB32PM<BlendTransformed>, // ARGB32_Premultiplied
- fetchTransformed<BlendTransformed>, // RGB16
- fetchTransformed<BlendTransformed>, // ARGB8565_Premultiplied
- fetchTransformed<BlendTransformed>, // RGB666
- fetchTransformed<BlendTransformed>, // ARGB6666_Premultiplied
- fetchTransformed<BlendTransformed>, // RGB555
- fetchTransformed<BlendTransformed>, // ARGB8555_Premultiplied
- fetchTransformed<BlendTransformed>, // RGB888
- fetchTransformed<BlendTransformed>, // RGB444
- fetchTransformed<BlendTransformed>, // ARGB4444_Premultiplied
- fetchTransformed<BlendTransformed>, // RGBX8888
- fetchTransformed<BlendTransformed>, // RGBA8888
- fetchTransformed<BlendTransformed>, // RGBA8888_Premultiplied
- fetchTransformed<BlendTransformed>, // BGR30
- fetchTransformed<BlendTransformed>, // A2BGR30_Premultiplied
- fetchTransformed<BlendTransformed>, // RGB30
- fetchTransformed<BlendTransformed>, // A2RGB30_Premultiplied
- fetchTransformed<BlendTransformed>, // Alpah8
- fetchTransformed<BlendTransformed>, // Grayscale8
- },
- {
- 0, // TransformedTiled
- fetchTransformed<BlendTransformedTiled>, // Mono
- fetchTransformed<BlendTransformedTiled>, // MonoLsb
- fetchTransformed<BlendTransformedTiled>, // Indexed8
- fetchTransformedARGB32PM<BlendTransformedTiled>, // RGB32
- fetchTransformed<BlendTransformedTiled>, // ARGB32
- fetchTransformedARGB32PM<BlendTransformedTiled>, // ARGB32_Premultiplied
- fetchTransformed<BlendTransformedTiled>, // RGB16
- fetchTransformed<BlendTransformedTiled>, // ARGB8565_Premultiplied
- fetchTransformed<BlendTransformedTiled>, // RGB666
- fetchTransformed<BlendTransformedTiled>, // ARGB6666_Premultiplied
- fetchTransformed<BlendTransformedTiled>, // RGB555
- fetchTransformed<BlendTransformedTiled>, // ARGB8555_Premultiplied
- fetchTransformed<BlendTransformedTiled>, // RGB888
- fetchTransformed<BlendTransformedTiled>, // RGB444
- fetchTransformed<BlendTransformedTiled>, // ARGB4444_Premultiplied
- fetchTransformed<BlendTransformedTiled>, // RGBX8888
- fetchTransformed<BlendTransformedTiled>, // RGBA8888
- fetchTransformed<BlendTransformedTiled>, // RGBA8888_Premultiplied
- fetchTransformed<BlendTransformedTiled>, // BGR30
- fetchTransformed<BlendTransformedTiled>, // A2BGR30_Premultiplied
- fetchTransformed<BlendTransformedTiled>, // RGB30
- fetchTransformed<BlendTransformedTiled>, // A2RGB30_Premultiplied
- fetchTransformed<BlendTransformedTiled>, // Alpha8
- fetchTransformed<BlendTransformedTiled>, // Grayscale8
- },
- {
- 0, // Bilinear
- fetchTransformedBilinear<BlendTransformedBilinear>, // Mono
- fetchTransformedBilinear<BlendTransformedBilinear>, // MonoLsb
- fetchTransformedBilinear<BlendTransformedBilinear>, // Indexed8
- fetchTransformedBilinearARGB32PM<BlendTransformedBilinear>, // RGB32
- fetchTransformedBilinear<BlendTransformedBilinear>, // ARGB32
- fetchTransformedBilinearARGB32PM<BlendTransformedBilinear>, // ARGB32_Premultiplied
- fetchTransformedBilinear<BlendTransformedBilinear>, // RGB16
- fetchTransformedBilinear<BlendTransformedBilinear>, // ARGB8565_Premultiplied
- fetchTransformedBilinear<BlendTransformedBilinear>, // RGB666
- fetchTransformedBilinear<BlendTransformedBilinear>, // ARGB6666_Premultiplied
- fetchTransformedBilinear<BlendTransformedBilinear>, // RGB555
- fetchTransformedBilinear<BlendTransformedBilinear>, // ARGB8555_Premultiplied
- fetchTransformedBilinear<BlendTransformedBilinear>, // RGB888
- fetchTransformedBilinear<BlendTransformedBilinear>, // RGB444
- fetchTransformedBilinear<BlendTransformedBilinear>, // ARGB4444_Premultiplied
- fetchTransformedBilinear<BlendTransformedBilinear>, // RGBX8888
- fetchTransformedBilinear<BlendTransformedBilinear>, // RGBA8888
- fetchTransformedBilinear<BlendTransformedBilinear>, // RGBA8888_Premultiplied
- fetchTransformedBilinear<BlendTransformedBilinear>, // BGR30
- fetchTransformedBilinear<BlendTransformedBilinear>, // A2BGR30_Premultiplied
- fetchTransformedBilinear<BlendTransformedBilinear>, // RGB30
- fetchTransformedBilinear<BlendTransformedBilinear>, // A2RGB30_Premultiplied
- fetchTransformedBilinear<BlendTransformedBilinear>, // Alpha8
- fetchTransformedBilinear<BlendTransformedBilinear>, // Grayscale8
- },
- {
- 0, // BilinearTiled
- fetchTransformedBilinear<BlendTransformedBilinearTiled>, // Mono
- fetchTransformedBilinear<BlendTransformedBilinearTiled>, // MonoLsb
- fetchTransformedBilinear<BlendTransformedBilinearTiled>, // Indexed8
- fetchTransformedBilinearARGB32PM<BlendTransformedBilinearTiled>, // RGB32
- fetchTransformedBilinear<BlendTransformedBilinearTiled>, // ARGB32
- fetchTransformedBilinearARGB32PM<BlendTransformedBilinearTiled>, // ARGB32_Premultiplied
- fetchTransformedBilinear<BlendTransformedBilinearTiled>, // RGB16
- fetchTransformedBilinear<BlendTransformedBilinearTiled>, // ARGB8565_Premultiplied
- fetchTransformedBilinear<BlendTransformedBilinearTiled>, // RGB666
- fetchTransformedBilinear<BlendTransformedBilinearTiled>, // ARGB6666_Premultiplied
- fetchTransformedBilinear<BlendTransformedBilinearTiled>, // RGB555
- fetchTransformedBilinear<BlendTransformedBilinearTiled>, // ARGB8555_Premultiplied
- fetchTransformedBilinear<BlendTransformedBilinearTiled>, // RGB888
- fetchTransformedBilinear<BlendTransformedBilinearTiled>, // RGB444
- fetchTransformedBilinear<BlendTransformedBilinearTiled>, // ARGB4444_Premultiplied
- fetchTransformedBilinear<BlendTransformedBilinearTiled>, // RGBX8888
- fetchTransformedBilinear<BlendTransformedBilinearTiled>, // RGBA8888
- fetchTransformedBilinear<BlendTransformedBilinearTiled>, // RGBA8888_Premultiplied
- fetchTransformedBilinear<BlendTransformedBilinearTiled>, // BGR30
- fetchTransformedBilinear<BlendTransformedBilinearTiled>, // A2BGR30_Premultiplied
- fetchTransformedBilinear<BlendTransformedBilinearTiled>, // RGB30
- fetchTransformedBilinear<BlendTransformedBilinearTiled>, // A2RGB30_Premultiplied
- fetchTransformedBilinear<BlendTransformedBilinearTiled>, // Alpha8
- fetchTransformedBilinear<BlendTransformedBilinearTiled>, // Grayscale8
- },
+// FetchUntransformed can have more specialized methods added depending on SIMD features.
+static SourceFetchProc sourceFetchUntransformed[QImage::NImageFormats] = {
+ 0, // Invalid
+ fetchUntransformed, // Mono
+ fetchUntransformed, // MonoLsb
+ fetchUntransformed, // Indexed8
+ fetchUntransformedARGB32PM, // RGB32
+ fetchUntransformed, // ARGB32
+ fetchUntransformedARGB32PM, // ARGB32_Premultiplied
+ fetchUntransformedRGB16, // RGB16
+ fetchUntransformed, // ARGB8565_Premultiplied
+ fetchUntransformed, // RGB666
+ fetchUntransformed, // ARGB6666_Premultiplied
+ fetchUntransformed, // RGB555
+ fetchUntransformed, // ARGB8555_Premultiplied
+ fetchUntransformed, // RGB888
+ fetchUntransformed, // RGB444
+ fetchUntransformed, // ARGB4444_Premultiplied
+ fetchUntransformed, // RGBX8888
+ fetchUntransformed, // RGBA8888
+ fetchUntransformed, // RGBA8888_Premultiplied
+ fetchUntransformed, // Format_BGR30
+ fetchUntransformed, // Format_A2BGR30_Premultiplied
+ fetchUntransformed, // Format_RGB30
+ fetchUntransformed, // Format_A2RGB30_Premultiplied
+ fetchUntransformed, // Alpha8
+ fetchUntransformed, // Grayscale8
};
-static SourceFetchProc64 sourceFetch64[NBlendTypes][QImage::NImageFormats] = {
- // Untransformed
- {
- 0, // Invalid
- fetchUntransformed64, // Mono
- fetchUntransformed64, // MonoLsb
- fetchUntransformed64, // Indexed8
- fetchUntransformed64, // RGB32
- fetchUntransformed64, // ARGB32
- fetchUntransformed64, // ARGB32_Premultiplied
- fetchUntransformed64, // RGB16
- fetchUntransformed64, // ARGB8565_Premultiplied
- fetchUntransformed64, // RGB666
- fetchUntransformed64, // ARGB6666_Premultiplied
- fetchUntransformed64, // RGB555
- fetchUntransformed64, // ARGB8555_Premultiplied
- fetchUntransformed64, // RGB888
- fetchUntransformed64, // RGB444
- fetchUntransformed64, // ARGB4444_Premultiplied
- fetchUntransformed64, // RGBX8888
- fetchUntransformed64, // RGBA8888
- fetchUntransformed64, // RGBA8888_Premultiplied
- fetchUntransformed64, // Format_BGR30
- fetchUntransformed64, // Format_A2BGR30_Premultiplied
- fetchUntransformed64, // Format_RGB30
- fetchUntransformed64, // Format_A2RGB30_Premultiplied
- fetchUntransformed64, // Alpha8
- fetchUntransformed64, // Grayscale8
- },
- // Tiled
- {
- 0, // Invalid
- fetchUntransformed64, // Mono
- fetchUntransformed64, // MonoLsb
- fetchUntransformed64, // Indexed8
- fetchUntransformed64, // RGB32
- fetchUntransformed64, // ARGB32
- fetchUntransformed64, // ARGB32_Premultiplied
- fetchUntransformed64, // RGB16
- fetchUntransformed64, // ARGB8565_Premultiplied
- fetchUntransformed64, // RGB666
- fetchUntransformed64, // ARGB6666_Premultiplied
- fetchUntransformed64, // RGB555
- fetchUntransformed64, // ARGB8555_Premultiplied
- fetchUntransformed64, // RGB888
- fetchUntransformed64, // RGB444
- fetchUntransformed64, // ARGB4444_Premultiplied
- fetchUntransformed64, // RGBX8888
- fetchUntransformed64, // RGBA8888
- fetchUntransformed64, // RGBA8888_Premultiplied
- fetchUntransformed64, // BGR30
- fetchUntransformed64, // A2BGR30_Premultiplied
- fetchUntransformed64, // RGB30
- fetchUntransformed64, // A2RGB30_Premultiplied
- fetchUntransformed64, // Alpha8
- fetchUntransformed64, // Grayscale8
- },
- // Transformed
- {
- 0, // Invalid
- fetchTransformed64<BlendTransformed>, // Mono
- fetchTransformed64<BlendTransformed>, // MonoLsb
- fetchTransformed64<BlendTransformed>, // Indexed8
- fetchTransformed64<BlendTransformed>, // RGB32
- fetchTransformed64<BlendTransformed>, // ARGB32
- fetchTransformed64<BlendTransformed>, // ARGB32_Premultiplied
- fetchTransformed64<BlendTransformed>, // RGB16
- fetchTransformed64<BlendTransformed>, // ARGB8565_Premultiplied
- fetchTransformed64<BlendTransformed>, // RGB666
- fetchTransformed64<BlendTransformed>, // ARGB6666_Premultiplied
- fetchTransformed64<BlendTransformed>, // RGB555
- fetchTransformed64<BlendTransformed>, // ARGB8555_Premultiplied
- fetchTransformed64<BlendTransformed>, // RGB888
- fetchTransformed64<BlendTransformed>, // RGB444
- fetchTransformed64<BlendTransformed>, // ARGB4444_Premultiplied
- fetchTransformed64<BlendTransformed>, // RGBX8888
- fetchTransformed64<BlendTransformed>, // RGBA8888
- fetchTransformed64<BlendTransformed>, // RGBA8888_Premultiplied
- fetchTransformed64<BlendTransformed>, // BGR30
- fetchTransformed64<BlendTransformed>, // A2BGR30_Premultiplied
- fetchTransformed64<BlendTransformed>, // RGB30
- fetchTransformed64<BlendTransformed>, // A2RGB30_Premultiplied
- fetchTransformed64<BlendTransformed>, // Alpah8
- fetchTransformed64<BlendTransformed>, // Grayscale8
- },
- {
- 0, // TransformedTiled
- fetchTransformed64<BlendTransformedTiled>, // Mono
- fetchTransformed64<BlendTransformedTiled>, // MonoLsb
- fetchTransformed64<BlendTransformedTiled>, // Indexed8
- fetchTransformed64<BlendTransformedTiled>, // RGB32
- fetchTransformed64<BlendTransformedTiled>, // ARGB32
- fetchTransformed64<BlendTransformedTiled>, // ARGB32_Premultiplied
- fetchTransformed64<BlendTransformedTiled>, // RGB16
- fetchTransformed64<BlendTransformedTiled>, // ARGB8565_Premultiplied
- fetchTransformed64<BlendTransformedTiled>, // RGB666
- fetchTransformed64<BlendTransformedTiled>, // ARGB6666_Premultiplied
- fetchTransformed64<BlendTransformedTiled>, // RGB555
- fetchTransformed64<BlendTransformedTiled>, // ARGB8555_Premultiplied
- fetchTransformed64<BlendTransformedTiled>, // RGB888
- fetchTransformed64<BlendTransformedTiled>, // RGB444
- fetchTransformed64<BlendTransformedTiled>, // ARGB4444_Premultiplied
- fetchTransformed64<BlendTransformedTiled>, // RGBX8888
- fetchTransformed64<BlendTransformedTiled>, // RGBA8888
- fetchTransformed64<BlendTransformedTiled>, // RGBA8888_Premultiplied
- fetchTransformed64<BlendTransformedTiled>, // BGR30
- fetchTransformed64<BlendTransformedTiled>, // A2BGR30_Premultiplied
- fetchTransformed64<BlendTransformedTiled>, // RGB30
- fetchTransformed64<BlendTransformedTiled>, // A2RGB30_Premultiplied
- fetchTransformed64<BlendTransformedTiled>, // Alpha8
- fetchTransformed64<BlendTransformedTiled>, // Grayscale8
- },
- {
- 0, // Bilinear
- fetchTransformedBilinear64<BlendTransformedBilinear>, // Mono
- fetchTransformedBilinear64<BlendTransformedBilinear>, // MonoLsb
- fetchTransformedBilinear64<BlendTransformedBilinear>, // Indexed8
- fetchTransformedBilinear64<BlendTransformedBilinear>, // RGB32
- fetchTransformedBilinear64<BlendTransformedBilinear>, // ARGB32
- fetchTransformedBilinear64<BlendTransformedBilinear>, // ARGB32_Premultiplied
- fetchTransformedBilinear64<BlendTransformedBilinear>, // RGB16
- fetchTransformedBilinear64<BlendTransformedBilinear>, // ARGB8565_Premultiplied
- fetchTransformedBilinear64<BlendTransformedBilinear>, // RGB666
- fetchTransformedBilinear64<BlendTransformedBilinear>, // ARGB6666_Premultiplied
- fetchTransformedBilinear64<BlendTransformedBilinear>, // RGB555
- fetchTransformedBilinear64<BlendTransformedBilinear>, // ARGB8555_Premultiplied
- fetchTransformedBilinear64<BlendTransformedBilinear>, // RGB888
- fetchTransformedBilinear64<BlendTransformedBilinear>, // RGB444
- fetchTransformedBilinear64<BlendTransformedBilinear>, // ARGB4444_Premultiplied
- fetchTransformedBilinear64<BlendTransformedBilinear>, // RGBX8888
- fetchTransformedBilinear64<BlendTransformedBilinear>, // RGBA8888
- fetchTransformedBilinear64<BlendTransformedBilinear>, // RGBA8888_Premultiplied
- fetchTransformedBilinear64<BlendTransformedBilinear>, // BGR30
- fetchTransformedBilinear64<BlendTransformedBilinear>, // A2BGR30_Premultiplied
- fetchTransformedBilinear64<BlendTransformedBilinear>, // RGB30
- fetchTransformedBilinear64<BlendTransformedBilinear>, // A2RGB30_Premultiplied
- fetchTransformedBilinear64<BlendTransformedBilinear>, // Alpha8
- fetchTransformedBilinear64<BlendTransformedBilinear>, // Grayscale8
- },
- {
- 0, // BilinearTiled
- fetchTransformedBilinear64<BlendTransformedBilinearTiled>, // Mono
- fetchTransformedBilinear64<BlendTransformedBilinearTiled>, // MonoLsb
- fetchTransformedBilinear64<BlendTransformedBilinearTiled>, // Indexed8
- fetchTransformedBilinear64<BlendTransformedBilinearTiled>, // RGB32
- fetchTransformedBilinear64<BlendTransformedBilinearTiled>, // ARGB32
- fetchTransformedBilinear64<BlendTransformedBilinearTiled>, // ARGB32_Premultiplied
- fetchTransformedBilinear64<BlendTransformedBilinearTiled>, // RGB16
- fetchTransformedBilinear64<BlendTransformedBilinearTiled>, // ARGB8565_Premultiplied
- fetchTransformedBilinear64<BlendTransformedBilinearTiled>, // RGB666
- fetchTransformedBilinear64<BlendTransformedBilinearTiled>, // ARGB6666_Premultiplied
- fetchTransformedBilinear64<BlendTransformedBilinearTiled>, // RGB555
- fetchTransformedBilinear64<BlendTransformedBilinearTiled>, // ARGB8555_Premultiplied
- fetchTransformedBilinear64<BlendTransformedBilinearTiled>, // RGB888
- fetchTransformedBilinear64<BlendTransformedBilinearTiled>, // RGB444
- fetchTransformedBilinear64<BlendTransformedBilinearTiled>, // ARGB4444_Premultiplied
- fetchTransformedBilinear64<BlendTransformedBilinearTiled>, // RGBX8888
- fetchTransformedBilinear64<BlendTransformedBilinearTiled>, // RGBA8888
- fetchTransformedBilinear64<BlendTransformedBilinearTiled>, // RGBA8888_Premultiplied
- fetchTransformedBilinear64<BlendTransformedBilinearTiled>, // BGR30
- fetchTransformedBilinear64<BlendTransformedBilinearTiled>, // A2BGR30_Premultiplied
- fetchTransformedBilinear64<BlendTransformedBilinearTiled>, // RGB30
- fetchTransformedBilinear64<BlendTransformedBilinearTiled>, // A2RGB30_Premultiplied
- fetchTransformedBilinear64<BlendTransformedBilinearTiled>, // Alpha8
- fetchTransformedBilinear64<BlendTransformedBilinearTiled>, // Grayscale8
- },
+static const SourceFetchProc sourceFetchGeneric[NBlendTypes] = {
+ fetchUntransformed, // Untransformed
+ fetchUntransformed, // Tiled
+ fetchTransformed<BlendTransformed>, // Transformed
+ fetchTransformed<BlendTransformedTiled>, // TransformedTiled
+ fetchTransformedBilinear<BlendTransformedBilinear>, // Bilinear
+ fetchTransformedBilinear<BlendTransformedBilinearTiled> // BilinearTiled
+};
+
+static SourceFetchProc sourceFetchARGB32PM[NBlendTypes] = {
+ fetchUntransformedARGB32PM, // Untransformed
+ fetchUntransformedARGB32PM, // Tiled
+ fetchTransformedARGB32PM<BlendTransformed>, // Transformed
+ fetchTransformedARGB32PM<BlendTransformedTiled>, // TransformedTiled
+ fetchTransformedBilinearARGB32PM<BlendTransformedBilinear>, // Bilinear
+ fetchTransformedBilinearARGB32PM<BlendTransformedBilinearTiled> // BilinearTiled
+};
+
+static const SourceFetchProc64 sourceFetchGeneric64[NBlendTypes] = {
+ fetchUntransformed64, // Untransformed
+ fetchUntransformed64, // Tiled
+ fetchTransformed64<BlendTransformed>, // Transformed
+ fetchTransformed64<BlendTransformedTiled>, // TransformedTiled
+ fetchTransformedBilinear64<BlendTransformedBilinear>, // Bilinear
+ fetchTransformedBilinear64<BlendTransformedBilinearTiled> // BilinearTiled
};
+static inline SourceFetchProc getSourceFetch(TextureBlendType blendType, QImage::Format format)
+{
+ if (format == QImage::Format_RGB32 || format == QImage::Format_ARGB32_Premultiplied)
+ return sourceFetchARGB32PM[blendType];
+ if (blendType == BlendUntransformed || blendType == BlendTiled)
+ return sourceFetchUntransformed[format];
+ return sourceFetchGeneric[blendType];
+}
+
+
#define FIXPT_BITS 8
#define FIXPT_SIZE (1<<FIXPT_BITS)
@@ -3772,8 +3669,8 @@ static inline Operator getOperator(const QSpanData *data, const QSpan *spans, in
break;
case QSpanData::Texture:
solidSource = !data->texture.hasAlpha;
- op.srcFetch = sourceFetch[getBlendType(data)][data->texture.format];
- op.srcFetch64 = sourceFetch64[getBlendType(data)][data->texture.format];
+ op.srcFetch = getSourceFetch(getBlendType(data), data->texture.format);
+ op.srcFetch64 = sourceFetchGeneric64[getBlendType(data)];
break;
default:
Q_UNREACHABLE();
@@ -4038,7 +3935,7 @@ template<typename T>
struct QBlendBase
{
typedef T BlendType;
- QBlendBase(QSpanData *d, Operator o)
+ QBlendBase(QSpanData *d, const Operator &o)
: data(d)
, op(o)
, dest(0)
@@ -4057,7 +3954,7 @@ struct QBlendBase
class BlendSrcGeneric : public QBlendBase<uint>
{
public:
- BlendSrcGeneric(QSpanData *d, Operator o)
+ BlendSrcGeneric(QSpanData *d, const Operator &o)
: QBlendBase<uint>(d, o)
{
}
@@ -4083,7 +3980,7 @@ public:
class BlendSrcGenericRGB64 : public QBlendBase<QRgba64>
{
public:
- BlendSrcGenericRGB64(QSpanData *d, Operator o)
+ BlendSrcGenericRGB64(QSpanData *d, const Operator &o)
: QBlendBase<QRgba64>(d, o)
{
}
@@ -5316,181 +5213,67 @@ static void blend_transformed_tiled_rgb565(int count, const QSpan *spans, void *
/* Image formats here are target formats */
-static const ProcessSpans processTextureSpans[NBlendTypes][QImage::NImageFormats] = {
- // Untransformed
- {
- 0, // Invalid
- blend_untransformed_generic, // Mono
- blend_untransformed_generic, // MonoLsb
- blend_untransformed_generic, // Indexed8
- blend_untransformed_generic, // RGB32
- blend_untransformed_generic, // ARGB32
- blend_untransformed_argb, // ARGB32_Premultiplied
- blend_untransformed_rgb565,
- blend_untransformed_generic,
- blend_untransformed_generic,
- blend_untransformed_generic,
- blend_untransformed_generic,
- blend_untransformed_generic,
- blend_untransformed_generic,
- blend_untransformed_generic,
- blend_untransformed_generic,
- blend_untransformed_generic,
- blend_untransformed_generic,
- blend_untransformed_generic,
- blend_untransformed_generic_rgb64,
- blend_untransformed_generic_rgb64,
- blend_untransformed_generic_rgb64,
- blend_untransformed_generic_rgb64,
- blend_untransformed_generic,
- blend_untransformed_generic,
- },
- // Tiled
- {
- 0, // Invalid
- blend_tiled_generic, // Mono
- blend_tiled_generic, // MonoLsb
- blend_tiled_generic, // Indexed8
- blend_tiled_generic, // RGB32
- blend_tiled_generic, // ARGB32
- blend_tiled_argb, // ARGB32_Premultiplied
- blend_tiled_rgb565,
- blend_tiled_generic,
- blend_tiled_generic,
- blend_tiled_generic,
- blend_tiled_generic,
- blend_tiled_generic,
- blend_tiled_generic,
- blend_tiled_generic,
- blend_tiled_generic,
- blend_tiled_generic,
- blend_tiled_generic,
- blend_tiled_generic,
- blend_tiled_generic_rgb64,
- blend_tiled_generic_rgb64,
- blend_tiled_generic_rgb64,
- blend_tiled_generic_rgb64,
- blend_tiled_generic,
- blend_tiled_generic,
- },
- // Transformed
- {
- 0, // Invalid
- blend_src_generic, // Mono
- blend_src_generic, // MonoLsb
- blend_src_generic, // Indexed8
- blend_src_generic, // RGB32
- blend_src_generic, // ARGB32
- blend_transformed_argb, // ARGB32_Premultiplied
- blend_transformed_rgb565,
- blend_src_generic, // ARGB8565_Premultiplied
- blend_src_generic, // RGB666
- blend_src_generic, // ARGB6666_Premultiplied
- blend_src_generic, // RGB555
- blend_src_generic, // ARGB8555_Premultiplied
- blend_src_generic, // RGB888
- blend_src_generic, // RGB444
- blend_src_generic, // ARGB4444_Premultiplied
- blend_src_generic, // RGBX8888
- blend_src_generic, // RGBA8888
- blend_src_generic, // RGBA8888_Premultiplied
- blend_src_generic_rgb64,
- blend_src_generic_rgb64,
- blend_src_generic_rgb64,
- blend_src_generic_rgb64,
- blend_src_generic,
- blend_src_generic,
- },
- // TransformedTiled
- {
- 0,
- blend_src_generic, // Mono
- blend_src_generic, // MonoLsb
- blend_src_generic, // Indexed8
- blend_src_generic, // RGB32
- blend_src_generic, // ARGB32
- blend_transformed_tiled_argb, // ARGB32_Premultiplied
- blend_transformed_tiled_rgb565,
- blend_src_generic, // ARGB8565_Premultiplied
- blend_src_generic, // RGB666
- blend_src_generic, // ARGB6666_Premultiplied
- blend_src_generic, // RGB555
- blend_src_generic, // ARGB8555_Premultiplied
- blend_src_generic, // RGB888
- blend_src_generic, // RGB444
- blend_src_generic, // ARGB4444_Premultiplied
- blend_src_generic, // RGBX8888
- blend_src_generic, // RGBA8888
- blend_src_generic, // RGBA8888_Premultiplied
- blend_src_generic_rgb64,
- blend_src_generic_rgb64,
- blend_src_generic_rgb64,
- blend_src_generic_rgb64,
- blend_src_generic,
- blend_src_generic,
- },
- // Bilinear
- {
- 0,
- blend_src_generic, // Mono
- blend_src_generic, // MonoLsb
- blend_src_generic, // Indexed8
- blend_src_generic, // RGB32
- blend_src_generic, // ARGB32
- blend_src_generic, // ARGB32_Premultiplied
- blend_transformed_bilinear_rgb565,
- blend_src_generic, // ARGB8565_Premultiplied
- blend_src_generic, // RGB666
- blend_src_generic, // ARGB6666_Premultiplied
- blend_src_generic, // RGB555
- blend_src_generic, // ARGB8555_Premultiplied
- blend_src_generic, // RGB888
- blend_src_generic, // RGB444
- blend_src_generic, // ARGB4444_Premultiplied
- blend_src_generic, // RGBX8888
- blend_src_generic, // RGBA8888
- blend_src_generic, // RGBA8888_Premultiplied
- blend_src_generic_rgb64,
- blend_src_generic_rgb64,
- blend_src_generic_rgb64,
- blend_src_generic_rgb64,
- blend_src_generic,
- blend_src_generic,
- },
- // BilinearTiled
- {
- 0,
- blend_src_generic, // Mono
- blend_src_generic, // MonoLsb
- blend_src_generic, // Indexed8
- blend_src_generic, // RGB32
- blend_src_generic, // ARGB32
- blend_src_generic, // ARGB32_Premultiplied
- blend_src_generic, // RGB16
- blend_src_generic, // ARGB8565_Premultiplied
- blend_src_generic, // RGB666
- blend_src_generic, // ARGB6666_Premultiplied
- blend_src_generic, // RGB555
- blend_src_generic, // ARGB8555_Premultiplied
- blend_src_generic, // RGB888
- blend_src_generic, // RGB444
- blend_src_generic, // ARGB4444_Premultiplied
- blend_src_generic, // RGBX8888
- blend_src_generic, // RGBA8888
- blend_src_generic, // RGBA8888_Premultiplied
- blend_src_generic_rgb64, // BGR30
- blend_src_generic_rgb64, // A2BGR30_Premultiplied
- blend_src_generic_rgb64, // RGB30
- blend_src_generic_rgb64, // A2RGB30_Premultiplied
- blend_src_generic, // Alpha8
- blend_src_generic, // Grayscale8
- }
+static const ProcessSpans processTextureSpansARGB32PM[NBlendTypes] = {
+ blend_untransformed_argb, // Untransformed
+ blend_tiled_argb, // Tiled
+ blend_transformed_argb, // Transformed
+ blend_transformed_tiled_argb, // TransformedTiled
+ blend_src_generic, // TransformedBilinear
+ blend_src_generic // TransformedBilinearTiled
+};
+
+static const ProcessSpans processTextureSpansRGB16[NBlendTypes] = {
+ blend_untransformed_rgb565, // Untransformed
+ blend_tiled_rgb565, // Tiled
+ blend_transformed_rgb565, // Transformed
+ blend_transformed_tiled_rgb565, // TransformedTiled
+ blend_transformed_bilinear_rgb565, // TransformedBilinear
+ blend_src_generic // TransformedBilinearTiled
+};
+
+static const ProcessSpans processTextureSpansGeneric[NBlendTypes] = {
+ blend_untransformed_generic, // Untransformed
+ blend_tiled_generic, // Tiled
+ blend_src_generic, // Transformed
+ blend_src_generic, // TransformedTiled
+ blend_src_generic, // TransformedBilinear
+ blend_src_generic // TransformedBilinearTiled
+};
+
+static const ProcessSpans processTextureSpansGeneric64[NBlendTypes] = {
+ blend_untransformed_generic_rgb64, // Untransformed
+ blend_tiled_generic_rgb64, // Tiled
+ blend_src_generic_rgb64, // Transformed
+ blend_src_generic_rgb64, // TransformedTiled
+ blend_src_generic_rgb64, // TransformedBilinear
+ blend_src_generic_rgb64 // TransformedBilinearTiled
};
void qBlendTexture(int count, const QSpan *spans, void *userData)
{
QSpanData *data = reinterpret_cast<QSpanData *>(userData);
- ProcessSpans proc = processTextureSpans[getBlendType(data)][data->rasterBuffer->format];
+ TextureBlendType blendType = getBlendType(data);
+ ProcessSpans proc;
+ switch (data->rasterBuffer->format) {
+ case QImage::Format_ARGB32_Premultiplied:
+ proc = processTextureSpansARGB32PM[blendType];
+ break;
+ case QImage::Format_RGB16:
+ proc = processTextureSpansRGB16[blendType];
+ break;
+ case QImage::Format_BGR30:
+ case QImage::Format_A2BGR30_Premultiplied:
+ case QImage::Format_RGB30:
+ case QImage::Format_A2RGB30_Premultiplied:
+ proc = processTextureSpansGeneric64[blendType];
+ break;
+ case QImage::Format_Invalid:
+ Q_UNREACHABLE();
+ return;
+ default:
+ proc = processTextureSpansGeneric[blendType];
+ break;
+ }
proc(count, spans, userData);
}
@@ -5765,7 +5548,7 @@ static inline void rgbBlendPixel(quint32 *dst, int coverage, int sr, int sg, int
*dst = qRgb(nr, ng, nb);
}
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
+#if defined(Q_OS_WIN)
Q_GUI_EXPORT bool qt_needs_a8_gamma_correction = false;
static inline void grayBlendPixel(quint32 *dst, int coverage, int sr, int sg, int sb, const uint *gamma, const uchar *invgamma)
@@ -5802,7 +5585,7 @@ static void qt_alphamapblit_uint32(QRasterBuffer *rasterBuffer,
const quint32 c = color;
const int destStride = rasterBuffer->bytesPerLine() / sizeof(quint32);
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
+#if defined(Q_OS_WIN)
const QDrawHelperGammaTables *tables = QGuiApplicationPrivate::instance()->gammaTables();
if (!tables)
return;
@@ -5829,7 +5612,7 @@ static void qt_alphamapblit_uint32(QRasterBuffer *rasterBuffer,
} else if (coverage == 255) {
dest[i] = c;
} else {
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
+#if defined(Q_OS_WIN)
if (QSysInfo::WindowsVersion >= QSysInfo::WV_XP && doGrayBlendPixel
&& qAlpha(dest[i]) == 255) {
grayBlendPixel(dest+i, coverage, sr, sg, sb, gamma, invgamma);
@@ -5870,7 +5653,7 @@ static void qt_alphamapblit_uint32(QRasterBuffer *rasterBuffer,
} else if (coverage == 255) {
dest[xp] = c;
} else {
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
+#if defined(Q_OS_WIN)
if (QSysInfo::WindowsVersion >= QSysInfo::WV_XP && doGrayBlendPixel
&& qAlpha(dest[xp]) == 255) {
grayBlendPixel(dest+xp, coverage, sr, sg, sb, gamma, invgamma);
@@ -6328,7 +6111,7 @@ void qt_memfill32(quint32 *dest, quint32 color, int count)
#endif
#ifdef QT_COMPILER_SUPPORTS_SSE4_1
-template<QtPixelOrder> const uint *QT_FASTCALL convertA2RGB30PMFromARGB32PM_sse4(uint *buffer, const uint *src, int count, const QPixelLayout *, const QRgb *);
+template<QtPixelOrder> const uint *QT_FASTCALL convertA2RGB30PMFromARGB32PM_sse4(uint *buffer, const uint *src, int count, const QVector<QRgb> *, QDitherInfo *);
#endif
extern void qInitBlendFunctions();
@@ -6381,6 +6164,15 @@ static void qInitDrawhelperFunctions()
qt_fetch_radial_gradient = qt_fetch_radial_gradient_sse2;
+ extern void QT_FASTCALL comp_func_SourceOver_sse2(uint *destPixels, const uint *srcPixels, int length, uint const_alpha);
+ extern void QT_FASTCALL comp_func_solid_SourceOver_sse2(uint *destPixels, int length, uint color, uint const_alpha);
+ extern void QT_FASTCALL comp_func_Source_sse2(uint *destPixels, const uint *srcPixels, int length, uint const_alpha);
+ extern void QT_FASTCALL comp_func_Plus_sse2(uint *destPixels, const uint *srcPixels, int length, uint const_alpha);
+ qt_functionForMode_C[QPainter::CompositionMode_SourceOver] = comp_func_SourceOver_sse2;
+ qt_functionForModeSolid_C[QPainter::CompositionMode_SourceOver] = comp_func_solid_SourceOver_sse2;
+ qt_functionForMode_C[QPainter::CompositionMode_Source] = comp_func_Source_sse2;
+ qt_functionForMode_C[QPainter::CompositionMode_Plus] = comp_func_Plus_sse2;
+
#ifdef QT_COMPILER_SUPPORTS_SSSE3
if (qCpuHasFeature(SSSE3)) {
extern void qt_blend_argb32_on_argb32_ssse3(uchar *destPixels, int dbpl,
@@ -6396,22 +6188,26 @@ static void qInitDrawhelperFunctions()
qBlendFunctions[QImage::Format_RGBX8888][QImage::Format_RGBA8888_Premultiplied] = qt_blend_argb32_on_argb32_ssse3;
qBlendFunctions[QImage::Format_RGBA8888_Premultiplied][QImage::Format_RGBA8888_Premultiplied] = qt_blend_argb32_on_argb32_ssse3;
qStorePixels[QPixelLayout::BPP24] = storePixelsBPP24_ssse3;
- sourceFetch[BlendUntransformed][QImage::Format_RGB888] = qt_fetchUntransformed_888_ssse3;
- sourceFetch[BlendTiled][QImage::Format_RGB888] = qt_fetchUntransformed_888_ssse3;
+ sourceFetchUntransformed[QImage::Format_RGB888] = qt_fetchUntransformed_888_ssse3;
}
#endif // SSSE3
#if defined(QT_COMPILER_SUPPORTS_SSE4_1)
if (qCpuHasFeature(SSE4_1)) {
#if !defined(__SSE4_1__)
- extern const uint *QT_FASTCALL convertARGB32ToARGB32PM_sse4(uint *buffer, const uint *src, int count, const QPixelLayout *, const QRgb *);
- extern const uint *QT_FASTCALL convertRGBA8888ToARGB32PM_sse4(uint *buffer, const uint *src, int count, const QPixelLayout *, const QRgb *);
+ extern const uint *QT_FASTCALL convertARGB32ToARGB32PM_sse4(uint *buffer, const uint *src, int count,
+ const QVector<QRgb> *, QDitherInfo *);
+ extern const uint *QT_FASTCALL convertRGBA8888ToARGB32PM_sse4(uint *buffer, const uint *src, int count,
+ const QVector<QRgb> *, QDitherInfo *);
qPixelLayouts[QImage::Format_ARGB32].convertToARGB32PM = convertARGB32ToARGB32PM_sse4;
qPixelLayouts[QImage::Format_RGBA8888].convertToARGB32PM = convertRGBA8888ToARGB32PM_sse4;
#endif
- extern const uint *QT_FASTCALL convertARGB32FromARGB32PM_sse4(uint *buffer, const uint *src, int count, const QPixelLayout *, const QRgb *);
- extern const uint *QT_FASTCALL convertRGBA8888FromARGB32PM_sse4(uint *buffer, const uint *src, int count, const QPixelLayout *, const QRgb *);
- extern const uint *QT_FASTCALL convertRGBXFromARGB32PM_sse4(uint *buffer, const uint *src, int count, const QPixelLayout *, const QRgb *);
+ extern const uint *QT_FASTCALL convertARGB32FromARGB32PM_sse4(uint *buffer, const uint *src, int count,
+ const QVector<QRgb> *, QDitherInfo *);
+ extern const uint *QT_FASTCALL convertRGBA8888FromARGB32PM_sse4(uint *buffer, const uint *src, int count,
+ const QVector<QRgb> *, QDitherInfo *);
+ extern const uint *QT_FASTCALL convertRGBXFromARGB32PM_sse4(uint *buffer, const uint *src, int count,
+ const QVector<QRgb> *, QDitherInfo *);
qPixelLayouts[QImage::Format_ARGB32].convertFromARGB32PM = convertARGB32FromARGB32PM_sse4;
qPixelLayouts[QImage::Format_RGBA8888].convertFromARGB32PM = convertRGBA8888FromARGB32PM_sse4;
qPixelLayouts[QImage::Format_RGBX8888].convertFromARGB32PM = convertRGBXFromARGB32PM_sse4;
@@ -6420,22 +6216,39 @@ static void qInitDrawhelperFunctions()
}
#endif
-#if defined(QT_COMPILER_SUPPORTS_AVX2) && !defined(__AVX2__)
+#if defined(QT_COMPILER_SUPPORTS_AVX2)
if (qCpuHasFeature(AVX2)) {
- extern const uint *QT_FASTCALL convertARGB32ToARGB32PM_avx2(uint *buffer, const uint *src, int count, const QPixelLayout *, const QRgb *);
- extern const uint *QT_FASTCALL convertRGBA8888ToARGB32PM_avx2(uint *buffer, const uint *src, int count, const QPixelLayout *, const QRgb *);
+#if !defined(__AVX2__)
+ extern const uint *QT_FASTCALL convertARGB32ToARGB32PM_avx2(uint *buffer, const uint *src, int count,
+ const QVector<QRgb> *, QDitherInfo *);
+ extern const uint *QT_FASTCALL convertRGBA8888ToARGB32PM_avx2(uint *buffer, const uint *src, int count,
+ const QVector<QRgb> *, QDitherInfo *);
qPixelLayouts[QImage::Format_ARGB32].convertToARGB32PM = convertARGB32ToARGB32PM_avx2;
qPixelLayouts[QImage::Format_RGBA8888].convertToARGB32PM = convertRGBA8888ToARGB32PM_avx2;
+#endif
+ extern void qt_blend_rgb32_on_rgb32_avx2(uchar *destPixels, int dbpl,
+ const uchar *srcPixels, int sbpl,
+ int w, int h, int const_alpha);
+ extern void qt_blend_argb32_on_argb32_avx2(uchar *destPixels, int dbpl,
+ const uchar *srcPixels, int sbpl,
+ int w, int h, int const_alpha);
+ qBlendFunctions[QImage::Format_RGB32][QImage::Format_RGB32] = qt_blend_rgb32_on_rgb32_avx2;
+ qBlendFunctions[QImage::Format_ARGB32_Premultiplied][QImage::Format_RGB32] = qt_blend_rgb32_on_rgb32_avx2;
+ qBlendFunctions[QImage::Format_RGB32][QImage::Format_ARGB32_Premultiplied] = qt_blend_argb32_on_argb32_avx2;
+ qBlendFunctions[QImage::Format_ARGB32_Premultiplied][QImage::Format_ARGB32_Premultiplied] = qt_blend_argb32_on_argb32_avx2;
+ qBlendFunctions[QImage::Format_RGBX8888][QImage::Format_RGBX8888] = qt_blend_rgb32_on_rgb32_avx2;
+ qBlendFunctions[QImage::Format_RGBA8888_Premultiplied][QImage::Format_RGBX8888] = qt_blend_rgb32_on_rgb32_avx2;
+ qBlendFunctions[QImage::Format_RGBX8888][QImage::Format_RGBA8888_Premultiplied] = qt_blend_argb32_on_argb32_avx2;
+ qBlendFunctions[QImage::Format_RGBA8888_Premultiplied][QImage::Format_RGBA8888_Premultiplied] = qt_blend_argb32_on_argb32_avx2;
+
+ extern void QT_FASTCALL comp_func_SourceOver_avx2(uint *destPixels, const uint *srcPixels, int length, uint const_alpha);
+ extern void QT_FASTCALL comp_func_solid_SourceOver_avx2(uint *destPixels, int length, uint color, uint const_alpha);
+ extern void QT_FASTCALL comp_func_Source_avx2(uint *destPixels, const uint *srcPixels, int length, uint const_alpha);
+ qt_functionForMode_C[QPainter::CompositionMode_SourceOver] = comp_func_SourceOver_avx2;
+ qt_functionForModeSolid_C[QPainter::CompositionMode_SourceOver] = comp_func_solid_SourceOver_avx2;
+ qt_functionForMode_C[QPainter::CompositionMode_Source] = comp_func_Source_avx2;
}
#endif
- extern void QT_FASTCALL comp_func_SourceOver_sse2(uint *destPixels, const uint *srcPixels, int length, uint const_alpha);
- extern void QT_FASTCALL comp_func_solid_SourceOver_sse2(uint *destPixels, int length, uint color, uint const_alpha);
- extern void QT_FASTCALL comp_func_Source_sse2(uint *destPixels, const uint *srcPixels, int length, uint const_alpha);
- extern void QT_FASTCALL comp_func_Plus_sse2(uint *destPixels, const uint *srcPixels, int length, uint const_alpha);
- qt_functionForMode_C[QPainter::CompositionMode_SourceOver] = comp_func_SourceOver_sse2;
- qt_functionForModeSolid_C[QPainter::CompositionMode_SourceOver] = comp_func_solid_SourceOver_sse2;
- qt_functionForMode_C[QPainter::CompositionMode_Source] = comp_func_Source_sse2;
- qt_functionForMode_C[QPainter::CompositionMode_Plus] = comp_func_Plus_sse2;
#endif // SSE2
@@ -6460,8 +6273,7 @@ static void qInitDrawhelperFunctions()
qt_fetch_radial_gradient = qt_fetch_radial_gradient_neon;
- sourceFetch[BlendUntransformed][QImage::Format_RGB888] = qt_fetchUntransformed_888_neon;
- sourceFetch[BlendTiled][QImage::Format_RGB888] = qt_fetchUntransformed_888_neon;
+ sourceFetchUntransformed[QImage::Format_RGB888] = qt_fetchUntransformed_888_neon;
#if defined(ENABLE_PIXMAN_DRAWHELPERS)
// The RGB16 helpers are using Arm32 assemblythat has not been ported to AArch64
@@ -6522,14 +6334,9 @@ static void qInitDrawhelperFunctions()
destStoreProc[QImage::Format_ARGB32] = qt_destStoreARGB32_mips_dsp;
- sourceFetch[BlendUntransformed][QImage::Format_RGB888] = qt_fetchUntransformed_888_mips_dsp;
- sourceFetch[BlendTiled][QImage::Format_RGB888] = qt_fetchUntransformed_888_mips_dsp;
-
- sourceFetch[BlendUntransformed][QImage::Format_RGB444] = qt_fetchUntransformed_444_mips_dsp;
- sourceFetch[BlendTiled][QImage::Format_RGB444] = qt_fetchUntransformed_444_mips_dsp;
-
- sourceFetch[BlendUntransformed][QImage::Format_ARGB8565_Premultiplied] = qt_fetchUntransformed_argb8565_premultiplied_mips_dsp;
- sourceFetch[BlendTiled][QImage::Format_ARGB8565_Premultiplied] = qt_fetchUntransformed_argb8565_premultiplied_mips_dsp;
+ sourceFetchUntransformed[QImage::Format_RGB888] = qt_fetchUntransformed_888_mips_dsp;
+ sourceFetchUntransformed[QImage::Format_RGB444] = qt_fetchUntransformed_444_mips_dsp;
+ sourceFetchUntransformed[QImage::Format_ARGB8565_Premultiplied] = qt_fetchUntransformed_argb8565_premultiplied_mips_dsp;
#if defined(QT_COMPILER_SUPPORTS_MIPS_DSPR2)
qBlendFunctions[QImage::Format_RGB16][QImage::Format_RGB16] = qt_blend_rgb16_on_rgb16_mips_dspr2;
diff --git a/src/gui/painting/qdrawhelper_avx2.cpp b/src/gui/painting/qdrawhelper_avx2.cpp
index e11536ebd0..01ffd54918 100644
--- a/src/gui/painting/qdrawhelper_avx2.cpp
+++ b/src/gui/painting/qdrawhelper_avx2.cpp
@@ -37,24 +37,327 @@
**
****************************************************************************/
-#include <private/qdrawhelper_p.h>
+#include "qdrawhelper_p.h"
+#include "qdrawingprimitive_sse2_p.h"
#if defined(QT_COMPILER_SUPPORTS_AVX2)
QT_BEGIN_NAMESPACE
+// Autovectorized premultiply functions:
const uint *QT_FASTCALL convertARGB32ToARGB32PM_avx2(uint *buffer, const uint *src, int count,
- const QPixelLayout *, const QRgb *)
+ const QVector<QRgb> *, QDitherInfo *)
{
return qt_convertARGB32ToARGB32PM(buffer, src, count);
}
const uint *QT_FASTCALL convertRGBA8888ToARGB32PM_avx2(uint *buffer, const uint *src, int count,
- const QPixelLayout *, const QRgb *)
+ const QVector<QRgb> *, QDitherInfo *)
{
return qt_convertRGBA8888ToARGB32PM(buffer, src, count);
}
+// Vectorized blend functions:
+
+// See BYTE_MUL_SSE2 for details.
+inline static void BYTE_MUL_AVX2(__m256i &pixelVector, const __m256i &alphaChannel, const __m256i &colorMask, const __m256i &half)
+{
+ __m256i pixelVectorAG = _mm256_srli_epi16(pixelVector, 8);
+ __m256i pixelVectorRB = _mm256_and_si256(pixelVector, colorMask);
+
+ pixelVectorAG = _mm256_mullo_epi16(pixelVectorAG, alphaChannel);
+ pixelVectorRB = _mm256_mullo_epi16(pixelVectorRB, alphaChannel);
+
+ pixelVectorRB = _mm256_add_epi16(pixelVectorRB, _mm256_srli_epi16(pixelVectorRB, 8));
+ pixelVectorAG = _mm256_add_epi16(pixelVectorAG, _mm256_srli_epi16(pixelVectorAG, 8));
+ pixelVectorRB = _mm256_add_epi16(pixelVectorRB, half);
+ pixelVectorAG = _mm256_add_epi16(pixelVectorAG, half);
+
+ pixelVectorRB = _mm256_srli_epi16(pixelVectorRB, 8);
+ pixelVectorAG = _mm256_andnot_si256(colorMask, pixelVectorAG);
+
+ pixelVector = _mm256_or_si256(pixelVectorAG, pixelVectorRB);
+}
+
+// See INTERPOLATE_PIXEL_255_SSE2 for details.
+inline static void INTERPOLATE_PIXEL_255_AVX2(const __m256i &srcVector, __m256i &dstVector, const __m256i &alphaChannel, const __m256i &oneMinusAlphaChannel, const __m256i &colorMask, const __m256i &half)
+{
+ const __m256i srcVectorAG = _mm256_srli_epi16(srcVector, 8);
+ const __m256i dstVectorAG = _mm256_srli_epi16(dstVector, 8);
+ const __m256i srcVectorRB = _mm256_and_si256(srcVector, colorMask);
+ const __m256i dstVectorRB = _mm256_and_si256(dstVector, colorMask);
+ const __m256i srcVectorAGalpha = _mm256_mullo_epi16(srcVectorAG, alphaChannel);
+ const __m256i srcVectorRBalpha = _mm256_mullo_epi16(srcVectorRB, alphaChannel);
+ const __m256i dstVectorAGoneMinusAlpha = _mm256_mullo_epi16(dstVectorAG, oneMinusAlphaChannel);
+ const __m256i dstVectorRBoneMinusAlpha = _mm256_mullo_epi16(dstVectorRB, oneMinusAlphaChannel);
+ __m256i finalAG = _mm256_add_epi16(srcVectorAGalpha, dstVectorAGoneMinusAlpha);
+ __m256i finalRB = _mm256_add_epi16(srcVectorRBalpha, dstVectorRBoneMinusAlpha);
+ finalAG = _mm256_add_epi16(finalAG, _mm256_srli_epi16(finalAG, 8));
+ finalRB = _mm256_add_epi16(finalRB, _mm256_srli_epi16(finalRB, 8));
+ finalAG = _mm256_add_epi16(finalAG, half);
+ finalRB = _mm256_add_epi16(finalRB, half);
+ finalAG = _mm256_andnot_si256(colorMask, finalAG);
+ finalRB = _mm256_srli_epi16(finalRB, 8);
+
+ dstVector = _mm256_or_si256(finalAG, finalRB);
+}
+
+// See BLEND_SOURCE_OVER_ARGB32_SSE2 for details.
+inline static void BLEND_SOURCE_OVER_ARGB32_AVX2(quint32 *dst, const quint32 *src, const int length)
+{
+ const __m256i half = _mm256_set1_epi16(0x80);
+ const __m256i one = _mm256_set1_epi16(0xff);
+ const __m256i colorMask = _mm256_set1_epi32(0x00ff00ff);
+ const __m256i alphaMask = _mm256_set1_epi32(0xff000000);
+ const __m256i offsetMask = _mm256_setr_epi32(0, 1, 2, 3, 4, 5, 6, 7);
+ const __m256i alphaShuffleMask = _mm256_set_epi8(char(0xff),15,char(0xff),15,char(0xff),11,char(0xff),11,char(0xff),7,char(0xff),7,char(0xff),3,char(0xff),3,
+ char(0xff),15,char(0xff),15,char(0xff),11,char(0xff),11,char(0xff),7,char(0xff),7,char(0xff),3,char(0xff),3);
+
+ const int minusOffsetToAlignDstOn32Bytes = (reinterpret_cast<quintptr>(dst) >> 2) & 0x7;
+
+ int x = 0;
+ // Prologue to handle all pixels until dst is 32-byte aligned in one step.
+ if (minusOffsetToAlignDstOn32Bytes != 0 && x < (length - 7)) {
+ const __m256i prologueMask = _mm256_sub_epi32(_mm256_set1_epi32(minusOffsetToAlignDstOn32Bytes - 1), offsetMask);
+ const __m256i srcVector = _mm256_maskload_epi32((const int *)&src[x - minusOffsetToAlignDstOn32Bytes], prologueMask);
+ const __m256i prologueAlphaMask = _mm256_blendv_epi8(_mm256_setzero_si256(), alphaMask, prologueMask);
+ if (!_mm256_testz_si256(srcVector, prologueAlphaMask)) {
+ if (_mm256_testc_si256(srcVector, prologueAlphaMask)) {
+ _mm256_maskstore_epi32((int *)&dst[x - minusOffsetToAlignDstOn32Bytes], prologueMask, srcVector);
+ } else {
+ __m256i alphaChannel = _mm256_shuffle_epi8(srcVector, alphaShuffleMask);
+ alphaChannel = _mm256_sub_epi16(one, alphaChannel);
+ __m256i dstVector = _mm256_maskload_epi32((int *)&dst[x - minusOffsetToAlignDstOn32Bytes], prologueMask);
+ BYTE_MUL_AVX2(dstVector, alphaChannel, colorMask, half);
+ dstVector = _mm256_add_epi8(dstVector, srcVector);
+ _mm256_maskstore_epi32((int *)&dst[x - minusOffsetToAlignDstOn32Bytes], prologueMask, dstVector);
+ }
+ }
+ x += (8 - minusOffsetToAlignDstOn32Bytes);
+ }
+
+ for (; x < (length - 7); x += 8) {
+ const __m256i srcVector = _mm256_lddqu_si256((const __m256i *)&src[x]);
+ if (!_mm256_testz_si256(srcVector, alphaMask)) {
+ if (_mm256_testc_si256(srcVector, alphaMask)) {
+ _mm256_store_si256((__m256i *)&dst[x], srcVector);
+ } else {
+ __m256i alphaChannel = _mm256_shuffle_epi8(srcVector, alphaShuffleMask);
+ alphaChannel = _mm256_sub_epi16(one, alphaChannel);
+ __m256i dstVector = _mm256_load_si256((__m256i *)&dst[x]);
+ BYTE_MUL_AVX2(dstVector, alphaChannel, colorMask, half);
+ dstVector = _mm256_add_epi8(dstVector, srcVector);
+ _mm256_store_si256((__m256i *)&dst[x], dstVector);
+ }
+ }
+ }
+
+ // Epilogue to handle all remaining pixels in one step.
+ if (x < length) {
+ const __m256i epilogueMask = _mm256_add_epi32(offsetMask, _mm256_set1_epi32(x - length));
+ const __m256i srcVector = _mm256_maskload_epi32((const int *)&src[x], epilogueMask);
+ const __m256i epilogueAlphaMask = _mm256_blendv_epi8(_mm256_setzero_si256(), alphaMask, epilogueMask);
+ if (!_mm256_testz_si256(srcVector, epilogueAlphaMask)) {
+ if (_mm256_testc_si256(srcVector, epilogueAlphaMask)) {
+ _mm256_maskstore_epi32((int *)&dst[x], epilogueMask, srcVector);
+ } else {
+ __m256i alphaChannel = _mm256_shuffle_epi8(srcVector, alphaShuffleMask);
+ alphaChannel = _mm256_sub_epi16(one, alphaChannel);
+ __m256i dstVector = _mm256_maskload_epi32((int *)&dst[x], epilogueMask);
+ BYTE_MUL_AVX2(dstVector, alphaChannel, colorMask, half);
+ dstVector = _mm256_add_epi8(dstVector, srcVector);
+ _mm256_maskstore_epi32((int *)&dst[x], epilogueMask, dstVector);
+ }
+ }
+ }
+}
+
+
+// See BLEND_SOURCE_OVER_ARGB32_WITH_CONST_ALPHA_SSE2 for details.
+inline static void BLEND_SOURCE_OVER_ARGB32_WITH_CONST_ALPHA_AVX2(quint32 *dst, const quint32 *src, const int length, const int const_alpha)
+{
+ int x = 0;
+
+ ALIGNMENT_PROLOGUE_32BYTES(dst, x, length)
+ blend_pixel(dst[x], src[x], const_alpha);
+
+ const __m256i half = _mm256_set1_epi16(0x80);
+ const __m256i one = _mm256_set1_epi16(0xff);
+ const __m256i colorMask = _mm256_set1_epi32(0x00ff00ff);
+ const __m256i alphaMask = _mm256_set1_epi32(0xff000000);
+ const __m256i alphaShuffleMask = _mm256_set_epi8(char(0xff),15,char(0xff),15,char(0xff),11,char(0xff),11,char(0xff),7,char(0xff),7,char(0xff),3,char(0xff),3,
+ char(0xff),15,char(0xff),15,char(0xff),11,char(0xff),11,char(0xff),7,char(0xff),7,char(0xff),3,char(0xff),3);
+ const __m256i constAlphaVector = _mm256_set1_epi16(const_alpha);
+ for (; x < (length - 7); x += 8) {
+ __m256i srcVector = _mm256_lddqu_si256((const __m256i *)&src[x]);
+ if (!_mm256_testz_si256(srcVector, alphaMask)) {
+ BYTE_MUL_AVX2(srcVector, constAlphaVector, colorMask, half);
+
+ __m256i alphaChannel = _mm256_shuffle_epi8(srcVector, alphaShuffleMask);
+ alphaChannel = _mm256_sub_epi16(one, alphaChannel);
+ __m256i dstVector = _mm256_load_si256((__m256i *)&dst[x]);
+ BYTE_MUL_AVX2(dstVector, alphaChannel, colorMask, half);
+ dstVector = _mm256_add_epi8(dstVector, srcVector);
+ _mm256_store_si256((__m256i *)&dst[x], dstVector);
+ }
+ }
+ for (; x < length; ++x)
+ blend_pixel(dst[x], src[x], const_alpha);
+}
+
+void qt_blend_argb32_on_argb32_avx2(uchar *destPixels, int dbpl,
+ const uchar *srcPixels, int sbpl,
+ int w, int h,
+ int const_alpha)
+{
+ if (const_alpha == 256) {
+ for (int y = 0; y < h; ++y) {
+ const quint32 *src = reinterpret_cast<const quint32 *>(srcPixels);
+ quint32 *dst = reinterpret_cast<quint32 *>(destPixels);
+ BLEND_SOURCE_OVER_ARGB32_AVX2(dst, src, w);
+ destPixels += dbpl;
+ srcPixels += sbpl;
+ }
+ } else if (const_alpha != 0) {
+ const_alpha = (const_alpha * 255) >> 8;
+ for (int y = 0; y < h; ++y) {
+ const quint32 *src = reinterpret_cast<const quint32 *>(srcPixels);
+ quint32 *dst = reinterpret_cast<quint32 *>(destPixels);
+ BLEND_SOURCE_OVER_ARGB32_WITH_CONST_ALPHA_AVX2(dst, src, w, const_alpha);
+ destPixels += dbpl;
+ srcPixels += sbpl;
+ }
+ }
+}
+
+void qt_blend_rgb32_on_rgb32_avx2(uchar *destPixels, int dbpl,
+ const uchar *srcPixels, int sbpl,
+ int w, int h,
+ int const_alpha)
+{
+ if (const_alpha == 256) {
+ for (int y = 0; y < h; ++y) {
+ const quint32 *src = reinterpret_cast<const quint32 *>(srcPixels);
+ quint32 *dst = reinterpret_cast<quint32 *>(destPixels);
+ ::memcpy(dst, src, w * sizeof(uint));
+ srcPixels += sbpl;
+ destPixels += dbpl;
+ }
+ return;
+ }
+ if (const_alpha == 0)
+ return;
+
+ const __m256i half = _mm256_set1_epi16(0x80);
+ const __m256i colorMask = _mm256_set1_epi32(0x00ff00ff);
+
+ const_alpha = (const_alpha * 255) >> 8;
+ int one_minus_const_alpha = 255 - const_alpha;
+ const __m256i constAlphaVector = _mm256_set1_epi16(const_alpha);
+ const __m256i oneMinusConstAlpha = _mm256_set1_epi16(one_minus_const_alpha);
+ for (int y = 0; y < h; ++y) {
+ const quint32 *src = reinterpret_cast<const quint32 *>(srcPixels);
+ quint32 *dst = reinterpret_cast<quint32 *>(destPixels);
+ int x = 0;
+
+ // First, align dest to 32 bytes:
+ ALIGNMENT_PROLOGUE_32BYTES(dst, x, w)
+ dst[x] = INTERPOLATE_PIXEL_255(src[x], const_alpha, dst[x], one_minus_const_alpha);
+
+ // 2) interpolate pixels with AVX2
+ for (; x < (w - 7); x += 8) {
+ const __m256i srcVector = _mm256_lddqu_si256((const __m256i *)&src[x]);
+ if (!_mm256_testc_si256(srcVector, _mm256_setzero_si256())) {
+ __m256i dstVector = _mm256_load_si256((__m256i *)&dst[x]);
+ INTERPOLATE_PIXEL_255_AVX2(srcVector, dstVector, constAlphaVector, oneMinusConstAlpha, colorMask, half);
+ _mm256_store_si256((__m256i *)&dst[x], dstVector);
+ }
+ }
+
+ // 3) Epilogue
+ for (; x < w; ++x)
+ dst[x] = INTERPOLATE_PIXEL_255(src[x], const_alpha, dst[x], one_minus_const_alpha);
+
+ srcPixels += sbpl;
+ destPixels += dbpl;
+ }
+}
+
+void QT_FASTCALL comp_func_SourceOver_avx2(uint *destPixels, const uint *srcPixels, int length, uint const_alpha)
+{
+ Q_ASSERT(const_alpha < 256);
+
+ const quint32 *src = (const quint32 *) srcPixels;
+ quint32 *dst = (quint32 *) destPixels;
+
+ if (const_alpha == 255)
+ BLEND_SOURCE_OVER_ARGB32_AVX2(dst, src, length);
+ else
+ BLEND_SOURCE_OVER_ARGB32_WITH_CONST_ALPHA_AVX2(dst, src, length, const_alpha);
+}
+
+void QT_FASTCALL comp_func_Source_avx2(uint *dst, const uint *src, int length, uint const_alpha)
+{
+ if (const_alpha == 255) {
+ ::memcpy(dst, src, length * sizeof(uint));
+ } else {
+ const int ialpha = 255 - const_alpha;
+
+ int x = 0;
+
+ // 1) prologue, align on 32 bytes
+ ALIGNMENT_PROLOGUE_32BYTES(dst, x, length)
+ dst[x] = INTERPOLATE_PIXEL_255(src[x], const_alpha, dst[x], ialpha);
+
+ // 2) interpolate pixels with AVX2
+ const __m256i half = _mm256_set1_epi16(0x80);
+ const __m256i colorMask = _mm256_set1_epi32(0x00ff00ff);
+ const __m256i constAlphaVector = _mm256_set1_epi16(const_alpha);
+ const __m256i oneMinusConstAlpha = _mm256_set1_epi16(ialpha);
+ for (; x < length - 7; x += 8) {
+ const __m256i srcVector = _mm256_lddqu_si256((const __m256i *)&src[x]);
+ __m256i dstVector = _mm256_load_si256((__m256i *)&dst[x]);
+ INTERPOLATE_PIXEL_255_AVX2(srcVector, dstVector, constAlphaVector, oneMinusConstAlpha, colorMask, half);
+ _mm256_store_si256((__m256i *)&dst[x], dstVector);
+ }
+
+ // 3) Epilogue
+ for (; x < length; ++x)
+ dst[x] = INTERPOLATE_PIXEL_255(src[x], const_alpha, dst[x], ialpha);
+ }
+}
+
+void QT_FASTCALL comp_func_solid_SourceOver_avx2(uint *destPixels, int length, uint color, uint const_alpha)
+{
+ if ((const_alpha & qAlpha(color)) == 255) {
+ qt_memfill32(destPixels, color, length);
+ } else {
+ if (const_alpha != 255)
+ color = BYTE_MUL(color, const_alpha);
+
+ const quint32 minusAlphaOfColor = qAlpha(~color);
+ int x = 0;
+
+ quint32 *dst = (quint32 *) destPixels;
+ const __m256i colorVector = _mm256_set1_epi32(color);
+ const __m256i colorMask = _mm256_set1_epi32(0x00ff00ff);
+ const __m256i half = _mm256_set1_epi16(0x80);
+ const __m256i minusAlphaOfColorVector = _mm256_set1_epi16(minusAlphaOfColor);
+
+ ALIGNMENT_PROLOGUE_32BYTES(dst, x, length)
+ destPixels[x] = color + BYTE_MUL(destPixels[x], minusAlphaOfColor);
+
+ for (; x < length - 7; x += 8) {
+ __m256i dstVector = _mm256_load_si256((__m256i *)&dst[x]);
+ BYTE_MUL_AVX2(dstVector, minusAlphaOfColorVector, colorMask, half);
+ dstVector = _mm256_add_epi8(colorVector, dstVector);
+ _mm256_store_si256((__m256i *)&dst[x], dstVector);
+ }
+ for (; x < length; ++x)
+ destPixels[x] = color + BYTE_MUL(destPixels[x], minusAlphaOfColor);
+ }
+}
+
QT_END_NAMESPACE
#endif
diff --git a/src/gui/painting/qdrawhelper_p.h b/src/gui/painting/qdrawhelper_p.h
index fa3e6396ec..45a3174734 100644
--- a/src/gui/painting/qdrawhelper_p.h
+++ b/src/gui/painting/qdrawhelper_p.h
@@ -51,7 +51,7 @@
// We mean it.
//
-#include "QtCore/qglobal.h"
+#include <QtGui/private/qtguiglobal_p.h>
#include "QtCore/qmath.h"
#include "QtGui/qcolor.h"
#include "QtGui/qpainter.h"
@@ -636,6 +636,22 @@ static Q_ALWAYS_INLINE uint BYTE_MUL(uint x, uint a) {
}
#endif
+static Q_ALWAYS_INLINE void blend_pixel(quint32 &dst, const quint32 src)
+{
+ if (src >= 0xff000000)
+ dst = src;
+ else if (src != 0)
+ dst = src + BYTE_MUL(dst, qAlpha(~src));
+}
+
+static Q_ALWAYS_INLINE void blend_pixel(quint32 &dst, const quint32 src, const int const_alpha)
+{
+ if (src != 0) {
+ const quint32 s = BYTE_MUL(src, const_alpha);
+ dst = s + BYTE_MUL(dst, qAlpha(~s));
+ }
+}
+
#if defined(__SSE2__)
static Q_ALWAYS_INLINE uint interpolate_4_pixels_sse2(__m128i vt, __m128i vb, uint distx, uint disty)
{
@@ -1172,11 +1188,15 @@ inline int comp_func_Plus_one_pixel(uint d, const uint s)
#undef MIX
#undef AMIX
-struct QPixelLayout;
+struct QDitherInfo {
+ int x;
+ int y;
+};
+
typedef const uint *(QT_FASTCALL *ConvertFunc)(uint *buffer, const uint *src, int count,
- const QPixelLayout *layout, const QRgb *clut);
+ const QVector<QRgb> *clut, QDitherInfo *dither);
typedef const QRgba64 *(QT_FASTCALL *ConvertFunc64)(QRgba64 *buffer, const uint *src, int count,
- const QPixelLayout *layout, const QRgb *clut);
+ const QVector<QRgb> *clut, QDitherInfo *dither);
struct QPixelLayout
{
diff --git a/src/gui/painting/qdrawhelper_sse4.cpp b/src/gui/painting/qdrawhelper_sse4.cpp
index a39cdb3127..257bad9eca 100644
--- a/src/gui/painting/qdrawhelper_sse4.cpp
+++ b/src/gui/painting/qdrawhelper_sse4.cpp
@@ -45,19 +45,19 @@
QT_BEGIN_NAMESPACE
const uint *QT_FASTCALL convertARGB32ToARGB32PM_sse4(uint *buffer, const uint *src, int count,
- const QPixelLayout *, const QRgb *)
+ const QVector<QRgb> *, QDitherInfo *)
{
return qt_convertARGB32ToARGB32PM(buffer, src, count);
}
const uint *QT_FASTCALL convertRGBA8888ToARGB32PM_sse4(uint *buffer, const uint *src, int count,
- const QPixelLayout *, const QRgb *)
+ const QVector<QRgb> *, QDitherInfo *)
{
return qt_convertRGBA8888ToARGB32PM(buffer, src, count);
}
const uint *QT_FASTCALL convertARGB32FromARGB32PM_sse4(uint *buffer, const uint *src, int count,
- const QPixelLayout *, const QRgb *)
+ const QVector<QRgb> *, QDitherInfo *)
{
for (int i = 0; i < count; ++i)
buffer[i] = qUnpremultiply_sse4(src[i]);
@@ -65,7 +65,7 @@ const uint *QT_FASTCALL convertARGB32FromARGB32PM_sse4(uint *buffer, const uint
}
const uint *QT_FASTCALL convertRGBA8888FromARGB32PM_sse4(uint *buffer, const uint *src, int count,
- const QPixelLayout *, const QRgb *)
+ const QVector<QRgb> *, QDitherInfo *)
{
for (int i = 0; i < count; ++i)
buffer[i] = ARGB2RGBA(qUnpremultiply_sse4(src[i]));
@@ -73,7 +73,7 @@ const uint *QT_FASTCALL convertRGBA8888FromARGB32PM_sse4(uint *buffer, const uin
}
const uint *QT_FASTCALL convertRGBXFromARGB32PM_sse4(uint *buffer, const uint *src, int count,
- const QPixelLayout *, const QRgb *)
+ const QVector<QRgb> *, QDitherInfo *)
{
for (int i = 0; i < count; ++i)
buffer[i] = ARGB2RGBA(0xff000000 | qUnpremultiply_sse4(src[i]));
@@ -82,7 +82,7 @@ const uint *QT_FASTCALL convertRGBXFromARGB32PM_sse4(uint *buffer, const uint *s
template<QtPixelOrder PixelOrder>
const uint *QT_FASTCALL convertA2RGB30PMFromARGB32PM_sse4(uint *buffer, const uint *src, int count,
- const QPixelLayout *, const QRgb *)
+ const QVector<QRgb> *, QDitherInfo *)
{
for (int i = 0; i < count; ++i)
buffer[i] = qConvertArgb32ToA2rgb30_sse4<PixelOrder>(src[i]);
@@ -91,10 +91,10 @@ const uint *QT_FASTCALL convertA2RGB30PMFromARGB32PM_sse4(uint *buffer, const ui
template
const uint *QT_FASTCALL convertA2RGB30PMFromARGB32PM_sse4<PixelOrderBGR>(uint *buffer, const uint *src, int count,
- const QPixelLayout *, const QRgb *);
+ const QVector<QRgb> *, QDitherInfo *);
template
const uint *QT_FASTCALL convertA2RGB30PMFromARGB32PM_sse4<PixelOrderRGB>(uint *buffer, const uint *src, int count,
- const QPixelLayout *, const QRgb *);
+ const QVector<QRgb> *, QDitherInfo *);
QT_END_NAMESPACE
diff --git a/src/gui/painting/qdrawhelper_ssse3.cpp b/src/gui/painting/qdrawhelper_ssse3.cpp
index 7cd3e9ca1b..2026a4e656 100644
--- a/src/gui/painting/qdrawhelper_ssse3.cpp
+++ b/src/gui/painting/qdrawhelper_ssse3.cpp
@@ -45,15 +45,6 @@
QT_BEGIN_NAMESPACE
-inline static void blend_pixel(quint32 &dst, const quint32 src)
-{
- if (src >= 0xff000000)
- dst = src;
- else if (src != 0)
- dst = src + BYTE_MUL(dst, qAlpha(~src));
-}
-
-
/* The instruction palignr uses direct arguments, so we have to generate the code fo the different
shift (4, 8, 12). Checking the alignment inside the loop is unfortunatelly way too slow.
*/
diff --git a/src/gui/painting/qdrawhelper_x86_p.h b/src/gui/painting/qdrawhelper_x86_p.h
index 37be8b89a9..cefc213999 100644
--- a/src/gui/painting/qdrawhelper_x86_p.h
+++ b/src/gui/painting/qdrawhelper_x86_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#include <private/qdrawhelper_p.h>
QT_BEGIN_NAMESPACE
diff --git a/src/gui/painting/qdrawingprimitive_sse2_p.h b/src/gui/painting/qdrawingprimitive_sse2_p.h
index e16529e2d0..7affc63b32 100644
--- a/src/gui/painting/qdrawingprimitive_sse2_p.h
+++ b/src/gui/painting/qdrawingprimitive_sse2_p.h
@@ -40,6 +40,7 @@
#ifndef QDRAWINGPRIMITIVE_SSE2_P_H
#define QDRAWINGPRIMITIVE_SSE2_P_H
+#include <QtGui/private/qtguiglobal_p.h>
#include <private/qsimd_p.h>
#include "qdrawhelper_p.h"
@@ -170,11 +171,7 @@ QT_BEGIN_NAMESPACE
\
/* First, get dst aligned. */ \
ALIGNMENT_PROLOGUE_16BYTES(dst, x, length) { \
- uint s = src[x]; \
- if (s >= 0xff000000) \
- dst[x] = s; \
- else if (s != 0) \
- dst[x] = s + BYTE_MUL(dst[x], qAlpha(~s)); \
+ blend_pixel(dst[x], src[x]); \
} \
\
for (; x < length-3; x += 4) { \
@@ -182,11 +179,7 @@ QT_BEGIN_NAMESPACE
BLEND_SOURCE_OVER_ARGB32_SSE2_helper(dst, srcVector, nullVector, half, one, colorMask, alphaMask) \
} \
for (; x < length; ++x) { \
- uint s = src[x]; \
- if (s >= 0xff000000) \
- dst[x] = s; \
- else if (s != 0) \
- dst[x] = s + BYTE_MUL(dst[x], qAlpha(~s)); \
+ blend_pixel(dst[x], src[x]); \
} \
}
@@ -206,11 +199,7 @@ QT_BEGIN_NAMESPACE
int x = 0; \
\
ALIGNMENT_PROLOGUE_16BYTES(dst, x, length) { \
- quint32 s = src[x]; \
- if (s != 0) { \
- s = BYTE_MUL(s, const_alpha); \
- dst[x] = s + BYTE_MUL(dst[x], qAlpha(~s)); \
- } \
+ blend_pixel(dst[x], src[x], const_alpha); \
} \
\
for (; x < length-3; x += 4) { \
@@ -231,11 +220,7 @@ QT_BEGIN_NAMESPACE
} \
} \
for (; x < length; ++x) { \
- quint32 s = src[x]; \
- if (s != 0) { \
- s = BYTE_MUL(s, const_alpha); \
- dst[x] = s + BYTE_MUL(dst[x], qAlpha(~s)); \
- } \
+ blend_pixel(dst[x], src[x], const_alpha); \
} \
}
diff --git a/src/gui/painting/qemulationpaintengine_p.h b/src/gui/painting/qemulationpaintengine_p.h
index f3cf88af17..457cc06d63 100644
--- a/src/gui/painting/qemulationpaintengine_p.h
+++ b/src/gui/painting/qemulationpaintengine_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#include <private/qpaintengineex_p.h>
QT_BEGIN_NAMESPACE
diff --git a/src/gui/painting/qfixed_p.h b/src/gui/painting/qfixed_p.h
index d2b6e51ab1..846592881c 100644
--- a/src/gui/painting/qfixed_p.h
+++ b/src/gui/painting/qfixed_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#include "QtCore/qdebug.h"
#include "QtCore/qpoint.h"
#include "QtCore/qsize.h"
diff --git a/src/gui/painting/qmatrix.h b/src/gui/painting/qmatrix.h
index b28c8433cd..76bf61671c 100644
--- a/src/gui/painting/qmatrix.h
+++ b/src/gui/painting/qmatrix.h
@@ -40,6 +40,7 @@
#ifndef QMATRIX_H
#define QMATRIX_H
+#include <QtGui/qtguiglobal.h>
#include <QtGui/qpolygon.h>
#include <QtGui/qregion.h>
#include <QtGui/qwindowdefs.h>
diff --git a/src/gui/painting/qmemrotate_p.h b/src/gui/painting/qmemrotate_p.h
index 64cfb22517..62613d301a 100644
--- a/src/gui/painting/qmemrotate_p.h
+++ b/src/gui/painting/qmemrotate_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#include "private/qdrawhelper_p.h"
QT_BEGIN_NAMESPACE
diff --git a/src/gui/painting/qoutlinemapper_p.h b/src/gui/painting/qoutlinemapper_p.h
index 47413d920c..71999fbdee 100644
--- a/src/gui/painting/qoutlinemapper_p.h
+++ b/src/gui/painting/qoutlinemapper_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#include <QtCore/qrect.h>
#include <QtGui/qtransform.h>
diff --git a/src/gui/painting/qpagedpaintdevice.h b/src/gui/painting/qpagedpaintdevice.h
index 3aebbb7551..c516f6a963 100644
--- a/src/gui/painting/qpagedpaintdevice.h
+++ b/src/gui/painting/qpagedpaintdevice.h
@@ -40,6 +40,7 @@
#ifndef QPAGEDPAINTDEVICE_H
#define QPAGEDPAINTDEVICE_H
+#include <QtGui/qtguiglobal.h>
#include <QtGui/qpaintdevice.h>
#include <QtGui/qpagelayout.h>
diff --git a/src/gui/painting/qpagedpaintdevice_p.h b/src/gui/painting/qpagedpaintdevice_p.h
index 028ab3b5af..a993ea4cac 100644
--- a/src/gui/painting/qpagedpaintdevice_p.h
+++ b/src/gui/painting/qpagedpaintdevice_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#include <qpagedpaintdevice.h>
QT_BEGIN_NAMESPACE
diff --git a/src/gui/painting/qpagelayout.h b/src/gui/painting/qpagelayout.h
index bd29165777..b41689d33b 100644
--- a/src/gui/painting/qpagelayout.h
+++ b/src/gui/painting/qpagelayout.h
@@ -40,6 +40,7 @@
#ifndef QPAGELAYOUT_H
#define QPAGELAYOUT_H
+#include <QtGui/qtguiglobal.h>
#include <QtCore/qsharedpointer.h>
#include <QtCore/qstring.h>
#include <QtCore/qmargins.h>
diff --git a/src/gui/painting/qpagesize.cpp b/src/gui/painting/qpagesize.cpp
index f53285d9cb..8831d60d48 100644
--- a/src/gui/painting/qpagesize.cpp
+++ b/src/gui/painting/qpagesize.cpp
@@ -400,7 +400,7 @@ static QPageSize::PageSizeId qt_idForPpdKey(const QString &ppdKey, QSize *match
{
if (ppdKey.isEmpty())
return QPageSize::Custom;
- QString key = ppdKey;
+ QStringRef key(&ppdKey);
// Remove any Rotated or Tranverse modifiers
if (key.endsWith(QLatin1String("Rotated")))
key.chop(7);
diff --git a/src/gui/painting/qpagesize.h b/src/gui/painting/qpagesize.h
index 4916ddd4b5..82054824b4 100644
--- a/src/gui/painting/qpagesize.h
+++ b/src/gui/painting/qpagesize.h
@@ -40,6 +40,7 @@
#ifndef QPAGESIZE_H
#define QPAGESIZE_H
+#include <QtGui/qtguiglobal.h>
#include <QtCore/qsharedpointer.h>
QT_BEGIN_NAMESPACE
diff --git a/src/gui/painting/qpaintdevice.h b/src/gui/painting/qpaintdevice.h
index 5c9b966029..9458b4ba9a 100644
--- a/src/gui/painting/qpaintdevice.h
+++ b/src/gui/painting/qpaintdevice.h
@@ -40,6 +40,7 @@
#ifndef QPAINTDEVICE_H
#define QPAINTDEVICE_H
+#include <QtGui/qtguiglobal.h>
#include <QtGui/qwindowdefs.h>
#include <QtCore/qrect.h>
diff --git a/src/gui/painting/qpaintengine.h b/src/gui/painting/qpaintengine.h
index a9da37b354..9fb67e253e 100644
--- a/src/gui/painting/qpaintengine.h
+++ b/src/gui/painting/qpaintengine.h
@@ -40,6 +40,7 @@
#ifndef QPAINTENGINE_H
#define QPAINTENGINE_H
+#include <QtGui/qtguiglobal.h>
#include <QtCore/qnamespace.h>
#include <QtCore/qobjectdefs.h>
#include <QtCore/qscopedpointer.h>
diff --git a/src/gui/painting/qpaintengine_blitter.cpp b/src/gui/painting/qpaintengine_blitter.cpp
index 81191d07b8..a50d1dfd73 100644
--- a/src/gui/painting/qpaintengine_blitter.cpp
+++ b/src/gui/painting/qpaintengine_blitter.cpp
@@ -312,7 +312,7 @@ void QBlitterPaintEnginePrivate::updateBrushState(QPainterState *s)
{
Qt::BrushStyle style = qbrush_style(s->brush);
- caps.updateState(STATE_BRUSH_PATTERN, style > Qt::SolidPattern);
+ caps.updateState(STATE_BRUSH_PATTERN, style != Qt::SolidPattern);
caps.updateState(STATE_BRUSH_ALPHA,
qbrush_color(s->brush).alpha() < 255);
}
@@ -374,9 +374,8 @@ void QBlitterPaintEnginePrivate::fillRect(const QRectF &rect, const QColor &colo
else
pmData->blittable()->fillRect(targetRect & clipData->clipRect, color);
} else if (clipData->hasRegionClip) {
- QVector<QRect> rects = clipData->clipRegion.rects();
- for (int i = 0; i < rects.size(); ++i) {
- QRect intersectRect = rects.at(i).intersected(targetRect.toRect());
+ for (const QRect &rect : clipData->clipRegion) {
+ QRect intersectRect = rect.intersected(targetRect.toRect());
if (!intersectRect.isEmpty()) {
unlock();
if (alpha)
@@ -609,10 +608,8 @@ void QBlitterPaintEngine::fillRect(const QRectF &rect, const QBrush &brush)
}
} else if (clipData->hasRegionClip) {
QRect unclippedTargetRect(x, y, blitWidth, blitHeight);
- const QVector<QRect> intersectedRects = clipData->clipRegion.intersected(unclippedTargetRect).rects();
- const int intersectedSize = intersectedRects.size();
- for (int i = 0; i < intersectedSize; ++i) {
- const QRect &targetRect = intersectedRects.at(i);
+ const QRegion targetRegion = clipData->clipRegion.intersected(unclippedTargetRect);
+ for (const QRect &targetRect : targetRegion) {
if (!targetRect.isValid() || targetRect.isEmpty())
continue;
int tmpSrcX = srcX + (targetRect.x() - x);
@@ -686,9 +683,8 @@ void QBlitterPaintEngine::drawPixmap(const QRectF &r, const QPixmap &pm, const Q
if (clipData->hasRectClip) {
d->clipAndDrawPixmap(clipData->clipRect, targetRect, pm, sr, canDrawOpacity);
} else if (clipData->hasRegionClip) {
- QVector<QRect>rects = clipData->clipRegion.rects();
- for (int i = 0; i<rects.size(); ++i)
- d->clipAndDrawPixmap(rects.at(i), targetRect, pm, sr, canDrawOpacity);
+ for (const QRect &rect : clipData->clipRegion)
+ d->clipAndDrawPixmap(rect, targetRect, pm, sr, canDrawOpacity);
}
} else {
QRectF deviceRect(0, 0, paintDevice()->width(), paintDevice()->height());
diff --git a/src/gui/painting/qpaintengine_blitter_p.h b/src/gui/painting/qpaintengine_blitter_p.h
index 3feabcf6fc..40f5347b26 100644
--- a/src/gui/painting/qpaintengine_blitter_p.h
+++ b/src/gui/painting/qpaintengine_blitter_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#include "private/qpaintengine_raster_p.h"
#ifndef QT_NO_BLITTABLE
diff --git a/src/gui/painting/qpaintengine_p.h b/src/gui/painting/qpaintengine_p.h
index c14f085721..9d511f9bad 100644
--- a/src/gui/painting/qpaintengine_p.h
+++ b/src/gui/painting/qpaintengine_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#include "QtGui/qpainter.h"
#include "QtGui/qpaintengine.h"
#include "QtGui/qregion.h"
@@ -117,6 +118,11 @@ public:
virtual void systemStateChanged() { }
void drawBoxTextItem(const QPointF &p, const QTextItemInt &ti);
+
+ static QPaintEnginePrivate *get(QPaintEngine *paintEngine) { return paintEngine->d_func(); }
+
+ virtual QPaintEngine *aggregateEngine() { return 0; }
+ virtual Qt::HANDLE nativeHandle() { return 0; }
};
QT_END_NAMESPACE
diff --git a/src/gui/painting/qpaintengine_raster_p.h b/src/gui/painting/qpaintengine_raster_p.h
index 1afb119535..8cde88fa82 100644
--- a/src/gui/painting/qpaintengine_raster_p.h
+++ b/src/gui/painting/qpaintengine_raster_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#include "private/qpaintengineex_p.h"
#include "QtGui/qpainterpath.h"
#include "private/qdatabuffer_p.h"
diff --git a/src/gui/painting/qpaintengineex_p.h b/src/gui/painting/qpaintengineex_p.h
index 643c39c80f..7c2c98140f 100644
--- a/src/gui/painting/qpaintengineex_p.h
+++ b/src/gui/painting/qpaintengineex_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#include <QtGui/qpaintengine.h>
#include <private/qpaintengine_p.h>
diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp
index 2c5e0672b1..6472481e7a 100644
--- a/src/gui/painting/qpainter.cpp
+++ b/src/gui/painting/qpainter.cpp
@@ -2834,7 +2834,7 @@ void QPainter::setClipRegion(const QRegion &r, Qt::ClipOperation op)
QRect rect = r.boundingRect();
if (qt_show_painter_debug_output)
printf("QPainter::setClipRegion(), size=%d, [%d,%d,%d,%d]\n",
- r.rects().size(), rect.x(), rect.y(), rect.width(), rect.height());
+ r.rectCount(), rect.x(), rect.y(), rect.width(), rect.height());
#endif
if (!d->engine) {
qWarning("QPainter::setClipRegion: Painter not active");
@@ -6477,6 +6477,8 @@ void QPainterPrivate::drawTextItem(const QPointF &p, const QTextItem &_ti, QText
extended->drawTextItem(QPointF(x, y), ti2);
else
engine->drawTextItem(QPointF(x, y), ti2);
+ drawTextItemDecoration(q, p, ti2.fontEngine, textEngine, ti2.underlineStyle,
+ ti2.flags, ti2.width.toReal(), ti2.charFormat);
if (!rtl)
x += ti2.width.toReal();
@@ -6508,6 +6510,8 @@ void QPainterPrivate::drawTextItem(const QPointF &p, const QTextItem &_ti, QText
extended->drawTextItem(QPointF(x, y), ti2);
else
engine->drawTextItem(QPointF(x,y), ti2);
+ drawTextItemDecoration(q, p, ti2.fontEngine, textEngine, ti2.underlineStyle,
+ ti2.flags, ti2.width.toReal(), ti2.charFormat);
// reset the high byte for all glyphs
const int hi = which << 24;
@@ -6519,9 +6523,9 @@ void QPainterPrivate::drawTextItem(const QPointF &p, const QTextItem &_ti, QText
extended->drawTextItem(p, ti);
else
engine->drawTextItem(p, ti);
+ drawTextItemDecoration(q, p, ti.fontEngine, textEngine, ti.underlineStyle,
+ ti.flags, ti.width.toReal(), ti.charFormat);
}
- drawTextItemDecoration(q, p, ti.fontEngine, textEngine, ti.underlineStyle,
- ti.flags, ti.width.toReal(), ti.charFormat);
if (state->renderHints != oldRenderHints) {
state->renderHints = oldRenderHints;
diff --git a/src/gui/painting/qpainter.h b/src/gui/painting/qpainter.h
index 5743d97405..46817b9c73 100644
--- a/src/gui/painting/qpainter.h
+++ b/src/gui/painting/qpainter.h
@@ -40,6 +40,7 @@
#ifndef QPAINTER_H
#define QPAINTER_H
+#include <QtGui/qtguiglobal.h>
#include <QtCore/qnamespace.h>
#include <QtCore/qrect.h>
#include <QtCore/qpoint.h>
diff --git a/src/gui/painting/qpainter_p.h b/src/gui/painting/qpainter_p.h
index 23ab5db7b4..2d44577310 100644
--- a/src/gui/painting/qpainter_p.h
+++ b/src/gui/painting/qpainter_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#include "QtGui/qbrush.h"
#include "QtGui/qfont.h"
#include "QtGui/qpen.h"
diff --git a/src/gui/painting/qpainterpath.cpp b/src/gui/painting/qpainterpath.cpp
index 5b91266b64..7dbc83b338 100644
--- a/src/gui/painting/qpainterpath.cpp
+++ b/src/gui/painting/qpainterpath.cpp
@@ -1294,10 +1294,9 @@ void QPainterPath::addRegion(const QRegion &region)
ensureData();
detach();
- QVector<QRect> rects = region.rects();
- d_func()->elements.reserve(rects.size() * 5);
- for (int i=0; i<rects.size(); ++i)
- addRect(rects.at(i));
+ d_func()->elements.reserve(region.rectCount() * 5);
+ for (const QRect &rect : region)
+ addRect(rect);
}
diff --git a/src/gui/painting/qpainterpath.h b/src/gui/painting/qpainterpath.h
index 882918fc87..131fcde8cc 100644
--- a/src/gui/painting/qpainterpath.h
+++ b/src/gui/painting/qpainterpath.h
@@ -40,6 +40,7 @@
#ifndef QPAINTERPATH_H
#define QPAINTERPATH_H
+#include <QtGui/qtguiglobal.h>
#include <QtGui/qmatrix.h>
#include <QtCore/qglobal.h>
#include <QtCore/qrect.h>
diff --git a/src/gui/painting/qpainterpath_p.h b/src/gui/painting/qpainterpath_p.h
index e90cdb0f43..92d9a4ea66 100644
--- a/src/gui/painting/qpainterpath_p.h
+++ b/src/gui/painting/qpainterpath_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#include "QtGui/qpainterpath.h"
#include "QtGui/qregion.h"
#include "QtCore/qlist.h"
diff --git a/src/gui/painting/qpathclipper.cpp b/src/gui/painting/qpathclipper.cpp
index 4f2b59c775..f92a681eca 100644
--- a/src/gui/painting/qpathclipper.cpp
+++ b/src/gui/painting/qpathclipper.cpp
@@ -1760,7 +1760,7 @@ static bool bool_op(bool a, bool b, QPathClipper::Operation op)
switch (op) {
case QPathClipper::BoolAnd:
return a && b;
- case QPathClipper::BoolOr: // fall-through
+ case QPathClipper::BoolOr:
case QPathClipper::Simplify:
return a || b;
case QPathClipper::BoolSub:
@@ -1956,7 +1956,7 @@ QPointF intersectLine(const QPointF &a, const QPointF &b, qreal t)
{
QLineF line(a, b);
switch (edge) {
- case Left: // fall-through
+ case Left:
case Right:
return line.pointAt((t - a.x()) / (b.x() - a.x()));
default:
diff --git a/src/gui/painting/qpathclipper_p.h b/src/gui/painting/qpathclipper_p.h
index fe3ce84e4a..64e684e1ad 100644
--- a/src/gui/painting/qpathclipper_p.h
+++ b/src/gui/painting/qpathclipper_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#include <QtGui/qpainterpath.h>
#include <QtCore/qlist.h>
diff --git a/src/gui/painting/qpathsimplifier_p.h b/src/gui/painting/qpathsimplifier_p.h
index 47b1c3c623..6ef298f6bf 100644
--- a/src/gui/painting/qpathsimplifier_p.h
+++ b/src/gui/painting/qpathsimplifier_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#include <QtGui/qpainterpath.h>
#include <QtGui/private/qdatabuffer_p.h>
#include <QtGui/private/qvectorpath_p.h>
diff --git a/src/gui/painting/qpdf.cpp b/src/gui/painting/qpdf.cpp
index d568dca6b9..d246c96da6 100644
--- a/src/gui/painting/qpdf.cpp
+++ b/src/gui/painting/qpdf.cpp
@@ -1078,9 +1078,8 @@ void QPdfEngine::updateState(const QPaintEngineState &state)
} else if (flags & DirtyClipRegion) {
d->clipEnabled = true;
QPainterPath path;
- QVector<QRect> rects = state.clipRegion().rects();
- for (int i = 0; i < rects.size(); ++i)
- path.addRect(rects.at(i));
+ for (const QRect &rect : state.clipRegion())
+ path.addRect(rect);
updateClipPath(path, state.clipOperation());
flags |= DirtyClipPath;
} else if (flags & DirtyClipEnabled) {
@@ -2092,7 +2091,7 @@ int QPdfEnginePrivate::generateLinearGradientShader(const QLinearGradient *gradi
break;
case QGradient::ReflectSpread:
reflect = true;
- // fall through
+ Q_FALLTHROUGH();
case QGradient::RepeatSpread: {
// calculate required bounds
QRectF pageRect = m_pageLayout.fullRectPixels(resolution);
@@ -2155,7 +2154,7 @@ int QPdfEnginePrivate::generateRadialGradientShader(const QRadialGradient *gradi
break;
case QGradient::ReflectSpread:
reflect = true;
- // fall through
+ Q_FALLTHROUGH();
case QGradient::RepeatSpread: {
Q_ASSERT(qFuzzyIsNull(r0)); // QPainter emulates if this is not 0
diff --git a/src/gui/painting/qpdf_p.h b/src/gui/painting/qpdf_p.h
index ef41f1efc1..cb1a91e09f 100644
--- a/src/gui/painting/qpdf_p.h
+++ b/src/gui/painting/qpdf_p.h
@@ -51,7 +51,7 @@
// We mean it.
//
-#include <QtCore/qglobal.h>
+#include <QtGui/private/qtguiglobal_p.h>
#ifndef QT_NO_PDF
diff --git a/src/gui/painting/qpdfwriter.h b/src/gui/painting/qpdfwriter.h
index cf1da95bf1..baad274818 100644
--- a/src/gui/painting/qpdfwriter.h
+++ b/src/gui/painting/qpdfwriter.h
@@ -40,7 +40,7 @@
#ifndef QPDFWRITER_H
#define QPDFWRITER_H
-#include <QtCore/qglobal.h>
+#include <QtGui/qtguiglobal.h>
#ifndef QT_NO_PDF
diff --git a/src/gui/painting/qpen.h b/src/gui/painting/qpen.h
index 7469931a48..d8d99ba800 100644
--- a/src/gui/painting/qpen.h
+++ b/src/gui/painting/qpen.h
@@ -40,6 +40,7 @@
#ifndef QPEN_H
#define QPEN_H
+#include <QtGui/qtguiglobal.h>
#include <QtGui/qcolor.h>
#include <QtGui/qbrush.h>
diff --git a/src/gui/painting/qplatformbackingstore.cpp b/src/gui/painting/qplatformbackingstore.cpp
index 35cf1dae86..0c5de36981 100644
--- a/src/gui/painting/qplatformbackingstore.cpp
+++ b/src/gui/painting/qplatformbackingstore.cpp
@@ -49,7 +49,7 @@
#include <QtGui/QOpenGLContext>
#include <QtGui/QOpenGLFunctions>
#ifndef QT_NO_OPENGL
-#include <QtGui/private/qopengltextureblitter_p.h>
+#include <QtGui/qopengltextureblitter.h>
#endif
#include <qpa/qplatformgraphicsbuffer.h>
#include <qpa/qplatformgraphicsbufferhelper.h>
@@ -251,9 +251,8 @@ static QRegion deviceRegion(const QRegion &region, QWindow *window, const QPoint
return region;
QVector<QRect> rects;
- const QVector<QRect> regionRects = region.rects();
- rects.reserve(regionRects.count());
- for (const QRect &rect : regionRects)
+ rects.reserve(region.rectCount());
+ for (const QRect &rect : region)
rects.append(deviceRect(rect.translated(offset), window));
QRegion deviceRegion;
@@ -390,7 +389,7 @@ void QPlatformBackingStore::composeAndFlush(QWindow *window, const QRegion &regi
if (textureId) {
if (d_ptr->needsSwizzle)
- d_ptr->blitter->setSwizzleRB(true);
+ d_ptr->blitter->setRedBlueSwizzle(true);
// The backingstore is for the entire tlw.
// In case of native children offset tells the position relative to the tlw.
const QRect srcRect = toBottomLeftRect(deviceWindowRect.translated(offset), d_ptr->textureSize.height());
@@ -399,7 +398,7 @@ void QPlatformBackingStore::composeAndFlush(QWindow *window, const QRegion &regi
origin);
d_ptr->blitter->blit(textureId, QMatrix4x4(), source);
if (d_ptr->needsSwizzle)
- d_ptr->blitter->setSwizzleRB(false);
+ d_ptr->blitter->setRedBlueSwizzle(false);
}
// Textures for renderToTexture widgets that have WA_AlwaysStackOnTop set.
@@ -413,7 +412,7 @@ void QPlatformBackingStore::composeAndFlush(QWindow *window, const QRegion &regi
context->swapBuffers(window);
}
-
+#endif
/*!
Implemented in subclasses to return the content of the backingstore as a QImage.
@@ -426,7 +425,7 @@ QImage QPlatformBackingStore::toImage() const
{
return QImage();
}
-
+#ifndef QT_NO_OPENGL
/*!
May be reimplemented in subclasses to return the content of the
backingstore as an OpenGL texture. \a dirtyRegion is the part of the
@@ -472,14 +471,14 @@ GLuint QPlatformBackingStore::toTexture(const QRegion &dirtyRegion, QSize *textu
switch (image.format()) {
case QImage::Format_ARGB32_Premultiplied:
*flags |= TexturePremultiplied;
- // no break
+ Q_FALLTHROUGH();
case QImage::Format_RGB32:
case QImage::Format_ARGB32:
*flags |= TextureSwizzle;
break;
case QImage::Format_RGBA8888_Premultiplied:
*flags |= TexturePremultiplied;
- // no break
+ Q_FALLTHROUGH();
case QImage::Format_RGBX8888:
case QImage::Format_RGBA8888:
break;
diff --git a/src/gui/painting/qplatformbackingstore.h b/src/gui/painting/qplatformbackingstore.h
index 9b09620cce..8d0e29ad8d 100644
--- a/src/gui/painting/qplatformbackingstore.h
+++ b/src/gui/painting/qplatformbackingstore.h
@@ -49,6 +49,7 @@
// source and binary incompatible with future versions of Qt.
//
+#include <QtGui/qtguiglobal.h>
#include <QtCore/qrect.h>
#include <QtCore/qobject.h>
@@ -121,7 +122,9 @@ public:
virtual void composeAndFlush(QWindow *window, const QRegion &region, const QPoint &offset,
QPlatformTextureList *textures, QOpenGLContext *context,
bool translucentBackground);
+#endif
virtual QImage toImage() const;
+#ifndef QT_NO_OPENGL
enum TextureFlag {
TextureSwizzle = 0x01,
TextureFlip = 0x02,
diff --git a/src/gui/painting/qpolygon.cpp b/src/gui/painting/qpolygon.cpp
index d2203595c8..126b752811 100644
--- a/src/gui/painting/qpolygon.cpp
+++ b/src/gui/painting/qpolygon.cpp
@@ -443,14 +443,15 @@ void QPolygon::putPoints(int index, int nPoints, const QPolygon & from, int from
QRect QPolygon::boundingRect() const
{
- if (isEmpty())
- return QRect(0, 0, 0, 0);
const QPoint *pd = constData();
+ const QPoint *pe = pd + size();
+ if (pd == pe)
+ return QRect(0, 0, 0, 0);
int minx, maxx, miny, maxy;
minx = maxx = pd->x();
miny = maxy = pd->y();
++pd;
- for (int i = 1; i < size(); ++i) {
+ for (; pd != pe; ++pd) {
if (pd->x() < minx)
minx = pd->x();
else if (pd->x() > maxx)
@@ -459,7 +460,6 @@ QRect QPolygon::boundingRect() const
miny = pd->y();
else if (pd->y() > maxy)
maxy = pd->y();
- ++pd;
}
return QRect(QPoint(minx,miny), QPoint(maxx,maxy));
}
@@ -657,14 +657,15 @@ QPolygonF QPolygonF::translated(const QPointF &offset) const
QRectF QPolygonF::boundingRect() const
{
- if (isEmpty())
- return QRectF(0, 0, 0, 0);
const QPointF *pd = constData();
+ const QPointF *pe = pd + size();
+ if (pd == pe)
+ return QRectF(0, 0, 0, 0);
qreal minx, maxx, miny, maxy;
minx = maxx = pd->x();
miny = maxy = pd->y();
++pd;
- for (int i = 1; i < size(); ++i) {
+ while (pd != pe) {
if (pd->x() < minx)
minx = pd->x();
else if (pd->x() > maxx)
diff --git a/src/gui/painting/qpolygon.h b/src/gui/painting/qpolygon.h
index 23bdd1933f..c57802e84e 100644
--- a/src/gui/painting/qpolygon.h
+++ b/src/gui/painting/qpolygon.h
@@ -40,6 +40,7 @@
#ifndef QPOLYGON_H
#define QPOLYGON_H
+#include <QtGui/qtguiglobal.h>
#include <QtCore/qvector.h>
#include <QtCore/qpoint.h>
#include <QtCore/qrect.h>
diff --git a/src/gui/painting/qpolygonclipper_p.h b/src/gui/painting/qpolygonclipper_p.h
index c67a692b52..04a31111c9 100644
--- a/src/gui/painting/qpolygonclipper_p.h
+++ b/src/gui/painting/qpolygonclipper_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#include "private/qdatabuffer_p.h"
QT_BEGIN_NAMESPACE
diff --git a/src/gui/painting/qrasterizer_p.h b/src/gui/painting/qrasterizer_p.h
index a3e12c076d..955577f4a3 100644
--- a/src/gui/painting/qrasterizer_p.h
+++ b/src/gui/painting/qrasterizer_p.h
@@ -51,7 +51,7 @@
// We mean it.
//
-#include "QtCore/qglobal.h"
+#include <QtGui/private/qtguiglobal_p.h>
#include "QtGui/qpainter.h"
#include <private/qdrawhelper_p.h>
diff --git a/src/gui/opengl/qrbtree_p.h b/src/gui/painting/qrbtree_p.h
index 4c9dfe1af4..d3ee23a91c 100644
--- a/src/gui/opengl/qrbtree_p.h
+++ b/src/gui/painting/qrbtree_p.h
@@ -51,7 +51,7 @@
// We mean it.
//
-#include <QtCore/qglobal.h>
+#include <QtGui/private/qtguiglobal_p.h>
QT_BEGIN_NAMESPACE
diff --git a/src/gui/painting/qregion.cpp b/src/gui/painting/qregion.cpp
index 7571b5c3e8..0571e1a328 100644
--- a/src/gui/painting/qregion.cpp
+++ b/src/gui/painting/qregion.cpp
@@ -81,8 +81,8 @@ QT_BEGIN_NAMESPACE
contains() a QPoint or QRect. The bounding rectangle can be found
with boundingRect().
- The function rects() gives a decomposition of the region into
- rectangles.
+ Iteration over the region (with begin(), end()) gives a decomposition of
+ the region into rectangles. The same sequence of rectangles is returned by rects().
Example of using complex regions:
\snippet code/src_gui_painting_qregion.cpp 0
@@ -395,23 +395,24 @@ void QRegion::exec(const QByteArray &buffer, int ver, QDataStream::ByteOrder byt
QDataStream &operator<<(QDataStream &s, const QRegion &r)
{
- QVector<QRect> a = r.rects();
- if (a.isEmpty()) {
+ auto b = r.begin(), e = r.end();
+ if (b == e) {
s << (quint32)0;
} else {
+ const auto size = e - b;
if (s.version() == 1) {
- int i;
- for (i = a.size() - 1; i > 0; --i) {
+ for (auto i = size - 1; i > 0; --i) {
s << (quint32)(12 + i * 24);
s << (int)QRGN_OR;
}
- for (i = 0; i < a.size(); ++i) {
- s << (quint32)(4+8) << (int)QRGN_SETRECT << a[i];
- }
+ for (auto it = b; it != e; ++it)
+ s << (quint32)(4+8) << (int)QRGN_SETRECT << *it;
} else {
- s << (quint32)(4 + 4 + 16 * a.size()); // 16: storage size of QRect
+ s << quint32(4 + 4 + 16 * size); // 16: storage size of QRect
s << (qint32)QRGN_RECTS;
- s << a;
+ s << quint32(size);
+ for (auto it = b; it != e; ++it)
+ s << *it;
}
}
return s;
@@ -722,12 +723,9 @@ bool QRegion::intersects(const QRegion &region) const
if (rectCount() == 1 && region.rectCount() == 1)
return true;
- const QVector<QRect> myRects = rects();
- const QVector<QRect> otherRects = region.rects();
-
- for (QVector<QRect>::const_iterator i1 = myRects.constBegin(); i1 < myRects.constEnd(); ++i1)
- for (QVector<QRect>::const_iterator i2 = otherRects.constBegin(); i2 < otherRects.constEnd(); ++i2)
- if (rect_intersects(*i1, *i2))
+ for (const QRect &myRect : *this)
+ for (const QRect &otherRect : region)
+ if (rect_intersects(myRect, otherRect))
return true;
return false;
}
@@ -928,6 +926,100 @@ QRegion QRegion::intersect(const QRect &r) const
*/
/*!
+ \typedef QRegion::const_iterator
+ \since 5.8
+
+ An iterator over the QRects that make up the region.
+
+ QRegion does not offer mutable iterators.
+
+ \sa begin(), end()
+*/
+
+/*!
+ \typedef QRegion::const_reverse_iterator
+ \since 5.8
+
+ A reverse iterator over the QRects that make up the region.
+
+ QRegion does not offer mutable iterators.
+
+ \sa rbegin(), rend()
+*/
+
+/*!
+ \fn QRegion::begin() const
+ \since 5.8
+
+ Returns a const_iterator pointing to the beginning of the range of
+ rectangles that make up this range, in the order in which rects()
+ returns them.
+
+ \sa rbegin(), cbegin(), end()
+*/
+
+/*!
+ \fn QRegion::cbegin() const
+ \since 5.8
+
+ Same as begin().
+*/
+
+/*!
+ \fn QRegion::end() const
+ \since 5.8
+
+ Returns a const_iterator pointing to one past the end of the range of
+ rectangles that make up this range, in the order in which rects()
+ returns them.
+
+ \sa rend(), cend(), begin()
+*/
+
+/*!
+ \fn QRegion::cend() const
+ \since 5.8
+
+ Same as end().
+*/
+
+/*!
+ \fn QRegion::rbegin() const
+ \since 5.8
+
+ Returns a const_reverse_iterator pointing to the beginning of the range of
+ rectangles that make up this range, in the reverse order in which rects()
+ returns them.
+
+ \sa begin(), crbegin(), rend()
+*/
+
+/*!
+ \fn QRegion::crbegin() const
+ \since 5.8
+
+ Same as rbegin().
+*/
+
+/*!
+ \fn QRegion::rend() const
+ \since 5.8
+
+ Returns a const_reverse_iterator pointing to one past the end of the range of
+ rectangles that make up this range, in the reverse order in which rects()
+ returns them.
+
+ \sa end(), crend(), rbegin()
+*/
+
+/*!
+ \fn QRegion::crend() const
+ \since 5.8
+
+ Same as rend().
+*/
+
+/*!
\fn void QRegion::setRects(const QRect *rects, int number)
Sets the region using the array of rectangles specified by \a rects and
@@ -1065,13 +1157,11 @@ Q_GUI_EXPORT QPainterPath qt_regionToPath(const QRegion &region)
return result;
}
- const QVector<QRect> rects = region.rects();
+ auto rect = region.begin();
+ const auto end = region.end();
QVarLengthArray<Segment> segments;
- segments.resize(4 * rects.size());
-
- const QRect *rect = rects.constData();
- const QRect *end = rect + rects.size();
+ segments.resize(4 * (end - rect));
int lastRowSegmentCount = 0;
Segment *lastRowSegments = 0;
@@ -1179,6 +1269,12 @@ struct QRegionPrivate {
}
}
+ const QRect *begin() const Q_DECL_NOTHROW
+ { return numRects == 1 ? &extents : rects.data(); } // avoid vectorize()
+
+ const QRect *end() const Q_DECL_NOTHROW
+ { return begin() + numRects; }
+
inline void append(const QRect *r);
void append(const QRegionPrivate *r);
void prepend(const QRect *r);
@@ -4200,7 +4296,7 @@ QRegion QRegion::xored(const QRegion &r) const
}
}
-QRect QRegion::boundingRect() const
+QRect QRegion::boundingRect() const Q_DECL_NOTHROW
{
if (isEmpty())
return QRect();
@@ -4256,6 +4352,16 @@ QVector<QRect> QRegion::rects() const
}
}
+QRegion::const_iterator QRegion::begin() const Q_DECL_NOTHROW
+{
+ return d->qt_rgn ? d->qt_rgn->begin() : nullptr;
+}
+
+QRegion::const_iterator QRegion::end() const Q_DECL_NOTHROW
+{
+ return d->qt_rgn ? d->qt_rgn->end() : nullptr;
+}
+
void QRegion::setRects(const QRect *rects, int num)
{
*this = QRegion();
@@ -4288,7 +4394,7 @@ void QRegion::setRects(const QRect *rects, int num)
}
}
-int QRegion::rectCount() const
+int QRegion::rectCount() const Q_DECL_NOTHROW
{
return (d->qt_rgn ? d->qt_rgn->numRects : 0);
}
@@ -4318,10 +4424,10 @@ bool QRegion::intersects(const QRect &rect) const
if (d->qt_rgn->numRects == 1)
return true;
- const QVector<QRect> myRects = rects();
- for (QVector<QRect>::const_iterator it = myRects.constBegin(); it < myRects.constEnd(); ++it)
- if (rect_intersects(r, *it))
+ for (const QRect &rect : *this) {
+ if (rect_intersects(r, rect))
return true;
+ }
return false;
}
diff --git a/src/gui/painting/qregion.h b/src/gui/painting/qregion.h
index d66f80fcde..4f0a071da8 100644
--- a/src/gui/painting/qregion.h
+++ b/src/gui/painting/qregion.h
@@ -40,6 +40,7 @@
#ifndef QREGION_H
#define QREGION_H
+#include <QtGui/qtguiglobal.h>
#include <QtCore/qatomic.h>
#include <QtCore/qrect.h>
#include <QtGui/qwindowdefs.h>
@@ -81,6 +82,18 @@ public:
bool isEmpty() const;
bool isNull() const;
+ typedef const QRect *const_iterator;
+ typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
+
+ const_iterator begin() const Q_DECL_NOTHROW;
+ const_iterator cbegin() const Q_DECL_NOTHROW { return begin(); }
+ const_iterator end() const Q_DECL_NOTHROW;
+ const_iterator cend() const Q_DECL_NOTHROW { return end(); }
+ const_reverse_iterator rbegin() const Q_DECL_NOTHROW { return const_reverse_iterator(end()); }
+ const_reverse_iterator crbegin() const Q_DECL_NOTHROW { return rbegin(); }
+ const_reverse_iterator rend() const Q_DECL_NOTHROW { return const_reverse_iterator(begin()); }
+ const_reverse_iterator crend() const Q_DECL_NOTHROW { return rend(); }
+
bool contains(const QPoint &p) const;
bool contains(const QRect &r) const;
@@ -108,10 +121,10 @@ public:
bool intersects(const QRegion &r) const;
bool intersects(const QRect &r) const;
- QRect boundingRect() const;
+ QRect boundingRect() const Q_DECL_NOTHROW;
QVector<QRect> rects() const;
void setRects(const QRect *rect, int num);
- int rectCount() const;
+ int rectCount() const Q_DECL_NOTHROW;
#ifdef Q_COMPILER_MANGLES_RETURN_TYPE
// ### Qt 6: remove these, they're kept for MSVC compat
const QRegion operator|(const QRegion &r) const;
@@ -165,6 +178,7 @@ Q_GUI_EXPORT
static const struct QRegionData shared_empty;
static void cleanUp(QRegionData *x);
};
+Q_DECLARE_SHARED_NOT_MOVABLE_UNTIL_QT6(QRegion)
/*****************************************************************************
QRegion stream functions
diff --git a/src/gui/painting/qrgb.h b/src/gui/painting/qrgb.h
index 6e666025ac..fe8306109b 100644
--- a/src/gui/painting/qrgb.h
+++ b/src/gui/painting/qrgb.h
@@ -40,7 +40,7 @@
#ifndef QRGB_H
#define QRGB_H
-#include <QtCore/qglobal.h>
+#include <QtGui/qtguiglobal.h>
#include <QtCore/qprocessordetection.h>
QT_BEGIN_NAMESPACE
diff --git a/src/gui/painting/qrgba64.h b/src/gui/painting/qrgba64.h
index 27e1e6e06d..a3ae0c9b14 100644
--- a/src/gui/painting/qrgba64.h
+++ b/src/gui/painting/qrgba64.h
@@ -40,7 +40,7 @@
#ifndef QRGBA64_H
#define QRGBA64_H
-#include <QtCore/qglobal.h>
+#include <QtGui/qtguiglobal.h>
#include <QtCore/qprocessordetection.h>
QT_BEGIN_NAMESPACE
diff --git a/src/gui/painting/qrgba64_p.h b/src/gui/painting/qrgba64_p.h
index cf3dad5f90..0dadc038fa 100644
--- a/src/gui/painting/qrgba64_p.h
+++ b/src/gui/painting/qrgba64_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#include <QtGui/qrgba64.h>
#include <QtGui/private/qdrawhelper_p.h>
#include <private/qsimd_p.h>
@@ -72,27 +73,49 @@ inline QRgba64 multiplyAlpha256(QRgba64 rgba64, uint alpha256)
inline QRgba64 multiplyAlpha65535(QRgba64 rgba64, uint alpha65535)
{
+ return QRgba64::fromRgba64(qt_div_65535(rgba64.red() * alpha65535),
+ qt_div_65535(rgba64.green() * alpha65535),
+ qt_div_65535(rgba64.blue() * alpha65535),
+ qt_div_65535(rgba64.alpha() * alpha65535));
+}
+
#ifdef __SSE2__
- const __m128i va = _mm_shufflelo_epi16(_mm_cvtsi32_si128(alpha65535), _MM_SHUFFLE(0, 0, 0, 0));
- __m128i vs = _mm_loadl_epi64((__m128i*)&rgba64);
+Q_ALWAYS_INLINE __m128i multiplyAlpha65535(__m128i rgba64, __m128i va)
+{
+ __m128i vs = rgba64;
vs = _mm_unpacklo_epi16(_mm_mullo_epi16(vs, va), _mm_mulhi_epu16(vs, va));
vs = _mm_add_epi32(vs, _mm_srli_epi32(vs, 16));
vs = _mm_add_epi32(vs, _mm_set1_epi32(0x8000));
vs = _mm_srai_epi32(vs, 16);
vs = _mm_packs_epi32(vs, _mm_setzero_si128());
- _mm_storel_epi64((__m128i*)&rgba64, vs);
- return rgba64;
-#else
- return QRgba64::fromRgba64(qt_div_65535(rgba64.red() * alpha65535),
- qt_div_65535(rgba64.green() * alpha65535),
- qt_div_65535(rgba64.blue() * alpha65535),
- qt_div_65535(rgba64.alpha() * alpha65535));
+ return vs;
+}
+Q_ALWAYS_INLINE __m128i multiplyAlpha65535(__m128i rgba64, uint alpha65535)
+{
+ const __m128i va = _mm_shufflelo_epi16(_mm_cvtsi32_si128(alpha65535), _MM_SHUFFLE(0, 0, 0, 0));
+ return multiplyAlpha65535(rgba64, va);
+}
#endif
+
+#if defined(__ARM_NEON__)
+Q_ALWAYS_INLINE uint16x4_t multiplyAlpha65535(uint16x4_t rgba64, uint16x4_t alpha65535)
+{
+ uint32x4_t vs32 = vmull_u16(rgba64, alpha65535); // vs = vs * alpha
+ vs32 = vsraq_n_u32(vs32, vs32, 16); // vs = vs + (vs >> 16)
+ return vrshrn_n_u32(vs32, 16); // vs = (vs + 0x8000) >> 16
}
+Q_ALWAYS_INLINE uint16x4_t multiplyAlpha65535(uint16x4_t rgba64, uint alpha65535)
+{
+ uint32x4_t vs32 = vmull_n_u16(rgba64, alpha65535); // vs = vs * alpha
+ vs32 = vsraq_n_u32(vs32, vs32, 16); // vs = vs + (vs >> 16)
+ return vrshrn_n_u32(vs32, 16); // vs = (vs + 0x8000) >> 16
+}
+#endif
-inline QRgba64 multiplyAlpha255(QRgba64 rgba64, uint alpha255)
+template<typename T>
+inline T multiplyAlpha255(T rgba64, uint alpha255)
{
-#ifdef __SSE2__
+#if defined(__SSE2__) || defined(__ARM_NEON__)
return multiplyAlpha65535(rgba64, alpha255 * 257);
#else
return QRgba64::fromRgba64(qt_div_255(rgba64.red() * alpha255),
@@ -112,25 +135,69 @@ inline QRgba64 interpolate255(QRgba64 x, uint alpha1, QRgba64 y, uint alpha2)
return QRgba64::fromRgba64(multiplyAlpha255(x, alpha1) + multiplyAlpha255(y, alpha2));
}
+#if defined __SSE2__
+Q_ALWAYS_INLINE __m128i interpolate255(__m128i x, uint alpha1, __m128i y, uint alpha2)
+{
+ return _mm_add_epi32(multiplyAlpha255(x, alpha1), multiplyAlpha255(y, alpha2));
+}
+#endif
+
+#if defined __ARM_NEON__
+Q_ALWAYS_INLINE uint16x4_t interpolate255(uint16x4_t x, uint alpha1, uint16x4_t y, uint alpha2)
+{
+ return vadd_u16(multiplyAlpha255(x, alpha1), multiplyAlpha255(y, alpha2));
+}
+#endif
+
inline QRgba64 interpolate65535(QRgba64 x, uint alpha1, QRgba64 y, uint alpha2)
{
return QRgba64::fromRgba64(multiplyAlpha65535(x, alpha1) + multiplyAlpha65535(y, alpha2));
}
+#if defined __SSE2__
+Q_ALWAYS_INLINE __m128i interpolate65535(__m128i x, uint alpha1, __m128i y, uint alpha2)
+{
+ return _mm_add_epi32(multiplyAlpha65535(x, alpha1), multiplyAlpha65535(y, alpha2));
+}
+// alpha2 below is const-ref because otherwise MSVC2013 complains that it can't 16-byte align the argument.
+Q_ALWAYS_INLINE __m128i interpolate65535(__m128i x, __m128i alpha1, __m128i y, const __m128i &alpha2)
+{
+ return _mm_add_epi32(multiplyAlpha65535(x, alpha1), multiplyAlpha65535(y, alpha2));
+}
+#endif
+
+#if defined __ARM_NEON__
+Q_ALWAYS_INLINE uint16x4_t interpolate65535(uint16x4_t x, uint alpha1, uint16x4_t y, uint alpha2)
+{
+ return vadd_u16(multiplyAlpha65535(x, alpha1), multiplyAlpha65535(y, alpha2));
+}
+Q_ALWAYS_INLINE uint16x4_t interpolate65535(uint16x4_t x, uint16x4_t alpha1, uint16x4_t y, uint16x4_t alpha2)
+{
+ return vadd_u16(multiplyAlpha65535(x, alpha1), multiplyAlpha65535(y, alpha2));
+}
+#endif
+
inline QRgba64 addWithSaturation(QRgba64 a, QRgba64 b)
{
-#if defined(__SSE2__) && defined(Q_PROCESSOR_X86_64)
- __m128i va = _mm_cvtsi64_si128((quint64)a);
- __m128i vb = _mm_cvtsi64_si128((quint64)b);
- va = _mm_adds_epu16(va, vb);
- return QRgba64::fromRgba64(_mm_cvtsi128_si64(va));
-#else
return QRgba64::fromRgba64(qMin(a.red() + b.red(), 65535),
qMin(a.green() + b.green(), 65535),
qMin(a.blue() + b.blue(), 65535),
qMin(a.alpha() + b.alpha(), 65535));
+}
+
+#if defined(__SSE2__)
+Q_ALWAYS_INLINE __m128i addWithSaturation(__m128i a, __m128i b)
+{
+ return _mm_adds_epu16(a, b);
+}
#endif
+
+#if defined(__ARM_NEON__)
+Q_ALWAYS_INLINE uint16x4_t addWithSaturation(uint16x4_t a, uint16x4_t b)
+{
+ return vqmovn_u32(vaddl_u16(a, b));
}
+#endif
QT_END_NAMESPACE
diff --git a/src/gui/painting/qstroker_p.h b/src/gui/painting/qstroker_p.h
index e17e68b237..ededb5d80b 100644
--- a/src/gui/painting/qstroker_p.h
+++ b/src/gui/painting/qstroker_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#include "QtGui/qpainterpath.h"
#include "private/qdatabuffer_p.h"
#include "private/qnumeric_p.h"
diff --git a/src/gui/painting/qtextureglyphcache.cpp b/src/gui/painting/qtextureglyphcache.cpp
index d2c3eceeef..86a53c21a3 100644
--- a/src/gui/painting/qtextureglyphcache.cpp
+++ b/src/gui/painting/qtextureglyphcache.cpp
@@ -42,7 +42,6 @@
#include "qtextureglyphcache_p.h"
#include "private/qfontengine_p.h"
#include "private/qnumeric_p.h"
-#include "private/qnativeimage_p.h"
QT_BEGIN_NAMESPACE
@@ -247,6 +246,7 @@ void QTextureGlyphCache::fillInPendingGlyphs()
resizeCache(qNextPowerOfTwo(requiredWidth - 1), qNextPowerOfTwo(requiredHeight - 1));
}
+ beginFillTexture();
{
QHash<GlyphAndSubPixelPosition, Coord>::iterator iter = m_pendingGlyphs.begin();
while (iter != m_pendingGlyphs.end()) {
@@ -256,6 +256,7 @@ void QTextureGlyphCache::fillInPendingGlyphs()
++iter;
}
}
+ endFillTexture();
m_pendingGlyphs.clear();
}
diff --git a/src/gui/painting/qtextureglyphcache_p.h b/src/gui/painting/qtextureglyphcache_p.h
index 14271ccc65..25253b496a 100644
--- a/src/gui/painting/qtextureglyphcache_p.h
+++ b/src/gui/painting/qtextureglyphcache_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#include <qhash.h>
#include <qimage.h>
#include <qobject.h>
@@ -117,7 +118,9 @@ public:
virtual void resizeTextureData(int width, int height) = 0;
virtual int glyphPadding() const { return 0; }
+ virtual void beginFillTexture() { }
virtual void fillTexture(const Coord &coord, glyph_t glyph, QFixed subPixelPosition) = 0;
+ virtual void endFillTexture() { }
inline void createCache(int width, int height) {
m_w = width;
diff --git a/src/gui/painting/qtransform.cpp b/src/gui/painting/qtransform.cpp
index 6058811176..2d841b2953 100644
--- a/src/gui/painting/qtransform.cpp
+++ b/src/gui/painting/qtransform.cpp
@@ -446,7 +446,7 @@ QTransform &QTransform::translate(qreal dx, qreal dy)
break;
case TxProject:
m_33 += dx*m_13 + dy*m_23;
- // Fall through
+ Q_FALLTHROUGH();
case TxShear:
case TxRotate:
affine._dx += dx*affine._m11 + dy*affine._m21;
@@ -508,12 +508,12 @@ QTransform & QTransform::scale(qreal sx, qreal sy)
case TxProject:
m_13 *= sx;
m_23 *= sy;
- // fall through
+ Q_FALLTHROUGH();
case TxRotate:
case TxShear:
affine._m12 *= sx;
affine._m21 *= sy;
- // fall through
+ Q_FALLTHROUGH();
case TxScale:
affine._m11 *= sx;
affine._m22 *= sy;
@@ -581,7 +581,7 @@ QTransform & QTransform::shear(qreal sh, qreal sv)
m_13 += tm13;
m_23 += tm23;
}
- // fall through
+ Q_FALLTHROUGH();
case TxRotate:
case TxShear: {
qreal tm11 = sv*affine._m21;
@@ -663,7 +663,7 @@ QTransform & QTransform::rotate(qreal a, Qt::Axis axis)
qreal tm23 = -sina*m_13 + cosa*m_23;
m_13 = tm13;
m_23 = tm23;
- // fall through
+ Q_FALLTHROUGH();
}
case TxRotate:
case TxShear: {
@@ -742,7 +742,7 @@ QTransform & QTransform::rotateRadians(qreal a, Qt::Axis axis)
qreal tm23 = -sina*m_13 + cosa*m_23;
m_13 = tm13;
m_23 = tm23;
- // fall through
+ Q_FALLTHROUGH();
}
case TxRotate:
case TxShear: {
diff --git a/src/gui/painting/qtransform.h b/src/gui/painting/qtransform.h
index 470a5565e1..2aea19eca0 100644
--- a/src/gui/painting/qtransform.h
+++ b/src/gui/painting/qtransform.h
@@ -39,6 +39,7 @@
#ifndef QTRANSFORM_H
#define QTRANSFORM_H
+#include <QtGui/qtguiglobal.h>
#include <QtGui/qmatrix.h>
#include <QtGui/qpainterpath.h>
#include <QtGui/qpolygon.h>
diff --git a/src/gui/opengl/qtriangulatingstroker.cpp b/src/gui/painting/qtriangulatingstroker.cpp
index d9a3231165..d9a3231165 100644
--- a/src/gui/opengl/qtriangulatingstroker.cpp
+++ b/src/gui/painting/qtriangulatingstroker.cpp
diff --git a/src/gui/opengl/qtriangulatingstroker_p.h b/src/gui/painting/qtriangulatingstroker_p.h
index 5c037cb05d..2b0f08972b 100644
--- a/src/gui/opengl/qtriangulatingstroker_p.h
+++ b/src/gui/painting/qtriangulatingstroker_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#include <private/qdatabuffer_p.h>
#include <qvarlengtharray.h>
#include <private/qvectorpath_p.h>
diff --git a/src/gui/opengl/qtriangulator.cpp b/src/gui/painting/qtriangulator.cpp
index 601b51a5fb..6604d407f0 100644
--- a/src/gui/opengl/qtriangulator.cpp
+++ b/src/gui/painting/qtriangulator.cpp
@@ -50,9 +50,10 @@
#include <QtCore/qglobal.h>
#include <QtCore/qpoint.h>
#include <QtCore/qalgorithms.h>
-
-#include <private/qopenglcontext_p.h>
-#include <private/qopenglextensions_p.h>
+#ifndef QT_NO_OPENGL
+# include <private/qopenglcontext_p.h>
+# include <private/qopenglextensions_p.h>
+#endif
#include <private/qrbtree_p.h>
QT_BEGIN_NAMESPACE
@@ -873,7 +874,7 @@ void QTriangulator<T>::initialize(const QVectorPath &path, const QTransform &mat
case QPainterPath::MoveToElement:
if (!m_indices.isEmpty())
m_indices.push_back(T(-1)); // Q_TRIANGULATE_END_OF_POLYGON
- // Fall through.
+ Q_FALLTHROUGH();
case QPainterPath::LineToElement:
m_indices.push_back(T(m_vertices.size()));
m_vertices.resize(m_vertices.size() + 1);
@@ -2099,7 +2100,7 @@ void QTriangulator<T>::SimpleToMonotone::monotoneDecomposition()
} else {
qWarning("Inconsistent polygon. (#3)");
}
- // Fall through.
+ Q_FALLTHROUGH();
case StartVertex:
if (m_clockwiseOrder) {
leftEdgeNode = searchEdgeLeftOfEdge(j);
@@ -2128,7 +2129,7 @@ void QTriangulator<T>::SimpleToMonotone::monotoneDecomposition()
} else {
qWarning("Inconsistent polygon. (#4)");
}
- // Fall through.
+ Q_FALLTHROUGH();
case EndVertex:
if (m_clockwiseOrder) {
if (m_edges.at(m_edges.at(i).helper).type == MergeVertex)
@@ -2267,10 +2268,14 @@ void QTriangulator<T>::MonotoneToTriangles::decompose()
static bool hasElementIndexUint()
{
+#ifndef QT_NO_OPENGL
QOpenGLContext *context = QOpenGLContext::currentContext();
if (!context)
return false;
return static_cast<QOpenGLExtensions *>(context->functions())->hasOpenGLExtension(QOpenGLExtensions::ElementIndexUint);
+#else
+ return false;
+#endif
}
Q_GUI_EXPORT QTriangleSet qTriangulate(const qreal *polygon,
diff --git a/src/gui/opengl/qtriangulator_p.h b/src/gui/painting/qtriangulator_p.h
index 2ef635ff84..4d1aba099c 100644
--- a/src/gui/opengl/qtriangulator_p.h
+++ b/src/gui/painting/qtriangulator_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#include <QtCore/qvector.h>
#include <QtGui/private/qvectorpath_p.h>
diff --git a/src/gui/painting/qvectorpath_p.h b/src/gui/painting/qvectorpath_p.h
index 01f7418930..d1b08ed423 100644
--- a/src/gui/painting/qvectorpath_p.h
+++ b/src/gui/painting/qvectorpath_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#include <QtGui/qpaintengine.h>
#include <private/qpaintengine_p.h>
diff --git a/src/gui/text/qabstracttextdocumentlayout.cpp b/src/gui/text/qabstracttextdocumentlayout.cpp
index ff2497817e..2278378613 100644
--- a/src/gui/text/qabstracttextdocumentlayout.cpp
+++ b/src/gui/text/qabstracttextdocumentlayout.cpp
@@ -602,9 +602,32 @@ QTextDocument *QAbstractTextDocumentLayout::document() const
*/
QString QAbstractTextDocumentLayout::anchorAt(const QPointF& pos) const
{
+ QTextCharFormat fmt = formatAt(pos).toCharFormat();
+ return fmt.anchorHref();
+}
+
+/*!
+ \since 5.8
+
+ Returns the source of the image at the given position \a pos, or an empty
+ string if no image exists at that point.
+*/
+QString QAbstractTextDocumentLayout::imageAt(const QPointF &pos) const
+{
+ QTextImageFormat fmt = formatAt(pos).toImageFormat();
+ return fmt.name();
+}
+
+/*!
+ \since 5.8
+
+ Returns the text format at the given position \a pos.
+*/
+QTextFormat QAbstractTextDocumentLayout::formatAt(const QPointF &pos) const
+{
int cursorPos = hitTest(pos, Qt::ExactHit);
if (cursorPos == -1)
- return QString();
+ return QTextFormat();
// compensate for preedit in the hit text block
QTextBlock block = document()->firstBlock();
@@ -623,8 +646,7 @@ QString QAbstractTextDocumentLayout::anchorAt(const QPointF& pos) const
QTextDocumentPrivate *pieceTable = qobject_cast<const QTextDocument *>(parent())->docHandle();
QTextDocumentPrivate::FragmentIterator it = pieceTable->find(cursorPos);
- QTextCharFormat fmt = pieceTable->formatCollection()->charFormat(it->format);
- return fmt.anchorHref();
+ return pieceTable->formatCollection()->format(it->format);
}
/*!
diff --git a/src/gui/text/qabstracttextdocumentlayout.h b/src/gui/text/qabstracttextdocumentlayout.h
index 01704fe37b..438ad6e70b 100644
--- a/src/gui/text/qabstracttextdocumentlayout.h
+++ b/src/gui/text/qabstracttextdocumentlayout.h
@@ -40,6 +40,7 @@
#ifndef QABSTRACTTEXTDOCUMENTLAYOUT_H
#define QABSTRACTTEXTDOCUMENTLAYOUT_H
+#include <QtGui/qtguiglobal.h>
#include <QtCore/qobject.h>
#include <QtGui/qtextlayout.h>
#include <QtGui/qtextdocument.h>
@@ -82,7 +83,10 @@ public:
virtual void draw(QPainter *painter, const PaintContext &context) = 0;
virtual int hitTest(const QPointF &point, Qt::HitTestAccuracy accuracy) const = 0;
+
QString anchorAt(const QPointF& pos) const;
+ QString imageAt(const QPointF &pos) const;
+ QTextFormat formatAt(const QPointF &pos) const;
virtual int pageCount() const = 0;
virtual QSizeF documentSize() const = 0;
diff --git a/src/gui/text/qabstracttextdocumentlayout_p.h b/src/gui/text/qabstracttextdocumentlayout_p.h
index fc39d8ec5c..191c463dc6 100644
--- a/src/gui/text/qabstracttextdocumentlayout_p.h
+++ b/src/gui/text/qabstracttextdocumentlayout_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#include "private/qobject_p.h"
#include "QtCore/qhash.h"
diff --git a/src/gui/text/qcssparser.cpp b/src/gui/text/qcssparser.cpp
index 966ab3fcdb..cb19a42688 100644
--- a/src/gui/text/qcssparser.cpp
+++ b/src/gui/text/qcssparser.cpp
@@ -403,8 +403,8 @@ ValueExtractor::ValueExtractor(const QVector<Declaration> &decls, const QPalette
LengthData ValueExtractor::lengthValue(const Value& v)
{
- QString s = v.variant.toString();
- s.reserve(s.length());
+ const QString str = v.variant.toString();
+ QStringRef s(&str);
LengthData data;
data.unit = LengthData::None;
if (s.endsWith(QLatin1String("px"), Qt::CaseInsensitive))
@@ -900,7 +900,7 @@ static QBrush brushFromData(const BrushData& c, const QPalette &pal)
}
}
-static BorderStyle parseStyleValue(QCss::Value v)
+static BorderStyle parseStyleValue(const QCss::Value &v)
{
if (v.type == Value::KnownIdentifier) {
switch (v.variant.toInt()) {
@@ -1442,11 +1442,13 @@ bool Declaration::realValue(qreal *real, const char *unit) const
const Value &v = d->values.at(0);
if (unit && v.type != Value::Length)
return false;
- QString s = v.variant.toString();
+ const QString str = v.variant.toString();
+ QStringRef s(&str);
if (unit) {
- if (!s.endsWith(QLatin1String(unit), Qt::CaseInsensitive))
+ const QLatin1String unitStr(unit);
+ if (!s.endsWith(unitStr, Qt::CaseInsensitive))
return false;
- s.chop(qstrlen(unit));
+ s.chop(unitStr.size());
}
bool ok = false;
qreal val = s.toDouble(&ok);
@@ -1459,11 +1461,13 @@ static bool intValueHelper(const QCss::Value &v, int *i, const char *unit)
{
if (unit && v.type != Value::Length)
return false;
- QString s = v.variant.toString();
+ const QString str = v.variant.toString();
+ QStringRef s(&str);
if (unit) {
- if (!s.endsWith(QLatin1String(unit), Qt::CaseInsensitive))
+ const QLatin1String unitStr(unit);
+ if (!s.endsWith(unitStr, Qt::CaseInsensitive))
return false;
- s.chop(qstrlen(unit));
+ s.chop(unitStr.size());
}
bool ok = false;
int val = s.toInt(&ok);
@@ -1867,12 +1871,15 @@ bool StyleSelector::selectorMatches(const Selector &selector, NodePtr node)
do {
match = basicSelectorMatches(sel, node);
if (!match) {
- if (sel.relationToNext == BasicSelector::MatchNextSelectorIfParent
- || i == selector.basicSelectors.count() - 1) // first element must always match!
+ if (i == selector.basicSelectors.count() - 1) // first element must always match!
+ break;
+ if (sel.relationToNext != BasicSelector::MatchNextSelectorIfAncestor &&
+ sel.relationToNext != BasicSelector::MatchNextSelectorIfIndirectAdjecent)
break;
}
- if (match || sel.relationToNext != BasicSelector::MatchNextSelectorIfAncestor)
+ if (match || (sel.relationToNext != BasicSelector::MatchNextSelectorIfAncestor &&
+ sel.relationToNext != BasicSelector::MatchNextSelectorIfIndirectAdjecent))
--i;
if (i < 0)
@@ -1885,16 +1892,18 @@ bool StyleSelector::selectorMatches(const Selector &selector, NodePtr node)
NodePtr nextParent = parentNode(node);
freeNode(node);
node = nextParent;
- } else if (sel.relationToNext == BasicSelector::MatchNextSelectorIfPreceeds) {
+ } else if (sel.relationToNext == BasicSelector::MatchNextSelectorIfDirectAdjecent
+ || sel.relationToNext == BasicSelector::MatchNextSelectorIfIndirectAdjecent) {
NodePtr previousSibling = previousSiblingNode(node);
freeNode(node);
node = previousSibling;
- }
+ }
if (isNullNode(node)) {
match = false;
break;
}
- } while (i >= 0 && (match || sel.relationToNext == BasicSelector::MatchNextSelectorIfAncestor));
+ } while (i >= 0 && (match || sel.relationToNext == BasicSelector::MatchNextSelectorIfAncestor
+ || sel.relationToNext == BasicSelector::MatchNextSelectorIfIndirectAdjecent));
freeNode(node);
@@ -1914,18 +1923,38 @@ bool StyleSelector::basicSelectorMatches(const BasicSelector &sel, NodePtr node)
if (attrValue.isNull())
return false;
- if (a.valueMatchCriterium == QCss::AttributeSelector::MatchContains) {
+ switch (a.valueMatchCriterium) {
+ case QCss::AttributeSelector::NoMatch:
+ break;
+ case QCss::AttributeSelector::MatchEqual:
+ if (attrValue != a.value)
+ return false;
+ break;
+ case QCss::AttributeSelector::MatchIncludes: {
const auto lst = attrValue.splitRef(QLatin1Char(' '));
if (!lst.contains(QStringRef(&a.value)))
return false;
- } else if (
- (a.valueMatchCriterium == QCss::AttributeSelector::MatchEqual
- && attrValue != a.value)
- ||
- (a.valueMatchCriterium == QCss::AttributeSelector::MatchBeginsWith
- && !attrValue.startsWith(a.value))
- )
- return false;
+ break;
+ }
+ case QCss::AttributeSelector::MatchDashMatch: {
+ const QString dashPrefix = a.value + QLatin1Char('-');
+ if (attrValue != a.value && !attrValue.startsWith(dashPrefix))
+ return false;
+ break;
+ }
+ case QCss::AttributeSelector::MatchBeginsWith:
+ if (!attrValue.startsWith(a.value))
+ return false;
+ break;
+ case QCss::AttributeSelector::MatchEndsWith:
+ if (!attrValue.endsWith(a.value))
+ return false;
+ break;
+ case QCss::AttributeSelector::MatchContains:
+ if (!attrValue.contains(a.value))
+ return false;
+ break;
+ }
}
}
@@ -2082,7 +2111,7 @@ QString Scanner::preprocess(const QString &input, bool *hasEscapeSequences)
hexCount = qMin(hexCount, 6);
bool ok = false;
- ushort code = output.mid(hexStart, hexCount).toUShort(&ok, 16);
+ ushort code = output.midRef(hexStart, hexCount).toUShort(&ok, 16);
if (ok) {
output.replace(hexStart - 1, hexCount + 1, QChar(code));
i = hexStart;
@@ -2336,9 +2365,11 @@ bool Parser::parseCombinator(BasicSelector::Relation *relation)
prev();
}
if (test(PLUS)) {
- *relation = BasicSelector::MatchNextSelectorIfPreceeds;
+ *relation = BasicSelector::MatchNextSelectorIfDirectAdjecent;
} else if (test(GREATER)) {
*relation = BasicSelector::MatchNextSelectorIfParent;
+ } else if (test(TILDE)) {
+ *relation = BasicSelector::MatchNextSelectorIfIndirectAdjecent;
}
skipSpace();
return true;
@@ -2439,7 +2470,7 @@ bool Parser::parseSimpleSelector(BasicSelector *basicSel)
onceMore = true;
AttributeSelector a;
a.name = QLatin1String("class");
- a.valueMatchCriterium = AttributeSelector::MatchContains;
+ a.valueMatchCriterium = AttributeSelector::MatchIncludes;
if (!parseClass(&a.value)) return false;
basicSel->attributeSelectors.append(a);
} else if (testAttrib()) {
@@ -2485,9 +2516,15 @@ bool Parser::parseAttrib(AttributeSelector *attr)
if (test(EQUAL)) {
attr->valueMatchCriterium = AttributeSelector::MatchEqual;
} else if (test(INCLUDES)) {
- attr->valueMatchCriterium = AttributeSelector::MatchContains;
+ attr->valueMatchCriterium = AttributeSelector::MatchIncludes;
} else if (test(DASHMATCH)) {
+ attr->valueMatchCriterium = AttributeSelector::MatchDashMatch;
+ } else if (test(BEGINSWITH)) {
attr->valueMatchCriterium = AttributeSelector::MatchBeginsWith;
+ } else if (test(ENDSWITH)) {
+ attr->valueMatchCriterium = AttributeSelector::MatchEndsWith;
+ } else if (test(CONTAINS)) {
+ attr->valueMatchCriterium = AttributeSelector::MatchContains;
} else {
return next(RBRACKET);
}
diff --git a/src/gui/text/qcssparser_p.h b/src/gui/text/qcssparser_p.h
index 4da7b62dba..9f79e9934e 100644
--- a/src/gui/text/qcssparser_p.h
+++ b/src/gui/text/qcssparser_p.h
@@ -44,13 +44,14 @@
// W A R N I N G
// -------------
//
-// This file is not part of the Qt API. It exists for the convenience
-// of the QLibrary class. This header file may change from
-// version to version without notice, or even be removed.
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
//
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#include <QtCore/QStringList>
#include <QtCore/QVector>
#include <QtCore/QVariant>
@@ -538,8 +539,11 @@ struct AttributeSelector
enum ValueMatchType {
NoMatch,
MatchEqual,
- MatchContains,
- MatchBeginsWith
+ MatchIncludes,
+ MatchDashMatch,
+ MatchBeginsWith,
+ MatchEndsWith,
+ MatchContains
};
inline AttributeSelector() : valueMatchCriterium(NoMatch) {}
@@ -557,7 +561,8 @@ struct BasicSelector
NoRelation,
MatchNextSelectorIfAncestor,
MatchNextSelectorIfParent,
- MatchNextSelectorIfPreceeds
+ MatchNextSelectorIfDirectAdjecent,
+ MatchNextSelectorIfIndirectAdjecent,
};
QString elementName;
@@ -678,11 +683,15 @@ enum TokenType {
CDC,
INCLUDES,
DASHMATCH,
+ BEGINSWITH,
+ ENDSWITH,
+ CONTAINS,
LBRACE,
PLUS,
GREATER,
COMMA,
+ TILDE,
STRING,
INVALID,
@@ -782,7 +791,7 @@ public:
inline bool testImport() { return testTokenAndEndsWith(ATKEYWORD_SYM, QLatin1String("import")); }
inline bool testMedia() { return testTokenAndEndsWith(ATKEYWORD_SYM, QLatin1String("media")); }
inline bool testPage() { return testTokenAndEndsWith(ATKEYWORD_SYM, QLatin1String("page")); }
- inline bool testCombinator() { return test(PLUS) || test(GREATER) || test(S); }
+ inline bool testCombinator() { return test(PLUS) || test(GREATER) || test(TILDE) || test(S); }
inline bool testProperty() { return test(IDENT); }
bool testTerm();
inline bool testExpr() { return testTerm(); }
diff --git a/src/gui/text/qcssscanner.cpp b/src/gui/text/qcssscanner.cpp
index f6b25d50ba..33dc01c8bc 100644
--- a/src/gui/text/qcssscanner.cpp
+++ b/src/gui/text/qcssscanner.cpp
@@ -88,8 +88,10 @@ int QCssScanner_Generated::lex()
goto state_3;
if (ch.unicode() == 35)
goto state_4;
- if (ch.unicode() == 39)
+ if (ch.unicode() == 36)
goto state_5;
+ if (ch.unicode() == 39)
+ goto state_6;
if (ch.unicode() == 40) {
token = QCss::LPAREN;
goto found;
@@ -98,22 +100,20 @@ int QCssScanner_Generated::lex()
token = QCss::RPAREN;
goto found;
}
- if (ch.unicode() == 42) {
- token = QCss::STAR;
- goto found;
- }
- if (ch.unicode() == 43)
+ if (ch.unicode() == 42)
goto state_9;
- if (ch.unicode() == 44)
+ if (ch.unicode() == 43)
goto state_10;
- if (ch.unicode() == 45)
+ if (ch.unicode() == 44)
goto state_11;
- if (ch.unicode() == 46)
+ if (ch.unicode() == 45)
goto state_12;
- if (ch.unicode() == 47)
+ if (ch.unicode() == 46)
goto state_13;
- if (ch.unicode() >= 48 && ch.unicode() <= 57)
+ if (ch.unicode() == 47)
goto state_14;
+ if (ch.unicode() >= 48 && ch.unicode() <= 57)
+ goto state_15;
if (ch.unicode() == 58) {
token = QCss::COLON;
goto found;
@@ -123,147 +123,167 @@ int QCssScanner_Generated::lex()
goto found;
}
if (ch.unicode() == 60)
- goto state_17;
+ goto state_18;
if (ch.unicode() == 61) {
token = QCss::EQUAL;
goto found;
}
if (ch.unicode() == 62)
- goto state_19;
- if (ch.unicode() == 64)
goto state_20;
+ if (ch.unicode() == 64)
+ goto state_21;
if (ch.unicode() == 91) {
token = QCss::LBRACKET;
goto found;
}
if (ch.unicode() == 92)
- goto state_22;
+ goto state_23;
if (ch.unicode() == 93) {
token = QCss::RBRACKET;
goto found;
}
+ if (ch.unicode() == 94)
+ goto state_25;
if (ch.unicode() == 95)
- goto state_24;
+ goto state_26;
if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256)
- goto state_24;
+ goto state_26;
if (ch.unicode() == 123)
- goto state_25;
+ goto state_27;
if (ch.unicode() == 124)
- goto state_26;
+ goto state_28;
if (ch.unicode() == 125) {
token = QCss::RBRACE;
goto found;
}
if (ch.unicode() == 126)
- goto state_28;
+ goto state_30;
goto out;
state_1:
lastAcceptingPos = pos;
token = QCss::S;
ch = next();
if (ch.unicode() >= 9 && ch.unicode() <= 10)
- goto state_29;
+ goto state_31;
if (ch.unicode() >= 12 && ch.unicode() <= 13)
- goto state_29;
+ goto state_31;
if (ch.unicode() == 32)
- goto state_29;
+ goto state_31;
if (ch.unicode() == 43)
- goto state_9;
- if (ch.unicode() == 44)
goto state_10;
+ if (ch.unicode() == 44)
+ goto state_11;
if (ch.unicode() == 62)
- goto state_19;
+ goto state_20;
if (ch.unicode() == 123)
- goto state_25;
+ goto state_27;
+ if (ch.unicode() == 126)
+ goto state_32;
goto out;
state_3:
lastAcceptingPos = pos;
token = QCss::INVALID;
ch = next();
if (ch.unicode() >= 1 && ch.unicode() <= 9)
- goto state_30;
+ goto state_33;
if (ch.unicode() == 11)
- goto state_30;
+ goto state_33;
if (ch.unicode() >= 14 && ch.unicode() <= 33)
- goto state_30;
+ goto state_33;
if (ch.unicode() == 34)
- goto state_31;
+ goto state_34;
if (ch.unicode() >= 35 && ch.unicode() <= 91)
- goto state_30;
+ goto state_33;
if (ch.unicode() == 92)
- goto state_32;
+ goto state_35;
if (ch.unicode() >= 93 && ch.unicode() <= 96)
- goto state_30;
+ goto state_33;
if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256)
- goto state_30;
+ goto state_33;
if (ch.unicode() >= 123)
- goto state_30;
+ goto state_33;
goto out;
state_4:
ch = next();
if (ch.unicode() == 45)
- goto state_33;
+ goto state_36;
if (ch.unicode() >= 48 && ch.unicode() <= 57)
- goto state_33;
+ goto state_36;
if (ch.unicode() == 92)
- goto state_34;
+ goto state_37;
if (ch.unicode() == 95)
- goto state_33;
+ goto state_36;
if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256)
- goto state_33;
+ goto state_36;
goto out;
state_5:
+ ch = next();
+ if (ch.unicode() == 61) {
+ token = QCss::ENDSWITH;
+ goto found;
+ }
+ goto out;
+ state_6:
lastAcceptingPos = pos;
token = QCss::INVALID;
ch = next();
if (ch.unicode() >= 1 && ch.unicode() <= 9)
- goto state_35;
+ goto state_39;
if (ch.unicode() == 11)
- goto state_35;
+ goto state_39;
if (ch.unicode() >= 14 && ch.unicode() <= 38)
- goto state_35;
+ goto state_39;
if (ch.unicode() == 39)
- goto state_36;
+ goto state_40;
if (ch.unicode() >= 40 && ch.unicode() <= 91)
- goto state_35;
+ goto state_39;
if (ch.unicode() == 92)
- goto state_37;
+ goto state_41;
if (ch.unicode() >= 93 && ch.unicode() <= 96)
- goto state_35;
+ goto state_39;
if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256)
- goto state_35;
+ goto state_39;
if (ch.unicode() >= 123)
- goto state_35;
+ goto state_39;
goto out;
state_9:
lastAcceptingPos = pos;
- token = QCss::PLUS;
+ token = QCss::STAR;
+ ch = next();
+ if (ch.unicode() == 61) {
+ token = QCss::CONTAINS;
+ goto found;
+ }
goto out;
state_10:
lastAcceptingPos = pos;
- token = QCss::COMMA;
+ token = QCss::PLUS;
goto out;
state_11:
lastAcceptingPos = pos;
+ token = QCss::COMMA;
+ goto out;
+ state_12:
+ lastAcceptingPos = pos;
token = QCss::MINUS;
ch = next();
if (ch.unicode() == 45)
- goto state_38;
+ goto state_43;
if (ch.unicode() == 92)
- goto state_22;
+ goto state_23;
if (ch.unicode() == 95)
- goto state_24;
+ goto state_26;
if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256)
- goto state_24;
+ goto state_26;
goto out;
- state_12:
+ state_13:
lastAcceptingPos = pos;
token = QCss::DOT;
ch = next();
if (ch.unicode() >= 48 && ch.unicode() <= 57)
- goto state_39;
+ goto state_44;
goto out;
- state_13:
+ state_14:
lastAcceptingPos = pos;
token = QCss::SLASH;
ch = next();
@@ -272,80 +292,87 @@ int QCssScanner_Generated::lex()
goto found;
}
goto out;
- state_14:
+ state_15:
lastAcceptingPos = pos;
token = QCss::NUMBER;
ch = next();
if (ch.unicode() == 37)
- goto state_41;
+ goto state_46;
if (ch.unicode() == 45)
- goto state_42;
+ goto state_47;
if (ch.unicode() == 46)
- goto state_43;
+ goto state_48;
if (ch.unicode() >= 48 && ch.unicode() <= 57)
- goto state_44;
+ goto state_49;
if (ch.unicode() == 92)
- goto state_45;
+ goto state_50;
if (ch.unicode() == 95)
- goto state_46;
+ goto state_51;
if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256)
- goto state_46;
+ goto state_51;
goto out;
- state_17:
+ state_18:
ch = next();
if (ch.unicode() == 33)
- goto state_47;
+ goto state_52;
goto out;
- state_19:
+ state_20:
lastAcceptingPos = pos;
token = QCss::GREATER;
goto out;
- state_20:
+ state_21:
ch = next();
if (ch.unicode() == 45)
- goto state_48;
+ goto state_53;
if (ch.unicode() == 92)
- goto state_49;
+ goto state_54;
if (ch.unicode() == 95)
- goto state_50;
+ goto state_55;
if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256)
- goto state_50;
+ goto state_55;
goto out;
- state_22:
+ state_23:
ch = next();
if (ch.unicode() >= 1 && ch.unicode() <= 9)
- goto state_51;
+ goto state_56;
if (ch.unicode() == 11)
- goto state_51;
+ goto state_56;
if (ch.unicode() >= 14 && ch.unicode() <= 47)
- goto state_51;
+ goto state_56;
if (ch.unicode() >= 58 && ch.unicode() <= 96)
- goto state_51;
+ goto state_56;
if (ch.unicode() >= 103)
- goto state_51;
+ goto state_56;
+ goto out;
+ state_25:
+ ch = next();
+ if (ch.unicode() == 61) {
+ token = QCss::BEGINSWITH;
+ goto found;
+ }
goto out;
- state_24:
+ state_26:
lastAcceptingPos = pos;
token = QCss::IDENT;
ch = next();
if (ch.unicode() == 40)
- goto state_52;
+ goto state_58;
if (ch.unicode() == 45)
- goto state_53;
+ goto state_59;
if (ch.unicode() >= 48 && ch.unicode() <= 57)
- goto state_53;
+ goto state_59;
if (ch.unicode() == 92)
- goto state_54;
+ goto state_60;
if (ch.unicode() == 95)
- goto state_53;
+ goto state_59;
if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256)
- goto state_53;
+ goto state_59;
goto out;
- state_25:
+ state_27:
lastAcceptingPos = pos;
token = QCss::LBRACE;
goto out;
- state_26:
+ state_28:
lastAcceptingPos = pos;
token = QCss::OR;
ch = next();
@@ -354,782 +381,790 @@ int QCssScanner_Generated::lex()
goto found;
}
goto out;
- state_28:
+ state_30:
+ lastAcceptingPos = pos;
+ token = QCss::TILDE;
ch = next();
if (ch.unicode() == 61) {
token = QCss::INCLUDES;
goto found;
}
goto out;
- state_29:
+ state_31:
lastAcceptingPos = pos;
token = QCss::S;
ch = next();
if (ch.unicode() >= 9 && ch.unicode() <= 10)
- goto state_29;
+ goto state_31;
if (ch.unicode() >= 12 && ch.unicode() <= 13)
- goto state_29;
+ goto state_31;
if (ch.unicode() == 32)
- goto state_29;
+ goto state_31;
if (ch.unicode() == 43)
- goto state_9;
- if (ch.unicode() == 44)
goto state_10;
+ if (ch.unicode() == 44)
+ goto state_11;
if (ch.unicode() == 62)
- goto state_19;
+ goto state_20;
if (ch.unicode() == 123)
- goto state_25;
+ goto state_27;
+ if (ch.unicode() == 126)
+ goto state_32;
goto out;
- state_30:
+ state_32:
+ lastAcceptingPos = pos;
+ token = QCss::TILDE;
+ goto out;
+ state_33:
lastAcceptingPos = pos;
token = QCss::INVALID;
ch = next();
if (ch.unicode() >= 1 && ch.unicode() <= 9)
- goto state_30;
+ goto state_33;
if (ch.unicode() == 11)
- goto state_30;
+ goto state_33;
if (ch.unicode() >= 14 && ch.unicode() <= 33)
- goto state_30;
+ goto state_33;
if (ch.unicode() == 34)
- goto state_31;
+ goto state_34;
if (ch.unicode() >= 35 && ch.unicode() <= 91)
- goto state_30;
+ goto state_33;
if (ch.unicode() == 92)
- goto state_32;
+ goto state_35;
if (ch.unicode() >= 93 && ch.unicode() <= 96)
- goto state_30;
+ goto state_33;
if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256)
- goto state_30;
+ goto state_33;
if (ch.unicode() >= 123)
- goto state_30;
+ goto state_33;
goto out;
- state_31:
+ state_34:
lastAcceptingPos = pos;
token = QCss::STRING;
goto out;
- state_32:
+ state_35:
ch = next();
if (ch.unicode() >= 1 && ch.unicode() <= 9)
- goto state_57;
+ goto state_63;
if (ch.unicode() == 10)
- goto state_58;
+ goto state_64;
if (ch.unicode() == 11)
- goto state_57;
+ goto state_63;
if (ch.unicode() == 12)
- goto state_59;
+ goto state_65;
if (ch.unicode() == 13)
- goto state_60;
+ goto state_66;
if (ch.unicode() >= 14 && ch.unicode() <= 47)
- goto state_57;
+ goto state_63;
if (ch.unicode() >= 58 && ch.unicode() <= 96)
- goto state_57;
+ goto state_63;
if (ch.unicode() >= 103)
- goto state_57;
+ goto state_63;
goto out;
- state_33:
+ state_36:
lastAcceptingPos = pos;
token = QCss::HASH;
ch = next();
if (ch.unicode() == 45)
- goto state_61;
+ goto state_67;
if (ch.unicode() >= 48 && ch.unicode() <= 57)
- goto state_61;
+ goto state_67;
if (ch.unicode() == 92)
- goto state_62;
+ goto state_68;
if (ch.unicode() == 95)
- goto state_61;
+ goto state_67;
if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256)
- goto state_61;
+ goto state_67;
goto out;
- state_34:
+ state_37:
ch = next();
if (ch.unicode() >= 1 && ch.unicode() <= 9)
- goto state_63;
+ goto state_69;
if (ch.unicode() == 11)
- goto state_63;
+ goto state_69;
if (ch.unicode() >= 14 && ch.unicode() <= 47)
- goto state_63;
+ goto state_69;
if (ch.unicode() >= 58 && ch.unicode() <= 96)
- goto state_63;
+ goto state_69;
if (ch.unicode() >= 103)
- goto state_63;
+ goto state_69;
goto out;
- state_35:
+ state_39:
lastAcceptingPos = pos;
token = QCss::INVALID;
ch = next();
if (ch.unicode() >= 1 && ch.unicode() <= 9)
- goto state_35;
+ goto state_39;
if (ch.unicode() == 11)
- goto state_35;
+ goto state_39;
if (ch.unicode() >= 14 && ch.unicode() <= 38)
- goto state_35;
+ goto state_39;
if (ch.unicode() == 39)
- goto state_36;
+ goto state_40;
if (ch.unicode() >= 40 && ch.unicode() <= 91)
- goto state_35;
+ goto state_39;
if (ch.unicode() == 92)
- goto state_37;
+ goto state_41;
if (ch.unicode() >= 93 && ch.unicode() <= 96)
- goto state_35;
+ goto state_39;
if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256)
- goto state_35;
+ goto state_39;
if (ch.unicode() >= 123)
- goto state_35;
+ goto state_39;
goto out;
- state_36:
+ state_40:
lastAcceptingPos = pos;
token = QCss::STRING;
goto out;
- state_37:
+ state_41:
ch = next();
if (ch.unicode() >= 1 && ch.unicode() <= 9)
- goto state_64;
+ goto state_70;
if (ch.unicode() == 10)
- goto state_65;
+ goto state_71;
if (ch.unicode() == 11)
- goto state_64;
+ goto state_70;
if (ch.unicode() == 12)
- goto state_66;
+ goto state_72;
if (ch.unicode() == 13)
- goto state_67;
+ goto state_73;
if (ch.unicode() >= 14 && ch.unicode() <= 47)
- goto state_64;
+ goto state_70;
if (ch.unicode() >= 58 && ch.unicode() <= 96)
- goto state_64;
+ goto state_70;
if (ch.unicode() >= 103)
- goto state_64;
+ goto state_70;
goto out;
- state_38:
+ state_43:
ch = next();
if (ch.unicode() == 62) {
token = QCss::CDC;
goto found;
}
goto out;
- state_39:
+ state_44:
lastAcceptingPos = pos;
token = QCss::NUMBER;
ch = next();
if (ch.unicode() == 37)
- goto state_41;
+ goto state_46;
if (ch.unicode() == 45)
- goto state_42;
+ goto state_47;
if (ch.unicode() >= 48 && ch.unicode() <= 57)
- goto state_69;
+ goto state_75;
if (ch.unicode() == 92)
- goto state_45;
+ goto state_50;
if (ch.unicode() == 95)
- goto state_46;
+ goto state_51;
if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256)
- goto state_46;
+ goto state_51;
goto out;
- state_41:
+ state_46:
lastAcceptingPos = pos;
token = QCss::PERCENTAGE;
goto out;
- state_42:
+ state_47:
ch = next();
if (ch.unicode() == 92)
- goto state_45;
+ goto state_50;
if (ch.unicode() == 95)
- goto state_46;
+ goto state_51;
if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256)
- goto state_46;
+ goto state_51;
goto out;
- state_43:
+ state_48:
ch = next();
if (ch.unicode() >= 48 && ch.unicode() <= 57)
- goto state_39;
+ goto state_44;
goto out;
- state_44:
+ state_49:
lastAcceptingPos = pos;
token = QCss::NUMBER;
ch = next();
if (ch.unicode() == 37)
- goto state_41;
+ goto state_46;
if (ch.unicode() == 45)
- goto state_42;
+ goto state_47;
if (ch.unicode() == 46)
- goto state_43;
+ goto state_48;
if (ch.unicode() >= 48 && ch.unicode() <= 57)
- goto state_44;
+ goto state_49;
if (ch.unicode() == 92)
- goto state_45;
+ goto state_50;
if (ch.unicode() == 95)
- goto state_46;
+ goto state_51;
if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256)
- goto state_46;
+ goto state_51;
goto out;
- state_45:
+ state_50:
ch = next();
if (ch.unicode() >= 1 && ch.unicode() <= 9)
- goto state_70;
+ goto state_76;
if (ch.unicode() == 11)
- goto state_70;
+ goto state_76;
if (ch.unicode() >= 14 && ch.unicode() <= 47)
- goto state_70;
+ goto state_76;
if (ch.unicode() >= 58 && ch.unicode() <= 96)
- goto state_70;
+ goto state_76;
if (ch.unicode() >= 103)
- goto state_70;
+ goto state_76;
goto out;
- state_46:
+ state_51:
lastAcceptingPos = pos;
token = QCss::LENGTH;
ch = next();
if (ch.unicode() == 45)
- goto state_71;
+ goto state_77;
if (ch.unicode() >= 48 && ch.unicode() <= 57)
- goto state_71;
+ goto state_77;
if (ch.unicode() == 92)
- goto state_72;
+ goto state_78;
if (ch.unicode() == 95)
- goto state_71;
+ goto state_77;
if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256)
- goto state_71;
+ goto state_77;
goto out;
- state_47:
+ state_52:
ch = next();
if (ch.unicode() == 45)
- goto state_73;
+ goto state_79;
goto out;
- state_48:
+ state_53:
ch = next();
if (ch.unicode() == 92)
- goto state_49;
+ goto state_54;
if (ch.unicode() == 95)
- goto state_50;
+ goto state_55;
if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256)
- goto state_50;
+ goto state_55;
goto out;
- state_49:
+ state_54:
ch = next();
if (ch.unicode() >= 1 && ch.unicode() <= 9)
- goto state_74;
+ goto state_80;
if (ch.unicode() == 11)
- goto state_74;
+ goto state_80;
if (ch.unicode() >= 14 && ch.unicode() <= 47)
- goto state_74;
+ goto state_80;
if (ch.unicode() >= 58 && ch.unicode() <= 96)
- goto state_74;
+ goto state_80;
if (ch.unicode() >= 103)
- goto state_74;
+ goto state_80;
goto out;
- state_50:
+ state_55:
lastAcceptingPos = pos;
token = QCss::ATKEYWORD_SYM;
ch = next();
if (ch.unicode() == 45)
- goto state_75;
+ goto state_81;
if (ch.unicode() >= 48 && ch.unicode() <= 57)
- goto state_75;
+ goto state_81;
if (ch.unicode() == 92)
- goto state_76;
+ goto state_82;
if (ch.unicode() == 95)
- goto state_75;
+ goto state_81;
if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256)
- goto state_75;
+ goto state_81;
goto out;
- state_51:
+ state_56:
lastAcceptingPos = pos;
token = QCss::IDENT;
ch = next();
if (ch.unicode() == 40)
- goto state_52;
+ goto state_58;
if (ch.unicode() == 45)
- goto state_53;
+ goto state_59;
if (ch.unicode() >= 48 && ch.unicode() <= 57)
- goto state_53;
+ goto state_59;
if (ch.unicode() == 92)
- goto state_54;
+ goto state_60;
if (ch.unicode() == 95)
- goto state_53;
+ goto state_59;
if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256)
- goto state_53;
+ goto state_59;
goto out;
- state_52:
+ state_58:
lastAcceptingPos = pos;
token = QCss::FUNCTION;
goto out;
- state_53:
+ state_59:
lastAcceptingPos = pos;
token = QCss::IDENT;
ch = next();
if (ch.unicode() == 40)
- goto state_52;
+ goto state_58;
if (ch.unicode() == 45)
- goto state_53;
+ goto state_59;
if (ch.unicode() >= 48 && ch.unicode() <= 57)
- goto state_53;
+ goto state_59;
if (ch.unicode() == 92)
- goto state_54;
+ goto state_60;
if (ch.unicode() == 95)
- goto state_53;
+ goto state_59;
if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256)
- goto state_53;
+ goto state_59;
goto out;
- state_54:
+ state_60:
ch = next();
if (ch.unicode() >= 1 && ch.unicode() <= 9)
- goto state_77;
+ goto state_83;
if (ch.unicode() == 11)
- goto state_77;
+ goto state_83;
if (ch.unicode() >= 14 && ch.unicode() <= 47)
- goto state_77;
+ goto state_83;
if (ch.unicode() >= 58 && ch.unicode() <= 96)
- goto state_77;
+ goto state_83;
if (ch.unicode() >= 103)
- goto state_77;
+ goto state_83;
goto out;
- state_57:
+ state_63:
lastAcceptingPos = pos;
token = QCss::INVALID;
ch = next();
if (ch.unicode() >= 1 && ch.unicode() <= 9)
- goto state_30;
+ goto state_33;
if (ch.unicode() == 11)
- goto state_30;
+ goto state_33;
if (ch.unicode() >= 14 && ch.unicode() <= 33)
- goto state_30;
+ goto state_33;
if (ch.unicode() == 34)
- goto state_31;
+ goto state_34;
if (ch.unicode() >= 35 && ch.unicode() <= 91)
- goto state_30;
+ goto state_33;
if (ch.unicode() == 92)
- goto state_32;
+ goto state_35;
if (ch.unicode() >= 93 && ch.unicode() <= 96)
- goto state_30;
+ goto state_33;
if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256)
- goto state_30;
+ goto state_33;
if (ch.unicode() >= 123)
- goto state_30;
+ goto state_33;
goto out;
- state_58:
+ state_64:
lastAcceptingPos = pos;
token = QCss::INVALID;
ch = next();
if (ch.unicode() >= 1 && ch.unicode() <= 9)
- goto state_30;
+ goto state_33;
if (ch.unicode() == 11)
- goto state_30;
+ goto state_33;
if (ch.unicode() >= 14 && ch.unicode() <= 33)
- goto state_30;
+ goto state_33;
if (ch.unicode() == 34)
- goto state_31;
+ goto state_34;
if (ch.unicode() >= 35 && ch.unicode() <= 91)
- goto state_30;
+ goto state_33;
if (ch.unicode() == 92)
- goto state_32;
+ goto state_35;
if (ch.unicode() >= 93 && ch.unicode() <= 96)
- goto state_30;
+ goto state_33;
if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256)
- goto state_30;
+ goto state_33;
if (ch.unicode() >= 123)
- goto state_30;
+ goto state_33;
goto out;
- state_59:
+ state_65:
lastAcceptingPos = pos;
token = QCss::INVALID;
ch = next();
if (ch.unicode() >= 1 && ch.unicode() <= 9)
- goto state_30;
+ goto state_33;
if (ch.unicode() == 11)
- goto state_30;
+ goto state_33;
if (ch.unicode() >= 14 && ch.unicode() <= 33)
- goto state_30;
+ goto state_33;
if (ch.unicode() == 34)
- goto state_31;
+ goto state_34;
if (ch.unicode() >= 35 && ch.unicode() <= 91)
- goto state_30;
+ goto state_33;
if (ch.unicode() == 92)
- goto state_32;
+ goto state_35;
if (ch.unicode() >= 93 && ch.unicode() <= 96)
- goto state_30;
+ goto state_33;
if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256)
- goto state_30;
+ goto state_33;
if (ch.unicode() >= 123)
- goto state_30;
+ goto state_33;
goto out;
- state_60:
+ state_66:
lastAcceptingPos = pos;
token = QCss::INVALID;
ch = next();
if (ch.unicode() >= 1 && ch.unicode() <= 9)
- goto state_30;
+ goto state_33;
if (ch.unicode() == 10)
- goto state_78;
+ goto state_84;
if (ch.unicode() == 11)
- goto state_30;
+ goto state_33;
if (ch.unicode() >= 14 && ch.unicode() <= 33)
- goto state_30;
+ goto state_33;
if (ch.unicode() == 34)
- goto state_31;
+ goto state_34;
if (ch.unicode() >= 35 && ch.unicode() <= 91)
- goto state_30;
+ goto state_33;
if (ch.unicode() == 92)
- goto state_32;
+ goto state_35;
if (ch.unicode() >= 93 && ch.unicode() <= 96)
- goto state_30;
+ goto state_33;
if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256)
- goto state_30;
+ goto state_33;
if (ch.unicode() >= 123)
- goto state_30;
+ goto state_33;
goto out;
- state_61:
+ state_67:
lastAcceptingPos = pos;
token = QCss::HASH;
ch = next();
if (ch.unicode() == 45)
- goto state_61;
+ goto state_67;
if (ch.unicode() >= 48 && ch.unicode() <= 57)
- goto state_61;
+ goto state_67;
if (ch.unicode() == 92)
- goto state_62;
+ goto state_68;
if (ch.unicode() == 95)
- goto state_61;
+ goto state_67;
if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256)
- goto state_61;
+ goto state_67;
goto out;
- state_62:
+ state_68:
ch = next();
if (ch.unicode() >= 1 && ch.unicode() <= 9)
- goto state_79;
+ goto state_85;
if (ch.unicode() == 11)
- goto state_79;
+ goto state_85;
if (ch.unicode() >= 14 && ch.unicode() <= 47)
- goto state_79;
+ goto state_85;
if (ch.unicode() >= 58 && ch.unicode() <= 96)
- goto state_79;
+ goto state_85;
if (ch.unicode() >= 103)
- goto state_79;
+ goto state_85;
goto out;
- state_63:
+ state_69:
lastAcceptingPos = pos;
token = QCss::HASH;
ch = next();
if (ch.unicode() == 45)
- goto state_61;
+ goto state_67;
if (ch.unicode() >= 48 && ch.unicode() <= 57)
- goto state_61;
+ goto state_67;
if (ch.unicode() == 92)
- goto state_62;
+ goto state_68;
if (ch.unicode() == 95)
- goto state_61;
+ goto state_67;
if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256)
- goto state_61;
+ goto state_67;
goto out;
- state_64:
+ state_70:
lastAcceptingPos = pos;
token = QCss::INVALID;
ch = next();
if (ch.unicode() >= 1 && ch.unicode() <= 9)
- goto state_35;
+ goto state_39;
if (ch.unicode() == 11)
- goto state_35;
+ goto state_39;
if (ch.unicode() >= 14 && ch.unicode() <= 38)
- goto state_35;
+ goto state_39;
if (ch.unicode() == 39)
- goto state_36;
+ goto state_40;
if (ch.unicode() >= 40 && ch.unicode() <= 91)
- goto state_35;
+ goto state_39;
if (ch.unicode() == 92)
- goto state_37;
+ goto state_41;
if (ch.unicode() >= 93 && ch.unicode() <= 96)
- goto state_35;
+ goto state_39;
if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256)
- goto state_35;
+ goto state_39;
if (ch.unicode() >= 123)
- goto state_35;
+ goto state_39;
goto out;
- state_65:
+ state_71:
lastAcceptingPos = pos;
token = QCss::INVALID;
ch = next();
if (ch.unicode() >= 1 && ch.unicode() <= 9)
- goto state_35;
+ goto state_39;
if (ch.unicode() == 11)
- goto state_35;
+ goto state_39;
if (ch.unicode() >= 14 && ch.unicode() <= 38)
- goto state_35;
+ goto state_39;
if (ch.unicode() == 39)
- goto state_36;
+ goto state_40;
if (ch.unicode() >= 40 && ch.unicode() <= 91)
- goto state_35;
+ goto state_39;
if (ch.unicode() == 92)
- goto state_37;
+ goto state_41;
if (ch.unicode() >= 93 && ch.unicode() <= 96)
- goto state_35;
+ goto state_39;
if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256)
- goto state_35;
+ goto state_39;
if (ch.unicode() >= 123)
- goto state_35;
+ goto state_39;
goto out;
- state_66:
+ state_72:
lastAcceptingPos = pos;
token = QCss::INVALID;
ch = next();
if (ch.unicode() >= 1 && ch.unicode() <= 9)
- goto state_35;
+ goto state_39;
if (ch.unicode() == 11)
- goto state_35;
+ goto state_39;
if (ch.unicode() >= 14 && ch.unicode() <= 38)
- goto state_35;
+ goto state_39;
if (ch.unicode() == 39)
- goto state_36;
+ goto state_40;
if (ch.unicode() >= 40 && ch.unicode() <= 91)
- goto state_35;
+ goto state_39;
if (ch.unicode() == 92)
- goto state_37;
+ goto state_41;
if (ch.unicode() >= 93 && ch.unicode() <= 96)
- goto state_35;
+ goto state_39;
if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256)
- goto state_35;
+ goto state_39;
if (ch.unicode() >= 123)
- goto state_35;
+ goto state_39;
goto out;
- state_67:
+ state_73:
lastAcceptingPos = pos;
token = QCss::INVALID;
ch = next();
if (ch.unicode() >= 1 && ch.unicode() <= 9)
- goto state_35;
+ goto state_39;
if (ch.unicode() == 10)
- goto state_80;
+ goto state_86;
if (ch.unicode() == 11)
- goto state_35;
+ goto state_39;
if (ch.unicode() >= 14 && ch.unicode() <= 38)
- goto state_35;
+ goto state_39;
if (ch.unicode() == 39)
- goto state_36;
+ goto state_40;
if (ch.unicode() >= 40 && ch.unicode() <= 91)
- goto state_35;
+ goto state_39;
if (ch.unicode() == 92)
- goto state_37;
+ goto state_41;
if (ch.unicode() >= 93 && ch.unicode() <= 96)
- goto state_35;
+ goto state_39;
if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256)
- goto state_35;
+ goto state_39;
if (ch.unicode() >= 123)
- goto state_35;
+ goto state_39;
goto out;
- state_69:
+ state_75:
lastAcceptingPos = pos;
token = QCss::NUMBER;
ch = next();
if (ch.unicode() == 37)
- goto state_41;
+ goto state_46;
if (ch.unicode() == 45)
- goto state_42;
+ goto state_47;
if (ch.unicode() >= 48 && ch.unicode() <= 57)
- goto state_69;
+ goto state_75;
if (ch.unicode() == 92)
- goto state_45;
+ goto state_50;
if (ch.unicode() == 95)
- goto state_46;
+ goto state_51;
if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256)
- goto state_46;
+ goto state_51;
goto out;
- state_70:
+ state_76:
lastAcceptingPos = pos;
token = QCss::LENGTH;
ch = next();
if (ch.unicode() == 45)
- goto state_71;
+ goto state_77;
if (ch.unicode() >= 48 && ch.unicode() <= 57)
- goto state_71;
+ goto state_77;
if (ch.unicode() == 92)
- goto state_72;
+ goto state_78;
if (ch.unicode() == 95)
- goto state_71;
+ goto state_77;
if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256)
- goto state_71;
+ goto state_77;
goto out;
- state_71:
+ state_77:
lastAcceptingPos = pos;
token = QCss::LENGTH;
ch = next();
if (ch.unicode() == 45)
- goto state_71;
+ goto state_77;
if (ch.unicode() >= 48 && ch.unicode() <= 57)
- goto state_71;
+ goto state_77;
if (ch.unicode() == 92)
- goto state_72;
+ goto state_78;
if (ch.unicode() == 95)
- goto state_71;
+ goto state_77;
if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256)
- goto state_71;
+ goto state_77;
goto out;
- state_72:
+ state_78:
ch = next();
if (ch.unicode() >= 1 && ch.unicode() <= 9)
- goto state_81;
+ goto state_87;
if (ch.unicode() == 11)
- goto state_81;
+ goto state_87;
if (ch.unicode() >= 14 && ch.unicode() <= 47)
- goto state_81;
+ goto state_87;
if (ch.unicode() >= 58 && ch.unicode() <= 96)
- goto state_81;
+ goto state_87;
if (ch.unicode() >= 103)
- goto state_81;
+ goto state_87;
goto out;
- state_73:
+ state_79:
ch = next();
if (ch.unicode() == 45) {
token = QCss::CDO;
goto found;
}
goto out;
- state_74:
+ state_80:
lastAcceptingPos = pos;
token = QCss::ATKEYWORD_SYM;
ch = next();
if (ch.unicode() == 45)
- goto state_75;
+ goto state_81;
if (ch.unicode() >= 48 && ch.unicode() <= 57)
- goto state_75;
+ goto state_81;
if (ch.unicode() == 92)
- goto state_76;
+ goto state_82;
if (ch.unicode() == 95)
- goto state_75;
+ goto state_81;
if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256)
- goto state_75;
+ goto state_81;
goto out;
- state_75:
+ state_81:
lastAcceptingPos = pos;
token = QCss::ATKEYWORD_SYM;
ch = next();
if (ch.unicode() == 45)
- goto state_75;
+ goto state_81;
if (ch.unicode() >= 48 && ch.unicode() <= 57)
- goto state_75;
+ goto state_81;
if (ch.unicode() == 92)
- goto state_76;
+ goto state_82;
if (ch.unicode() == 95)
- goto state_75;
+ goto state_81;
if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256)
- goto state_75;
+ goto state_81;
goto out;
- state_76:
+ state_82:
ch = next();
if (ch.unicode() >= 1 && ch.unicode() <= 9)
- goto state_83;
+ goto state_89;
if (ch.unicode() == 11)
- goto state_83;
+ goto state_89;
if (ch.unicode() >= 14 && ch.unicode() <= 47)
- goto state_83;
+ goto state_89;
if (ch.unicode() >= 58 && ch.unicode() <= 96)
- goto state_83;
+ goto state_89;
if (ch.unicode() >= 103)
- goto state_83;
+ goto state_89;
goto out;
- state_77:
+ state_83:
lastAcceptingPos = pos;
token = QCss::IDENT;
ch = next();
if (ch.unicode() == 40)
- goto state_52;
+ goto state_58;
if (ch.unicode() == 45)
- goto state_53;
+ goto state_59;
if (ch.unicode() >= 48 && ch.unicode() <= 57)
- goto state_53;
+ goto state_59;
if (ch.unicode() == 92)
- goto state_54;
+ goto state_60;
if (ch.unicode() == 95)
- goto state_53;
+ goto state_59;
if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256)
- goto state_53;
+ goto state_59;
goto out;
- state_78:
+ state_84:
lastAcceptingPos = pos;
token = QCss::INVALID;
ch = next();
if (ch.unicode() >= 1 && ch.unicode() <= 9)
- goto state_30;
+ goto state_33;
if (ch.unicode() == 11)
- goto state_30;
+ goto state_33;
if (ch.unicode() >= 14 && ch.unicode() <= 33)
- goto state_30;
+ goto state_33;
if (ch.unicode() == 34)
- goto state_31;
+ goto state_34;
if (ch.unicode() >= 35 && ch.unicode() <= 91)
- goto state_30;
+ goto state_33;
if (ch.unicode() == 92)
- goto state_32;
+ goto state_35;
if (ch.unicode() >= 93 && ch.unicode() <= 96)
- goto state_30;
+ goto state_33;
if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256)
- goto state_30;
+ goto state_33;
if (ch.unicode() >= 123)
- goto state_30;
+ goto state_33;
goto out;
- state_79:
+ state_85:
lastAcceptingPos = pos;
token = QCss::HASH;
ch = next();
if (ch.unicode() == 45)
- goto state_61;
+ goto state_67;
if (ch.unicode() >= 48 && ch.unicode() <= 57)
- goto state_61;
+ goto state_67;
if (ch.unicode() == 92)
- goto state_62;
+ goto state_68;
if (ch.unicode() == 95)
- goto state_61;
+ goto state_67;
if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256)
- goto state_61;
+ goto state_67;
goto out;
- state_80:
+ state_86:
lastAcceptingPos = pos;
token = QCss::INVALID;
ch = next();
if (ch.unicode() >= 1 && ch.unicode() <= 9)
- goto state_35;
+ goto state_39;
if (ch.unicode() == 11)
- goto state_35;
+ goto state_39;
if (ch.unicode() >= 14 && ch.unicode() <= 38)
- goto state_35;
+ goto state_39;
if (ch.unicode() == 39)
- goto state_36;
+ goto state_40;
if (ch.unicode() >= 40 && ch.unicode() <= 91)
- goto state_35;
+ goto state_39;
if (ch.unicode() == 92)
- goto state_37;
+ goto state_41;
if (ch.unicode() >= 93 && ch.unicode() <= 96)
- goto state_35;
+ goto state_39;
if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256)
- goto state_35;
+ goto state_39;
if (ch.unicode() >= 123)
- goto state_35;
+ goto state_39;
goto out;
- state_81:
+ state_87:
lastAcceptingPos = pos;
token = QCss::LENGTH;
ch = next();
if (ch.unicode() == 45)
- goto state_71;
+ goto state_77;
if (ch.unicode() >= 48 && ch.unicode() <= 57)
- goto state_71;
+ goto state_77;
if (ch.unicode() == 92)
- goto state_72;
+ goto state_78;
if (ch.unicode() == 95)
- goto state_71;
+ goto state_77;
if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256)
- goto state_71;
+ goto state_77;
goto out;
- state_83:
+ state_89:
lastAcceptingPos = pos;
token = QCss::ATKEYWORD_SYM;
ch = next();
if (ch.unicode() == 45)
- goto state_75;
+ goto state_81;
if (ch.unicode() >= 48 && ch.unicode() <= 57)
- goto state_75;
+ goto state_81;
if (ch.unicode() == 92)
- goto state_76;
+ goto state_82;
if (ch.unicode() == 95)
- goto state_75;
+ goto state_81;
if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256)
- goto state_75;
+ goto state_81;
goto out;
found:
lastAcceptingPos = pos;
diff --git a/src/gui/text/qdistancefield.cpp b/src/gui/text/qdistancefield.cpp
index 5a696807b4..933dd1bf54 100644
--- a/src/gui/text/qdistancefield.cpp
+++ b/src/gui/text/qdistancefield.cpp
@@ -45,6 +45,8 @@
QT_BEGIN_NAMESPACE
+Q_LOGGING_CATEGORY(lcDistanceField, "qt.distanceField");
+
namespace
{
enum FillHDir
@@ -736,8 +738,40 @@ static bool imageHasNarrowOutlines(const QImage &im)
return minHThick == 1 || minVThick == 1;
}
+static int QT_DISTANCEFIELD_DEFAULT_BASEFONTSIZE = 54;
+static int QT_DISTANCEFIELD_DEFAULT_SCALE = 16;
+static int QT_DISTANCEFIELD_DEFAULT_RADIUS = 80;
+static int QT_DISTANCEFIELD_DEFAULT_HIGHGLYPHCOUNT = 2000;
+
+static void initialDistanceFieldFactor()
+{
+ static bool initialized = false;
+ if (initialized)
+ return;
+ initialized = true;
+
+ if (qEnvironmentVariableIsSet("QT_DISTANCEFIELD_DEFAULT_BASEFONTSIZE")) {
+ QT_DISTANCEFIELD_DEFAULT_BASEFONTSIZE = qEnvironmentVariableIntValue("QT_DISTANCEFIELD_DEFAULT_BASEFONTSIZE");
+ qCDebug(lcDistanceField) << "set the QT_DISTANCEFIELD_DEFAULT_BASEFONTSIZE:" << QT_DISTANCEFIELD_DEFAULT_BASEFONTSIZE;
+ }
+
+ if (qEnvironmentVariableIsSet("QT_DISTANCEFIELD_DEFAULT_SCALE")) {
+ QT_DISTANCEFIELD_DEFAULT_SCALE = qEnvironmentVariableIntValue("QT_DISTANCEFIELD_DEFAULT_SCALE");
+ qCDebug(lcDistanceField) << "set the QT_DISTANCEFIELD_DEFAULT_SCALE:" << QT_DISTANCEFIELD_DEFAULT_SCALE;
+ }
+ if (qEnvironmentVariableIsSet("QT_DISTANCEFIELD_DEFAULT_RADIUS")) {
+ QT_DISTANCEFIELD_DEFAULT_RADIUS = qEnvironmentVariableIntValue("QT_DISTANCEFIELD_DEFAULT_RADIUS");
+ qDebug(lcDistanceField) << "set the QT_DISTANCEFIELD_DEFAULT_RADIUS:" << QT_DISTANCEFIELD_DEFAULT_RADIUS;
+ }
+ if (qEnvironmentVariableIsSet("QT_DISTANCEFIELD_DEFAULT_HIGHGLYPHCOUNT")) {
+ QT_DISTANCEFIELD_DEFAULT_HIGHGLYPHCOUNT = qEnvironmentVariableIntValue("QT_DISTANCEFIELD_DEFAULT_HIGHGLYPHCOUNT");
+ qCDebug(lcDistanceField) << "set the QT_DISTANCEFIELD_DEFAULT_HIGHGLYPHCOUNT:" << QT_DISTANCEFIELD_DEFAULT_HIGHGLYPHCOUNT;
+ }
+}
+
bool qt_fontHasNarrowOutlines(QFontEngine *fontEngine)
{
+ initialDistanceFieldFactor();
QFontEngine *fe = fontEngine->cloneWithSize(QT_DISTANCEFIELD_DEFAULT_BASEFONTSIZE);
if (!fe)
return false;
@@ -757,6 +791,7 @@ bool qt_fontHasNarrowOutlines(QFontEngine *fontEngine)
bool qt_fontHasNarrowOutlines(const QRawFont &f)
{
QRawFont font = f;
+ initialDistanceFieldFactor();
font.setPixelSize(QT_DISTANCEFIELD_DEFAULT_BASEFONTSIZE);
if (!font.isValid())
return false;
@@ -769,6 +804,41 @@ bool qt_fontHasNarrowOutlines(const QRawFont &f)
QRawFont::PixelAntialiasing));
}
+int QT_DISTANCEFIELD_BASEFONTSIZE(bool narrowOutlineFont)
+{
+ initialDistanceFieldFactor();
+
+ if (Q_UNLIKELY(narrowOutlineFont))
+ return QT_DISTANCEFIELD_DEFAULT_BASEFONTSIZE * 2;
+ else
+ return QT_DISTANCEFIELD_DEFAULT_BASEFONTSIZE;
+}
+
+int QT_DISTANCEFIELD_SCALE(bool narrowOutlineFont)
+{
+ initialDistanceFieldFactor();
+
+ if (Q_UNLIKELY(narrowOutlineFont))
+ return QT_DISTANCEFIELD_DEFAULT_SCALE / 2;
+ else
+ return QT_DISTANCEFIELD_DEFAULT_SCALE;
+}
+
+int QT_DISTANCEFIELD_RADIUS(bool narrowOutlineFont)
+{
+ initialDistanceFieldFactor();
+
+ if (Q_UNLIKELY(narrowOutlineFont))
+ return QT_DISTANCEFIELD_DEFAULT_RADIUS / 2;
+ else
+ return QT_DISTANCEFIELD_DEFAULT_RADIUS;
+}
+
+int QT_DISTANCEFIELD_HIGHGLYPHCOUNT()
+{
+ initialDistanceFieldFactor();
+ return QT_DISTANCEFIELD_DEFAULT_HIGHGLYPHCOUNT;
+}
QDistanceFieldData::QDistanceFieldData(const QDistanceFieldData &other)
: QSharedData(other)
diff --git a/src/gui/text/qdistancefield_p.h b/src/gui/text/qdistancefield_p.h
index c6c5e6b650..27ab84332c 100644
--- a/src/gui/text/qdistancefield_p.h
+++ b/src/gui/text/qdistancefield_p.h
@@ -51,30 +51,24 @@
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#include <qrawfont.h>
#include <private/qfontengine_p.h>
#include <QtCore/qshareddata.h>
+#include <QtCore/qglobal.h>
+#include <QLoggingCategory>
QT_BEGIN_NAMESPACE
-#define QT_DISTANCEFIELD_DEFAULT_BASEFONTSIZE 54
-#define QT_DISTANCEFIELD_DEFAULT_SCALE 16
-#define QT_DISTANCEFIELD_DEFAULT_RADIUS 80
-#define QT_DISTANCEFIELD_HIGHGLYPHCOUNT 2000
-
-#define QT_DISTANCEFIELD_BASEFONTSIZE(NarrowOutlineFont) \
- (NarrowOutlineFont ? QT_DISTANCEFIELD_DEFAULT_BASEFONTSIZE * 2 : \
- QT_DISTANCEFIELD_DEFAULT_BASEFONTSIZE)
-#define QT_DISTANCEFIELD_SCALE(NarrowOutlineFont) \
- (NarrowOutlineFont ? QT_DISTANCEFIELD_DEFAULT_SCALE / 2 : \
- QT_DISTANCEFIELD_DEFAULT_SCALE)
-#define QT_DISTANCEFIELD_RADIUS(NarrowOutlineFont) \
- (NarrowOutlineFont ? QT_DISTANCEFIELD_DEFAULT_RADIUS / 2 : \
- QT_DISTANCEFIELD_DEFAULT_RADIUS)
-
bool Q_GUI_EXPORT qt_fontHasNarrowOutlines(const QRawFont &f);
bool Q_GUI_EXPORT qt_fontHasNarrowOutlines(QFontEngine *fontEngine);
+int Q_GUI_EXPORT QT_DISTANCEFIELD_BASEFONTSIZE(bool narrowOutlineFont);
+int Q_GUI_EXPORT QT_DISTANCEFIELD_TILESIZE(bool narrowOutlineFont);
+int Q_GUI_EXPORT QT_DISTANCEFIELD_SCALE(bool narrowOutlineFont);
+int Q_GUI_EXPORT QT_DISTANCEFIELD_RADIUS(bool narrowOutlineFont);
+int Q_GUI_EXPORT QT_DISTANCEFIELD_HIGHGLYPHCOUNT();
+
class Q_GUI_EXPORT QDistanceFieldData : public QSharedData
{
public:
diff --git a/src/gui/text/qfont.cpp b/src/gui/text/qfont.cpp
index 9e4f61ebee..3b24039ea6 100644
--- a/src/gui/text/qfont.cpp
+++ b/src/gui/text/qfont.cpp
@@ -1376,6 +1376,7 @@ void QFont::setStyleStrategy(StyleStrategy s)
Predefined stretch values that follow the CSS naming convention. The higher
the value, the more stretched the text is.
+ \value AnyStretch 0 Accept any stretch matched using the other QFont properties (added in Qt 5.8)
\value UltraCondensed 50
\value ExtraCondensed 62
\value Condensed 75
@@ -1402,20 +1403,25 @@ int QFont::stretch() const
/*!
Sets the stretch factor for the font.
- The stretch factor changes the width of all characters in the font
- by \a factor percent. For example, setting \a factor to 150
+ The stretch factor matches a condensed or expanded version of the font or
+ applies a stretch transform that changes the width of all characters
+ in the font by \a factor percent. For example, setting \a factor to 150
results in all characters in the font being 1.5 times (ie. 150%)
- wider. The default stretch factor is 100. The minimum stretch
- factor is 1, and the maximum stretch factor is 4000.
+ wider. The minimum stretch factor is 1, and the maximum stretch factor
+ is 4000. The default stretch factor is \c AnyStretch, which will accept
+ any stretch factor and not apply any transform on the font.
The stretch factor is only applied to outline fonts. The stretch
factor is ignored for bitmap fonts.
+ \note When matching a font with a native non-default stretch factor,
+ requesting a stretch of 100 will stretch it back to a medium width font.
+
\sa stretch(), QFont::Stretch
*/
void QFont::setStretch(int factor)
{
- if (factor < 1 || factor > 4000) {
+ if (factor < 0 || factor > 4000) {
qWarning("QFont::setStretch: Parameter '%d' out of range", factor);
return;
}
@@ -2001,7 +2007,7 @@ QString QFont::key() const
QString QFont::toString() const
{
const QChar comma(QLatin1Char(','));
- return family() + comma +
+ QString fontDescription = family() + comma +
QString::number( pointSizeF()) + comma +
QString::number( pixelSize()) + comma +
QString::number((int) styleHint()) + comma +
@@ -2011,6 +2017,12 @@ QString QFont::toString() const
QString::number((int) strikeOut()) + comma +
QString::number((int)fixedPitch()) + comma +
QString::number((int) false);
+
+ QString fontStyle = styleName();
+ if (!fontStyle.isEmpty())
+ fontDescription += comma + fontStyle;
+
+ return fontDescription;
}
/*!
@@ -2054,7 +2066,7 @@ bool QFont::fromString(const QString &descrip)
setUnderline(l[5].toInt());
setStrikeOut(l[6].toInt());
setFixedPitch(l[7].toInt());
- } else if (count == 10) {
+ } else if (count >= 10) {
if (l[2].toInt() > 0)
setPixelSize(l[2].toInt());
setStyleHint((StyleHint) l[3].toInt());
@@ -2063,7 +2075,10 @@ bool QFont::fromString(const QString &descrip)
setUnderline(l[6].toInt());
setStrikeOut(l[7].toInt());
setFixedPitch(l[8].toInt());
+ if (count == 11)
+ d->request.styleName = l[10].toString();
}
+
if (count >= 9 && !d->request.fixedPitch) // assume 'false' fixedPitch equals default
d->request.ignorePitch = true;
diff --git a/src/gui/text/qfont.h b/src/gui/text/qfont.h
index 85a237643c..6f0dd27fbe 100644
--- a/src/gui/text/qfont.h
+++ b/src/gui/text/qfont.h
@@ -40,6 +40,7 @@
#ifndef QFONT_H
#define QFONT_H
+#include <QtGui/qtguiglobal.h>
#include <QtGui/qwindowdefs.h>
#include <QtCore/qstring.h>
#include <QtCore/qsharedpointer.h>
@@ -112,6 +113,7 @@ public:
};
enum Stretch {
+ AnyStretch = 0,
UltraCondensed = 50,
ExtraCondensed = 62,
Condensed = 75,
diff --git a/src/gui/text/qfont_p.h b/src/gui/text/qfont_p.h
index 3979bb27ac..9e5d0b4329 100644
--- a/src/gui/text/qfont_p.h
+++ b/src/gui/text/qfont_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#include "QtGui/qfont.h"
#include "QtCore/qmap.h"
#include "QtCore/qhash.h"
@@ -70,7 +71,7 @@ struct QFontDef
inline QFontDef()
: pointSize(-1.0), pixelSize(-1),
styleStrategy(QFont::PreferDefault), styleHint(QFont::AnyStyle),
- weight(50), fixedPitch(false), style(QFont::StyleNormal), stretch(100),
+ weight(50), fixedPitch(false), style(QFont::StyleNormal), stretch(QFont::AnyStretch),
hintingPreference(QFont::PreferDefaultHinting), ignorePitch(true),
fixedPitchComputed(0), reserved(0)
{
diff --git a/src/gui/text/qfontdatabase.cpp b/src/gui/text/qfontdatabase.cpp
index 283d03f22c..7fcac9b9f2 100644
--- a/src/gui/text/qfontdatabase.cpp
+++ b/src/gui/text/qfontdatabase.cpp
@@ -663,11 +663,8 @@ struct QtFontDesc
static void initFontDef(const QtFontDesc &desc, const QFontDef &request, QFontDef *fontDef, bool multi)
{
fontDef->family = desc.family->name;
- if (! desc.foundry->name.isEmpty() && desc.family->count > 1) {
- fontDef->family += QString::fromLatin1(" [");
- fontDef->family += desc.foundry->name;
- fontDef->family += QLatin1Char(']');
- }
+ if (! desc.foundry->name.isEmpty() && desc.family->count > 1)
+ fontDef->family += QLatin1String(" [") + desc.foundry->name + QLatin1Char(']');
if (desc.style->smoothScalable
|| QGuiApplicationPrivate::platformIntegration()->fontDatabase()->fontsAlwaysScalable()
@@ -955,12 +952,14 @@ QFontEngine *loadSingleEngine(int script,
}
}
- // If the font data's native stretch matches the requested stretch we need to set stretch to 100
- // to avoid the fontengine synthesizing stretch. If they didn't match exactly we need to calculate
- // the new stretch factor. This only done if not matched by styleName.
+ // To avoid synthesized stretch we need a matching stretch to be 100 after this point.
+ // If stretch didn't match exactly we need to calculate the new stretch factor.
+ // This only done if not matched by styleName.
if (style->key.stretch != 0 && request.stretch != 0
&& (request.styleName.isEmpty() || request.styleName != style->styleName)) {
- def.stretch = (request.stretch * 100 + 50) / style->key.stretch;
+ def.stretch = (request.stretch * 100 + style->key.stretch / 2) / style->key.stretch;
+ } else {
+ def.stretch = 100;
}
engine = pfdb->fontEngine(def, size->handle);
@@ -1223,7 +1222,8 @@ static int match(int script, const QFontDef &request,
QtFontStyle::Key styleKey;
styleKey.style = request.style;
styleKey.weight = request.weight;
- styleKey.stretch = request.stretch;
+ // Prefer a stretch closest to 100.
+ styleKey.stretch = request.stretch ? request.stretch : 100;
char pitch = request.ignorePitch ? '*' : request.fixedPitch ? 'm' : 'p';
@@ -2225,10 +2225,18 @@ QString QFontDatabase::writingSystemSample(WritingSystem writingSystem)
sample += QChar(0x05D3);
break;
case Arabic:
+ sample += QChar(0x0623);
+ sample += QChar(0x0628);
+ sample += QChar(0x062C);
+ sample += QChar(0x062F);
+ sample += QChar(0x064A);
+ sample += QChar(0x0629);
+ sample += QChar(0x0020);
+ sample += QChar(0x0639);
+ sample += QChar(0x0631);
sample += QChar(0x0628);
+ sample += QChar(0x064A);
sample += QChar(0x0629);
- sample += QChar(0x062A);
- sample += QChar(0x063A);
break;
case Syriac:
sample += QChar(0x0715);
@@ -2431,7 +2439,7 @@ int QFontDatabasePrivate::addAppFont(const QByteArray &fontData, const QString &
}
if (font.fileName.isEmpty() && !fontData.isEmpty())
- font.fileName = QString::fromLatin1(":qmemoryfonts/") + QString::number(i);
+ font.fileName = QLatin1String(":qmemoryfonts/") + QString::number(i);
registerFont(&font);
if (font.families.isEmpty())
@@ -2736,8 +2744,6 @@ void QFontDatabase::load(const QFontPrivate *d, int script)
}
if (req.pointSize < 0)
req.pointSize = req.pixelSize*72.0/d->dpi;
- if (req.stretch == 0)
- req.stretch = 100;
// respect the fallback families that might be passed through the request
const QStringList fallBackFamilies = familyList(req);
diff --git a/src/gui/text/qfontdatabase.h b/src/gui/text/qfontdatabase.h
index 67cf671304..e6aef493bd 100644
--- a/src/gui/text/qfontdatabase.h
+++ b/src/gui/text/qfontdatabase.h
@@ -40,6 +40,7 @@
#ifndef QFONTDATABASE_H
#define QFONTDATABASE_H
+#include <QtGui/qtguiglobal.h>
#include <QtGui/qwindowdefs.h>
#include <QtCore/qstring.h>
#include <QtGui/qfont.h>
diff --git a/src/gui/text/qfontengine.cpp b/src/gui/text/qfontengine.cpp
index 4f0c6d25f7..74ea8d15b7 100644
--- a/src/gui/text/qfontengine.cpp
+++ b/src/gui/text/qfontengine.cpp
@@ -418,6 +418,13 @@ glyph_metrics_t QFontEngine::boundingBox(glyph_t glyph, const QTransform &matrix
return metrics;
}
+QFixed QFontEngine::calculatedCapHeight() const
+{
+ const glyph_t glyph = glyphIndex('H');
+ glyph_metrics_t bb = const_cast<QFontEngine *>(this)->boundingBox(glyph);
+ return bb.height;
+}
+
QFixed QFontEngine::xHeight() const
{
const glyph_t glyph = glyphIndex('x');
@@ -1700,6 +1707,11 @@ QFixed QFontEngineBox::ascent() const
return _size;
}
+QFixed QFontEngineBox::capHeight() const
+{
+ return _size;
+}
+
QFixed QFontEngineBox::descent() const
{
return 0;
@@ -1842,7 +1854,11 @@ QFontEngine *QFontEngineMulti::loadEngine(int at)
glyph_t QFontEngineMulti::glyphIndex(uint ucs4) const
{
glyph_t glyph = engine(0)->glyphIndex(ucs4);
- if (glyph == 0 && ucs4 != QChar::LineSeparator) {
+ if (glyph == 0
+ && ucs4 != QChar::LineSeparator
+ && ucs4 != QChar::LineFeed
+ && ucs4 != QChar::CarriageReturn
+ && ucs4 != QChar::ParagraphSeparator) {
if (!m_fallbackFamiliesQueried)
const_cast<QFontEngineMulti *>(this)->ensureFallbackFamiliesQueried();
for (int x = 1, n = qMin(m_engines.size(), 256); x < n; ++x) {
@@ -1880,7 +1896,11 @@ bool QFontEngineMulti::stringToCMap(const QChar *str, int len,
QStringIterator it(str, str + len);
while (it.hasNext()) {
const uint ucs4 = it.peekNext();
- if (glyphs->glyphs[glyph_pos] == 0 && ucs4 != QChar::LineSeparator) {
+ if (glyphs->glyphs[glyph_pos] == 0
+ && ucs4 != QChar::LineSeparator
+ && ucs4 != QChar::LineFeed
+ && ucs4 != QChar::CarriageReturn
+ && ucs4 != QChar::ParagraphSeparator) {
if (!m_fallbackFamiliesQueried)
const_cast<QFontEngineMulti *>(this)->ensureFallbackFamiliesQueried();
for (int x = 1, n = qMin(m_engines.size(), 256); x < n; ++x) {
@@ -2152,6 +2172,9 @@ glyph_metrics_t QFontEngineMulti::boundingBox(glyph_t glyph)
QFixed QFontEngineMulti::ascent() const
{ return engine(0)->ascent(); }
+QFixed QFontEngineMulti::capHeight() const
+{ return engine(0)->capHeight(); }
+
QFixed QFontEngineMulti::descent() const
{ return engine(0)->descent(); }
diff --git a/src/gui/text/qfontengine_ft.cpp b/src/gui/text/qfontengine_ft.cpp
index 5550dc21db..62941b6cac 100644
--- a/src/gui/text/qfontengine_ft.cpp
+++ b/src/gui/text/qfontengine_ft.cpp
@@ -414,6 +414,7 @@ QFontEngine::Properties QFreetypeFace::properties() const
p.italicAngle = 0;
p.capHeight = p.ascent;
p.lineWidth = face->underline_thickness;
+
return p;
}
@@ -585,8 +586,7 @@ static void convertRGBToARGB_helper(const uchar *src, uint *dst, int width, int
uchar green = src[x + 1];
uchar blue = src[x + 1 + offs];
LcdFilter::filterPixel(red, green, blue);
- // alpha = green
- *dd++ = (green << 24) | (red << 16) | (green << 8) | blue;
+ *dd++ = (0xFF << 24) | (red << 16) | (green << 8) | blue;
}
dst += width;
src += src_pitch;
@@ -611,8 +611,7 @@ static void convertRGBToARGB_V_helper(const uchar *src, uint *dst, int width, in
uchar green = src[x + src_pitch];
uchar blue = src[x + src_pitch + offs];
LcdFilter::filterPixel(red, green, blue);
- // alpha = green
- *dst++ = (green << 24) | (red << 16) | (green << 8) | blue;
+ *dst++ = (0XFF << 24) | (red << 16) | (green << 8) | blue;
}
src += 3*src_pitch;
}
@@ -1299,6 +1298,18 @@ QFixed QFontEngineFT::ascent() const
return v;
}
+QFixed QFontEngineFT::capHeight() const
+{
+ TT_OS2 *os2 = (TT_OS2 *)FT_Get_Sfnt_Table(freetype->face, ft_sfnt_os2);
+ if (os2 && os2->version >= 2) {
+ lockFace();
+ QFixed answer = QFixed::fromFixed(FT_MulFix(os2->sCapHeight, freetype->face->size->metrics.y_scale));
+ unlockFace();
+ return answer;
+ }
+ return calculatedCapHeight();
+}
+
QFixed QFontEngineFT::descent() const
{
QFixed v = QFixed::fromFixed(-metrics.descender);
@@ -1317,33 +1328,25 @@ QFixed QFontEngineFT::leading() const
QFixed QFontEngineFT::xHeight() const
{
- if (!isScalableBitmap()) {
- TT_OS2 *os2 = (TT_OS2 *)FT_Get_Sfnt_Table(freetype->face, ft_sfnt_os2);
- if (os2 && os2->sxHeight) {
- lockFace();
- QFixed answer = QFixed(os2->sxHeight * freetype->face->size->metrics.y_ppem) / emSquareSize();
- unlockFace();
- return answer;
- }
- } else {
- return QFixed(freetype->face->size->metrics.y_ppem) * scalableBitmapScaleFactor;
+ TT_OS2 *os2 = (TT_OS2 *)FT_Get_Sfnt_Table(freetype->face, ft_sfnt_os2);
+ if (os2 && os2->sxHeight) {
+ lockFace();
+ QFixed answer = QFixed(os2->sxHeight * freetype->face->size->metrics.y_ppem) / emSquareSize();
+ unlockFace();
+ return answer;
}
+
return QFontEngine::xHeight();
}
QFixed QFontEngineFT::averageCharWidth() const
{
- if (!isScalableBitmap()) {
- TT_OS2 *os2 = (TT_OS2 *)FT_Get_Sfnt_Table(freetype->face, ft_sfnt_os2);
- if (os2 && os2->xAvgCharWidth) {
- lockFace();
- QFixed answer = QFixed(os2->xAvgCharWidth * freetype->face->size->metrics.x_ppem) / emSquareSize();
- unlockFace();
- return answer;
- }
- } else {
- const qreal aspectRatio = (qreal)xsize / ysize;
- return QFixed::fromReal(fontDef.pixelSize * aspectRatio);
+ TT_OS2 *os2 = (TT_OS2 *)FT_Get_Sfnt_Table(freetype->face, ft_sfnt_os2);
+ if (os2 && os2->xAvgCharWidth) {
+ lockFace();
+ QFixed answer = QFixed(os2->xAvgCharWidth * freetype->face->size->metrics.x_ppem) / emSquareSize();
+ unlockFace();
+ return answer;
}
return QFontEngine::averageCharWidth();
@@ -1842,7 +1845,7 @@ static inline QImage alphaMapFromGlyphData(QFontEngineFT::Glyph *glyph, QFontEng
bytesPerLine = (glyph->width + 3) & ~3;
break;
case QFontEngine::Format_A32:
- format = QImage::Format_ARGB32;
+ format = QImage::Format_RGB32;
bytesPerLine = glyph->width * 4;
break;
default:
diff --git a/src/gui/text/qfontengine_ft_p.h b/src/gui/text/qfontengine_ft_p.h
index 3cdf0cda47..5ca3721c71 100644
--- a/src/gui/text/qfontengine_ft_p.h
+++ b/src/gui/text/qfontengine_ft_p.h
@@ -209,6 +209,7 @@ private:
int synthesized() const Q_DECL_OVERRIDE;
QFixed ascent() const Q_DECL_OVERRIDE;
+ QFixed capHeight() const Q_DECL_OVERRIDE;
QFixed descent() const Q_DECL_OVERRIDE;
QFixed leading() const Q_DECL_OVERRIDE;
QFixed xHeight() const Q_DECL_OVERRIDE;
diff --git a/src/gui/text/qfontengine_p.h b/src/gui/text/qfontengine_p.h
index 132531f5bc..42610e9b70 100644
--- a/src/gui/text/qfontengine_p.h
+++ b/src/gui/text/qfontengine_p.h
@@ -51,7 +51,7 @@
// We mean it.
//
-#include "QtCore/qglobal.h"
+#include <QtGui/private/qtguiglobal_p.h>
#include "QtCore/qatomic.h"
#include <QtCore/qvarlengtharray.h>
#include <QtCore/QLinkedList>
@@ -211,6 +211,7 @@ public:
glyph_metrics_t tightBoundingBox(const QGlyphLayout &glyphs);
virtual QFixed ascent() const = 0;
+ virtual QFixed capHeight() const = 0;
virtual QFixed descent() const = 0;
virtual QFixed leading() const = 0;
virtual QFixed xHeight() const;
@@ -348,6 +349,7 @@ protected:
QFixed lastRightBearing(const QGlyphLayout &glyphs, bool round = false);
inline void setUserData(const QVariant &userData) { m_userData = userData; }
+ QFixed calculatedCapHeight() const;
private:
struct GlyphCacheEntry {
@@ -413,6 +415,7 @@ public:
virtual QFontEngine *cloneWithSize(qreal pixelSize) const Q_DECL_OVERRIDE;
virtual QFixed ascent() const Q_DECL_OVERRIDE;
+ virtual QFixed capHeight() const Q_DECL_OVERRIDE;
virtual QFixed descent() const Q_DECL_OVERRIDE;
virtual QFixed leading() const Q_DECL_OVERRIDE;
virtual qreal maxCharWidth() const Q_DECL_OVERRIDE;
@@ -450,6 +453,7 @@ public:
virtual void getGlyphBearings(glyph_t glyph, qreal *leftBearing = 0, qreal *rightBearing = 0) Q_DECL_OVERRIDE;
virtual QFixed ascent() const Q_DECL_OVERRIDE;
+ virtual QFixed capHeight() const Q_DECL_OVERRIDE;
virtual QFixed descent() const Q_DECL_OVERRIDE;
virtual QFixed leading() const Q_DECL_OVERRIDE;
virtual QFixed xHeight() const Q_DECL_OVERRIDE;
diff --git a/src/gui/text/qfontengine_qpf2.cpp b/src/gui/text/qfontengine_qpf2.cpp
index 2e4af09550..110d512d39 100644
--- a/src/gui/text/qfontengine_qpf2.cpp
+++ b/src/gui/text/qfontengine_qpf2.cpp
@@ -459,6 +459,11 @@ QFixed QFontEngineQPF2::ascent() const
return QFixed::fromReal(extractHeaderField(fontData, Tag_Ascent).value<qreal>());
}
+QFixed QFontEngineQPF2::capHeight() const
+{
+ return calculatedCapHeight();
+}
+
QFixed QFontEngineQPF2::descent() const
{
return QFixed::fromReal(extractHeaderField(fontData, Tag_Descent).value<qreal>());
diff --git a/src/gui/text/qfontengine_qpf2_p.h b/src/gui/text/qfontengine_qpf2_p.h
index 50aac245c1..e5c38ffbaf 100644
--- a/src/gui/text/qfontengine_qpf2_p.h
+++ b/src/gui/text/qfontengine_qpf2_p.h
@@ -172,6 +172,7 @@ public:
glyph_metrics_t boundingBox(glyph_t glyph) Q_DECL_OVERRIDE;
QFixed ascent() const Q_DECL_OVERRIDE;
+ QFixed capHeight() const Q_DECL_OVERRIDE;
QFixed descent() const Q_DECL_OVERRIDE;
QFixed leading() const Q_DECL_OVERRIDE;
qreal maxCharWidth() const Q_DECL_OVERRIDE;
diff --git a/src/gui/text/qfontengineglyphcache_p.h b/src/gui/text/qfontengineglyphcache_p.h
index 54b9af71df..fd5db1ecf5 100644
--- a/src/gui/text/qfontengineglyphcache_p.h
+++ b/src/gui/text/qfontengineglyphcache_p.h
@@ -52,7 +52,7 @@
//
-#include "QtCore/qglobal.h"
+#include <QtGui/private/qtguiglobal_p.h>
#include "QtCore/qatomic.h"
#include <QtCore/qvarlengtharray.h>
#include "private/qfont_p.h"
diff --git a/src/gui/text/qfontinfo.h b/src/gui/text/qfontinfo.h
index ee368e26bd..f5e05775b4 100644
--- a/src/gui/text/qfontinfo.h
+++ b/src/gui/text/qfontinfo.h
@@ -40,6 +40,7 @@
#ifndef QFONTINFO_H
#define QFONTINFO_H
+#include <QtGui/qtguiglobal.h>
#include <QtGui/qfont.h>
#include <QtCore/qsharedpointer.h>
diff --git a/src/gui/text/qfontmetrics.cpp b/src/gui/text/qfontmetrics.cpp
index 2189923b25..aca59d0288 100644
--- a/src/gui/text/qfontmetrics.cpp
+++ b/src/gui/text/qfontmetrics.cpp
@@ -274,6 +274,24 @@ int QFontMetrics::ascent() const
return qRound(engine->ascent());
}
+/*!
+ Returns the cap height of the font.
+
+ \since 5.8
+
+ The cap height of a font is the height of a capital letter above
+ the baseline. It specifically is the height of capital letters
+ that are flat - such as H or I - as opposed to round letters such
+ as O, or pointed letters like A, both of which may display overshoot.
+
+ \sa ascent()
+*/
+int QFontMetrics::capHeight() const
+{
+ QFontEngine *engine = d->engineForScript(QChar::Script_Common);
+ Q_ASSERT(engine != 0);
+ return qRound(engine->capHeight());
+}
/*!
Returns the descent of the font.
@@ -1138,6 +1156,24 @@ qreal QFontMetricsF::ascent() const
return engine->ascent().toReal();
}
+/*!
+ Returns the cap height of the font.
+
+ \since 5.8
+
+ The cap height of a font is the height of a capital letter above
+ the baseline. It specifically is the height of capital letters
+ that are flat - such as H or I - as opposed to round letters such
+ as O, or pointed letters like A, both of which may display overshoot.
+
+ \sa ascent()
+*/
+qreal QFontMetricsF::capHeight() const
+{
+ QFontEngine *engine = d->engineForScript(QChar::Script_Common);
+ Q_ASSERT(engine != 0);
+ return engine->capHeight().toReal();
+}
/*!
Returns the descent of the font.
diff --git a/src/gui/text/qfontmetrics.h b/src/gui/text/qfontmetrics.h
index 1d7241c9f2..3eac309092 100644
--- a/src/gui/text/qfontmetrics.h
+++ b/src/gui/text/qfontmetrics.h
@@ -40,6 +40,7 @@
#ifndef QFONTMETRICS_H
#define QFONTMETRICS_H
+#include <QtGui/qtguiglobal.h>
#include <QtGui/qfont.h>
#include <QtCore/qsharedpointer.h>
#ifndef QT_INCLUDE_COMPAT
@@ -72,6 +73,7 @@ public:
{ qSwap(d, other.d); }
int ascent() const;
+ int capHeight() const;
int descent() const;
int height() const;
int leading() const;
@@ -145,6 +147,7 @@ public:
void swap(QFontMetricsF &other) { qSwap(d, other.d); }
qreal ascent() const;
+ qreal capHeight() const;
qreal descent() const;
qreal height() const;
qreal leading() const;
diff --git a/src/gui/text/qfontsubset.cpp b/src/gui/text/qfontsubset.cpp
index c8f0393084..92eeaf7919 100644
--- a/src/gui/text/qfontsubset.cpp
+++ b/src/gui/text/qfontsubset.cpp
@@ -740,7 +740,7 @@ static void convertPath(const QPainterPath &path, QVector<TTF_POINT> *points, QV
points->takeLast();
endPoints->append(points->size() - 1);
}
- // fall through
+ Q_FALLTHROUGH();
case QPainterPath::LineToElement:
p.flags = OnCurve;
break;
@@ -966,7 +966,7 @@ static QTtfGlyph generateGlyph(int index, const QPainterPath &path, qreal advanc
glyph.advanceWidth = qRound(advance * 2048. / ppem);
glyph.lsb = qRound(lsb * 2048. / ppem);
- if (!path.elementCount()) {
+ if (path.isEmpty()) {
//qDebug("glyph %d is empty", index);
lsb = 0;
glyph.xMin = glyph.xMax = glyph.yMin = glyph.yMax = 0;
diff --git a/src/gui/text/qfontsubset_p.h b/src/gui/text/qfontsubset_p.h
index a7328df4ed..e7c6053beb 100644
--- a/src/gui/text/qfontsubset_p.h
+++ b/src/gui/text/qfontsubset_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#include "private/qfontengine_p.h"
QT_BEGIN_NAMESPACE
diff --git a/src/gui/text/qfragmentmap_p.h b/src/gui/text/qfragmentmap_p.h
index b54d7261d0..35f60ac961 100644
--- a/src/gui/text/qfragmentmap_p.h
+++ b/src/gui/text/qfragmentmap_p.h
@@ -51,7 +51,7 @@
// We mean it.
//
-#include "QtCore/qglobal.h"
+#include <QtGui/private/qtguiglobal_p.h>
#include <stdlib.h>
#include <private/qtools_p.h>
diff --git a/src/gui/text/qglyphrun.h b/src/gui/text/qglyphrun.h
index 6016925d27..6182c4f749 100644
--- a/src/gui/text/qglyphrun.h
+++ b/src/gui/text/qglyphrun.h
@@ -40,6 +40,7 @@
#ifndef QGLYPHRUN_H
#define QGLYPHRUN_H
+#include <QtGui/qtguiglobal.h>
#include <QtCore/qsharedpointer.h>
#include <QtCore/qvector.h>
#include <QtCore/qpoint.h>
diff --git a/src/gui/text/qglyphrun_p.h b/src/gui/text/qglyphrun_p.h
index 52fa03f150..5b6bdad648 100644
--- a/src/gui/text/qglyphrun_p.h
+++ b/src/gui/text/qglyphrun_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#include "qglyphrun.h"
#include "qrawfont.h"
diff --git a/src/gui/text/qharfbuzzng_p.h b/src/gui/text/qharfbuzzng_p.h
index 28f20338dd..95a21eedb6 100644
--- a/src/gui/text/qharfbuzzng_p.h
+++ b/src/gui/text/qharfbuzzng_p.h
@@ -52,6 +52,7 @@
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#include <QtCore/qchar.h>
#include <harfbuzz/hb.h>
diff --git a/src/gui/text/qplatformfontdatabase.cpp b/src/gui/text/qplatformfontdatabase.cpp
index 0d7cb204ff..b83affecdc 100644
--- a/src/gui/text/qplatformfontdatabase.cpp
+++ b/src/gui/text/qplatformfontdatabase.cpp
@@ -395,10 +395,8 @@ void QPlatformFontDatabase::releaseHandle(void *handle)
QString QPlatformFontDatabase::fontDir() const
{
QString fontpath = QString::fromLocal8Bit(qgetenv("QT_QPA_FONTDIR"));
- if (fontpath.isEmpty()) {
- fontpath = QLibraryInfo::location(QLibraryInfo::LibrariesPath);
- fontpath += QLatin1String("/fonts");
- }
+ if (fontpath.isEmpty())
+ fontpath = QLibraryInfo::location(QLibraryInfo::LibrariesPath) + QLatin1String("/fonts");
return fontpath;
}
diff --git a/src/gui/text/qplatformfontdatabase.h b/src/gui/text/qplatformfontdatabase.h
index 61c892ad8b..13d8cbde60 100644
--- a/src/gui/text/qplatformfontdatabase.h
+++ b/src/gui/text/qplatformfontdatabase.h
@@ -49,7 +49,7 @@
// source and binary incompatible with future versions of Qt.
//
-#include <QtCore/qconfig.h>
+#include <QtGui/qtguiglobal.h>
#include <QtCore/QString>
#include <QtCore/QStringList>
#include <QtCore/QList>
diff --git a/src/gui/text/qrawfont.cpp b/src/gui/text/qrawfont.cpp
index eadb65959a..8e6ffa5e94 100644
--- a/src/gui/text/qrawfont.cpp
+++ b/src/gui/text/qrawfont.cpp
@@ -325,6 +325,23 @@ qreal QRawFont::ascent() const
}
/*!
+ Returns the cap height of this QRawFont in pixel units.
+
+ \since 5.8
+
+ The cap height of a font is the height of a capital letter above
+ the baseline. It specifically is the height of capital letters
+ that are flat - such as H or I - as opposed to round letters such
+ as O, or pointed letters like A, both of which may display overshoot.
+
+ \sa QFontMetricsF::capHeight()
+*/
+qreal QRawFont::capHeight() const
+{
+ return d->isValid() ? d->fontEngine->capHeight().toReal() : 0.0;
+}
+
+/*!
Returns the descent of this QRawFont in pixel units.
\sa QFontMetricsF::descent()
diff --git a/src/gui/text/qrawfont.h b/src/gui/text/qrawfont.h
index aa98363229..0252e62370 100644
--- a/src/gui/text/qrawfont.h
+++ b/src/gui/text/qrawfont.h
@@ -40,6 +40,7 @@
#ifndef QRAWFONT_H
#define QRAWFONT_H
+#include <QtGui/qtguiglobal.h>
#include <QtCore/qstring.h>
#include <QtCore/qiodevice.h>
#include <QtCore/qglobal.h>
@@ -117,6 +118,7 @@ public:
QFont::HintingPreference hintingPreference() const;
qreal ascent() const;
+ qreal capHeight() const;
qreal descent() const;
qreal leading() const;
qreal xHeight() const;
diff --git a/src/gui/text/qrawfont_p.h b/src/gui/text/qrawfont_p.h
index ee54578cf9..0fc8739bfb 100644
--- a/src/gui/text/qrawfont_p.h
+++ b/src/gui/text/qrawfont_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#include "qrawfont.h"
#include "qfontengine_p.h"
diff --git a/src/gui/text/qstatictext.h b/src/gui/text/qstatictext.h
index 2da74825a2..00dfccc144 100644
--- a/src/gui/text/qstatictext.h
+++ b/src/gui/text/qstatictext.h
@@ -40,6 +40,7 @@
#ifndef QSTATICTEXT_H
#define QSTATICTEXT_H
+#include <QtGui/qtguiglobal.h>
#include <QtCore/qsize.h>
#include <QtCore/qstring.h>
#include <QtCore/qmetatype.h>
diff --git a/src/gui/text/qstatictext_p.h b/src/gui/text/qstatictext_p.h
index 7fdf46c101..dda566a22b 100644
--- a/src/gui/text/qstatictext_p.h
+++ b/src/gui/text/qstatictext_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#include "qstatictext.h"
#include <private/qtextureglyphcache_p.h>
diff --git a/src/gui/text/qsyntaxhighlighter.h b/src/gui/text/qsyntaxhighlighter.h
index 2ccb3a68b9..d87f89f0fd 100644
--- a/src/gui/text/qsyntaxhighlighter.h
+++ b/src/gui/text/qsyntaxhighlighter.h
@@ -40,7 +40,7 @@
#ifndef QSYNTAXHIGHLIGHTER_H
#define QSYNTAXHIGHLIGHTER_H
-#include <QtCore/qglobal.h>
+#include <QtGui/qtguiglobal.h>
#ifndef QT_NO_SYNTAXHIGHLIGHTER
diff --git a/src/gui/text/qtextcursor.cpp b/src/gui/text/qtextcursor.cpp
index f824d1b369..f32c31d18e 100644
--- a/src/gui/text/qtextcursor.cpp
+++ b/src/gui/text/qtextcursor.cpp
@@ -438,7 +438,7 @@ bool QTextCursorPrivate::movePosition(QTextCursor::MoveOperation op, QTextCursor
if (relativePos < blockIt.length()-1)
++position;
- // FALL THROUGH!
+ Q_FALLTHROUGH();
}
case QTextCursor::PreviousWord:
case QTextCursor::WordLeft:
@@ -590,9 +590,9 @@ bool QTextCursorPrivate::movePosition(QTextCursor::MoveOperation op, QTextCursor
adjustX = false;
break;
}
- case QTextCursor::NextCell: // fall through
- case QTextCursor::PreviousCell: // fall through
- case QTextCursor::NextRow: // fall through
+ case QTextCursor::NextCell:
+ case QTextCursor::PreviousCell:
+ case QTextCursor::NextRow:
case QTextCursor::PreviousRow: {
QTextTable *table = qobject_cast<QTextTable *>(priv->frameAt(position));
if (!table)
diff --git a/src/gui/text/qtextcursor.h b/src/gui/text/qtextcursor.h
index 9610e61b39..1a00b753ad 100644
--- a/src/gui/text/qtextcursor.h
+++ b/src/gui/text/qtextcursor.h
@@ -40,6 +40,7 @@
#ifndef QTEXTCURSOR_H
#define QTEXTCURSOR_H
+#include <QtGui/qtguiglobal.h>
#include <QtCore/qstring.h>
#include <QtCore/qshareddata.h>
#include <QtGui/qtextformat.h>
diff --git a/src/gui/text/qtextcursor_p.h b/src/gui/text/qtextcursor_p.h
index 84f912a3fa..3569317b6d 100644
--- a/src/gui/text/qtextcursor_p.h
+++ b/src/gui/text/qtextcursor_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#include "qtextcursor.h"
#include "qtextdocument.h"
#include "qtextdocument_p.h"
diff --git a/src/gui/text/qtextdocument.cpp b/src/gui/text/qtextdocument.cpp
index bb44c19557..07aec6f019 100644
--- a/src/gui/text/qtextdocument.cpp
+++ b/src/gui/text/qtextdocument.cpp
@@ -94,7 +94,7 @@ bool Qt::mightBeRichText(const QString& text)
++start;
// skip a leading <?xml ... ?> as for example with xhtml
- if (text.mid(start, 5) == QLatin1String("<?xml")) {
+ if (text.midRef(start, 5).compare(QLatin1String("<?xml")) == 0) {
while (start < text.length()) {
if (text.at(start) == QLatin1Char('?')
&& start + 2 < text.length()
@@ -109,12 +109,12 @@ bool Qt::mightBeRichText(const QString& text)
++start;
}
- if (text.mid(start, 5).toLower() == QLatin1String("<!doc"))
+ if (text.midRef(start, 5).compare(QLatin1String("<!doc"), Qt::CaseInsensitive) == 0)
return true;
int open = start;
while (open < text.length() && text.at(open) != QLatin1Char('<')
&& text.at(open) != QLatin1Char('\n')) {
- if (text.at(open) == QLatin1Char('&') && text.mid(open+1,3) == QLatin1String("lt;"))
+ if (text.at(open) == QLatin1Char('&') && text.midRef(open + 1, 3) == QLatin1String("lt;"))
return true; // support desperate attempt of user to see <...>
++open;
}
@@ -3135,7 +3135,7 @@ void QTextHtmlExporter::emitTable(const QTextTable *table)
html += QLatin1String("</table>");
}
-void QTextHtmlExporter::emitFrame(QTextFrame::Iterator frameIt)
+void QTextHtmlExporter::emitFrame(const QTextFrame::Iterator &frameIt)
{
if (!frameIt.atEnd()) {
QTextFrame::Iterator next = frameIt;
diff --git a/src/gui/text/qtextdocument.h b/src/gui/text/qtextdocument.h
index 02cfa97bce..1888088f0d 100644
--- a/src/gui/text/qtextdocument.h
+++ b/src/gui/text/qtextdocument.h
@@ -40,6 +40,7 @@
#ifndef QTEXTDOCUMENT_H
#define QTEXTDOCUMENT_H
+#include <QtGui/qtguiglobal.h>
#include <QtCore/qobject.h>
#include <QtCore/qsize.h>
#include <QtCore/qrect.h>
diff --git a/src/gui/text/qtextdocument_p.cpp b/src/gui/text/qtextdocument_p.cpp
index ffc5d7418b..7107c7c26e 100644
--- a/src/gui/text/qtextdocument_p.cpp
+++ b/src/gui/text/qtextdocument_p.cpp
@@ -131,7 +131,7 @@ static bool isValidBlockSeparator(QChar ch)
|| ch == QTextEndOfFrame;
}
-static bool noBlockInString(const QString &str)
+static bool noBlockInString(const QStringRef &str)
{
return !str.contains(QChar::ParagraphSeparator)
&& !str.contains(QTextBeginningOfFrame)
@@ -320,7 +320,7 @@ void QTextDocumentPrivate::setLayout(QAbstractTextDocumentLayout *layout)
void QTextDocumentPrivate::insert_string(int pos, uint strPos, uint length, int format, QTextUndoCommand::Operation op)
{
// ##### optimize when only appending to the fragment!
- Q_ASSERT(noBlockInString(text.mid(strPos, length)));
+ Q_ASSERT(noBlockInString(text.midRef(strPos, length)));
split(pos);
uint x = fragments.insert_single(pos, length);
@@ -476,7 +476,7 @@ void QTextDocumentPrivate::insert(int pos, const QString &str, int format)
if (str.size() == 0)
return;
- Q_ASSERT(noBlockInString(str));
+ Q_ASSERT(noBlockInString(QStringRef(&str)));
int strPos = text.length();
text.append(str);
@@ -494,7 +494,7 @@ int QTextDocumentPrivate::remove_string(int pos, uint length, QTextUndoCommand::
Q_ASSERT(blocks.size(b) > length);
Q_ASSERT(x && fragments.position(x) == (uint)pos && fragments.size(x) == length);
- Q_ASSERT(noBlockInString(text.mid(fragments.fragment(x)->stringPosition, length)));
+ Q_ASSERT(noBlockInString(text.midRef(fragments.fragment(x)->stringPosition, length)));
blocks.setSize(b, blocks.size(b)-length);
@@ -629,7 +629,7 @@ void QTextDocumentPrivate::move(int pos, int to, int length, QTextUndoCommand::O
if (key+1 != blocks.position(b)) {
// qDebug("remove_string from %d length %d", key, X->size_array[0]);
- Q_ASSERT(noBlockInString(text.mid(X->stringPosition, X->size_array[0])));
+ Q_ASSERT(noBlockInString(text.midRef(X->stringPosition, X->size_array[0])));
w = remove_string(key, X->size_array[0], op);
if (needsInsert) {
@@ -1078,8 +1078,9 @@ void QTextDocumentPrivate::appendUndoItem(const QTextUndoCommand &c)
const QTextUndoCommand &last = undoStack.at(lastIdx);
if ( (last.block_part && c.block_part && !last.block_end) // part of the same block => can merge
- || (!c.block_part && !last.block_part)) { // two single undo items => can merge
-
+ || (!c.block_part && !last.block_part) // two single undo items => can merge
+ || (c.command == QTextUndoCommand::Inserted && last.command == c.command && (last.block_part && !c.block_part))) {
+ // two sequential inserts that are not part of the same block => can merge
if (undoStack[lastIdx].tryMerge(c))
return;
}
diff --git a/src/gui/text/qtextdocument_p.h b/src/gui/text/qtextdocument_p.h
index 34849df0bb..cad9131fbf 100644
--- a/src/gui/text/qtextdocument_p.h
+++ b/src/gui/text/qtextdocument_p.h
@@ -51,7 +51,7 @@
// We mean it.
//
-#include "QtCore/qglobal.h"
+#include <QtGui/private/qtguiglobal_p.h>
#include "QtCore/qstring.h"
#include "QtCore/qvector.h"
#include "QtCore/qlist.h"
@@ -158,7 +158,7 @@ public:
};
Q_DECLARE_TYPEINFO(QTextUndoCommand, Q_PRIMITIVE_TYPE);
-class Q_AUTOTEST_EXPORT QTextDocumentPrivate : public QObjectPrivate
+class Q_GUI_EXPORT QTextDocumentPrivate : public QObjectPrivate
{
Q_DECLARE_PUBLIC(QTextDocument)
public:
@@ -378,7 +378,7 @@ private:
enum StyleMode { EmitStyleTag, OmitStyleTag };
enum FrameType { TextFrame, TableFrame, RootFrame };
- void emitFrame(QTextFrame::Iterator frameIt);
+ void emitFrame(const QTextFrame::Iterator &frameIt);
void emitTextFrame(const QTextFrame *frame);
void emitBlock(const QTextBlock &block);
void emitTable(const QTextTable *table);
diff --git a/src/gui/text/qtextdocumentfragment.cpp b/src/gui/text/qtextdocumentfragment.cpp
index 5727b34e86..079b2e01f7 100644
--- a/src/gui/text/qtextdocumentfragment.cpp
+++ b/src/gui/text/qtextdocumentfragment.cpp
@@ -827,7 +827,7 @@ bool QTextHtmlImporter::closeTag()
case Html_div:
if (closedNode->children.isEmpty())
break;
- // fall through
+ Q_FALLTHROUGH();
default:
if (closedNode->isBlock())
blockTagClosed = true;
diff --git a/src/gui/text/qtextdocumentfragment.h b/src/gui/text/qtextdocumentfragment.h
index d1c1adfd0a..a56f6d06d6 100644
--- a/src/gui/text/qtextdocumentfragment.h
+++ b/src/gui/text/qtextdocumentfragment.h
@@ -40,6 +40,7 @@
#ifndef QTEXTDOCUMENTFRAGMENT_H
#define QTEXTDOCUMENTFRAGMENT_H
+#include <QtGui/qtguiglobal.h>
#include <QtCore/qstring.h>
QT_BEGIN_NAMESPACE
diff --git a/src/gui/text/qtextdocumentfragment_p.h b/src/gui/text/qtextdocumentfragment_p.h
index 56dff01149..e8699545f7 100644
--- a/src/gui/text/qtextdocumentfragment_p.h
+++ b/src/gui/text/qtextdocumentfragment_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#include "QtGui/qtextdocument.h"
#include "private/qtexthtmlparser_p.h"
#include "private/qtextdocument_p.h"
diff --git a/src/gui/text/qtextdocumentlayout.cpp b/src/gui/text/qtextdocumentlayout.cpp
index b6cbd9617f..8ad2d85e7c 100644
--- a/src/gui/text/qtextdocumentlayout.cpp
+++ b/src/gui/text/qtextdocumentlayout.cpp
@@ -295,7 +295,7 @@ static inline bool isEmptyBlockBeforeTable(const QTextBlock &block, const QTextB
;
}
-static inline bool isEmptyBlockBeforeTable(QTextFrame::Iterator it)
+static inline bool isEmptyBlockBeforeTable(const QTextFrame::Iterator &it)
{
QTextFrame::Iterator next = it; ++next;
if (it.currentFrame())
@@ -419,7 +419,7 @@ static bool operator<(int pos, const QCheckPoint &checkPoint)
#endif
-static void fillBackground(QPainter *p, const QRectF &rect, QBrush brush, const QPointF &origin, QRectF gradientRect = QRectF())
+static void fillBackground(QPainter *p, const QRectF &rect, QBrush brush, const QPointF &origin, const QRectF &gradientRect = QRectF())
{
p->save();
if (brush.style() >= Qt::LinearGradientPattern && brush.style() <= Qt::ConicalGradientPattern) {
@@ -1504,7 +1504,7 @@ void QTextDocumentLayoutPrivate::drawListItem(const QPointF &offset, QPainter *p
painter->restore();
}
-static QFixed flowPosition(const QTextFrame::iterator it)
+static QFixed flowPosition(const QTextFrame::iterator &it)
{
if (it.atEnd())
return 0;
@@ -2921,11 +2921,11 @@ void QTextDocumentLayout::documentChanged(int from, int oldLength, int length)
{
Q_D(QTextDocumentLayout);
- QTextBlock startIt = document()->findBlock(from);
+ QTextBlock blockIt = document()->findBlock(from);
QTextBlock endIt = document()->findBlock(qMax(0, from + length - 1));
if (endIt.isValid())
endIt = endIt.next();
- for (QTextBlock blockIt = startIt; blockIt.isValid() && blockIt != endIt; blockIt = blockIt.next())
+ for (; blockIt.isValid() && blockIt != endIt; blockIt = blockIt.next())
blockIt.clearLayout();
if (d->docPrivate->pageSize.isNull())
@@ -2967,9 +2967,6 @@ void QTextDocumentLayout::documentChanged(int from, int oldLength, int length)
d->insideDocumentChange = false;
- for (QTextBlock blockIt = startIt; blockIt.isValid() && blockIt != endIt; blockIt = blockIt.next())
- emit updateBlock(blockIt);
-
if (d->showLayoutProgress) {
const QSizeF newSize = dynamicDocumentSize();
if (newSize != d->lastReportedSize) {
diff --git a/src/gui/text/qtextdocumentlayout_p.h b/src/gui/text/qtextdocumentlayout_p.h
index a9cd6cf289..710c49628e 100644
--- a/src/gui/text/qtextdocumentlayout_p.h
+++ b/src/gui/text/qtextdocumentlayout_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#include "QtGui/qabstracttextdocumentlayout.h"
#include "QtGui/qtextoption.h"
#include "QtGui/qtextobject.h"
diff --git a/src/gui/text/qtextdocumentwriter.cpp b/src/gui/text/qtextdocumentwriter.cpp
index a7c58ac2a6..731aaf1fcf 100644
--- a/src/gui/text/qtextdocumentwriter.cpp
+++ b/src/gui/text/qtextdocumentwriter.cpp
@@ -139,12 +139,9 @@ QTextDocumentWriter::QTextDocumentWriter(QIODevice *device, const QByteArray &fo
format by inspecting the extension of \a fileName.
*/
QTextDocumentWriter::QTextDocumentWriter(const QString &fileName, const QByteArray &format)
- : d(new QTextDocumentWriterPrivate(this))
+ : QTextDocumentWriter(new QFile(fileName), format)
{
- QFile *file = new QFile(fileName);
- d->device = file;
d->deleteDevice = true;
- d->format = format;
}
/*!
diff --git a/src/gui/text/qtextdocumentwriter.h b/src/gui/text/qtextdocumentwriter.h
index b7917e55a4..0502bf1a96 100644
--- a/src/gui/text/qtextdocumentwriter.h
+++ b/src/gui/text/qtextdocumentwriter.h
@@ -39,6 +39,7 @@
#ifndef QTEXTDOCUMENTWRITER_H
#define QTEXTDOCUMENTWRITER_H
+#include <QtGui/qtguiglobal.h>
#include <QtCore/qstring.h>
QT_BEGIN_NAMESPACE
diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp
index 2f069a9abd..5dbeccff7f 100644
--- a/src/gui/text/qtextengine.cpp
+++ b/src/gui/text/qtextengine.cpp
@@ -508,7 +508,7 @@ static bool bidiItemize(QTextEngine *engine, QScriptAnalysis *analysis, QBidiCon
case QChar::DirAN:
if (eor >= 0)
appendItems(analysis, sor, eor, control, dir);
- // fall through
+ Q_FALLTHROUGH();
case QChar::DirR:
case QChar::DirAL:
dir = QChar::DirR; eor = current; status.eor = QChar::DirR; break;
@@ -564,7 +564,7 @@ static bool bidiItemize(QTextEngine *engine, QScriptAnalysis *analysis, QBidiCon
status.eor = QChar::DirON;
dir = QChar::DirAN;
}
- // fall through
+ Q_FALLTHROUGH();
case QChar::DirEN:
case QChar::DirL:
eor = current;
@@ -744,7 +744,7 @@ static bool bidiItemize(QTextEngine *engine, QScriptAnalysis *analysis, QBidiCon
status.last = QChar::DirL;
break;
}
- // fall through
+ Q_FALLTHROUGH();
default:
status.last = dirCurrent;
}
@@ -843,7 +843,7 @@ enum JustificationClass {
Adds an inter character justification opportunity after the number or letter
character and a space justification opportunity after the space character.
*/
-static inline void qt_getDefaultJustificationOpportunities(const ushort *string, int length, QGlyphLayout g, ushort *log_clusters, int spaceAs)
+static inline void qt_getDefaultJustificationOpportunities(const ushort *string, int length, const QGlyphLayout &g, ushort *log_clusters, int spaceAs)
{
int str_pos = 0;
while (str_pos < length) {
@@ -877,7 +877,7 @@ static inline void qt_getDefaultJustificationOpportunities(const ushort *string,
}
}
-static inline void qt_getJustificationOpportunities(const ushort *string, int length, const QScriptItem &si, QGlyphLayout g, ushort *log_clusters)
+static inline void qt_getJustificationOpportunities(const ushort *string, int length, const QScriptItem &si, const QGlyphLayout &g, ushort *log_clusters)
{
Q_ASSERT(length > 0 && g.numGlyphs > 0);
@@ -1292,9 +1292,7 @@ int QTextEngine::shapeTextWithHarfbuzzNG(const QScriptItem &si,
#ifdef Q_OS_DARWIN
if (actualFontEngine->type() == QFontEngine::Mac) {
- // CTRunGetPosition has a bug which applies matrix on 10.6, so we disable
- // scaling the advances for this particular version
- if (QSysInfo::MacintoshVersion != QSysInfo::MV_10_6 && actualFontEngine->fontDef.stretch != 100) {
+ if (actualFontEngine->fontDef.stretch != 100) {
QFixed stretch = QFixed(int(actualFontEngine->fontDef.stretch)) / QFixed(100);
for (uint i = 0; i < num_glyphs; ++i)
g.advances[i] *= stretch;
@@ -1666,7 +1664,7 @@ void QTextEngine::itemize() const
analysis->bidiLevel = control.baseLevel();
break;
}
- // fall through
+ Q_FALLTHROUGH();
default:
analysis->flags = QScriptAnalysis::None;
break;
@@ -2253,7 +2251,6 @@ void QTextEngine::justify(const QScriptLine &line)
case Justification_Prohibited:
break;
case Justification_Space:
- // fall through
case Justification_Arabic_Space:
if (kashida_pos >= 0) {
// qDebug("kashida position at %d in word", kashida_pos);
@@ -2266,7 +2263,7 @@ void QTextEngine::justify(const QScriptLine &line)
}
kashida_pos = -1;
kashida_type = Justification_Arabic_Normal;
- // fall through
+ Q_FALLTHROUGH();
case Justification_Character:
set(&justificationPoints[nPoints++], justification, g.mid(i), fontEngine(si));
maxJustify = qMax(maxJustify, justification);
@@ -2714,7 +2711,7 @@ static QString stringMidRetainingBidiCC(const QString &string,
suffix += c;
}
- return prefix + ellidePrefix + string.mid(midStart, midLength) + ellideSuffix + suffix;
+ return prefix + ellidePrefix + string.midRef(midStart, midLength) + ellideSuffix + suffix;
}
QString QTextEngine::elidedText(Qt::TextElideMode mode, const QFixed &width, int flags, int from, int count) const
@@ -2877,7 +2874,7 @@ QString QTextEngine::elidedText(Qt::TextElideMode mode, const QFixed &width, int
if (prevCharJoins(layoutData->string, rightPos))
ellipsisText.append(QChar(0x200d) /* ZWJ */);
- return layoutData->string.mid(from, leftPos - from) + ellipsisText + layoutData->string.mid(rightPos, to - rightPos);
+ return layoutData->string.midRef(from, leftPos - from) + ellipsisText + layoutData->string.midRef(rightPos, to - rightPos);
}
return layoutData->string.mid(from, to - from);
@@ -2969,9 +2966,8 @@ QFixed QTextEngine::calculateTabWidth(int item, QFixed x) const
switch (tabSpec.type) {
case QTextOption::CenterTab:
length /= 2;
- // fall through
+ Q_FALLTHROUGH();
case QTextOption::DelimiterTab:
- // fall through
case QTextOption::RightTab:
tab = QFixed::fromReal(tabSpec.position) * dpiScale - length;
if (tab < x) // default to tab taking no space
@@ -3519,7 +3515,7 @@ QTextItemInt QTextItemInt::midItem(QFontEngine *fontEngine, int firstGlyphIndex,
}
-QTransform qt_true_matrix(qreal w, qreal h, QTransform x)
+QTransform qt_true_matrix(qreal w, qreal h, const QTransform &x)
{
QRectF rect = x.mapRect(QRectF(0, 0, w, h));
return x * QTransform::fromTranslate(-rect.x(), -rect.y());
diff --git a/src/gui/text/qtextengine_p.h b/src/gui/text/qtextengine_p.h
index 56c9825cc1..160e9ce490 100644
--- a/src/gui/text/qtextengine_p.h
+++ b/src/gui/text/qtextengine_p.h
@@ -51,7 +51,7 @@
// We mean it.
//
-#include "QtCore/qglobal.h"
+#include <QtGui/private/qtguiglobal_p.h>
#include "QtCore/qstring.h"
#include "QtCore/qvarlengtharray.h"
#include "QtCore/qnamespace.h"
diff --git a/src/gui/text/qtextformat.h b/src/gui/text/qtextformat.h
index 805affd87c..28c3035537 100644
--- a/src/gui/text/qtextformat.h
+++ b/src/gui/text/qtextformat.h
@@ -40,6 +40,7 @@
#ifndef QTEXTFORMAT_H
#define QTEXTFORMAT_H
+#include <QtGui/qtguiglobal.h>
#include <QtGui/qcolor.h>
#include <QtGui/qfont.h>
#include <QtCore/qshareddata.h>
diff --git a/src/gui/text/qtextformat_p.h b/src/gui/text/qtextformat_p.h
index 45a432d2f5..f05bfaff71 100644
--- a/src/gui/text/qtextformat_p.h
+++ b/src/gui/text/qtextformat_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#include "QtGui/qtextformat.h"
#include "QtCore/qvector.h"
diff --git a/src/gui/text/qtexthtmlparser.cpp b/src/gui/text/qtexthtmlparser.cpp
index d18d432f46..d4c43b3069 100644
--- a/src/gui/text/qtexthtmlparser.cpp
+++ b/src/gui/text/qtexthtmlparser.cpp
@@ -1872,7 +1872,7 @@ QVector<QCss::Declaration> standardDeclarationForNode(const QTextHtmlParserNode
decls << decl;
if (node.id == Html_b || node.id == Html_strong)
break;
- // Delibrate fall through
+ Q_FALLTHROUGH();
case Html_big:
case Html_small:
if (node.id != Html_th) {
@@ -1893,7 +1893,7 @@ QVector<QCss::Declaration> standardDeclarationForNode(const QTextHtmlParserNode
decls << decl;
break;
}
- // Delibrate fall through
+ Q_FALLTHROUGH();
case Html_center:
case Html_td:
decl = QCss::Declaration();
@@ -1970,7 +1970,7 @@ QVector<QCss::Declaration> standardDeclarationForNode(const QTextHtmlParserNode
}
if (node.id != Html_pre)
break;
- // Delibrate fall through
+ Q_FALLTHROUGH();
case Html_br:
case Html_nobr:
decl = QCss::Declaration();
diff --git a/src/gui/text/qtexthtmlparser_p.h b/src/gui/text/qtexthtmlparser_p.h
index 38c9108f75..e93d46a59f 100644
--- a/src/gui/text/qtexthtmlparser_p.h
+++ b/src/gui/text/qtexthtmlparser_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#include "QtCore/qvector.h"
#include "QtGui/qbrush.h"
#include "QtGui/qcolor.h"
diff --git a/src/gui/text/qtextimagehandler.cpp b/src/gui/text/qtextimagehandler.cpp
index 18311ed161..f7117bfe0a 100644
--- a/src/gui/text/qtextimagehandler.cpp
+++ b/src/gui/text/qtextimagehandler.cpp
@@ -61,10 +61,10 @@ static QString resolveFileName(QString fileName, QUrl *url, qreal targetDevicePi
// Also, QFile{Info}::exists works only on filepaths (not urls)
if (url->isValid()) {
- if (url->scheme() == QLatin1Literal("qrc")) {
+ if (url->scheme() == QLatin1String("qrc")) {
fileName = fileName.right(fileName.length() - 3);
}
- else if (url->scheme() == QLatin1Literal("file")) {
+ else if (url->scheme() == QLatin1String("file")) {
fileName = url->toLocalFile();
}
}
diff --git a/src/gui/text/qtextimagehandler_p.h b/src/gui/text/qtextimagehandler_p.h
index 4bc19d49c3..a22c91ecbf 100644
--- a/src/gui/text/qtextimagehandler_p.h
+++ b/src/gui/text/qtextimagehandler_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#include "QtCore/qobject.h"
#include "QtGui/qabstracttextdocumentlayout.h"
diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp
index 3b1ee8ec03..f5827bb683 100644
--- a/src/gui/text/qtextlayout.cpp
+++ b/src/gui/text/qtextlayout.cpp
@@ -975,7 +975,7 @@ void QTextLayout::setFlags(int flags)
}
static void addSelectedRegionsToPath(QTextEngine *eng, int lineNumber, const QPointF &pos, QTextLayout::FormatRange *selection,
- QPainterPath *region, QRectF boundingRect)
+ QPainterPath *region, const QRectF &boundingRect)
{
const QScriptLine &line = eng->lines[lineNumber];
@@ -1326,7 +1326,11 @@ void QTextLayout::drawCursor(QPainter *p, const QPointF &pos, int cursorPosition
&& (p->transform().type() > QTransform::TxTranslate);
if (toggleAntialiasing)
p->setRenderHint(QPainter::Antialiasing);
+ QPainter::CompositionMode origCompositionMode = p->compositionMode();
+ if (p->paintEngine()->hasFeature(QPaintEngine::RasterOpModes))
+ p->setCompositionMode(QPainter::RasterOp_NotDestination);
p->fillRect(QRectF(x, y, qreal(width), (base + descent).toReal()), p->pen().brush());
+ p->setCompositionMode(origCompositionMode);
if (toggleAntialiasing)
p->setRenderHint(QPainter::Antialiasing, false);
if (d->layoutData->hasBidi) {
diff --git a/src/gui/text/qtextlayout.h b/src/gui/text/qtextlayout.h
index 1cbb5ac8d8..980a099b05 100644
--- a/src/gui/text/qtextlayout.h
+++ b/src/gui/text/qtextlayout.h
@@ -39,6 +39,7 @@
#ifndef QTEXTLAYOUT_H
#define QTEXTLAYOUT_H
+#include <QtGui/qtguiglobal.h>
#include <QtCore/qstring.h>
#include <QtCore/qnamespace.h>
#include <QtCore/qrect.h>
diff --git a/src/gui/text/qtextlist.h b/src/gui/text/qtextlist.h
index 71da175a14..3967787f03 100644
--- a/src/gui/text/qtextlist.h
+++ b/src/gui/text/qtextlist.h
@@ -40,6 +40,7 @@
#ifndef QTEXTLIST_H
#define QTEXTLIST_H
+#include <QtGui/qtguiglobal.h>
#include <QtGui/qtextobject.h>
#include <QtCore/qobject.h>
diff --git a/src/gui/text/qtextobject.h b/src/gui/text/qtextobject.h
index d3f6b3d0ac..a5030de112 100644
--- a/src/gui/text/qtextobject.h
+++ b/src/gui/text/qtextobject.h
@@ -40,6 +40,7 @@
#ifndef QTEXTOBJECT_H
#define QTEXTOBJECT_H
+#include <QtGui/qtguiglobal.h>
#include <QtCore/qobject.h>
#include <QtGui/qtextformat.h>
#include <QtGui/qtextlayout.h>
diff --git a/src/gui/text/qtextobject_p.h b/src/gui/text/qtextobject_p.h
index ffc331e99d..81ab023cc3 100644
--- a/src/gui/text/qtextobject_p.h
+++ b/src/gui/text/qtextobject_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#include "QtGui/qtextobject.h"
#include "private/qobject_p.h"
#include "QtGui/qtextdocument.h"
diff --git a/src/gui/text/qtextodfwriter.cpp b/src/gui/text/qtextodfwriter.cpp
index ad537b7126..e228b3c840 100644
--- a/src/gui/text/qtextodfwriter.cpp
+++ b/src/gui/text/qtextodfwriter.cpp
@@ -63,7 +63,7 @@ QT_BEGIN_NAMESPACE
static QString pixelToPoint(qreal pixels)
{
// we hardcode 96 DPI, we do the same in the ODF importer to have a perfect roundtrip.
- return QString::number(pixels * 72 / 96) + QString::fromLatin1("pt");
+ return QString::number(pixels * 72 / 96) + QLatin1String("pt");
}
// strategies
@@ -295,7 +295,7 @@ void QTextOdfWriter::writeBlock(QXmlStreamWriter &writer, const QTextBlock &bloc
writer.writeStartElement(textNS, QString::fromLatin1("span"));
QString fragmentText = frag.fragment().text();
- if (fragmentText.length() == 1 && fragmentText[0] == 0xFFFC) { // its an inline character.
+ if (fragmentText.length() == 1 && fragmentText[0] == QChar(0xFFFC)) { // its an inline character.
writeInlineCharacter(writer, frag.fragment());
writer.writeEndElement(); // span
continue;
@@ -510,7 +510,7 @@ void QTextOdfWriter::writeBlockFormat(QXmlStreamWriter &writer, QTextBlockFormat
case QTextOption::CenterTab: type = QString::fromLatin1("center"); break;
}
writer.writeAttribute(styleNS, QString::fromLatin1("type"), type);
- if (iterator->delimiter != 0)
+ if (!iterator->delimiter.isNull())
writer.writeAttribute(styleNS, QString::fromLatin1("char"), iterator->delimiter);
++iterator;
}
diff --git a/src/gui/text/qtextodfwriter_p.h b/src/gui/text/qtextodfwriter_p.h
index d4cd91f8a3..d0dd7d2b5c 100644
--- a/src/gui/text/qtextodfwriter_p.h
+++ b/src/gui/text/qtextodfwriter_p.h
@@ -40,7 +40,7 @@
#ifndef QTEXTODFWRITER_H
#define QTEXTODFWRITER_H
-#include <QtCore/qglobal.h>
+#include <QtGui/private/qtguiglobal_p.h>
#ifndef QT_NO_TEXTODFWRITER
@@ -48,9 +48,9 @@
// W A R N I N G
// -------------
//
-// This file is not part of the Qt API. It exists for the convenience
-// of the QLibrary class. This header file may change from
-// version to version without notice, or even be removed.
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
//
// We mean it.
//
diff --git a/src/gui/text/qtextoption.h b/src/gui/text/qtextoption.h
index f9c24ffeaf..9ef9cee9bb 100644
--- a/src/gui/text/qtextoption.h
+++ b/src/gui/text/qtextoption.h
@@ -40,6 +40,7 @@
#ifndef QTEXTOPTION_H
#define QTEXTOPTION_H
+#include <QtGui/qtguiglobal.h>
#include <QtCore/qnamespace.h>
#include <QtCore/qchar.h>
#include <QtCore/qmetatype.h>
diff --git a/src/gui/text/qtexttable.h b/src/gui/text/qtexttable.h
index 14525aae25..ee8e974396 100644
--- a/src/gui/text/qtexttable.h
+++ b/src/gui/text/qtexttable.h
@@ -40,7 +40,7 @@
#ifndef QTEXTTABLE_H
#define QTEXTTABLE_H
-#include <QtCore/qglobal.h>
+#include <QtGui/qtguiglobal.h>
#include <QtCore/qobject.h>
#include <QtGui/qtextobject.h>
diff --git a/src/gui/text/qtexttable_p.h b/src/gui/text/qtexttable_p.h
index 72d9d8c639..848537272d 100644
--- a/src/gui/text/qtexttable_p.h
+++ b/src/gui/text/qtexttable_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#include "private/qtextobject_p.h"
#include "private/qtextdocument_p.h"
diff --git a/src/gui/text/qzip.cpp b/src/gui/text/qzip.cpp
index 7cb89543ba..b68c36fd9e 100644
--- a/src/gui/text/qzip.cpp
+++ b/src/gui/text/qzip.cpp
@@ -498,11 +498,13 @@ QZipReader::FileInfo QZipPrivate::fillFileInfo(int index) const
// fix the file path, if broken (convert separators, eat leading and trailing ones)
fileInfo.filePath = QDir::fromNativeSeparators(fileInfo.filePath);
- while (!fileInfo.filePath.isEmpty() && (fileInfo.filePath.at(0) == QLatin1Char('.') || fileInfo.filePath.at(0) == QLatin1Char('/')))
- fileInfo.filePath = fileInfo.filePath.mid(1);
- while (!fileInfo.filePath.isEmpty() && fileInfo.filePath.at(fileInfo.filePath.size() - 1) == QLatin1Char('/'))
- fileInfo.filePath.chop(1);
+ QStringRef filePathRef(&fileInfo.filePath);
+ while (filePathRef.startsWith(QLatin1Char('.')) || filePathRef.startsWith(QLatin1Char('/')))
+ filePathRef = filePathRef.mid(1);
+ while (filePathRef.endsWith(QLatin1Char('/')))
+ filePathRef.chop(1);
+ fileInfo.filePath = filePathRef.toString();
return fileInfo;
}
diff --git a/src/gui/text/qzipreader_p.h b/src/gui/text/qzipreader_p.h
index 5603f0f0d6..eed6ee6a62 100644
--- a/src/gui/text/qzipreader_p.h
+++ b/src/gui/text/qzipreader_p.h
@@ -40,6 +40,7 @@
#ifndef QZIPREADER_H
#define QZIPREADER_H
+#include <QtGui/private/qtguiglobal_p.h>
#include <QtCore/qglobal.h>
#ifndef QT_NO_TEXTODFWRITER
diff --git a/src/gui/text/qzipwriter_p.h b/src/gui/text/qzipwriter_p.h
index 0a4763855e..433bbab31e 100644
--- a/src/gui/text/qzipwriter_p.h
+++ b/src/gui/text/qzipwriter_p.h
@@ -39,7 +39,7 @@
#ifndef QZIPWRITER_H
#define QZIPWRITER_H
-#include <QtCore/qglobal.h>
+#include <QtGui/private/qtguiglobal_p.h>
#ifndef QT_NO_TEXTODFWRITER
diff --git a/src/gui/text/text.pri b/src/gui/text/text.pri
index be60ba72cc..3fe47a6645 100644
--- a/src/gui/text/text.pri
+++ b/src/gui/text/text.pri
@@ -85,7 +85,7 @@ SOURCES += \
HEADERS += \
text/qplatformfontdatabase.h
-contains(QT_CONFIG, harfbuzz)|contains(QT_CONFIG, system-harfbuzz) {
+qtConfig(harfbuzz)|qtConfig(system-harfbuzz) {
DEFINES += QT_ENABLE_HARFBUZZ_NG
include($$PWD/../../3rdparty/harfbuzz_dependency.pri)
diff --git a/src/gui/util/qabstractlayoutstyleinfo_p.h b/src/gui/util/qabstractlayoutstyleinfo_p.h
index b8f3825ada..bf1e1fc852 100644
--- a/src/gui/util/qabstractlayoutstyleinfo_p.h
+++ b/src/gui/util/qabstractlayoutstyleinfo_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#include <QtCore/qnamespace.h>
#include "qlayoutpolicy_p.h"
diff --git a/src/gui/util/qdesktopservices.h b/src/gui/util/qdesktopservices.h
index 3d44ab4a1e..21705e2757 100644
--- a/src/gui/util/qdesktopservices.h
+++ b/src/gui/util/qdesktopservices.h
@@ -40,6 +40,7 @@
#ifndef QDESKTOPSERVICES_H
#define QDESKTOPSERVICES_H
+#include <QtGui/qtguiglobal.h>
#include <QtCore/qstring.h>
#include <QtCore/qstandardpaths.h>
diff --git a/src/gui/util/qgridlayoutengine_p.h b/src/gui/util/qgridlayoutengine_p.h
index d79d4cc9c9..5f0cc5da73 100644
--- a/src/gui/util/qgridlayoutengine_p.h
+++ b/src/gui/util/qgridlayoutengine_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#include "qalgorithms.h"
#include "qbitarray.h"
#include "qlist.h"
diff --git a/src/gui/util/qhexstring_p.h b/src/gui/util/qhexstring_p.h
index ac11c8ad14..511eec0f1b 100644
--- a/src/gui/util/qhexstring_p.h
+++ b/src/gui/util/qhexstring_p.h
@@ -37,7 +37,7 @@
**
****************************************************************************/
-#include <QtCore/qglobal.h>
+#include <QtGui/private/qtguiglobal_p.h>
#include <QtCore/qpoint.h>
#include <QtCore/qstring.h>
#include <QtGui/qpolygon.h>
diff --git a/src/gui/util/qlayoutpolicy_p.h b/src/gui/util/qlayoutpolicy_p.h
index 979b808563..a729a57e8b 100644
--- a/src/gui/util/qlayoutpolicy_p.h
+++ b/src/gui/util/qlayoutpolicy_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <QtGui/private/qtguiglobal_p.h>
#include <QtCore/qobject.h>
#include <QtCore/qnamespace.h>
diff --git a/src/gui/util/qvalidator.cpp b/src/gui/util/qvalidator.cpp
index 90c6e7a7b8..fb9dfc9f69 100644
--- a/src/gui/util/qvalidator.cpp
+++ b/src/gui/util/qvalidator.cpp
@@ -216,7 +216,7 @@ public:
*/
QValidator::QValidator(QObject * parent)
- : QObject(*new QValidatorPrivate, parent)
+ : QValidator(*new QValidatorPrivate, parent)
{
}
@@ -337,10 +337,8 @@ void QValidator::fixup(QString &) const
*/
QIntValidator::QIntValidator(QObject * parent)
- : QValidator(parent)
+ : QIntValidator(INT_MIN, INT_MAX, parent)
{
- b = INT_MIN;
- t = INT_MAX;
}
@@ -589,11 +587,8 @@ public:
*/
QDoubleValidator::QDoubleValidator(QObject * parent)
- : QValidator(*new QDoubleValidatorPrivate , parent)
+ : QDoubleValidator(-HUGE_VAL, HUGE_VAL, 1000, parent)
{
- b = -HUGE_VAL;
- t = HUGE_VAL;
- dec = 1000;
}
@@ -845,7 +840,7 @@ QDoubleValidator::Notation QDoubleValidator::notation() const
*/
QRegExpValidator::QRegExpValidator(QObject *parent)
- : QValidator(parent), r(QString::fromLatin1(".*"))
+ : QRegExpValidator(QRegExp(QString::fromLatin1(".*")), parent)
{
}
@@ -982,7 +977,7 @@ QRegularExpressionValidator::QRegularExpressionValidator(QObject *parent)
*/
QRegularExpressionValidator::QRegularExpressionValidator(const QRegularExpression &re, QObject *parent)
- : QValidator(*new QRegularExpressionValidatorPrivate, parent)
+ : QRegularExpressionValidator(parent)
{
Q_D(QRegularExpressionValidator);
d->setRegularExpression(re);
diff --git a/src/gui/util/qvalidator.h b/src/gui/util/qvalidator.h
index 85787a66c6..eba4b54672 100644
--- a/src/gui/util/qvalidator.h
+++ b/src/gui/util/qvalidator.h
@@ -41,6 +41,7 @@
#ifndef QVALIDATOR_H
#define QVALIDATOR_H
+#include <QtGui/qtguiglobal.h>
#include <QtCore/qobject.h>
#include <QtCore/qstring.h>
#include <QtCore/qregexp.h>