diff options
author | Liang Qi <liang.qi@qt.io> | 2018-12-04 19:41:52 +0000 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2018-12-04 19:41:52 +0000 |
commit | 009a5538ebce4c5517a717a201707f2b79749f64 (patch) | |
tree | 9dfd3f3d3b6ab997eeb37215e948b5af7160beb8 /src/gui | |
parent | e19df161cdc14f834a278fe0939d50475864a78c (diff) | |
parent | 5d5c00c67682bce105197b659687fd1fee8f60cf (diff) |
Merge "Merge remote-tracking branch 'origin/5.12' into dev" into refs/staging/dev
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/configure.json | 64 | ||||
-rw-r--r-- | src/gui/image/qimage.cpp | 14 | ||||
-rw-r--r-- | src/gui/image/qimage_darwin.mm | 29 | ||||
-rw-r--r-- | src/gui/kernel/qsimpledrag.cpp | 2 | ||||
-rw-r--r-- | src/gui/painting/qcoregraphics.mm | 50 | ||||
-rw-r--r-- | src/gui/painting/qcoregraphics_p.h | 2 | ||||
-rw-r--r-- | src/gui/painting/qdrawhelper.cpp | 64 | ||||
-rw-r--r-- | src/gui/text/qfontengine.cpp | 2 | ||||
-rw-r--r-- | src/gui/text/qfontengine_p.h | 2 | ||||
-rw-r--r-- | src/gui/text/qtextdocumentlayout.cpp | 4 |
10 files changed, 122 insertions, 111 deletions
diff --git a/src/gui/configure.json b/src/gui/configure.json index 0332631ec8..25ff553876 100644 --- a/src/gui/configure.json +++ b/src/gui/configure.json @@ -46,9 +46,7 @@ "xcb-xlib": "boolean", "xcb-xinput": "boolean", "xkb": "boolean", - "xkbcommon": { "type": "enum", "values": [ "no", "qt", "system" ] }, - "xkbcommon-evdev": "boolean", - "xkbcommon-x11": { "type": "enum", "name": "xkbcommon", "values": [ "no", "qt", "system" ] } + "xkbcommon": "boolean" } }, @@ -486,13 +484,8 @@ "xcb/xinerama.h", "xcb/sync.h", "xcb/randr.h", - "xcb/shm.h" - ], - "tail": [ - "// This workaround can be removed for xcb-icccm > 3.8", - "#define class class_name", - "#include <xcb/xcb_icccm.h>", - "#undef class" + "xcb/shm.h", + "xcb/xcb_icccm.h" ], "main": [ "int primaryScreen = 0;", @@ -606,21 +599,33 @@ ] }, "xkbcommon": { - "label": "xkbcommon", - "export": "xkbcommon_evdev", + "label": "xkbcommon >= 0.5.0", "test": { - "include": [ "xkbcommon/xkbcommon.h", "xkbcommon/xkbcommon-keysyms.h", "xkbcommon/xkbcommon-names.h" ], + "include": [ "xkbcommon/xkbcommon.h" ], "main": "xkb_context_new(XKB_CONTEXT_NO_FLAGS);" }, "sources": [ - { "type": "pkgConfig", "args": "xkbcommon" } + { "type": "pkgConfig", "args": "xkbcommon >= 0.5.0" } ] }, "xkbcommon_x11": { - "label": "xkbcommon-x11 >= 0.4.1", - "export": "xkbcommon", + "label": "xkbcommon-x11", + "test": { + "include": [ "xkbcommon/xkbcommon-x11.h" ], + "main": "xkb_x11_get_core_keyboard_device_id(nullptr);" + }, + "sources": [ + { "type": "pkgConfig", "args": "xkbcommon-x11" } + ] + }, + "xkbcommon_evdev": { + "label": "xkbcommon_evdev TRANSITION HACK", + "test": { + "include": [ "xkbcommon/xkbcommon.h" ], + "main": "xkb_context_new(XKB_CONTEXT_NO_FLAGS);" + }, "sources": [ - { "type": "pkgConfig", "args": "xkbcommon xkbcommon-x11 >= 0.4.1" } + { "type": "pkgConfig", "args": "xkbcommon >= 0.5.0" } ] }, "xrender": { @@ -1091,7 +1096,7 @@ "label": "Mir client", "section": "Platform plugins", "autoDetect": false, - "condition": "libs.mirclient", + "condition": "libs.mirclient && features.xkbcommon", "output": [ "privateFeature" ] }, "mtdev": { @@ -1304,7 +1309,7 @@ "section": "Platform plugins", "autoDetect": "!config.darwin", "enable": "input.xcb == 'system' || input.xcb == 'qt' || input.xcb == 'yes'", - "condition": "features.thread && libs.xcb", + "condition": "features.thread && features.xkbcommon && libs.xcb", "output": [ "privateFeature" ] }, "system-xcb": { @@ -1347,7 +1352,7 @@ "xkb": { "label": "XCB XKB", "emitIf": "features.xcb", - "condition": "!features.system-xcb || libs.xcb_xkb", + "condition": "(!features.system-xcb || libs.xcb_xkb) && libs.xkbcommon_x11", "output": [ "privateFeature" ] }, "xcb-xlib": { @@ -1368,17 +1373,14 @@ "condition": "!features.system-xcb || libs.xcb_xinput", "output": [ "privateFeature" ] }, - "xkbcommon-evdev": { - "label": "xkbcommon-evdev", + "xkbcommon": { + "label": "xkbcommon", "condition": "libs.xkbcommon", "output": [ "privateFeature" ] }, - "xkbcommon-system": { - "label": "Using system-provided xkbcommon", - "emitIf": "features.xcb", - "enable": "input.xkbcommon == 'system'", - "disable": "input.xkbcommon == 'qt' || input.xkbcommon == 'no'", - "condition": "libs.xkbcommon_x11", + "xkbcommon-evdev": { + "label": "xkbcommon-evdev TRANSITION HACK", + "condition": "libs.xkbcommon_evdev", "output": [ "privateFeature" ] }, "xlib": { @@ -1594,7 +1596,7 @@ { "type": "error", "condition": "input.xcb != '' && input.xcb != 'no' && input.xkbcommon == 'no'", - "message": "XCB plugin requires libxkbcommon. See -qt-xkbcommon-x11 and -system-xkbcommon-x11." + "message": "XCB plugin requires xkbcommon, but -no-xkbcommon was provided." } ], @@ -1705,7 +1707,7 @@ QMAKE_LIBDIR_OPENGL[_ES2] and QMAKE_LIBS_OPENGL[_ES2] in the mkspec for your pla "integrityhid", "mtdev", "tslib", - "xkbcommon-evdev" + "xkbcommon" ] }, { @@ -1736,7 +1738,7 @@ QMAKE_LIBDIR_OPENGL[_ES2] and QMAKE_LIBS_OPENGL[_ES2] in the mkspec for your pla "section": "X11", "condition": "features.xcb", "entries": [ - "system-xcb", "egl_x11", "xkb", "xlib", "xcb-render", "xcb-glx", "xcb-xinput", "xcb-xlib", "xkbcommon-system", "xcb-native-painting" + "system-xcb", "egl_x11", "xkb", "xlib", "xcb-render", "xcb-glx", "xcb-xinput", "xcb-xlib", "xcb-native-painting" ] }, { diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp index 0105f1decd..da963adae6 100644 --- a/src/gui/image/qimage.cpp +++ b/src/gui/image/qimage.cpp @@ -149,7 +149,10 @@ QImageData * QImageData::create(const QSize &size, QImage::Format format) d->bytes_per_line = params.bytesPerLine; d->nbytes = params.totalSize; - d->data = (uchar *)malloc(d->nbytes); + if (depth == 64) + d->data = (uchar *)new (std::nothrow) quint64[d->nbytes / sizeof(quint64)]; + else // nbytes is known to already be a multipla of 4: + d->data = (uchar *)new (std::nothrow) quint32[d->nbytes / sizeof(quint32)]; if (!d->data) return nullptr; @@ -165,8 +168,13 @@ QImageData::~QImageData() if (is_cached) QImagePixmapCleanupHooks::executeImageHooks((((qint64) ser_no) << 32) | ((qint64) detach_no)); delete paintEngine; - if (data && own_data) - free(data); + if (data && own_data) { + // Casting to avoid being theoretically UB: + if (depth == 64) + delete[] (quint64 *)data; + else + delete[] (quint32 *)data; + } data = 0; } diff --git a/src/gui/image/qimage_darwin.mm b/src/gui/image/qimage_darwin.mm index a5c391ad21..7ca1a0869a 100644 --- a/src/gui/image/qimage_darwin.mm +++ b/src/gui/image/qimage_darwin.mm @@ -40,6 +40,7 @@ #include "qimage.h" #include <private/qcore_mac_p.h> +#include <private/qcoregraphics_p.h> #import <Foundation/Foundation.h> #import <CoreGraphics/CoreGraphics.h> @@ -98,32 +99,10 @@ CGImageRef QImage::toCGImage() const if (isNull()) return nil; - // Determine the target native format - uint cgflags = kCGImageAlphaNone; - switch (format()) { - case QImage::Format_ARGB32: - cgflags = kCGImageAlphaFirst | kCGBitmapByteOrder32Host; - break; - case QImage::Format_RGB32: - cgflags = kCGImageAlphaNoneSkipFirst | kCGBitmapByteOrder32Host; - break; - case QImage::Format_RGBA8888_Premultiplied: - cgflags = kCGImageAlphaPremultipliedLast | kCGBitmapByteOrder32Big; - break; - case QImage::Format_RGBA8888: - cgflags = kCGImageAlphaLast | kCGBitmapByteOrder32Big; - break; - case QImage::Format_RGBX8888: - cgflags = kCGImageAlphaNoneSkipLast | kCGBitmapByteOrder32Big; - break; - case QImage::Format_ARGB32_Premultiplied: - cgflags = kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Host; - break; - default: break; - } + CGBitmapInfo bitmapInfo = qt_mac_bitmapInfoForImage(*this); // Format not supported: return nil CGImageRef - if (cgflags == kCGImageAlphaNone) + if (bitmapInfo == kCGImageAlphaNone) return nil; // Create a data provider that owns a copy of the QImage and references the image data. @@ -140,7 +119,7 @@ CGImageRef QImage::toCGImage() const const bool shouldInterpolate = false; return CGImageCreate(width(), height(), bitsPerComponent, bitsPerPixel, - this->bytesPerLine(), colorSpace, cgflags, dataProvider, + this->bytesPerLine(), colorSpace, bitmapInfo, dataProvider, decode, shouldInterpolate, kCGRenderingIntentDefault); } diff --git a/src/gui/kernel/qsimpledrag.cpp b/src/gui/kernel/qsimpledrag.cpp index 2611dc8580..9aab332ef5 100644 --- a/src/gui/kernel/qsimpledrag.cpp +++ b/src/gui/kernel/qsimpledrag.cpp @@ -74,7 +74,7 @@ static QWindow* topLevelAt(const QPoint &pos) QWindowList list = QGuiApplication::topLevelWindows(); for (int i = list.count()-1; i >= 0; --i) { QWindow *w = list.at(i); - if (w->isVisible() && w->geometry().contains(pos) && !qobject_cast<QShapedPixmapWindow*>(w)) + if (w->isVisible() && w->handle() && w->geometry().contains(pos) && !qobject_cast<QShapedPixmapWindow*>(w)) return w; } return 0; diff --git a/src/gui/painting/qcoregraphics.mm b/src/gui/painting/qcoregraphics.mm index 2249859c43..53066687d3 100644 --- a/src/gui/painting/qcoregraphics.mm +++ b/src/gui/painting/qcoregraphics.mm @@ -51,6 +51,33 @@ QT_BEGIN_NAMESPACE // ---------------------- Images ---------------------- +CGBitmapInfo qt_mac_bitmapInfoForImage(const QImage &image) +{ + CGBitmapInfo bitmapInfo = kCGImageAlphaNone; + switch (image.format()) { + case QImage::Format_ARGB32: + bitmapInfo = kCGImageAlphaFirst | kCGBitmapByteOrder32Host; + break; + case QImage::Format_RGB32: + bitmapInfo = kCGImageAlphaNoneSkipFirst | kCGBitmapByteOrder32Host; + break; + case QImage::Format_RGBA8888_Premultiplied: + bitmapInfo = kCGImageAlphaPremultipliedLast | kCGBitmapByteOrder32Big; + break; + case QImage::Format_RGBA8888: + bitmapInfo = kCGImageAlphaLast | kCGBitmapByteOrder32Big; + break; + case QImage::Format_RGBX8888: + bitmapInfo = kCGImageAlphaNoneSkipLast | kCGBitmapByteOrder32Big; + break; + case QImage::Format_ARGB32_Premultiplied: + bitmapInfo = kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Host; + break; + default: break; + } + return bitmapInfo; +} + CGImageRef qt_mac_toCGImage(const QImage &inImage) { CGImageRef cgImage = inImage.toCGImage(); @@ -153,7 +180,7 @@ QPixmap qt_mac_toQPixmap(const NSImage *image, const QSizeF &size) return QPixmap(); [NSGraphicsContext saveGraphicsState]; [NSGraphicsContext setCurrentContext:gc]; - [image drawInRect:iconRect fromRect:iconRect operation:NSCompositeSourceOver fraction:1.0 respectFlipped:YES hints:nil]; + [image drawInRect:iconRect fromRect:iconRect operation:NSCompositingOperationSourceOver fraction:1.0 respectFlipped:YES hints:nil]; [NSGraphicsContext restoreGraphicsState]; return pixmap; } @@ -362,13 +389,10 @@ QMacCGContext::QMacCGContext(QPaintDevice *paintDevice) : context(0) if (!image) return; // Context type not supported. - CGColorSpaceRef colorSpace = CGColorSpaceCreateWithName(kCGColorSpaceSRGB); - uint flags = kCGImageAlphaPremultipliedFirst; - flags |= kCGBitmapByteOrder32Host; + QCFType<CGColorSpaceRef> colorSpace = CGColorSpaceCreateWithName(kCGColorSpaceSRGB); + context = CGBitmapContextCreate(image->bits(), image->width(), image->height(), 8, + image->bytesPerLine(), colorSpace, qt_mac_bitmapInfoForImage(*image)); - context = CGBitmapContextCreate(image->bits(), image->width(), image->height(), - 8, image->bytesPerLine(), colorSpace, flags); - CFRelease(colorSpace); CGContextTranslateCTM(context, 0, image->height()); const qreal devicePixelRatio = paintDevice->devicePixelRatioF(); CGContextScaleCTM(context, devicePixelRatio, devicePixelRatio); @@ -396,16 +420,10 @@ QMacCGContext::QMacCGContext(QPainter *painter) : context(0) devType == QInternal::Pixmap || devType == QInternal::Image)) { - CGColorSpaceRef colorSpace = CGColorSpaceCreateWithName(kCGColorSpaceSRGB); - uint flags = kCGImageAlphaPremultipliedFirst; -#ifdef kCGBitmapByteOrder32Host //only needed because CGImage.h added symbols in the minor version - flags |= kCGBitmapByteOrder32Host; -#endif const QImage *image = static_cast<const QImage *>(paintEngine->paintDevice()); - - context = CGBitmapContextCreate((void *)image->bits(), image->width(), image->height(), - 8, image->bytesPerLine(), colorSpace, flags); - CFRelease(colorSpace); + QCFType<CGColorSpaceRef> colorSpace = CGColorSpaceCreateWithName(kCGColorSpaceSRGB); + context = CGBitmapContextCreate((void *)image->bits(), image->width(), image->height(), 8, + image->bytesPerLine(), colorSpace, qt_mac_bitmapInfoForImage(*image)); // Invert y axis CGContextTranslateCTM(context, 0, image->height()); diff --git a/src/gui/painting/qcoregraphics_p.h b/src/gui/painting/qcoregraphics_p.h index de721c94aa..868c2b08b5 100644 --- a/src/gui/painting/qcoregraphics_p.h +++ b/src/gui/painting/qcoregraphics_p.h @@ -64,6 +64,8 @@ QT_BEGIN_NAMESPACE +Q_GUI_EXPORT CGBitmapInfo qt_mac_bitmapInfoForImage(const QImage &image); + #ifdef HAVE_APPKIT Q_GUI_EXPORT NSImage *qt_mac_create_nsimage(const QPixmap &pm); Q_GUI_EXPORT NSImage *qt_mac_create_nsimage(const QIcon &icon, int defaultSize = 0); diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp index a588ca0969..783d2e40b0 100644 --- a/src/gui/painting/qdrawhelper.cpp +++ b/src/gui/painting/qdrawhelper.cpp @@ -3500,8 +3500,8 @@ static const QRgba64 *QT_FASTCALL fetchTransformedBilinear64_uint32(QRgba64 *buf uint sbuf1[BufferSize]; uint sbuf2[BufferSize]; - QRgba64 buf1[BufferSize]; - QRgba64 buf2[BufferSize]; + alignas(8) QRgba64 buf1[BufferSize]; + alignas(8) QRgba64 buf2[BufferSize]; QRgba64 *end = buffer + length; QRgba64 *b = buffer; @@ -3658,8 +3658,8 @@ static const QRgba64 *QT_FASTCALL fetchTransformedBilinear64_uint64(QRgba64 *buf const qreal cx = x + qreal(0.5); const qreal cy = y + qreal(0.5); - QRgba64 buf1[BufferSize]; - QRgba64 buf2[BufferSize]; + alignas(8) QRgba64 buf1[BufferSize]; + alignas(8) QRgba64 buf2[BufferSize]; QRgba64 *end = buffer + length; QRgba64 *b = buffer; @@ -4410,7 +4410,7 @@ void blend_color_generic_rgb64(int count, const QSpan *spans, void *userData) return blend_color_generic(count, spans, userData); } - quint64 buffer[BufferSize]; + alignas(8) QRgba64 buffer[BufferSize]; const QRgba64 color = data->solidColor; bool solidFill = data->rasterBuffer->compositionMode == QPainter::CompositionMode_Source || (data->rasterBuffer->compositionMode == QPainter::CompositionMode_SourceOver && color.isOpaque()); @@ -4428,7 +4428,7 @@ void blend_color_generic_rgb64(int count, const QSpan *spans, void *userData) while (length) { int l = qMin(BufferSize, length); - QRgba64 *dest = op.destFetch64((QRgba64 *)buffer, data->rasterBuffer, x, spans->y, l); + QRgba64 *dest = op.destFetch64(buffer, data->rasterBuffer, x, spans->y, l); op.funcSolid64(dest, l, color, spans->coverage); if (op.destStore64) op.destStore64(data->rasterBuffer, x, spans->y, dest, l); @@ -4580,8 +4580,8 @@ struct QBlendBase BlendType *dest; - BlendType buffer[BufferSize]; - BlendType src_buffer[BufferSize]; + alignas(8) BlendType buffer[BufferSize]; + alignas(8) BlendType src_buffer[BufferSize]; }; class BlendSrcGeneric : public QBlendBase<uint> @@ -4610,11 +4610,11 @@ public: } }; -class BlendSrcGenericRGB64 : public QBlendBase<quint64> +class BlendSrcGenericRGB64 : public QBlendBase<QRgba64> { public: BlendSrcGenericRGB64(QSpanData *d, const Operator &o) - : QBlendBase<quint64>(d, o) + : QBlendBase<QRgba64>(d, o) { } @@ -4623,21 +4623,21 @@ public: return op.func64 && op.destFetch64; } - const quint64 *fetch(int x, int y, int len) + const QRgba64 *fetch(int x, int y, int len) { - dest = (quint64 *)op.destFetch64((QRgba64 *)buffer, data->rasterBuffer, x, y, len); - return (const quint64 *)op.srcFetch64((QRgba64 *)src_buffer, &op, data, y, x, len); + dest = op.destFetch64(buffer, data->rasterBuffer, x, y, len); + return op.srcFetch64(src_buffer, &op, data, y, x, len); } - void process(int, int, int len, int coverage, const quint64 *src, int offset) + void process(int, int, int len, int coverage, const QRgba64 *src, int offset) { - op.func64((QRgba64 *)dest + offset, (const QRgba64 *)src + offset, len, coverage); + op.func64(dest + offset, src + offset, len, coverage); } void store(int x, int y, int len) { if (op.destStore64) - op.destStore64(data->rasterBuffer, x, y, (QRgba64 *)dest, len); + op.destStore64(data->rasterBuffer, x, y, dest, len); } }; @@ -4716,8 +4716,8 @@ static void blend_untransformed_generic_rgb64(int count, const QSpan *spans, voi qCDebug(lcQtGuiDrawHelper, "blend_untransformed_generic_rgb64: unsupported 64-bit blend attempted, falling back to 32-bit"); return blend_untransformed_generic(count, spans, userData); } - quint64 buffer[BufferSize]; - quint64 src_buffer[BufferSize]; + alignas(8) QRgba64 buffer[BufferSize]; + alignas(8) QRgba64 src_buffer[BufferSize]; const int image_width = data->texture.width; const int image_height = data->texture.height; @@ -4741,8 +4741,8 @@ static void blend_untransformed_generic_rgb64(int count, const QSpan *spans, voi const int coverage = (spans->coverage * data->texture.const_alpha) >> 8; while (length) { int l = qMin(BufferSize, length); - const QRgba64 *src = op.srcFetch64((QRgba64 *)src_buffer, &op, data, sy, sx, l); - QRgba64 *dest = op.destFetch64((QRgba64 *)buffer, data->rasterBuffer, x, spans->y, l); + const QRgba64 *src = op.srcFetch64(src_buffer, &op, data, sy, sx, l); + QRgba64 *dest = op.destFetch64(buffer, data->rasterBuffer, x, spans->y, l); op.func64(dest, src, l, coverage); if (op.destStore64) op.destStore64(data->rasterBuffer, x, spans->y, dest, l); @@ -4958,8 +4958,8 @@ static void blend_tiled_generic_rgb64(int count, const QSpan *spans, void *userD qCDebug(lcQtGuiDrawHelper, "blend_tiled_generic_rgb64: unsupported 64-bit blend attempted, falling back to 32-bit"); return blend_tiled_generic(count, spans, userData); } - quint64 buffer[BufferSize]; - quint64 src_buffer[BufferSize]; + alignas(8) QRgba64 buffer[BufferSize]; + alignas(8) QRgba64 src_buffer[BufferSize]; const int image_width = data->texture.width; const int image_height = data->texture.height; @@ -4988,7 +4988,7 @@ static void blend_tiled_generic_rgb64(int count, const QSpan *spans, void *userD int sl = qMin(image_width, length); if (sx > 0 && sl > 0) { int l = qMin(image_width - sx, sl); - const QRgba64 *src = op.srcFetch64((QRgba64 *)src_buffer, &op, data, sy, sx, l); + const QRgba64 *src = op.srcFetch64(src_buffer, &op, data, sy, sx, l); op.destStore64(data->rasterBuffer, x, y, src, l); x += l; sx += l; @@ -4998,7 +4998,7 @@ static void blend_tiled_generic_rgb64(int count, const QSpan *spans, void *userD } if (sl > 0) { Q_ASSERT(sx == 0); - const QRgba64 *src = op.srcFetch64((QRgba64 *)src_buffer, &op, data, sy, sx, sl); + const QRgba64 *src = op.srcFetch64(src_buffer, &op, data, sy, sx, sl); op.destStore64(data->rasterBuffer, x, y, src, sl); x += sl; sx += sl; @@ -5030,8 +5030,8 @@ static void blend_tiled_generic_rgb64(int count, const QSpan *spans, void *userD int l = qMin(image_width - sx, length); if (BufferSize < l) l = BufferSize; - const QRgba64 *src = op.srcFetch64((QRgba64 *)src_buffer, &op, data, sy, sx, l); - QRgba64 *dest = op.destFetch64((QRgba64 *)buffer, data->rasterBuffer, x, spans->y, l); + const QRgba64 *src = op.srcFetch64(src_buffer, &op, data, sy, sx, l); + QRgba64 *dest = op.destFetch64(buffer, data->rasterBuffer, x, spans->y, l); op.func64(dest, src, l, coverage); if (op.destStore64) op.destStore64(data->rasterBuffer, x, spans->y, dest, l); @@ -5515,7 +5515,7 @@ static void qt_alphamapblit_generic(QRasterBuffer *rasterBuffer, srcColor = colorProfile->toLinear(srcColor.unpremultiplied()).premultiplied(); } - quint64 buffer[BufferSize]; + alignas(8) QRgba64 buffer[BufferSize]; const DestFetchProc64 destFetch64 = destFetchProc64[rasterBuffer->format]; const DestStoreProc64 destStore64 = destStoreProc64[rasterBuffer->format]; @@ -5525,7 +5525,7 @@ static void qt_alphamapblit_generic(QRasterBuffer *rasterBuffer, int length = mapWidth; while (length > 0) { int l = qMin(BufferSize, length); - QRgba64 *dest = destFetch64((QRgba64*)buffer, rasterBuffer, i, y + ly, l); + QRgba64 *dest = destFetch64(buffer, rasterBuffer, i, y + ly, l); for (int j=0; j < l; ++j) { const int coverage = map[j + (i - x)]; alphamapblend_generic(coverage, dest, j, srcColor, color, colorProfile); @@ -5555,7 +5555,7 @@ static void qt_alphamapblit_generic(QRasterBuffer *rasterBuffer, if (end <= start) continue; Q_ASSERT(end - start <= BufferSize); - QRgba64 *dest = destFetch64((QRgba64*)buffer, rasterBuffer, start, clip.y, end - start); + QRgba64 *dest = destFetch64(buffer, rasterBuffer, start, clip.y, end - start); for (int xp=start; xp<end; ++xp) { const int coverage = map[xp - x]; @@ -5834,7 +5834,7 @@ static void qt_alphargbblit_generic(QRasterBuffer *rasterBuffer, srcColor = colorProfile->toLinear(srcColor.unpremultiplied()).premultiplied(); } - quint64 buffer[BufferSize]; + alignas(8) QRgba64 buffer[BufferSize]; const DestFetchProc64 destFetch64 = destFetchProc64[rasterBuffer->format]; const DestStoreProc64 destStore64 = destStoreProc64[rasterBuffer->format]; @@ -5844,7 +5844,7 @@ static void qt_alphargbblit_generic(QRasterBuffer *rasterBuffer, int length = mapWidth; while (length > 0) { int l = qMin(BufferSize, length); - QRgba64 *dest = destFetch64((QRgba64*)buffer, rasterBuffer, i, y + ly, l); + QRgba64 *dest = destFetch64(buffer, rasterBuffer, i, y + ly, l); for (int j=0; j < l; ++j) { const uint coverage = src[j + (i - x)]; alphargbblend_generic(coverage, dest, j, srcColor, color, colorProfile); @@ -5874,7 +5874,7 @@ static void qt_alphargbblit_generic(QRasterBuffer *rasterBuffer, if (end <= start) continue; Q_ASSERT(end - start <= BufferSize); - QRgba64 *dest = destFetch64((QRgba64*)buffer, rasterBuffer, start, clip.y, end - start); + QRgba64 *dest = destFetch64(buffer, rasterBuffer, start, clip.y, end - start); for (int xp=start; xp<end; ++xp) { const uint coverage = src[xp - x]; diff --git a/src/gui/text/qfontengine.cpp b/src/gui/text/qfontengine.cpp index b06b64ca63..cab4ca0047 100644 --- a/src/gui/text/qfontengine.cpp +++ b/src/gui/text/qfontengine.cpp @@ -1755,7 +1755,7 @@ QImage QFontEngineBox::alphaMapForGlyph(glyph_t) // Multi engine // ------------------------------------------------------------------ -static inline uchar highByte(glyph_t glyph) +uchar QFontEngineMulti::highByte(glyph_t glyph) { return glyph >> 24; } // strip high byte from glyph diff --git a/src/gui/text/qfontengine_p.h b/src/gui/text/qfontengine_p.h index a411e9ce4c..708c79c2ae 100644 --- a/src/gui/text/qfontengine_p.h +++ b/src/gui/text/qfontengine_p.h @@ -485,6 +485,8 @@ public: void setFallbackFamiliesList(const QStringList &fallbackFamilies); + static uchar highByte(glyph_t glyph); // Used for determining engine + inline QFontEngine *engine(int at) const { Q_ASSERT(at < m_engines.size()); return m_engines.at(at); } diff --git a/src/gui/text/qtextdocumentlayout.cpp b/src/gui/text/qtextdocumentlayout.cpp index ebd7a7d69f..323253c70d 100644 --- a/src/gui/text/qtextdocumentlayout.cpp +++ b/src/gui/text/qtextdocumentlayout.cpp @@ -155,7 +155,7 @@ struct QTextLayoutStruct { { return pageHeight == 0 ? 0 : (absoluteY() / pageHeight).truncate(); } inline void newPage() - { if (pageHeight == QFIXED_MAX) return; pageBottom += pageHeight; y = pageBottom - pageHeight + pageBottomMargin + pageTopMargin - frameY; } + { if (pageHeight == QFIXED_MAX) return; pageBottom += pageHeight; y = qMax(y, pageBottom - pageHeight + pageBottomMargin + pageTopMargin - frameY); } }; class QTextTableData : public QTextFrameData @@ -2709,7 +2709,7 @@ void QTextDocumentLayoutPrivate::layoutBlock(const QTextBlock &bl, int blockPosi qreal(q->paintDevice()->logicalDpiY()) / qreal(qt_defaultDpi()) : 1; getLineHeightParams(blockFormat, line, scaling, &lineAdjustment, &lineBreakHeight, &lineHeight, &lineBottom); - if (layoutStruct->pageHeight > 0 && layoutStruct->absoluteY() + lineBreakHeight > layoutStruct->pageBottom && + while (layoutStruct->pageHeight > 0 && layoutStruct->absoluteY() + lineBreakHeight > layoutStruct->pageBottom && layoutStruct->pageHeight >= lineBreakHeight) { layoutStruct->newPage(); |