summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms
diff options
context:
space:
mode:
authorSérgio Martins <sergio.martins@kdab.com>2014-11-20 21:15:16 +0000
committerSérgio Martins <sergio.martins@kdab.com>2015-02-14 01:15:11 +0000
commitfbc3d75354dc6ca6a84c9642efdccf99ac8d5a8b (patch)
treefd48da9b75b28d93a780882b1618762b110bc349 /src/plugins/platforms
parentc5e2d5f73b26b556ab76ab980e28f6435935f092 (diff)
FreeType: Support RGB rendering when not using FontConfig
Windows+FreeType, Linux with -no-fontconfig and the forthcoming OSX FreeType engine can now use sub pixel rendering. The function to get the subpixel type is in QPlatformScreen because we're moving to per screen font settings in the future. This patch is safe, as no functionality is changed for existing users, if one wants sub pixel rendering they'll still have to pass -DFT_CONFIG_OPTION_SUBPIXEL_RENDERING to configure. Task-number: QTBUG-44269 Change-Id: Ib6c22d48a1b7c7b85ee316d5d9e3b6eae0c1ecc0 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@theqtcompany.com> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
Diffstat (limited to 'src/plugins/platforms')
-rw-r--r--src/plugins/platforms/windows/qwindowsscreen.cpp32
-rw-r--r--src/plugins/platforms/windows/qwindowsscreen.h1
2 files changed, 33 insertions, 0 deletions
diff --git a/src/plugins/platforms/windows/qwindowsscreen.cpp b/src/plugins/platforms/windows/qwindowsscreen.cpp
index 4915c4f3be..059ebf19f6 100644
--- a/src/plugins/platforms/windows/qwindowsscreen.cpp
+++ b/src/plugins/platforms/windows/qwindowsscreen.cpp
@@ -39,6 +39,7 @@
#include "qtwindows_additional.h"
+#include <QtCore/QSettings>
#include <QtGui/QPixmap>
#include <QtGui/QGuiApplication>
#include <qpa/qwindowsysteminterface.h>
@@ -359,6 +360,37 @@ void QWindowsScreen::handleChanges(const QWindowsScreenData &newData)
}
/*!
+ \brief Queries ClearType settings to check the pixel layout
+*/
+QPlatformScreen::SubpixelAntialiasingType QWindowsScreen::subpixelAntialiasingTypeHint() const
+{
+#if defined(Q_OS_WINCE) || !defined(FT_LCD_FILTER_H) || !defined(FT_CONFIG_OPTION_SUBPIXEL_RENDERING)
+ return QPlatformScreen::Subpixel_None;
+#else
+ QPlatformScreen::SubpixelAntialiasingType type = QPlatformScreen::subpixelAntialiasingTypeHint();
+ if (type == QPlatformScreen::Subpixel_None) {
+ QSettings settings(QLatin1String("HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Avalon.Graphics\\DISPLAY1"), QSettings::NativeFormat);
+ int registryValue = settings.value(QLatin1String("PixelStructure"), -1).toInt();
+ switch (registryValue) {
+ case 0:
+ type = QPlatformScreen::Subpixel_None;
+ break;
+ case 1:
+ type = QPlatformScreen::Subpixel_RGB;
+ break;
+ case 2:
+ type = QPlatformScreen::Subpixel_BGR;
+ break;
+ default:
+ type = QPlatformScreen::Subpixel_None;
+ break;
+ }
+ }
+ return type;
+#endif
+}
+
+/*!
\class QWindowsScreenManager
\brief Manages a list of QWindowsScreen.
diff --git a/src/plugins/platforms/windows/qwindowsscreen.h b/src/plugins/platforms/windows/qwindowsscreen.h
index 07b0d51971..b561f73804 100644
--- a/src/plugins/platforms/windows/qwindowsscreen.h
+++ b/src/plugins/platforms/windows/qwindowsscreen.h
@@ -100,6 +100,7 @@ public:
static QWindow *windowAt(const QPoint &point, unsigned flags);
QPixmap grabWindow(WId window, int qX, int qY, int qWidth, int qHeight) const Q_DECL_OVERRIDE;
+ QPlatformScreen::SubpixelAntialiasingType subpixelAntialiasingTypeHint() const Q_DECL_OVERRIDE;
inline void handleChanges(const QWindowsScreenData &newData);