diff options
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/image/qbmphandler.cpp | 8 | ||||
-rw-r--r-- | src/gui/kernel/qguiapplication.cpp | 14 | ||||
-rw-r--r-- | src/gui/kernel/qwindow.cpp | 16 | ||||
-rw-r--r-- | src/gui/opengl/qopengltexture.cpp | 4 | ||||
-rw-r--r-- | src/gui/painting/qpaintengineex_p.h | 9 | ||||
-rw-r--r-- | src/gui/painting/qpainter.cpp | 5 | ||||
-rw-r--r-- | src/gui/painting/qpdf.cpp | 11 | ||||
-rw-r--r-- | src/gui/text/qfontdatabase.cpp | 2 | ||||
-rw-r--r-- | src/gui/text/qfontengine_ft.cpp | 11 | ||||
-rw-r--r-- | src/gui/text/qfontengine_ft_p.h | 4 |
10 files changed, 50 insertions, 34 deletions
diff --git a/src/gui/image/qbmphandler.cpp b/src/gui/image/qbmphandler.cpp index 390d3a666f..61353ebe6d 100644 --- a/src/gui/image/qbmphandler.cpp +++ b/src/gui/image/qbmphandler.cpp @@ -314,12 +314,20 @@ static bool read_dib_body(QDataStream &s, const BMP_INFOHDR &bi, int offset, int } } else if (comp == BMP_BITFIELDS && (nbits == 16 || nbits == 32)) { red_shift = calc_shift(red_mask); + if (((red_mask >> red_shift) + 1) == 0) + return false; red_scale = 256 / ((red_mask >> red_shift) + 1); green_shift = calc_shift(green_mask); + if (((green_mask >> green_shift) + 1) == 0) + return false; green_scale = 256 / ((green_mask >> green_shift) + 1); blue_shift = calc_shift(blue_mask); + if (((blue_mask >> blue_shift) + 1) == 0) + return false; blue_scale = 256 / ((blue_mask >> blue_shift) + 1); alpha_shift = calc_shift(alpha_mask); + if (((alpha_mask >> alpha_shift) + 1) == 0) + return false; alpha_scale = 256 / ((alpha_mask >> alpha_shift) + 1); } else if (comp == BMP_RGB && (nbits == 24 || nbits == 32)) { blue_mask = 0x000000ff; diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index 1467c96adb..0d5a130dfd 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -1675,15 +1675,13 @@ void QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::Mo if (e->globalPos != QGuiApplicationPrivate::lastCursorPosition && (stateChange != Qt::NoButton)) { // A mouse event should not change both position and buttons at the same time. Instead we // should first send a move event followed by a button changed event. Since this is not the case - // with the current event, we fake a move-only event that we recurse and process first. This - // will update the global mouse position and cause the second event to be a button only event. - QWindowSystemInterfacePrivate::MouseEvent moveEvent(e->window.data(), - e->timestamp, e->type, e->localPos, e->globalPos, buttons, e->modifiers, e->source); + // with the current event, we split it in two. + QWindowSystemInterfacePrivate::MouseEvent *mouseButtonEvent = new QWindowSystemInterfacePrivate::MouseEvent( + e->window.data(), e->timestamp, e->type, e->localPos, e->globalPos, e->buttons, e->modifiers); if (e->flags & QWindowSystemInterfacePrivate::WindowSystemEvent::Synthetic) - moveEvent.flags |= QWindowSystemInterfacePrivate::WindowSystemEvent::Synthetic; - processMouseEvent(&moveEvent); - Q_ASSERT(e->globalPos == QGuiApplicationPrivate::lastCursorPosition); - // continue with processing mouse button change event + mouseButtonEvent->flags |= QWindowSystemInterfacePrivate::WindowSystemEvent::Synthetic; + QWindowSystemInterfacePrivate::windowSystemEventQueue.prepend(mouseButtonEvent); + stateChange = Qt::NoButton; } QWindow *window = e->window.data(); diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp index 4a88988322..33f0409216 100644 --- a/src/gui/kernel/qwindow.cpp +++ b/src/gui/kernel/qwindow.cpp @@ -2238,10 +2238,12 @@ bool QWindow::nativeEvent(const QByteArray &eventType, void *message, long *resu QPoint QWindow::mapToGlobal(const QPoint &pos) const { Q_D(const QWindow); - if (d->platformWindow && d->platformWindow->isEmbedded(0)) + // QTBUG-43252, prefer platform implementation for foreign windows. + if (d->platformWindow + && (type() == Qt::ForeignWindow || d->platformWindow->isEmbedded(0))) { return d->platformWindow->mapToGlobal(pos); - else - return pos + d_func()->globalPosition(); + } + return pos + d_func()->globalPosition(); } @@ -2256,10 +2258,12 @@ QPoint QWindow::mapToGlobal(const QPoint &pos) const QPoint QWindow::mapFromGlobal(const QPoint &pos) const { Q_D(const QWindow); - if (d->platformWindow && d->platformWindow->isEmbedded(0)) + // QTBUG-43252, prefer platform implementation for foreign windows. + if (d->platformWindow + && (type() == Qt::ForeignWindow || d->platformWindow->isEmbedded(0))) { return d->platformWindow->mapFromGlobal(pos); - else - return pos - d_func()->globalPosition(); + } + return pos - d_func()->globalPosition(); } diff --git a/src/gui/opengl/qopengltexture.cpp b/src/gui/opengl/qopengltexture.cpp index b0245dd5c7..f480a2a109 100644 --- a/src/gui/opengl/qopengltexture.cpp +++ b/src/gui/opengl/qopengltexture.cpp @@ -840,6 +840,8 @@ static QOpenGLTexture::PixelType pixelTypeCompatibleWithInternalFormat(QOpenGLTe return QOpenGLTexture::UInt8; case QOpenGLTexture::DepthFormat: + return QOpenGLTexture::UInt32; + case QOpenGLTexture::AlphaFormat: case QOpenGLTexture::RGBFormat: case QOpenGLTexture::RGBAFormat: @@ -1859,7 +1861,7 @@ QOpenGLTexture *QOpenGLTexturePrivate::createTextureView(QOpenGLTexture::Target \value SRGB_Alpha_DXT5 Equivalent to GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT \value SRGB_BP_UNorm Equivalent to GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM_ARB - \value DepthFormat Equivalent to GL_DEPTH_COMPONENT (OpenGL ES 2 only and when OES_depth_texture is present) + \value DepthFormat Equivalent to GL_DEPTH_COMPONENT (only OpenGL ES 3 or ES 2 with OES_depth_texture) \value AlphaFormat Equivalent to GL_ALPHA (OpenGL ES 2 only) \value RGBFormat Equivalent to GL_RGB (OpenGL ES 2 only) \value RGBAFormat Equivalent to GL_RGBA (OpenGL ES 2 only) diff --git a/src/gui/painting/qpaintengineex_p.h b/src/gui/painting/qpaintengineex_p.h index 9f3e577c34..29eea6032e 100644 --- a/src/gui/painting/qpaintengineex_p.h +++ b/src/gui/painting/qpaintengineex_p.h @@ -65,8 +65,6 @@ struct StrokeHandler; QDebug Q_GUI_EXPORT &operator<<(QDebug &, const QVectorPath &path); #endif -class QPixmapFilter; - class Q_GUI_EXPORT QPaintEngineEx : public QPaintEngine { Q_DECLARE_PRIVATE(QPaintEngineEx) @@ -140,13 +138,6 @@ public: virtual void beginNativePainting() {} virtual void endNativePainting() {} - // Return a pixmap filter of "type" that can render the parameters - // in "prototype". The returned filter is owned by the engine and - // will be destroyed when the engine is destroyed. The "prototype" - // allows the engine to pick different filters based on the parameters - // that will be requested, and not just the "type". - virtual QPixmapFilter *pixmapFilter(int /*type*/, const QPixmapFilter * /*prototype*/) { return 0; } - // These flags are needed in the implementation of paint buffers. enum Flags { diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp index 47af6a883a..01f9904798 100644 --- a/src/gui/painting/qpainter.cpp +++ b/src/gui/painting/qpainter.cpp @@ -5536,6 +5536,11 @@ void QPainter::drawGlyphRun(const QPointF &position, const QGlyphRun &glyphRun) { Q_D(QPainter); + if (!d->engine) { + qWarning("QPainter::drawGlyphRun: Painter not active"); + return; + } + QRawFont font = glyphRun.rawFont(); if (!font.isValid()) return; diff --git a/src/gui/painting/qpdf.cpp b/src/gui/painting/qpdf.cpp index 8fe57d3d23..cc1ad02eee 100644 --- a/src/gui/painting/qpdf.cpp +++ b/src/gui/painting/qpdf.cpp @@ -1051,7 +1051,7 @@ void QPdfEngine::drawPath (const QPainterPath &p) if (!d->hasPen && !d->hasBrush) return; - if (d->simplePen && d->opacity == 1.0) { + if (d->simplePen) { // draw strokes natively in this case for better output *d->currentPage << QPdf::generatePath(p, QTransform(), d->hasBrush ? QPdf::FillAndStrokePath : QPdf::StrokePath); } else { @@ -1198,7 +1198,7 @@ void QPdfEngine::updateState(const QPaintEngineState &state) d->stroker.setPen(d->pen, state.renderHints()); QBrush penBrush = d->pen.brush(); bool oldSimple = d->simplePen; - d->simplePen = (d->hasPen && (penBrush.style() == Qt::SolidPattern) && penBrush.isOpaque()); + d->simplePen = (d->hasPen && (penBrush.style() == Qt::SolidPattern) && penBrush.isOpaque() && d->opacity == 1.0); if (oldSimple != d->simplePen) flags |= DirtyTransform; } else if (flags & DirtyHints) { @@ -1214,8 +1214,13 @@ void QPdfEngine::updateState(const QPaintEngineState &state) d->brushOrigin = state.brushOrigin(); flags |= DirtyBrush; } - if (flags & DirtyOpacity) + if (flags & DirtyOpacity) { d->opacity = state.opacity(); + if (d->simplePen && d->opacity != 1.0) { + d->simplePen = false; + flags |= DirtyTransform; + } + } bool ce = d->clipEnabled; if (flags & DirtyClipPath) { diff --git a/src/gui/text/qfontdatabase.cpp b/src/gui/text/qfontdatabase.cpp index 1cdbf6aa8e..1a71042648 100644 --- a/src/gui/text/qfontdatabase.cpp +++ b/src/gui/text/qfontdatabase.cpp @@ -152,8 +152,10 @@ static int getFontWeight(const QString &weightString) return QFont::ExtraBold; // And now the contains() checks for the translated strings. + //: The word for "Extra" as in "Extra Bold, Extra Thin" used as a pattern for string searches const QString translatedExtra = QCoreApplication::translate("QFontDatabase", "Extra").toLower(); if (s.contains(translatedBold)) { + //: The word for "Demi" as in "Demi Bold" used as a pattern for string searches QString translatedDemi = QCoreApplication::translate("QFontDatabase", "Demi").toLower(); if (s .contains(translatedDemi)) return QFont::DemiBold; diff --git a/src/gui/text/qfontengine_ft.cpp b/src/gui/text/qfontengine_ft.cpp index 9aab0282d3..b79f971156 100644 --- a/src/gui/text/qfontengine_ft.cpp +++ b/src/gui/text/qfontengine_ft.cpp @@ -510,7 +510,7 @@ void QFreetypeFace::addGlyphToPath(FT_Face face, FT_GlyphSlot g, const QFixedPoi extern void qt_addBitmapToPath(qreal x0, qreal y0, const uchar *image_data, int bpl, int w, int h, QPainterPath *path); -void QFreetypeFace::addBitmapToPath(FT_GlyphSlot slot, const QFixedPoint &point, QPainterPath *path, bool) +void QFreetypeFace::addBitmapToPath(FT_GlyphSlot slot, const QFixedPoint &point, QPainterPath *path) { if (slot->format != FT_GLYPH_FORMAT_BITMAP || slot->bitmap.pixel_mode != FT_PIXEL_MODE_MONO) @@ -1430,7 +1430,7 @@ void QFontEngineFT::addOutlineToPath(qreal x, qreal y, const QGlyphLayout &glyph for (int gl = 0; gl < glyphs.numGlyphs; gl++) { FT_UInt glyph = positioned_glyphs[gl]; FT_Load_Glyph(face, glyph, FT_LOAD_TARGET_MONO); - freetype->addBitmapToPath(face->glyph, positions[gl], path); + QFreetypeFace::addBitmapToPath(face->glyph, positions[gl], path); } unlockFace(); } @@ -1696,7 +1696,7 @@ glyph_metrics_t QFontEngineFT::boundingBox(glyph_t glyph, const QTransform &matr glyph_metrics_t QFontEngineFT::alphaMapBoundingBox(glyph_t glyph, QFixed subPixelPosition, const QTransform &matrix, QFontEngine::GlyphFormat format) { - Glyph *g = loadGlyphFor(glyph, subPixelPosition, format, matrix); + Glyph *g = loadGlyphFor(glyph, subPixelPosition, format, matrix, true); glyph_metrics_t overall; if (g) { @@ -1839,7 +1839,8 @@ void QFontEngineFT::unlockAlphaMapForGlyph() QFontEngineFT::Glyph *QFontEngineFT::loadGlyphFor(glyph_t g, QFixed subPixelPosition, GlyphFormat format, - const QTransform &t) + const QTransform &t, + bool fetchBoundingBox) { FT_Face face = 0; QGlyphSet *glyphSet = 0; @@ -1852,7 +1853,7 @@ QFontEngineFT::Glyph *QFontEngineFT::loadGlyphFor(glyph_t g, Q_ASSERT(glyphSet != 0); } - if (glyphSet != 0 && glyphSet->outline_drawing) + if (glyphSet != 0 && glyphSet->outline_drawing && !fetchBoundingBox) return 0; Glyph *glyph = glyphSet != 0 ? glyphSet->getGlyph(g, subPixelPosition) : 0; diff --git a/src/gui/text/qfontengine_ft_p.h b/src/gui/text/qfontengine_ft_p.h index 8fd5ca23af..1218893e19 100644 --- a/src/gui/text/qfontengine_ft_p.h +++ b/src/gui/text/qfontengine_ft_p.h @@ -102,7 +102,7 @@ public: int getPointInOutline(glyph_t glyph, int flags, quint32 point, QFixed *xpos, QFixed *ypos, quint32 *nPoints); static void addGlyphToPath(FT_Face face, FT_GlyphSlot g, const QFixedPoint &point, QPainterPath *path, FT_Fixed x_scale, FT_Fixed y_scale); - static void addBitmapToPath(FT_GlyphSlot slot, const QFixedPoint &point, QPainterPath *path, bool = false); + static void addBitmapToPath(FT_GlyphSlot slot, const QFixedPoint &point, QPainterPath *path); private: friend class QFontEngineFT; @@ -266,7 +266,7 @@ private: inline Glyph *loadGlyph(uint glyph, QFixed subPixelPosition, GlyphFormat format = Format_None, bool fetchMetricsOnly = false) const { return loadGlyph(cacheEnabled ? &defaultGlyphSet : 0, glyph, subPixelPosition, format, fetchMetricsOnly); } Glyph *loadGlyph(QGlyphSet *set, uint glyph, QFixed subPixelPosition, GlyphFormat = Format_None, bool fetchMetricsOnly = false) const; - Glyph *loadGlyphFor(glyph_t g, QFixed subPixelPosition, GlyphFormat format, const QTransform &t); + Glyph *loadGlyphFor(glyph_t g, QFixed subPixelPosition, GlyphFormat format, const QTransform &t, bool fetchBoundingBox = false); QGlyphSet *loadTransformedGlyphSet(const QTransform &matrix); |