diff options
author | Frederik Gladhorn <frederik.gladhorn@digia.com> | 2014-06-25 10:25:36 +0200 |
---|---|---|
committer | Frederik Gladhorn <frederik.gladhorn@digia.com> | 2014-06-25 10:25:36 +0200 |
commit | 36b798a8d15531bfeeaac801f9dd225120c34bda (patch) | |
tree | 85cf8471ae600452760ebde87c71330a0c93d8cd /src | |
parent | c2c90b95bf8304e69a5f0a586c607105cc104f83 (diff) | |
parent | b1d99dad098320777a4391052eac531c834748fa (diff) |
Merge remote-tracking branch 'origin/5.3.1' into 5.3
Change-Id: I51fb88701b19ce4f7ea78e12a4049156f3ef9d7f
Diffstat (limited to 'src')
-rw-r--r-- | src/3rdparty/harfbuzz-ng/src/hb-coretext.cc | 3 | ||||
-rw-r--r-- | src/gui/opengl/qopenglframebufferobject.cpp | 1 | ||||
-rw-r--r-- | src/gui/text/qfontengine.cpp | 27 |
3 files changed, 24 insertions, 7 deletions
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-coretext.cc b/src/3rdparty/harfbuzz-ng/src/hb-coretext.cc index 4fef861acc..2507cd1d9f 100644 --- a/src/3rdparty/harfbuzz-ng/src/hb-coretext.cc +++ b/src/3rdparty/harfbuzz-ng/src/hb-coretext.cc @@ -738,7 +738,8 @@ _hb_coretext_shape (hb_shape_plan_t *shape_plan, if (num_glyphs == 0) continue; - buffer->ensure (buffer->len + num_glyphs + (endWithPDF ? 1 : 0)); + const long ensureCount = DIV_CEIL(sizeof(CGGlyph) + sizeof(CGPoint) + sizeof(CFIndex), sizeof(*scratch)); + buffer->ensure (buffer->len + ensureCount * (num_glyphs + (endWithPDF ? 1 : 0))); scratch = buffer->get_scratch_buffer (&scratch_size); diff --git a/src/gui/opengl/qopenglframebufferobject.cpp b/src/gui/opengl/qopenglframebufferobject.cpp index cd6468cccd..3102e1ecd2 100644 --- a/src/gui/opengl/qopenglframebufferobject.cpp +++ b/src/gui/opengl/qopenglframebufferobject.cpp @@ -436,6 +436,7 @@ void QOpenGLFramebufferObjectPrivate::init(QOpenGLFramebufferObject *, const QSi samples = qBound(0, int(samples), int(maxSamples)); #endif + samples = qMax(0, samples); requestedSamples = samples; size = sz; target = texture_target; diff --git a/src/gui/text/qfontengine.cpp b/src/gui/text/qfontengine.cpp index 078e16574f..8adbb31a55 100644 --- a/src/gui/text/qfontengine.cpp +++ b/src/gui/text/qfontengine.cpp @@ -177,9 +177,13 @@ static const HB_FontClass hb_fontClass = { static HB_Error hb_getSFntTable(void *font, HB_Tag tableTag, HB_Byte *buffer, HB_UInt *length) { - QFontEngine *fe = (QFontEngine *)font; - Q_ASSERT(fe->faceData.get_font_table); - if (!fe->faceData.get_font_table(fe->faceData.user_data, tableTag, buffer, length)) + QFontEngine::FaceData *data = (QFontEngine::FaceData *)font; + Q_ASSERT(data); + + qt_get_font_table_func_t get_font_table = data->get_font_table; + Q_ASSERT(get_font_table); + + if (!get_font_table(data->user_data, tableTag, buffer, length)) return HB_Err_Invalid_Argument; return HB_Err_Ok; } @@ -287,8 +291,11 @@ void *QFontEngine::harfbuzzFont() const #endif if (!font_) { HB_Face hbFace = (HB_Face)harfbuzzFace(); - if (hbFace->font_for_init != 0) + if (hbFace->font_for_init) { + void *data = hbFace->font_for_init; q_check_ptr(qHBLoadFace(hbFace)); + free(data); + } HB_FontRec *hbFont = (HB_FontRec *) malloc(sizeof(HB_FontRec)); Q_CHECK_PTR(hbFont); @@ -319,7 +326,12 @@ void *QFontEngine::harfbuzzFace() const return hb_qt_face_get_for_engine(const_cast<QFontEngine *>(this)); #endif if (!face_) { - HB_Face hbFace = qHBNewFace(const_cast<QFontEngine *>(this), hb_getSFntTable); + QFontEngine::FaceData *data = (QFontEngine::FaceData *)malloc(sizeof(QFontEngine::FaceData)); + Q_CHECK_PTR(data); + data->user_data = faceData.user_data; + data->get_font_table = faceData.get_font_table; + + HB_Face hbFace = qHBNewFace(data, hb_getSFntTable); Q_CHECK_PTR(hbFace); hbFace->isSymbolFont = symbol; @@ -372,8 +384,11 @@ bool QFontEngine::supportsScript(QChar::Script script) const } #endif HB_Face hbFace = (HB_Face)harfbuzzFace(); - if (hbFace->font_for_init != 0) + if (hbFace->font_for_init) { + void *data = hbFace->font_for_init; q_check_ptr(qHBLoadFace(hbFace)); + free(data); + } return hbFace->supported_scripts[script_to_hbscript(script)]; } |