summaryrefslogtreecommitdiffstats
path: root/src/platformsupport
diff options
context:
space:
mode:
Diffstat (limited to 'src/platformsupport')
-rw-r--r--src/platformsupport/fbconvenience/qfbbackingstore.cpp11
-rw-r--r--src/platformsupport/fbconvenience/qfbscreen.cpp5
-rw-r--r--src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm61
3 files changed, 66 insertions, 11 deletions
diff --git a/src/platformsupport/fbconvenience/qfbbackingstore.cpp b/src/platformsupport/fbconvenience/qfbbackingstore.cpp
index 2800a81507..5eddf71145 100644
--- a/src/platformsupport/fbconvenience/qfbbackingstore.cpp
+++ b/src/platformsupport/fbconvenience/qfbbackingstore.cpp
@@ -37,6 +37,7 @@
#include <qpa/qplatformwindow.h>
#include <QtGui/qscreen.h>
+#include <QtGui/qpainter.h>
QT_BEGIN_NAMESPACE
@@ -84,9 +85,17 @@ void QFbBackingStore::unlock()
mImageMutex.unlock();
}
-void QFbBackingStore::beginPaint(const QRegion &)
+void QFbBackingStore::beginPaint(const QRegion &region)
{
lock();
+
+ if (mImage.hasAlphaChannel()) {
+ QPainter p(&mImage);
+ p.setCompositionMode(QPainter::CompositionMode_Source);
+ const QVector<QRect> rects = region.rects();
+ for (QVector<QRect>::const_iterator it = rects.begin(); it != rects.end(); ++it)
+ p.fillRect(*it, Qt::transparent);
+ }
}
void QFbBackingStore::endPaint()
diff --git a/src/platformsupport/fbconvenience/qfbscreen.cpp b/src/platformsupport/fbconvenience/qfbscreen.cpp
index d00954375d..ad4c62f4a6 100644
--- a/src/platformsupport/fbconvenience/qfbscreen.cpp
+++ b/src/platformsupport/fbconvenience/qfbscreen.cpp
@@ -233,6 +233,7 @@ QRegion QFbScreen::doRedraw()
if (!mCompositePainter)
mCompositePainter = new QPainter(mScreenImage);
+
for (int rectIndex = 0; rectIndex < mRepaintRegion.rectCount(); rectIndex++) {
QRegion rectRegion = rects[rectIndex];
@@ -250,7 +251,8 @@ QRegion QFbScreen::doRedraw()
foreach (const QRect &rect, intersect.rects()) {
bool firstLayer = true;
if (layer == -1) {
- mCompositePainter->fillRect(rect, Qt::black);
+ mCompositePainter->setCompositionMode(QPainter::CompositionMode_Source);
+ mCompositePainter->fillRect(rect, mScreenImage->hasAlphaChannel() ? Qt::transparent : Qt::black);
firstLayer = false;
layer = mWindowStack.size() - 1;
}
@@ -283,6 +285,7 @@ QRegion QFbScreen::doRedraw()
QRect cursorRect;
if (mCursor && (mCursor->isDirty() || mRepaintRegion.intersects(mCursor->lastPainted()))) {
+ mCompositePainter->setCompositionMode(QPainter::CompositionMode_SourceOver);
cursorRect = mCursor->drawCursor(*mCompositePainter);
touchedRegion += cursorRect;
}
diff --git a/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm b/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm
index 91bf00d1a7..703ec3a8b8 100644
--- a/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm
+++ b/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm
@@ -41,6 +41,49 @@
#include <cmath>
+#if defined(Q_OS_OSX) && !QT_OSX_DEPLOYMENT_TARGET_BELOW(__MAC_10_11)
+#import <AppKit/AppKit.h>
+#endif
+
+#if defined(Q_OS_IOS) && !QT_IOS_DEPLOYMENT_TARGET_BELOW(__IPHONE_8_2)
+#import <UIKit/UIKit.h>
+#endif
+
+// These are available cross platform, exported as kCTFontWeightXXX from CoreText.framework,
+// but they are not documented and are not in public headers so are private API and exposed
+// only through the NSFontWeightXXX and UIFontWeightXXX aliases in AppKit and UIKit (rdar://26109857)
+#if QT_MAC_DEPLOYMENT_TARGET_BELOW(__MAC_10_11, __IPHONE_8_2)
+#define kCTFontWeightUltraLight -0.8
+#define kCTFontWeightThin -0.6
+#define kCTFontWeightLight -0.4
+#define kCTFontWeightRegular 0
+#define kCTFontWeightMedium 0.23
+#define kCTFontWeightSemibold 0.3
+#define kCTFontWeightBold 0.4
+#define kCTFontWeightHeavy 0.56
+#define kCTFontWeightBlack 0.62
+#elif defined(Q_OS_OSX)
+#define kCTFontWeightUltraLight NSFontWeightUltraLight
+#define kCTFontWeightThin NSFontWeightThin
+#define kCTFontWeightLight NSFontWeightLight
+#define kCTFontWeightRegular NSFontWeightRegular
+#define kCTFontWeightMedium NSFontWeightMedium
+#define kCTFontWeightSemibold NSFontWeightSemibold
+#define kCTFontWeightBold NSFontWeightBold
+#define kCTFontWeightHeavy NSFontWeightHeavy
+#define kCTFontWeightBlack NSFontWeightBlack
+#elif defined(Q_OS_IOS)
+#define kCTFontWeightUltraLight UIFontWeightUltraLight
+#define kCTFontWeightThin UIFontWeightThin
+#define kCTFontWeightLight UIFontWeightLight
+#define kCTFontWeightRegular UIFontWeightRegular
+#define kCTFontWeightMedium UIFontWeightMedium
+#define kCTFontWeightSemibold UIFontWeightSemibold
+#define kCTFontWeightBold UIFontWeightBold
+#define kCTFontWeightHeavy UIFontWeightHeavy
+#define kCTFontWeightBlack UIFontWeightBlack
+#endif
+
QT_BEGIN_NAMESPACE
static float SYNTHETIC_ITALIC_SKEW = std::tan(14.f * std::acos(0.f) / 90.f);
@@ -63,23 +106,23 @@ bool QCoreTextFontEngine::ct_getSfntTable(void *user_data, uint tag, uchar *buff
QFont::Weight QCoreTextFontEngine::qtWeightFromCFWeight(float value)
{
- if (value >= 0.62)
+ if (value >= kCTFontWeightBlack)
return QFont::Black;
- if (value >= 0.5)
+ if (value >= kCTFontWeightHeavy)
return QFont::ExtraBold;
- if (value >= 0.4)
+ if (value >= kCTFontWeightBold)
return QFont::Bold;
- if (value >= 0.3)
+ if (value >= kCTFontWeightSemibold)
return QFont::DemiBold;
- if (value >= 0.2)
+ if (value >= kCTFontWeightMedium)
return QFont::Medium;
- if (value == 0.0)
+ if (value == kCTFontWeightRegular)
return QFont::Normal;
- if (value <= -0.8)
+ if (value <= kCTFontWeightUltraLight)
return QFont::Thin;
- if (value <= -0.6)
+ if (value <= kCTFontWeightThin)
return QFont::ExtraLight;
- if (value <= -0.4)
+ if (value <= kCTFontWeightLight)
return QFont::Light;
return QFont::Normal;
}