summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2011-04-01 08:04:03 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2011-04-01 08:04:03 (GMT)
commit95d5218439c3e6df039e86a70d318a62558b196d (patch)
tree118a24cc6a3df3b3fcb4b7126235551c3f442c38 /src
parent7b18baf23b1e8c663872b2b25b1323798b1d09df (diff)
parent8a3699622745ce35d2983f10ad8ae8f04ff380cf (diff)
downloadQt-95d5218439c3e6df039e86a70d318a62558b196d.zip
Qt-95d5218439c3e6df039e86a70d318a62558b196d.tar.gz
Qt-95d5218439c3e6df039e86a70d318a62558b196d.tar.bz2
Merge branch 'master' of scm.dev.nokia.troll.no:qt/qt-fire-staging into master-integration
* 'master' of scm.dev.nokia.troll.no:qt/qt-fire-staging: opengl2: Make maximum cached glyph size configurable QWS: fix the software/hardware cursor switcher Fix horizontal centered text drawing without word wrap Remove Font Smoothing hack for OS X Revert "Fixed underline offset after raster coordinate system change." Fix the painting for widgets painting directly on screen. Fixed bad merges in GL windowsurface and get rid of redundant variable. Added WindowSurfaceFeature enum to QWindowSurface. Added preserved contents property to QWindowSurface. Fixed underline offset after raster coordinate system change.
Diffstat (limited to 'src')
-rw-r--r--src/declarative/util/qdeclarativeview.cpp8
-rw-r--r--src/gui/embedded/qscreen_qws.cpp3
-rw-r--r--src/gui/embedded/qscreen_qws.h4
-rw-r--r--src/gui/kernel/qcocoaview_mac.mm11
-rw-r--r--src/gui/painting/qbackingstore.cpp8
-rw-r--r--src/gui/painting/qbackingstore_p.h3
-rw-r--r--src/gui/painting/qgraphicssystem_runtime.cpp9
-rw-r--r--src/gui/painting/qgraphicssystem_runtime_p.h3
-rw-r--r--src/gui/painting/qpainter.cpp17
-rw-r--r--src/gui/painting/qwindowsurface.cpp11
-rw-r--r--src/gui/painting/qwindowsurface_p.h19
-rw-r--r--src/gui/painting/qwindowsurface_raster.cpp5
-rw-r--r--src/gui/painting/qwindowsurface_raster_p.h2
-rw-r--r--src/gui/painting/qwindowsurface_s60.cpp4
-rw-r--r--src/gui/painting/qwindowsurface_s60_p.h2
-rw-r--r--src/gui/painting/qwindowsurface_x11.cpp9
-rw-r--r--src/gui/painting/qwindowsurface_x11_p.h3
-rw-r--r--src/gui/text/qtextengine.cpp16
-rw-r--r--src/gui/text/qtextengine_p.h1
-rw-r--r--src/gui/text/qtextlayout.cpp19
-rw-r--r--src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp7
-rw-r--r--src/opengl/qwindowsurface_gl.cpp44
-rw-r--r--src/opengl/qwindowsurface_gl_p.h2
-rw-r--r--src/openvg/qwindowsurface_vg.cpp7
-rw-r--r--src/openvg/qwindowsurface_vg_p.h2
25 files changed, 112 insertions, 107 deletions
diff --git a/src/declarative/util/qdeclarativeview.cpp b/src/declarative/util/qdeclarativeview.cpp
index 1b50a56..421cd89 100644
--- a/src/declarative/util/qdeclarativeview.cpp
+++ b/src/declarative/util/qdeclarativeview.cpp
@@ -72,7 +72,6 @@
QT_BEGIN_NAMESPACE
DEFINE_BOOL_CONFIG_OPTION(frameRateDebug, QML_SHOW_FRAMERATE)
-extern Q_GUI_EXPORT bool qt_applefontsmoothing_enabled;
class QDeclarativeScene : public QGraphicsScene
{
@@ -707,14 +706,7 @@ void QDeclarativeView::paintEvent(QPaintEvent *event)
if (frameRateDebug())
time = d->frameTimer.restart();
-#ifdef Q_WS_MAC
- bool oldSmooth = qt_applefontsmoothing_enabled;
- qt_applefontsmoothing_enabled = false;
-#endif
QGraphicsView::paintEvent(event);
-#ifdef Q_WS_MAC
- qt_applefontsmoothing_enabled = oldSmooth;
-#endif
QDeclarativeDebugTrace::endRange(QDeclarativeDebugTrace::Painting);
diff --git a/src/gui/embedded/qscreen_qws.cpp b/src/gui/embedded/qscreen_qws.cpp
index e207ed1..90561fd 100644
--- a/src/gui/embedded/qscreen_qws.cpp
+++ b/src/gui/embedded/qscreen_qws.cpp
@@ -64,7 +64,6 @@ QT_BEGIN_NAMESPACE
// #define QT_USE_MEMCPY_DUFF
#ifndef QT_NO_QWS_CURSOR
-bool qt_sw_cursor=false;
Q_GUI_EXPORT QScreenCursor * qt_screencursor = 0;
#endif
Q_GUI_EXPORT QScreen * qt_screen = 0;
@@ -119,8 +118,6 @@ ClearCacheFunc QScreen::clearCacheFunc = 0;
Returns a pointer to the application's unique screen cursor.
*/
-extern bool qws_sw_cursor;
-
/*!
Constructs a screen cursor
*/
diff --git a/src/gui/embedded/qscreen_qws.h b/src/gui/embedded/qscreen_qws.h
index 17ffbbb..85c775e 100644
--- a/src/gui/embedded/qscreen_qws.h
+++ b/src/gui/embedded/qscreen_qws.h
@@ -130,7 +130,7 @@ const int SourcePixmap=1;
class QScreenCursor;
extern QScreenCursor *qt_screencursor;
-extern bool qt_sw_cursor;
+extern bool qws_sw_cursor;
class Q_GUI_EXPORT QScreenCursor
{
@@ -145,7 +145,7 @@ public:
bool supportsAlphaCursor() const { return supportsAlpha; }
- static bool enabled() { return qt_sw_cursor; }
+ static bool enabled() { return qws_sw_cursor; }
QRect boundingRect() const { return QRect(pos - hotspot, size); }
QImage image() const { return cursor; }
diff --git a/src/gui/kernel/qcocoaview_mac.mm b/src/gui/kernel/qcocoaview_mac.mm
index 54e7e3e..b5e5d18 100644
--- a/src/gui/kernel/qcocoaview_mac.mm
+++ b/src/gui/kernel/qcocoaview_mac.mm
@@ -254,7 +254,10 @@ static int qCocoaViewCount = 0;
qt_mac_retain_graphics_context(context);
// We use a different graphics system.
- if (QApplicationPrivate::graphicsSystem() != 0) {
+ //
+ // Widgets that are set to paint on screen, specifically QGLWidget,
+ // requires the native engine to execute in order to be drawn.
+ if (QApplicationPrivate::graphicsSystem() != 0 && !qwidget->testAttribute(Qt::WA_PaintOnScreen)) {
// Raster engine.
if (QApplicationPrivate::graphics_system_name == QLatin1String("raster")) {
@@ -334,12 +337,6 @@ static int qCocoaViewCount = 0;
qwidget->update(qwidget->rect());
qwidgetprivate->syncBackingStore(qwidget->rect());
}
-
- // Since we don't want to use the native engine, we must exit, however
- // widgets that are set to paint on screen, specifically QGLWidget,
- // requires the following code to execute in order to be drawn.
- if (!qwidget->testAttribute(Qt::WA_PaintOnScreen))
- return;
}
// Native engine.
diff --git a/src/gui/painting/qbackingstore.cpp b/src/gui/painting/qbackingstore.cpp
index e5d8abc..42c1c35 100644
--- a/src/gui/painting/qbackingstore.cpp
+++ b/src/gui/painting/qbackingstore.cpp
@@ -588,7 +588,7 @@ void QWidgetBackingStore::markDirty(const QRegion &rgn, QWidget *widget, bool up
return;
}
- if (!windowSurface->hasPartialUpdateSupport()) {
+ if (!windowSurface->hasFeature(QWindowSurface::PartialUpdates)) {
fullUpdatePending = true;
sendUpdateRequest(tlw, updateImmediately);
return;
@@ -683,7 +683,7 @@ void QWidgetBackingStore::markDirty(const QRect &rect, QWidget *widget, bool upd
return;
}
- if (!windowSurface->hasPartialUpdateSupport()) {
+ if (!windowSurface->hasFeature(QWindowSurface::PartialUpdates)) {
fullUpdatePending = true;
sendUpdateRequest(tlw, updateImmediately);
return;
@@ -1143,9 +1143,9 @@ void QWidgetBackingStore::sync(QWidget *exposedWidget, const QRegion &exposedReg
return;
}
- // If there's no partial update support we always need
+ // If there's no preserved contents support we always need
// to do a full repaint before flushing
- if (!windowSurface->hasPartialUpdateSupport())
+ if (!windowSurface->hasFeature(QWindowSurface::PreservedContents))
fullUpdatePending = true;
// Nothing to repaint.
diff --git a/src/gui/painting/qbackingstore_p.h b/src/gui/painting/qbackingstore_p.h
index 39bf66c..05f4bfc 100644
--- a/src/gui/painting/qbackingstore_p.h
+++ b/src/gui/painting/qbackingstore_p.h
@@ -262,8 +262,7 @@ private:
}
inline bool hasStaticContents() const
- { return !staticWidgets.isEmpty() && windowSurface->hasStaticContentsSupport()
- && windowSurface->hasPartialUpdateSupport(); }
+ { return !staticWidgets.isEmpty() && windowSurface->hasFeature(QWindowSurface::StaticContents); }
friend QRegion qt_dirtyRegion(QWidget *);
friend class QWidgetPrivate;
diff --git a/src/gui/painting/qgraphicssystem_runtime.cpp b/src/gui/painting/qgraphicssystem_runtime.cpp
index 46a6f81..d1dd7ef 100644
--- a/src/gui/painting/qgraphicssystem_runtime.cpp
+++ b/src/gui/painting/qgraphicssystem_runtime.cpp
@@ -319,14 +319,9 @@ QPoint QRuntimeWindowSurface::offset(const QWidget *widget) const
return m_windowSurface->offset(widget);
}
-bool QRuntimeWindowSurface::hasStaticContentsSupport() const
+QWindowSurface::WindowSurfaceFeatures QRuntimeWindowSurface::features() const
{
- return m_windowSurface->hasStaticContentsSupport();
-}
-
-bool QRuntimeWindowSurface::hasPartialUpdateSupport() const
-{
- return m_windowSurface->hasPartialUpdateSupport();
+ return m_windowSurface->features();
}
QRuntimeGraphicsSystem::QRuntimeGraphicsSystem()
diff --git a/src/gui/painting/qgraphicssystem_runtime_p.h b/src/gui/painting/qgraphicssystem_runtime_p.h
index 998fa98..26d3777 100644
--- a/src/gui/painting/qgraphicssystem_runtime_p.h
+++ b/src/gui/painting/qgraphicssystem_runtime_p.h
@@ -129,8 +129,7 @@ public:
virtual QPoint offset(const QWidget *widget) const;
- virtual bool hasStaticContentsSupport() const;
- virtual bool hasPartialUpdateSupport() const;
+ virtual WindowSurfaceFeatures features() const;
QScopedPointer<QWindowSurface> m_windowSurface;
QScopedPointer<QWindowSurface> m_pendingWindowSurface;
diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp
index 14fb772..64ef549 100644
--- a/src/gui/painting/qpainter.cpp
+++ b/src/gui/painting/qpainter.cpp
@@ -8149,10 +8149,6 @@ start_lengthVariant:
engine.option.setTextDirection(layout_direction);
if (tf & Qt::AlignJustify)
engine.option.setAlignment(Qt::AlignJustify);
- else if (tf & Qt::AlignRight)
- engine.option.setAlignment(Qt::AlignRight);
- else if (tf & Qt::AlignHCenter)
- engine.option.setAlignment(Qt::AlignHCenter);
else
engine.option.setAlignment(Qt::AlignLeft); // do not do alignment twice
@@ -8248,7 +8244,18 @@ start_lengthVariant:
for (int i = 0; i < textLayout.lineCount(); i++) {
QTextLine line = textLayout.lineAt(i);
- line.draw(painter, QPointF(r.x(), r.y() + yoff));
+
+ qreal advance = line.horizontalAdvance();
+ xoff = 0;
+ if (tf & Qt::AlignRight) {
+ QTextEngine *eng = textLayout.engine();
+ xoff = r.width() - advance -
+ eng->leadingSpaceWidth(eng->lines[line.lineNumber()]).toReal();
+ }
+ else if (tf & Qt::AlignHCenter)
+ xoff = (r.width() - advance) / 2;
+
+ line.draw(painter, QPointF(r.x() + xoff, r.y() + yoff));
}
if (restore) {
diff --git a/src/gui/painting/qwindowsurface.cpp b/src/gui/painting/qwindowsurface.cpp
index 9b71818..0fb9bf7 100644
--- a/src/gui/painting/qwindowsurface.cpp
+++ b/src/gui/painting/qwindowsurface.cpp
@@ -307,11 +307,6 @@ QPoint QWindowSurface::offset(const QWidget *widget) const
window surface.
*/
-bool QWindowSurface::hasStaticContentsSupport() const
-{
- return false;
-}
-
void QWindowSurface::setStaticContents(const QRegion &region)
{
d_ptr->staticContents = region;
@@ -324,12 +319,12 @@ QRegion QWindowSurface::staticContents() const
bool QWindowSurface::hasStaticContents() const
{
- return hasStaticContentsSupport() && !d_ptr->staticContents.isEmpty();
+ return hasFeature(QWindowSurface::StaticContents) && !d_ptr->staticContents.isEmpty();
}
-bool QWindowSurface::hasPartialUpdateSupport() const
+QWindowSurface::WindowSurfaceFeatures QWindowSurface::features() const
{
- return true;
+ return PartialUpdates | PreservedContents;
}
#ifdef Q_WS_QPA
diff --git a/src/gui/painting/qwindowsurface_p.h b/src/gui/painting/qwindowsurface_p.h
index 4a2775f..a3fea67 100644
--- a/src/gui/painting/qwindowsurface_p.h
+++ b/src/gui/painting/qwindowsurface_p.h
@@ -68,6 +68,14 @@ class QPlatformWindow;
class Q_GUI_EXPORT QWindowSurface
{
public:
+ enum WindowSurfaceFeature {
+ PartialUpdates = 0x00000001, // Supports doing partial updates.
+ PreservedContents = 0x00000002, // Supports doing flush without first doing a repaint.
+ StaticContents = 0x00000004, // Supports having static content regions when being resized.
+ AllFeatures = 0xffffffff // For convenience
+ };
+ Q_DECLARE_FLAGS(WindowSurfaceFeatures, WindowSurfaceFeature)
+
QWindowSurface(QWidget *window, bool setDefaultSurface = true);
virtual ~QWindowSurface();
@@ -100,8 +108,8 @@ public:
virtual QPoint offset(const QWidget *widget) const;
inline QRect rect(const QWidget *widget) const;
- virtual bool hasStaticContentsSupport() const;
- virtual bool hasPartialUpdateSupport() const;
+ bool hasFeature(WindowSurfaceFeature feature) const;
+ virtual WindowSurfaceFeatures features() const;
void setStaticContents(const QRegion &region);
QRegion staticContents() const;
@@ -113,11 +121,18 @@ private:
QWindowSurfacePrivate *d_ptr;
};
+Q_DECLARE_OPERATORS_FOR_FLAGS(QWindowSurface::WindowSurfaceFeatures)
+
inline QRect QWindowSurface::rect(const QWidget *widget) const
{
return widget->rect().translated(offset(widget));
}
+inline bool QWindowSurface::hasFeature(WindowSurfaceFeature feature) const
+{
+ return (features() & feature) != 0;
+}
+
QT_END_NAMESPACE
#endif // QWINDOWSURFACE_P_H
diff --git a/src/gui/painting/qwindowsurface_raster.cpp b/src/gui/painting/qwindowsurface_raster.cpp
index a5c45c0..9860841 100644
--- a/src/gui/painting/qwindowsurface_raster.cpp
+++ b/src/gui/painting/qwindowsurface_raster.cpp
@@ -410,12 +410,11 @@ bool QRasterWindowSurface::scroll(const QRegion &area, int dx, int dy)
#endif
}
-bool QRasterWindowSurface::hasStaticContentsSupport() const
+QWindowSurface::WindowSurfaceFeatures QRasterWindowSurface::features() const
{
- return true;
+ return QWindowSurface::AllFeatures;
}
-
void QRasterWindowSurface::prepareBuffer(QImage::Format format, QWidget *widget)
{
Q_D(QRasterWindowSurface);
diff --git a/src/gui/painting/qwindowsurface_raster_p.h b/src/gui/painting/qwindowsurface_raster_p.h
index 669511d..06abcd3 100644
--- a/src/gui/painting/qwindowsurface_raster_p.h
+++ b/src/gui/painting/qwindowsurface_raster_p.h
@@ -109,7 +109,7 @@ public:
void beginPaint(const QRegion &rgn);
void setGeometry(const QRect &rect);
bool scroll(const QRegion &area, int dx, int dy);
- bool hasStaticContentsSupport() const;
+ WindowSurfaceFeatures features() const;
#ifdef QT_MAC_USE_COCOA
CGContextRef imageContext();
diff --git a/src/gui/painting/qwindowsurface_s60.cpp b/src/gui/painting/qwindowsurface_s60.cpp
index 4fa25cb..9fa01ed 100644
--- a/src/gui/painting/qwindowsurface_s60.cpp
+++ b/src/gui/painting/qwindowsurface_s60.cpp
@@ -239,9 +239,9 @@ void QS60WindowSurface::setGeometry(const QRect& rect)
QWindowSurface::setGeometry(rect);
}
-bool QS60WindowSurface::hasStaticContentsSupport() const
+QWindowSurface::WindowSurfaceFeatures QS60WindowSurface::features() const
{
- return true;
+ return QWindowSurface::AllFeatures;
}
CFbsBitmap* QS60WindowSurface::symbianBitmap() const
diff --git a/src/gui/painting/qwindowsurface_s60_p.h b/src/gui/painting/qwindowsurface_s60_p.h
index f730c87..25018d8 100644
--- a/src/gui/painting/qwindowsurface_s60_p.h
+++ b/src/gui/painting/qwindowsurface_s60_p.h
@@ -79,7 +79,7 @@ public:
void setGeometry(const QRect &rect);
- bool hasStaticContentsSupport() const;
+ WindowSurfaceFeatures features() const;
CFbsBitmap *symbianBitmap() const;
diff --git a/src/gui/painting/qwindowsurface_x11.cpp b/src/gui/painting/qwindowsurface_x11.cpp
index ab4f53e..deb83b4 100644
--- a/src/gui/painting/qwindowsurface_x11.cpp
+++ b/src/gui/painting/qwindowsurface_x11.cpp
@@ -250,13 +250,16 @@ QPixmap QX11WindowSurface::grabWidget(const QWidget *widget,
return px;
}
-bool QX11WindowSurface::hasStaticContentsSupport() const
+QWindowSurface::WindowSurfaceFeatures QX11WindowSurface::features() const
{
+ WindowSurfaceFeatures features = QWindowSurface::PartialUpdates | QWindowSurface::PreservedContents;
#ifndef QT_NO_XRENDER
- return !d_ptr->translucentBackground;
+ if (!d_ptr->translucentBackground)
+ features |= QWindowSurface::StaticContents;
#else
- return true;
+ features |= QWindowSurface::StaticContents;
#endif
+ return features;
}
QT_END_NAMESPACE
diff --git a/src/gui/painting/qwindowsurface_x11_p.h b/src/gui/painting/qwindowsurface_x11_p.h
index d5179dd..df76f98 100644
--- a/src/gui/painting/qwindowsurface_x11_p.h
+++ b/src/gui/painting/qwindowsurface_x11_p.h
@@ -80,7 +80,8 @@ public:
bool scroll(const QRegion &area, int dx, int dy);
QPixmap grabWidget(const QWidget *widget,
const QRect& rectangle = QRect()) const;
- bool hasStaticContentsSupport() const;
+ WindowSurfaceFeatures features() const;
+
private:
QX11WindowSurfacePrivate *d_ptr;
GC gc;
diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp
index a63fdbf..6aa333c 100644
--- a/src/gui/text/qtextengine.cpp
+++ b/src/gui/text/qtextengine.cpp
@@ -2725,6 +2725,22 @@ void QTextEngine::resolveAdditionalFormats() const
specialData->resolvedFormatIndices = indices;
}
+QFixed QTextEngine::leadingSpaceWidth(const QScriptLine &line)
+{
+ if (!line.hasTrailingSpaces
+ || (option.flags() & QTextOption::IncludeTrailingSpaces)
+ || !isRightToLeft())
+ return QFixed();
+
+ int pos = line.length;
+ const HB_CharAttributes *attributes = this->attributes();
+ if (!attributes)
+ return QFixed();
+ while (pos > 0 && attributes[line.from + pos - 1].whiteSpace)
+ --pos;
+ return width(line.from + pos, line.length - pos);
+}
+
QStackTextEngine::QStackTextEngine(const QString &string, const QFont &f)
: QTextEngine(string, f),
_layoutData(string, _memory, MemSize)
diff --git a/src/gui/text/qtextengine_p.h b/src/gui/text/qtextengine_p.h
index 50d1ff8..366c5c3 100644
--- a/src/gui/text/qtextengine_p.h
+++ b/src/gui/text/qtextengine_p.h
@@ -609,6 +609,7 @@ public:
QString elidedText(Qt::TextElideMode mode, const QFixed &width, int flags = 0) const;
void shapeLine(const QScriptLine &line);
+ QFixed leadingSpaceWidth(const QScriptLine &line);
private:
void setBoundary(int strPos) const;
diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp
index 8eff7d2..afe6949 100644
--- a/src/gui/text/qtextlayout.cpp
+++ b/src/gui/text/qtextlayout.cpp
@@ -66,23 +66,6 @@ QT_BEGIN_NAMESPACE
#define SuppressText 0x5012
#define SuppressBackground 0x513
-static inline QFixed leadingSpaceWidth(QTextEngine *eng, const QScriptLine &line)
-{
- if (!line.hasTrailingSpaces
- || (eng->option.flags() & QTextOption::IncludeTrailingSpaces)
- || !(eng->option.alignment() & Qt::AlignRight)
- || !eng->isRightToLeft())
- return QFixed();
-
- int pos = line.length;
- const HB_CharAttributes *attributes = eng->attributes();
- if (!attributes)
- return QFixed();
- while (pos > 0 && attributes[line.from + pos - 1].whiteSpace)
- --pos;
- return eng->width(line.from + pos, line.length - pos);
-}
-
static QFixed alignLine(QTextEngine *eng, const QScriptLine &line)
{
QFixed x = 0;
@@ -93,7 +76,7 @@ static QFixed alignLine(QTextEngine *eng, const QScriptLine &line)
if (align & Qt::AlignJustify && eng->isRightToLeft())
align = Qt::AlignRight;
if (align & Qt::AlignRight)
- x = line.width - (line.textAdvance + leadingSpaceWidth(eng, line));
+ x = line.width - (line.textAdvance + eng->leadingSpaceWidth(line));
else if (align & Qt::AlignHCenter)
x = (line.width - line.textAdvance)/2;
}
diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
index 6678522..4d1d5dc 100644
--- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
+++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
@@ -98,6 +98,10 @@ extern Q_GUI_EXPORT bool qt_cleartype_enabled;
extern bool qt_applefontsmoothing_enabled;
#endif
+#if !defined(QT_MAX_CACHED_GLYPH_SIZE)
+# define QT_MAX_CACHED_GLYPH_SIZE 64
+#endif
+
Q_GUI_EXPORT QImage qt_imageForBrush(int brushStyle, bool invert);
////////////////////////////////// Private Methods //////////////////////////////////////////
@@ -1473,7 +1477,8 @@ void QGL2PaintEngineEx::drawTextItem(const QPointF &p, const QTextItem &textItem
// don't try to cache huge fonts or vastly transformed fonts
const qreal pixelSize = ti.fontEngine->fontDef.pixelSize;
- if (pixelSize * pixelSize * qAbs(det) >= 64 * 64 || det < 0.25f || det > 4.f)
+ if (pixelSize * pixelSize * qAbs(det) >= QT_MAX_CACHED_GLYPH_SIZE * QT_MAX_CACHED_GLYPH_SIZE ||
+ det < 0.25f || det > 4.f)
drawCached = false;
QFontEngineGlyphCache::Type glyphType = ti.fontEngine->glyphFormat >= 0
diff --git a/src/opengl/qwindowsurface_gl.cpp b/src/opengl/qwindowsurface_gl.cpp
index eae1c9b..77f6103 100644
--- a/src/opengl/qwindowsurface_gl.cpp
+++ b/src/opengl/qwindowsurface_gl.cpp
@@ -338,7 +338,7 @@ struct QGLWindowSurfacePrivate
QGLWindowSurfaceGLPaintDevice glDevice;
QGLWindowSurface* q_ptr;
- bool partialUpdateSupport;
+ bool swap_region_support;
};
QGLFormat QGLWindowSurface::surfaceFormat;
@@ -391,7 +391,7 @@ QGLWindowSurface::QGLWindowSurface(QWidget *window)
d_ptr->q_ptr = this;
d_ptr->geometry_updated = false;
d_ptr->did_paint = false;
- d_ptr->partialUpdateSupport = false;
+ d_ptr->swap_region_support = false;
}
QGLWindowSurface::~QGLWindowSurface()
@@ -491,22 +491,17 @@ void QGLWindowSurface::hijackWindow(QWidget *widget)
if (haveNOKSwapRegion)
qDebug() << "Found EGL_NOK_swap_region2 extension. Using partial updates.";
}
- bool swapBehaviourPreserved = (ctx->d_func()->eglContext->configAttrib(EGL_SWAP_BEHAVIOR) != EGL_BUFFER_PRESERVED)
- || (ctx->d_func()->eglContext->configAttrib(EGL_SURFACE_TYPE)&EGL_SWAP_BEHAVIOR_PRESERVED_BIT);
+
+ d_ptr->destructive_swap_buffers = true;
if (ctx->d_func()->eglContext->configAttrib(EGL_SURFACE_TYPE)&EGL_SWAP_BEHAVIOR_PRESERVED_BIT) {
EGLint swapBehavior;
if (eglQuerySurface(ctx->d_func()->eglContext->display(), ctx->d_func()->eglSurface
, EGL_SWAP_BEHAVIOR, &swapBehavior)) {
- swapBehaviourPreserved = (swapBehavior == EGL_BUFFER_PRESERVED);
+ d_ptr->destructive_swap_buffers = (swapBehavior != EGL_BUFFER_PRESERVED);
}
}
- if (!swapBehaviourPreserved && !haveNOKSwapRegion)
- d_ptr->partialUpdateSupport = false; // Force full-screen updates
- else
- d_ptr->partialUpdateSupport = true;
-#else
- d_ptr->partialUpdateSupport = false;
+ d_ptr->swap_region_support = haveNOKSwapRegion;
#endif
widgetPrivate->extraData()->glContext = ctx;
@@ -622,7 +617,7 @@ void QGLWindowSurface::flush(QWidget *widget, const QRegion &rgn, const QPoint &
// mistake to call swapBuffers if nothing was painted unless
// EGL_BUFFER_PRESERVED is set. This check protects the flush func from
// being executed if it's for nothing.
- if (!hasPartialUpdateSupport() && !d_ptr->did_paint)
+ if (!d_ptr->destructive_swap_buffers && !d_ptr->did_paint)
return;
QWidget *parent = widget->internalWinId() ? widget : widget->nativeParentWidget();
@@ -698,12 +693,12 @@ void QGLWindowSurface::flush(QWidget *widget, const QRegion &rgn, const QPoint &
}
#endif
bool doingPartialUpdate = false;
- if (QGLWindowSurface::swapBehavior == QGLWindowSurface::AutomaticSwap)
- doingPartialUpdate = hasPartialUpdateSupport() && br.width() * br.height() < parent->geometry().width() * parent->geometry().height() * 0.2;
- else if (QGLWindowSurface::swapBehavior == QGLWindowSurface::AlwaysFullSwap)
- doingPartialUpdate = false;
- else if (QGLWindowSurface::swapBehavior == QGLWindowSurface::AlwaysPartialSwap)
- doingPartialUpdate = hasPartialUpdateSupport();
+ if (d_ptr->swap_region_support) {
+ if (QGLWindowSurface::swapBehavior == QGLWindowSurface::AutomaticSwap)
+ doingPartialUpdate = br.width() * br.height() < parent->geometry().width() * parent->geometry().height() * 0.2;
+ else if (QGLWindowSurface::swapBehavior == QGLWindowSurface::AlwaysPartialSwap)
+ doingPartialUpdate = true;
+ }
QGLContext *ctx = reinterpret_cast<QGLContext *>(parent->d_func()->extraData()->glContext);
if (widget != window()) {
@@ -922,7 +917,7 @@ void QGLWindowSurface::updateGeometry() {
ctx->d_func()->eglContext->config());
eglGetError(); // Clear error state.
- if (hasPartialUpdateSupport()) {
+ if (!d_ptr->destructive_swap_buffers) {
eglSurfaceAttrib(ctx->d_func()->eglContext->display(),
ctx->d_func()->eglSurface,
EGL_SWAP_BEHAVIOR, EGL_BUFFER_PRESERVED);
@@ -1166,12 +1161,15 @@ QImage *QGLWindowSurface::buffer(const QWidget *widget)
return &d_ptr->buffers.last();
}
-bool QGLWindowSurface::hasPartialUpdateSupport() const
+QWindowSurface::WindowSurfaceFeatures QGLWindowSurface::features() const
{
- return d_ptr->partialUpdateSupport;
+ WindowSurfaceFeatures features = 0;
+ if (!d_ptr->destructive_swap_buffers || d_ptr->swap_region_support)
+ features |= PartialUpdates;
+ if (!d_ptr->destructive_swap_buffers)
+ features |= PreservedContents;
+ return features;
}
-
-
QT_END_NAMESPACE
diff --git a/src/opengl/qwindowsurface_gl_p.h b/src/opengl/qwindowsurface_gl_p.h
index e1689bf..4ad8339 100644
--- a/src/opengl/qwindowsurface_gl_p.h
+++ b/src/opengl/qwindowsurface_gl_p.h
@@ -108,7 +108,7 @@ public:
QImage *buffer(const QWidget *widget);
- bool hasPartialUpdateSupport() const;
+ WindowSurfaceFeatures features() const;
QGLContext *context() const;
diff --git a/src/openvg/qwindowsurface_vg.cpp b/src/openvg/qwindowsurface_vg.cpp
index 6f99de4..eedfea5 100644
--- a/src/openvg/qwindowsurface_vg.cpp
+++ b/src/openvg/qwindowsurface_vg.cpp
@@ -119,9 +119,12 @@ QPaintEngine *QVGWindowSurface::paintEngine() const
return d_ptr->paintEngine();
}
-bool QVGWindowSurface::hasStaticContentsSupport() const
+QWindowSurface::WindowSurfaceFeatures QVGWindowSurface::features() const
{
- d_ptr->supportsStaticContents();
+ WindowSurfaceFeatures features = PartialUpdates | PreservedContents;
+ if (d_ptr->supportsStaticContents())
+ features |= StaticContents;
+ return features;
}
int QVGWindowSurface::metric(PaintDeviceMetric met) const
diff --git a/src/openvg/qwindowsurface_vg_p.h b/src/openvg/qwindowsurface_vg_p.h
index 2d6b4f9..d63d077 100644
--- a/src/openvg/qwindowsurface_vg_p.h
+++ b/src/openvg/qwindowsurface_vg_p.h
@@ -78,7 +78,7 @@ public:
QPaintEngine *paintEngine() const;
- bool hasStaticContentsSupport() const;
+ WindowSurfaceFeatures features() const;
protected:
int metric(PaintDeviceMetric metric) const;