From 7c506150a52031877145daceb032ccb882fd0a1b Mon Sep 17 00:00:00 2001 From: Alexander Volkov Date: Tue, 19 Mar 2019 18:13:23 +0300 Subject: Force font antialiasing with highdpi scaling MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fonts look ugly when they are drawn scaled without antialiasing. Change-Id: I64268db5b37d4bc763ffa23632aca2eaac5d8eae Reviewed-by: Morten Johan Sørvig --- src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp b/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp index aa8f9a892a..e545d54ec2 100644 --- a/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp +++ b/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp @@ -908,7 +908,7 @@ QFont QFontconfigDatabase::defaultFont() const void QFontconfigDatabase::setupFontEngine(QFontEngineFT *engine, const QFontDef &fontDef) const { bool antialias = !(fontDef.styleStrategy & QFont::NoAntialias); - bool forcedAntialiasSetting = !antialias; + bool forcedAntialiasSetting = !antialias || QHighDpiScaling::isActive(); const QPlatformServices *services = QGuiApplicationPrivate::platformIntegration()->services(); bool useXftConf = false; -- cgit v1.2.3 From f48a76bbbfb5823fb98d17a042bb00ad7c9da174 Mon Sep 17 00:00:00 2001 From: Oliver Wolff Date: Wed, 20 Mar 2019 10:10:28 +0100 Subject: Revert "Fix compilation with icc, converting between egl's and gl's Error types" The patch causes an Assert on close and thus cannot be used as is. I do not have ICC available to try to come up with an alternative solution so the patch is reverted for the time being. This reverts commit 93a78799c3df7c8859b2d9addad45bb4a535dc97. Fixes: QTBUG-74467 Change-Id: Ic572dfa667a479686675eb3f9066d133657b4499 Reviewed-by: Friedemann Kleint Reviewed-by: Yuhang Zhao <2546789017@qq.com> --- src/3rdparty/angle/src/libANGLE/Context.cpp | 3 +- src/3rdparty/angle/src/libANGLE/Stream.cpp | 8 +- src/3rdparty/angle/src/libANGLE/Texture.cpp | 3 +- .../src/libANGLE/renderer/d3d/d3d9/Renderer9.cpp | 3 +- ...tion-with-icc-converting-between-egl-s-an.patch | 93 ---------------------- 5 files changed, 6 insertions(+), 104 deletions(-) delete mode 100644 src/angle/patches/0013-Fix-compilation-with-icc-converting-between-egl-s-an.patch (limited to 'src') diff --git a/src/3rdparty/angle/src/libANGLE/Context.cpp b/src/3rdparty/angle/src/libANGLE/Context.cpp index 84f7936feb..f638beda58 100644 --- a/src/3rdparty/angle/src/libANGLE/Context.cpp +++ b/src/3rdparty/angle/src/libANGLE/Context.cpp @@ -451,8 +451,7 @@ egl::Error Context::onDestroy(const egl::Display *display) for (auto &zeroTexture : mZeroTextures) { - auto result = zeroTexture.second->onDestroy(this); - ANGLE_TRY(egl::Error(result)); + ANGLE_TRY(zeroTexture.second->onDestroy(this)); zeroTexture.second.set(this, nullptr); } mZeroTextures.clear(); diff --git a/src/3rdparty/angle/src/libANGLE/Stream.cpp b/src/3rdparty/angle/src/libANGLE/Stream.cpp index e384c7d486..68279976b7 100644 --- a/src/3rdparty/angle/src/libANGLE/Stream.cpp +++ b/src/3rdparty/angle/src/libANGLE/Stream.cpp @@ -192,9 +192,8 @@ Error Stream::consumerAcquire(const gl::Context *context) { if (mPlanes[i].texture != nullptr) { - auto result = mPlanes[i].texture->acquireImageFromStream( - context, mProducerImplementation->getGLFrameDescription(i)); - ANGLE_TRY(Error(result)); + ANGLE_TRY(mPlanes[i].texture->acquireImageFromStream( + context, mProducerImplementation->getGLFrameDescription(i))); } } @@ -214,8 +213,7 @@ Error Stream::consumerRelease(const gl::Context *context) { if (mPlanes[i].texture != nullptr) { - auto result = mPlanes[i].texture->releaseImageFromStream(context); - ANGLE_TRY(Error(result)); + ANGLE_TRY(mPlanes[i].texture->releaseImageFromStream(context)); } } diff --git a/src/3rdparty/angle/src/libANGLE/Texture.cpp b/src/3rdparty/angle/src/libANGLE/Texture.cpp index 7447604fe6..da92e65916 100644 --- a/src/3rdparty/angle/src/libANGLE/Texture.cpp +++ b/src/3rdparty/angle/src/libANGLE/Texture.cpp @@ -550,8 +550,7 @@ Error Texture::onDestroy(const Context *context) { if (mBoundSurface) { - auto result = mBoundSurface->releaseTexImage(context, EGL_BACK_BUFFER); - ANGLE_TRY(Error(result)); + ANGLE_TRY(mBoundSurface->releaseTexImage(context, EGL_BACK_BUFFER)); mBoundSurface = nullptr; } if (mBoundStream) diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/Renderer9.cpp b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/Renderer9.cpp index b583273641..75c6298868 100644 --- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/Renderer9.cpp +++ b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/Renderer9.cpp @@ -376,8 +376,7 @@ egl::Error Renderer9::initializeDevice() ASSERT(!mBlit); mBlit = new Blit9(this); - auto result = mBlit->initialize(); - ANGLE_TRY(egl::Error(result)); + ANGLE_TRY(mBlit->initialize()); ASSERT(!mVertexDataManager && !mIndexDataManager); mVertexDataManager = new VertexDataManager(this); diff --git a/src/angle/patches/0013-Fix-compilation-with-icc-converting-between-egl-s-an.patch b/src/angle/patches/0013-Fix-compilation-with-icc-converting-between-egl-s-an.patch deleted file mode 100644 index 6d3b1cac08..0000000000 --- a/src/angle/patches/0013-Fix-compilation-with-icc-converting-between-egl-s-an.patch +++ /dev/null @@ -1,93 +0,0 @@ -From 2d8118620d4871f74a3ddca233529ff540384477 Mon Sep 17 00:00:00 2001 -From: Yuhang Zhao <2546789017@qq.com> -Date: Wed, 13 Feb 2019 23:26:55 +0800 -Subject: [PATCH] Fix compilation with icc, converting between egl's and gl's - Error types - -Each has two constructors from the other, one copying the other -moving; and this leads to an ambiguous overload when converting -Texture::onDestroy()'s gl::error to the egl::Error that -gl::Context::onDestroy() returns. Passing the value through a -temporary prevents the move-constructor from being attempted and saves -the day. Thanks to Ville Voutilainen for suggesting the fix. - -Fixes: QTBUG-73698 -Change-Id: I628173399a73cee2e253201bc3e8d3e6477a2fbf ---- - src/3rdparty/angle/src/libANGLE/Context.cpp | 3 ++- - src/3rdparty/angle/src/libANGLE/Stream.cpp | 8 +++++--- - src/3rdparty/angle/src/libANGLE/Texture.cpp | 3 ++- - .../angle/src/libANGLE/renderer/d3d/d3d9/Renderer9.cpp | 3 ++- - 4 files changed, 11 insertions(+), 6 deletions(-) - -diff --git a/src/3rdparty/angle/src/libANGLE/Context.cpp b/src/3rdparty/angle/src/libANGLE/Context.cpp -index f638beda58..84f7936feb 100644 ---- a/src/3rdparty/angle/src/libANGLE/Context.cpp -+++ b/src/3rdparty/angle/src/libANGLE/Context.cpp -@@ -451,7 +451,8 @@ egl::Error Context::onDestroy(const egl::Display *display) - - for (auto &zeroTexture : mZeroTextures) - { -- ANGLE_TRY(zeroTexture.second->onDestroy(this)); -+ auto result = zeroTexture.second->onDestroy(this); -+ ANGLE_TRY(egl::Error(result)); - zeroTexture.second.set(this, nullptr); - } - mZeroTextures.clear(); -diff --git a/src/3rdparty/angle/src/libANGLE/Stream.cpp b/src/3rdparty/angle/src/libANGLE/Stream.cpp -index 68279976b7..e384c7d486 100644 ---- a/src/3rdparty/angle/src/libANGLE/Stream.cpp -+++ b/src/3rdparty/angle/src/libANGLE/Stream.cpp -@@ -192,8 +192,9 @@ Error Stream::consumerAcquire(const gl::Context *context) - { - if (mPlanes[i].texture != nullptr) - { -- ANGLE_TRY(mPlanes[i].texture->acquireImageFromStream( -- context, mProducerImplementation->getGLFrameDescription(i))); -+ auto result = mPlanes[i].texture->acquireImageFromStream( -+ context, mProducerImplementation->getGLFrameDescription(i)); -+ ANGLE_TRY(Error(result)); - } - } - -@@ -213,7 +214,8 @@ Error Stream::consumerRelease(const gl::Context *context) - { - if (mPlanes[i].texture != nullptr) - { -- ANGLE_TRY(mPlanes[i].texture->releaseImageFromStream(context)); -+ auto result = mPlanes[i].texture->releaseImageFromStream(context); -+ ANGLE_TRY(Error(result)); - } - } - -diff --git a/src/3rdparty/angle/src/libANGLE/Texture.cpp b/src/3rdparty/angle/src/libANGLE/Texture.cpp -index da92e65916..7447604fe6 100644 ---- a/src/3rdparty/angle/src/libANGLE/Texture.cpp -+++ b/src/3rdparty/angle/src/libANGLE/Texture.cpp -@@ -550,7 +550,8 @@ Error Texture::onDestroy(const Context *context) - { - if (mBoundSurface) - { -- ANGLE_TRY(mBoundSurface->releaseTexImage(context, EGL_BACK_BUFFER)); -+ auto result = mBoundSurface->releaseTexImage(context, EGL_BACK_BUFFER); -+ ANGLE_TRY(Error(result)); - mBoundSurface = nullptr; - } - if (mBoundStream) -diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/Renderer9.cpp b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/Renderer9.cpp -index 75c6298868..b583273641 100644 ---- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/Renderer9.cpp -+++ b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/Renderer9.cpp -@@ -376,7 +376,8 @@ egl::Error Renderer9::initializeDevice() - - ASSERT(!mBlit); - mBlit = new Blit9(this); -- ANGLE_TRY(mBlit->initialize()); -+ auto result = mBlit->initialize(); -+ ANGLE_TRY(egl::Error(result)); - - ASSERT(!mVertexDataManager && !mIndexDataManager); - mVertexDataManager = new VertexDataManager(this); --- -2.20.1.windows.1 - -- cgit v1.2.3 From b0145f029cdde7ae8475b85a20099f115879496e Mon Sep 17 00:00:00 2001 From: Alexander Volkov Date: Mon, 18 Mar 2019 16:03:59 +0300 Subject: Handle device pixel ratio in QIconLoaderEngine::paint() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit QIcon::paint() paints blurry icons on HighDPI screens. In particular, it is called by QCommonStyle to paint icons for CE_ItemViewItem's. Change-Id: Iffe6bd01a8756e617656195ef63fe13c968e0832 Reviewed-by: Morten Johan Sørvig --- src/gui/image/qiconloader.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/gui/image/qiconloader.cpp b/src/gui/image/qiconloader.cpp index a9adde8c8d..1d0c93f26f 100644 --- a/src/gui/image/qiconloader.cpp +++ b/src/gui/image/qiconloader.cpp @@ -629,7 +629,10 @@ void QIconLoaderEngine::ensureLoaded() void QIconLoaderEngine::paint(QPainter *painter, const QRect &rect, QIcon::Mode mode, QIcon::State state) { - QSize pixmapSize = rect.size(); + const qreal dpr = !qApp->testAttribute(Qt::AA_UseHighDpiPixmaps) ? + qreal(1.0) : painter->device()->devicePixelRatioF(); + + QSize pixmapSize = rect.size() * dpr; painter->drawPixmap(rect, pixmap(pixmapSize, mode, state)); } -- cgit v1.2.3 From 26462f9c4c31a691cf98526c4cea23afee79bcc6 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Thu, 7 Mar 2019 09:54:30 +0100 Subject: X11PaintEngine: Don't use system clip for non-system painting When painting into a pixmap, we would apply the system clip, which is a rectangle that starts at the position of the current widget relative to the window. If the widget was not positioned at (0,0), we would therefore clip the top left part of the drawing when drawing into a pixmap, which is obviously not intentional. The solution is in accordance with how it is done in e.g. the OpenGL paint engine, where useSystemClip is set to true only if we are drawing to a widget. The system clip should otherwise be ignored, so we do that in the X11 paint engine as well. Task-number: QTBUG-70387 Change-Id: I9cad26019970280a8a452dc6f1015d229120cac5 Reviewed-by: Eskil Abrahamsen Blomfeldt --- .../platforms/xcb/nativepainting/qbackingstore_x11.cpp | 4 ++++ .../platforms/xcb/nativepainting/qpaintengine_x11.cpp | 10 +++++++--- src/plugins/platforms/xcb/nativepainting/qpixmap_x11.cpp | 14 ++++++++++++++ src/plugins/platforms/xcb/nativepainting/qpixmap_x11_p.h | 5 ++++- 4 files changed, 29 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/plugins/platforms/xcb/nativepainting/qbackingstore_x11.cpp b/src/plugins/platforms/xcb/nativepainting/qbackingstore_x11.cpp index ed482e5dae..bbc156fc53 100644 --- a/src/plugins/platforms/xcb/nativepainting/qbackingstore_x11.cpp +++ b/src/plugins/platforms/xcb/nativepainting/qbackingstore_x11.cpp @@ -192,6 +192,10 @@ bool QXcbNativeBackingStore::scroll(const QRegion &area, int dx, int dy) void QXcbNativeBackingStore::beginPaint(const QRegion ®ion) { + QX11PlatformPixmap *x11pm = qt_x11Pixmap(m_pixmap); + if (x11pm) + x11pm->setIsBackingStore(true); + #if QT_CONFIG(xrender) if (m_translucentBackground) { const QVector xrects = qt_region_to_xrectangles(region); diff --git a/src/plugins/platforms/xcb/nativepainting/qpaintengine_x11.cpp b/src/plugins/platforms/xcb/nativepainting/qpaintengine_x11.cpp index a3e6cedecd..d43b273f4d 100644 --- a/src/plugins/platforms/xcb/nativepainting/qpaintengine_x11.cpp +++ b/src/plugins/platforms/xcb/nativepainting/qpaintengine_x11.cpp @@ -200,6 +200,7 @@ public: uint has_pattern : 1; uint has_alpha_pen : 1; uint has_alpha_brush : 1; + uint use_sysclip : 1; uint render_hints; const QXcbX11Info *xinfo; @@ -701,6 +702,9 @@ bool QX11PaintEngine::begin(QPaintDevice *pdev) d->xlibMaxLinePoints = 32762; // a safe number used to avoid, call to XMaxRequestSize(d->dpy) - 3; d->opacity = 1; + QX11PlatformPixmap *x11pm = paintDevice()->devType() == QInternal::Pixmap ? qt_x11Pixmap(*static_cast(paintDevice())) : nullptr; + d->use_sysclip = paintDevice()->devType() == QInternal::Widget || (x11pm ? x11pm->isBackingStore() : false); + // Set up the polygon clipper. Note: This will only work in // polyline mode as long as we have a buffer zone, since a // polyline may be clipped into several non-connected polylines. @@ -1472,7 +1476,7 @@ void QX11PaintEngine::updatePen(const QPen &pen) } if (!d->has_clipping) { // if clipping is set the paintevent clip region is merged with the clip region - QRegion sysClip = systemClip(); + QRegion sysClip = d->use_sysclip ? systemClip() : QRegion(); if (!sysClip.isEmpty()) x11SetClipRegion(d->dpy, d->gc, 0, d->picture, sysClip); else @@ -1603,7 +1607,7 @@ void QX11PaintEngine::updateBrush(const QBrush &brush, const QPointF &origin) vals.fill_style = s; XChangeGC(d->dpy, d->gc_brush, mask, &vals); if (!d->has_clipping) { - QRegion sysClip = systemClip(); + QRegion sysClip = d->use_sysclip ? systemClip() : QRegion(); if (!sysClip.isEmpty()) x11SetClipRegion(d->dpy, d->gc_brush, 0, d->picture, sysClip); else @@ -2223,7 +2227,7 @@ void QX11PaintEngine::updateMatrix(const QTransform &mtx) void QX11PaintEngine::updateClipRegion_dev(const QRegion &clipRegion, Qt::ClipOperation op) { Q_D(QX11PaintEngine); - QRegion sysClip = systemClip(); + QRegion sysClip = d->use_sysclip ? systemClip() : QRegion(); if (op == Qt::NoClip) { d->has_clipping = false; d->crgn = sysClip; diff --git a/src/plugins/platforms/xcb/nativepainting/qpixmap_x11.cpp b/src/plugins/platforms/xcb/nativepainting/qpixmap_x11.cpp index 86c87e5e30..b1ce39f363 100644 --- a/src/plugins/platforms/xcb/nativepainting/qpixmap_x11.cpp +++ b/src/plugins/platforms/xcb/nativepainting/qpixmap_x11.cpp @@ -1772,6 +1772,20 @@ XID QX11PlatformPixmap::createBitmapFromImage(const QImage &image) return hd; } +bool QX11PlatformPixmap::isBackingStore() const +{ + return (flags & IsBackingStore); +} + +void QX11PlatformPixmap::setIsBackingStore(bool on) +{ + if (on) + flags |= IsBackingStore; + else { + flags &= ~IsBackingStore; + } +} + #if QT_CONFIG(xrender) void QX11PlatformPixmap::convertToARGB32(bool preserveContents) { diff --git a/src/plugins/platforms/xcb/nativepainting/qpixmap_x11_p.h b/src/plugins/platforms/xcb/nativepainting/qpixmap_x11_p.h index 7392cbfccf..9c0ba98300 100644 --- a/src/plugins/platforms/xcb/nativepainting/qpixmap_x11_p.h +++ b/src/plugins/platforms/xcb/nativepainting/qpixmap_x11_p.h @@ -90,6 +90,8 @@ public: void convertToARGB32(bool preserveContents = true); #endif + bool isBackingStore() const; + void setIsBackingStore(bool on); private: friend class QX11PaintEngine; friend const QXcbX11Info &qt_x11Info(const QPixmap &pixmap); @@ -110,7 +112,8 @@ private: Uninitialized = 0x1, Readonly = 0x2, InvertedWhenBoundToTexture = 0x4, - GlSurfaceCreatedWithAlpha = 0x8 + GlSurfaceCreatedWithAlpha = 0x8, + IsBackingStore = 0x10 }; uint flags; -- cgit v1.2.3 From 12978d4ad03af753130ba7c40b6203491cd86cd5 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Mon, 18 Mar 2019 14:02:26 +0100 Subject: Android: Support for separate landscape/portrait splash screens To get appropriate aspect ratios for the splash screen, you usually need separate drawables for the portrait and landscape versions. We support this by adding two new meta data entries that can be used. If they are not available, we will fall back to the generic one, so we are still compatible with existing AndroidManifest.xmls. [ChangeLog][Android] Added entries in the AndroidManifest.xml for specific portrait and landscape splash screens. If one is present for the current orientation, it will be preferred over the generic one. Task-number: QTBUG-74029 Change-Id: I5ffea56320aef85f62f21a59df4d077b4163a65a Reviewed-by: Andy Shaw --- .../src/org/qtproject/qt5/android/QtActivityDelegate.java | 13 ++++++++++--- src/android/templates/AndroidManifest.xml | 6 ++++++ 2 files changed, 16 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java b/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java index 350c6eee96..5fef1eccad 100644 --- a/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java +++ b/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java @@ -744,11 +744,19 @@ public class QtActivityDelegate } m_layout = new QtLayout(m_activity, startApplication); + int orientation = m_activity.getResources().getConfiguration().orientation; + try { ActivityInfo info = m_activity.getPackageManager().getActivityInfo(m_activity.getComponentName(), PackageManager.GET_META_DATA); - if (info.metaData.containsKey("android.app.splash_screen_drawable")) { + + String splashScreenKey = "android.app.splash_screen_drawable_" + + (orientation == Configuration.ORIENTATION_LANDSCAPE ? "landscape" : "portrait"); + if (!info.metaData.containsKey(splashScreenKey)) + splashScreenKey = "android.app.splash_screen_drawable"; + + if (info.metaData.containsKey(splashScreenKey)) { m_splashScreenSticky = info.metaData.containsKey("android.app.splash_screen_sticky") && info.metaData.getBoolean("android.app.splash_screen_sticky"); - int id = info.metaData.getInt("android.app.splash_screen_drawable"); + int id = info.metaData.getInt(splashScreenKey); m_splashScreen = new ImageView(m_activity); m_splashScreen.setImageDrawable(m_activity.getResources().getDrawable(id)); m_splashScreen.setScaleType(ImageView.ScaleType.FIT_XY); @@ -768,7 +776,6 @@ public class QtActivityDelegate new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); - int orientation = m_activity.getResources().getConfiguration().orientation; int rotation = m_activity.getWindowManager().getDefaultDisplay().getRotation(); boolean rot90 = (rotation == Surface.ROTATION_90 || rotation == Surface.ROTATION_270); boolean currentlyLandscape = (orientation == Configuration.ORIENTATION_LANDSCAPE); diff --git a/src/android/templates/AndroidManifest.xml b/src/android/templates/AndroidManifest.xml index cb97002560..b5b26758d9 100644 --- a/src/android/templates/AndroidManifest.xml +++ b/src/android/templates/AndroidManifest.xml @@ -52,6 +52,12 @@ + + + -- cgit v1.2.3