summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>2010-05-19 08:20:08 (GMT)
committerEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>2010-05-19 08:43:21 (GMT)
commitfa608f9094591c146f9170ba485ea2e4d7827dca (patch)
treed9f367e61996f2dcb1b8a4c4f034152ca997e406 /src
parent42d46a85a50926cd24d7216cb99b4084f6d8ad04 (diff)
downloadQt-fa608f9094591c146f9170ba485ea2e4d7827dca.zip
Qt-fa608f9094591c146f9170ba485ea2e4d7827dca.tar.gz
Qt-fa608f9094591c146f9170ba485ea2e4d7827dca.tar.bz2
Small hack to allow forcing off font smoothing on Mac OS X
In declarative all text is cached in a transparent buffer. Using subpixel antialiasing for this gives subpar results, and for better results, we want to turn off the font smoothing in the OS for this case. Since we cannot efficiently detect non-opaque destination pixels, we have to have a way where a user can override the default. We'll introduce a style strategy for this later, but for now we only want to enable the use of CGContextSetShouldSmoothFonts() to explicitly turn smoothing off in the declarative context. We still override if font smoothing has been explicitly turned off by us for the context by the TextAntialiasing flag. Task-number: QT-2776 Reviewed-by: MortenS
Diffstat (limited to 'src')
-rw-r--r--src/gui/painting/qpaintengine_mac.cpp6
-rw-r--r--src/gui/painting/qpaintengine_mac_p.h3
2 files changed, 7 insertions, 2 deletions
diff --git a/src/gui/painting/qpaintengine_mac.cpp b/src/gui/painting/qpaintengine_mac.cpp
index 14ba94e..e5323d8 100644
--- a/src/gui/painting/qpaintengine_mac.cpp
+++ b/src/gui/painting/qpaintengine_mac.cpp
@@ -1390,7 +1390,11 @@ QCoreGraphicsPaintEngine::updateRenderHints(QPainter::RenderHints hints)
CGContextSetInterpolationQuality(d->hd, (hints & QPainter::SmoothPixmapTransform) ?
kCGInterpolationHigh : kCGInterpolationNone);
}
- CGContextSetShouldSmoothFonts(d->hd, hints & QPainter::TextAntialiasing);
+ bool textAntialiasing = (hints & QPainter::TextAntialiasing) == QPainter::TextAntialiasing;
+ if (!textAntialiasing || d->disabledSmoothFonts) {
+ d->disabledSmoothFonts = !textAntialiasing;
+ CGContextSetShouldSmoothFonts(d->hd, textAntialiasing);
+ }
}
/*
diff --git a/src/gui/painting/qpaintengine_mac_p.h b/src/gui/painting/qpaintengine_mac_p.h
index c9ab419..940b2bc 100644
--- a/src/gui/painting/qpaintengine_mac_p.h
+++ b/src/gui/painting/qpaintengine_mac_p.h
@@ -148,7 +148,7 @@ class QCoreGraphicsPaintEnginePrivate : public QPaintEnginePrivate
Q_DECLARE_PUBLIC(QCoreGraphicsPaintEngine)
public:
QCoreGraphicsPaintEnginePrivate()
- : hd(0), shading(0), stackCount(0), complexXForm(false)
+ : hd(0), shading(0), stackCount(0), complexXForm(false), disabledSmoothFonts(false)
{
}
@@ -168,6 +168,7 @@ public:
CGShadingRef shading;
int stackCount;
bool complexXForm;
+ bool disabledSmoothFonts;
enum { CosmeticNone, CosmeticTransformPath, CosmeticSetPenWidth } cosmeticPen;
// pixel and cosmetic pen size in user coordinates.