summaryrefslogtreecommitdiffstats
path: root/src/gui/image/qimage.cpp
diff options
context:
space:
mode:
authorEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>2011-09-16 16:00:04 +0200
committerQt by Nokia <qt-info@nokia.com>2011-09-20 12:00:23 +0200
commit070d9c00c488a5ee6811f04170cf488ead79bf80 (patch)
treeef3511a994b4ec4b8d563393ea2fb1a4783ad095 /src/gui/image/qimage.cpp
parent57368c7037c6d2a6c8cc18d9d41399bf740abe5c (diff)
Avoid double caching glyphs in raster/QPA/FreeType
Since FreeType has internal caching, it has had a special code path in the raster engine which avoided using Qt's glyph cache, as that would be redundant. However, when compiling with QPA, we want the same behavior without being able to access the QFontEngineFT class. To achieve this, I've made a new abstraction and added it to QFontEngine which allows the FT engine to provide direct pointers into the alpha maps stored by FT. This requires a locking/unlocking mechanism. Yes, the QFontEngine::alphaMap* API is slowly becoming a horrible mess, but due to time constraints, the task of refactoring these functions into a more flexible API needs to wait. I've added a TODO comment for this. Change-Id: I08237403c2967f8fb952258178676f33a87c0353 Reviewed-on: http://codereview.qt-project.org/5155 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
Diffstat (limited to 'src/gui/image/qimage.cpp')
-rw-r--r--src/gui/image/qimage.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp
index 2dbb2f4b52..d0de95366f 100644
--- a/src/gui/image/qimage.cpp
+++ b/src/gui/image/qimage.cpp
@@ -69,6 +69,11 @@
QT_BEGIN_NAMESPACE
+static inline bool isLocked(QImageData *data)
+{
+ return data != 0 && data->is_locked;
+}
+
static inline bool checkPixelSize(const QImage::Format format)
{
switch (format) {
@@ -130,7 +135,7 @@ QImageData::QImageData()
dpmx(qt_defaultDpiX() * 100 / qreal(2.54)),
dpmy(qt_defaultDpiY() * 100 / qreal(2.54)),
offset(0, 0), own_data(true), ro_data(false), has_alpha_clut(false),
- is_cached(false), paintEngine(0)
+ is_cached(false), is_locked(false), paintEngine(0)
{
}
@@ -1022,7 +1027,7 @@ QImage::QImage(const char * const xpm[])
QImage::QImage(const QImage &image)
: QPaintDevice()
{
- if (image.paintingActive()) {
+ if (image.paintingActive() || isLocked(image.d)) {
d = 0;
operator=(image.copy());
} else {
@@ -1054,7 +1059,7 @@ QImage::~QImage()
QImage &QImage::operator=(const QImage &image)
{
- if (image.paintingActive()) {
+ if (image.paintingActive() || isLocked(image.d)) {
operator=(image.copy());
} else {
if (image.d)