diff options
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/image/qimage.cpp | 19 | ||||
-rw-r--r-- | src/gui/kernel/qguiapplication.cpp | 2 | ||||
-rw-r--r-- | src/gui/opengl/qopengltexture.cpp | 6 | ||||
-rw-r--r-- | src/gui/text/qfont.cpp | 12 | ||||
-rw-r--r-- | src/gui/text/qfont_p.h | 1 | ||||
-rw-r--r-- | src/gui/text/qfontengine_ft.cpp | 2 | ||||
-rw-r--r-- | src/gui/text/qfontengine_p.h | 2 |
7 files changed, 39 insertions, 5 deletions
diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp index 6ec1eecfb1..667b65431e 100644 --- a/src/gui/image/qimage.cpp +++ b/src/gui/image/qimage.cpp @@ -192,7 +192,9 @@ bool QImageData::checkForAlphaPixels() const case QImage::Format_Indexed8: has_alpha_pixels = has_alpha_clut; break; - + case QImage::Format_Alpha8: + has_alpha_pixels = true; + break; case QImage::Format_ARGB32: case QImage::Format_ARGB32_Premultiplied: { uchar *bits = data; @@ -266,7 +268,20 @@ bool QImageData::checkForAlphaPixels() const } } break; - default: + case QImage::Format_RGB32: + case QImage::Format_RGB16: + case QImage::Format_RGB444: + case QImage::Format_RGB555: + case QImage::Format_RGB666: + case QImage::Format_RGB888: + case QImage::Format_RGBX8888: + case QImage::Format_BGR30: + case QImage::Format_RGB30: + case QImage::Format_Grayscale8: + break; + case QImage::Format_Invalid: + case QImage::NImageFormats: + Q_UNREACHABLE(); break; } diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index 770f847190..0f015af2b9 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -607,6 +607,8 @@ QGuiApplication::~QGuiApplication() QGuiApplicationPrivate::platform_name = 0; delete QGuiApplicationPrivate::displayName; QGuiApplicationPrivate::displayName = 0; + delete QGuiApplicationPrivate::m_inputDeviceManager; + QGuiApplicationPrivate::m_inputDeviceManager = 0; } QGuiApplicationPrivate::QGuiApplicationPrivate(int &argc, char **argv, int flags) diff --git a/src/gui/opengl/qopengltexture.cpp b/src/gui/opengl/qopengltexture.cpp index 02dee5a90a..6b83c17fd4 100644 --- a/src/gui/opengl/qopengltexture.cpp +++ b/src/gui/opengl/qopengltexture.cpp @@ -3222,6 +3222,12 @@ void QOpenGLTexture::setData(const QImage& image, MipMapGeneration genMipMaps) qWarning("QOpenGLTexture::setData() requires a valid current context"); return; } + + if (image.isNull()) { + qWarning("QOpenGLTexture::setData() tried to set a null image"); + return; + } + if (context->isOpenGLES() && context->format().majorVersion() < 3) setFormat(QOpenGLTexture::RGBAFormat); else diff --git a/src/gui/text/qfont.cpp b/src/gui/text/qfont.cpp index 947c538234..bc9da5b564 100644 --- a/src/gui/text/qfont.cpp +++ b/src/gui/text/qfont.cpp @@ -2796,6 +2796,10 @@ void QFontCache::insertEngineData(const QFontDef &def, QFontEngineData *engineDa Q_ASSERT(!engineDataCache.contains(def)); engineData->ref.ref(); + // Decrease now rather than waiting + if (total_cost > min_cost * 2) + decreaseCache(); + engineDataCache.insert(def, engineData); increaseCost(sizeof(QFontEngineData)); } @@ -2833,8 +2837,10 @@ void QFontCache::insertEngine(const Key &key, QFontEngine *engine, bool insertMu key.def.pixelSize, key.def.weight, key.def.style, key.def.fixedPitch); } #endif - engine->ref.ref(); + // Decrease now rather than waiting + if (total_cost > min_cost * 2) + decreaseCache(); Engine data(engine); data.timestamp = ++current_timestamp; @@ -2895,7 +2901,11 @@ void QFontCache::timerEvent(QTimerEvent *) return; } + decreaseCache(); +} +void QFontCache::decreaseCache() +{ // go through the cache and count up everything in use uint in_use_cost = 0; diff --git a/src/gui/text/qfont_p.h b/src/gui/text/qfont_p.h index 25b5ef0b0e..ff9265ca19 100644 --- a/src/gui/text/qfont_p.h +++ b/src/gui/text/qfont_p.h @@ -276,6 +276,7 @@ private: void increaseCost(uint cost); void decreaseCost(uint cost); void timerEvent(QTimerEvent *event) Q_DECL_OVERRIDE; + void decreaseCache(); static const uint min_cost; uint total_cost, max_cost; diff --git a/src/gui/text/qfontengine_ft.cpp b/src/gui/text/qfontengine_ft.cpp index 89bc72ae4f..4dd2ee35b1 100644 --- a/src/gui/text/qfontengine_ft.cpp +++ b/src/gui/text/qfontengine_ft.cpp @@ -646,7 +646,7 @@ QFontEngineFT::QFontEngineFT(const QFontDef &fd) matrix.yy = 0x10000; matrix.xy = 0; matrix.yx = 0; - cache_cost = 100; + cache_cost = 100 * 1024; kerning_pairs_loaded = false; transform = false; embolden = false; diff --git a/src/gui/text/qfontengine_p.h b/src/gui/text/qfontengine_p.h index 5282a4033e..be9eaa5020 100644 --- a/src/gui/text/qfontengine_p.h +++ b/src/gui/text/qfontengine_p.h @@ -278,7 +278,7 @@ public: qt_get_font_table_func_t get_font_table; } faceData; - uint cache_cost; // amount of mem used in kb by the font + uint cache_cost; // amount of mem used in bytes by the font uint fsType : 16; bool symbol; struct KernPair { |