From 34bcce7616b2e2b8fae05174ca881bbbb0bc8b79 Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Wed, 20 May 2009 11:26:15 +1000 Subject: Fix width=0 pens without radius. --- src/declarative/fx/qfxrect.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/declarative/fx/qfxrect.cpp b/src/declarative/fx/qfxrect.cpp index f1cbb58..f81f9b3 100644 --- a/src/declarative/fx/qfxrect.cpp +++ b/src/declarative/fx/qfxrect.cpp @@ -55,7 +55,7 @@ QML_DEFINE_TYPE(QFxPen,Pen); By default, the pen is invalid and nothing is drawn. You must either set a color (then the default width is 0) or a width (then the default color is black). - A width of 0 is a single-pixel line on the border of the item being painted. + A width of 0 indicates a cosmetic pen, a single-pixel line on the border of the item being painted. Example: \qml @@ -401,7 +401,7 @@ void QFxRect::generateRoundedRect() Q_D(QFxRect); if (d->_rectImage.isNull()) { const int pw = d->_pen && d->_pen->isValid() ? d->_pen->width() : 0; - d->_rectImage = QImage(d->_radius*2 + 1 + pw*2, d->_radius*2 + 1 + pw*2, QImage::Format_ARGB32_Premultiplied); + d->_rectImage = QImage(d->_radius*2 + 3 + pw*2, d->_radius*2 + 3 + pw*2, QImage::Format_ARGB32_Premultiplied); d->_rectImage.fill(0); QPainter p(&(d->_rectImage)); p.setRenderHint(QPainter::Antialiasing); @@ -421,7 +421,7 @@ void QFxRect::generateBorderedRect() Q_D(QFxRect); if (d->_rectImage.isNull()) { const int pw = d->_pen && d->_pen->isValid() ? d->_pen->width() : 0; - d->_rectImage = QImage(d->pen()->width()*2 + 1 + pw*2, d->pen()->width()*2 + 1 + pw*2, QImage::Format_ARGB32_Premultiplied); + d->_rectImage = QImage(d->pen()->width()*2 + 3 + pw*2, d->pen()->width()*2 + 3 + pw*2, QImage::Format_ARGB32_Premultiplied); d->_rectImage.fill(0); QPainter p(&(d->_rectImage)); p.setRenderHint(QPainter::Antialiasing); @@ -533,10 +533,10 @@ void QFxRect::drawRect(QPainter &p) if (d->_radius > 0) { generateRoundedRect(); //### implicit conversion to int - offset = int(d->_radius+0.5+pw); + offset = int(d->_radius+1.5+pw); } else { generateBorderedRect(); - offset = pw; + offset = pw+1; } //basically same code as QFxImage uses to paint sci images -- cgit v0.12 From e4d41f8090838359ae0deb1af410e8a501a6a9b6 Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Wed, 20 May 2009 15:13:28 +1000 Subject: Fix possible X11/EGL crash. Changed-by: Rhys Weatherley Reviewed-by: Tom Cooksey --- src/opengl/qgl_x11egl.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/opengl/qgl_x11egl.cpp b/src/opengl/qgl_x11egl.cpp index 480a2dc..f8ea8de 100644 --- a/src/opengl/qgl_x11egl.cpp +++ b/src/opengl/qgl_x11egl.cpp @@ -268,10 +268,16 @@ void QGLWidget::setContext(QGLContext *context, const QGLContext* shareContext, XVisualInfo vi; - int err = XMatchVisualInfo(x11Info().display(), x11Info().screen(), x11Info().depth(), TrueColor, &vi); - if (err == 0) { - qWarning("Error: Couldn't get a matching X visual for format"); - return; + if (parentWidget()) { + vi.depth = parentWidget()->x11Info().depth(); + vi.screen = parentWidget()->x11Info().screen(); + vi.visual = (Visual *)(parentWidget()->x11Info().visual()); + } else { + int err = XMatchVisualInfo(x11Info().display(), x11Info().screen(), x11Info().depth(), TrueColor, &vi); + if (err == 0) { + qWarning("Error: Couldn't get a matching X visual for format"); + return; + } } XSetWindowAttributes a; -- cgit v0.12 From 1aeab18c1e78e201a38d76a24e8cfd2733e4f5e7 Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Wed, 20 May 2009 15:36:25 +1000 Subject: Basic qualified type support. Can now: DialLibrary.Dial { ... } without any import statement. Can also run qmlviewer with -L DialLibrary then use Dial { ... }. The exact way this works will almost definitely change to ensure predictable behaviour under future type additions to scopes. --- src/declarative/qml/qmlscriptparser.cpp | 17 +++++++++++++---- tools/qmlviewer/main.cpp | 6 ++++++ tools/qmlviewer/qmlviewer.cpp | 4 ++++ tools/qmlviewer/qmlviewer.h | 1 + 4 files changed, 24 insertions(+), 4 deletions(-) diff --git a/src/declarative/qml/qmlscriptparser.cpp b/src/declarative/qml/qmlscriptparser.cpp index ead7ee5..64f0bac 100644 --- a/src/declarative/qml/qmlscriptparser.cpp +++ b/src/declarative/qml/qmlscriptparser.cpp @@ -203,7 +203,10 @@ ProcessAST::defineObjectBinding_helper(AST::UiQualifiedId *propertyName, LocationSpan location, AST::UiObjectInitializer *initializer) { - bool isType = !objectType.isEmpty() && objectType.at(0).isUpper() && !objectType.contains(QLatin1Char('.')); + int lastTypeDot = objectType.lastIndexOf(QLatin1Char('.')); + bool isType = !objectType.isEmpty() && + (objectType.at(0).isUpper() | + lastTypeDot >= 0 && objectType.at(lastTypeDot+1).isUpper()); int propertyCount = 0; for (; propertyName; propertyName = propertyName->next){ @@ -234,15 +237,21 @@ ProcessAST::defineObjectBinding_helper(AST::UiQualifiedId *propertyName, return 0; } else { - // Class - const int typeId = _parser->findOrCreateTypeId(objectType); + + QString resolvableObjectType = objectType; + if (lastTypeDot >= 0) + resolvableObjectType.replace(QLatin1Char('.'),QLatin1Char('/')); + const int typeId = _parser->findOrCreateTypeId(resolvableObjectType); Object *obj = new Object; obj->type = typeId; - _scope.append(objectType); + + // XXX this doesn't do anything (_scope never builds up) + _scope.append(resolvableObjectType); obj->typeName = qualifiedNameId().toLatin1(); _scope.removeLast(); + obj->location = location; if (propertyCount) { diff --git a/tools/qmlviewer/main.cpp b/tools/qmlviewer/main.cpp index f59918f..38a00bb 100644 --- a/tools/qmlviewer/main.cpp +++ b/tools/qmlviewer/main.cpp @@ -41,6 +41,7 @@ void usage() qWarning(" -recordtest .................. record an autotest"); qWarning(" -runtest ..................... run a previously recorded test"); qWarning(" -translation ........... set the language to run in"); + qWarning(" -L ........................... prepend to the library search path"); qWarning(" "); qWarning(" Press F1 for interactive help"); exit(1); @@ -81,6 +82,7 @@ int main(int argc, char ** argv) QString dither = "none"; QString recordfile; QStringList recordargs; + QStringList libraries; QString skin; bool devkeys = false; bool cache = false; @@ -132,6 +134,8 @@ int main(int argc, char ** argv) usage(); translationFile = newargv[i + 1]; ++i; + } else if (arg == "-L") { + libraries << QString(argv[++i]); } else if (arg[0] != '-') { fileName = arg; } else if (1 || arg == "-help") { @@ -146,6 +150,8 @@ int main(int argc, char ** argv) } QmlViewer viewer(testMode, testDir, 0, frameless ? Qt::FramelessWindowHint : Qt::Widget); + foreach (QString lib, libraries) + viewer.addLibraryPath(lib); viewer.setCacheEnabled(cache); viewer.setRecordFile(recordfile); if (period>0) diff --git a/tools/qmlviewer/qmlviewer.cpp b/tools/qmlviewer/qmlviewer.cpp index 97db22e..4b0a83a 100644 --- a/tools/qmlviewer/qmlviewer.cpp +++ b/tools/qmlviewer/qmlviewer.cpp @@ -314,6 +314,10 @@ void QmlViewer::toggleRecording() setRecording(recording); } +void QmlViewer::addLibraryPath(const QString& lib) +{ + canvas->engine()->addNameSpacePath("",lib); +} void QmlViewer::reload() { diff --git a/tools/qmlviewer/qmlviewer.h b/tools/qmlviewer/qmlviewer.h index 09b2b5b..967af49 100644 --- a/tools/qmlviewer/qmlviewer.h +++ b/tools/qmlviewer/qmlviewer.h @@ -42,6 +42,7 @@ public: void setAutoRecord(int from, int to); void setDeviceKeys(bool); void setCacheEnabled(bool); + void addLibraryPath(const QString& lib); QSize sizeHint() const; -- cgit v0.12 From b5bada2b06d85ea74a851b98d3652aff8e64a723 Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Wed, 20 May 2009 15:44:34 +1000 Subject: Cleanup and fixes for performance logging. --- src/declarative/fx/qfximage.cpp | 3 +++ src/declarative/qml/qmlscriptparser.cpp | 5 +++++ src/declarative/util/qfxperf.cpp | 17 ++++++++--------- src/declarative/util/qfxperf.h | 13 ++++++------- 4 files changed, 22 insertions(+), 16 deletions(-) diff --git a/src/declarative/fx/qfximage.cpp b/src/declarative/fx/qfximage.cpp index 4197a80..064580e 100644 --- a/src/declarative/fx/qfximage.cpp +++ b/src/declarative/fx/qfximage.cpp @@ -863,6 +863,9 @@ QString QFxImage::source() const void QFxImage::setSource(const QString &url) { +#ifdef Q_ENABLE_PERFORMANCE_LOG + QFxPerfTimer perf; +#endif Q_D(QFxImage); if (url == d->source) return; diff --git a/src/declarative/qml/qmlscriptparser.cpp b/src/declarative/qml/qmlscriptparser.cpp index ead7ee5..435a586 100644 --- a/src/declarative/qml/qmlscriptparser.cpp +++ b/src/declarative/qml/qmlscriptparser.cpp @@ -12,6 +12,8 @@ #include #include +#include + QT_BEGIN_NAMESPACE using namespace JavaScript; @@ -621,6 +623,9 @@ QmlScriptParser::~QmlScriptParser() bool QmlScriptParser::parse(const QByteArray &data, const QUrl &url) { +#ifdef Q_ENABLE_PERFORMANCE_LOG + QFxPerfTimer pt; +#endif const QString fileName = url.toString(); QTextStream stream(data, QIODevice::ReadOnly); diff --git a/src/declarative/util/qfxperf.cpp b/src/declarative/util/qfxperf.cpp index 5ce8646..ae51157 100644 --- a/src/declarative/util/qfxperf.cpp +++ b/src/declarative/util/qfxperf.cpp @@ -44,16 +44,20 @@ QT_BEGIN_NAMESPACE Q_DEFINE_PERFORMANCE_LOG(QFxPerf, "QFx") { - Q_DEFINE_PERFORMANCE_METRIC(XmlParsing, "XML Parsing"); - Q_DEFINE_PERFORMANCE_METRIC(Compile, "XML Compilation"); - Q_DEFINE_PERFORMANCE_METRIC(CompileRun, "XML Compilation Run"); - Q_DEFINE_PERFORMANCE_METRIC(CssParsing, "CSS Parsing"); + Q_DEFINE_PERFORMANCE_METRIC(QmlParsing, "QML Parsing"); + Q_DEFINE_PERFORMANCE_METRIC(Compile, "QML Compilation"); + Q_DEFINE_PERFORMANCE_METRIC(CompileRun, "QML Compilation Run"); Q_DEFINE_PERFORMANCE_METRIC(CreateComponent, "Component creation"); Q_DEFINE_PERFORMANCE_METRIC(BindInit, "BindValue Initialization"); Q_DEFINE_PERFORMANCE_METRIC(BindCompile, "BindValue compile"); Q_DEFINE_PERFORMANCE_METRIC(BindValue, "BindValue execution"); Q_DEFINE_PERFORMANCE_METRIC(BindValueSSE, "BindValue execution SSE"); Q_DEFINE_PERFORMANCE_METRIC(BindValueQt, "BindValue execution QtScript"); + Q_DEFINE_PERFORMANCE_METRIC(ContextQuery, "QtScript: Query Context"); + Q_DEFINE_PERFORMANCE_METRIC(ContextProperty, "QtScript: Context Property"); + Q_DEFINE_PERFORMANCE_METRIC(ObjectQuery, "QtScript: Query Object"); + Q_DEFINE_PERFORMANCE_METRIC(ObjectProperty, "QtScript: Object Property"); + Q_DEFINE_PERFORMANCE_METRIC(ObjectSetProperty, "QtScript: Set Object Property"); Q_DEFINE_PERFORMANCE_METRIC(BindableValueUpdate, "QmlBindableValue::update"); Q_DEFINE_PERFORMANCE_METRIC(PixmapLoad, "Pixmap loading"); Q_DEFINE_PERFORMANCE_METRIC(MetaProperty, "Meta property resolution"); @@ -65,11 +69,6 @@ Q_DEFINE_PERFORMANCE_LOG(QFxPerf, "QFx") { Q_DEFINE_PERFORMANCE_METRIC(ComponentInstanceComponentComplete, "QFxComponentInstance::componentComplete"); Q_DEFINE_PERFORMANCE_METRIC(BaseLayoutComponentComplete, "QFxBaseLayout::componentComplete"); Q_DEFINE_PERFORMANCE_METRIC(TextComponentComplete, "QFxText::componentComplete"); - Q_DEFINE_PERFORMANCE_METRIC(ContextQuery, "QtScript: Query Context"); - Q_DEFINE_PERFORMANCE_METRIC(ContextProperty, "QtScript: Context Property"); - Q_DEFINE_PERFORMANCE_METRIC(ObjectQuery, "QtScript: Query Object"); - Q_DEFINE_PERFORMANCE_METRIC(ObjectProperty, "QtScript: Object Property"); - Q_DEFINE_PERFORMANCE_METRIC(ObjectSetProperty, "QtScript: Set Object Property"); Q_DEFINE_PERFORMANCE_METRIC(QFxText_setText, "QFxText::setText"); } QT_END_NAMESPACE diff --git a/src/declarative/util/qfxperf.h b/src/declarative/util/qfxperf.h index b1f9bd0..d1f3a5b 100644 --- a/src/declarative/util/qfxperf.h +++ b/src/declarative/util/qfxperf.h @@ -50,16 +50,20 @@ QT_BEGIN_NAMESPACE QT_MODULE(Declarative) Q_DECLARE_PERFORMANCE_LOG(QFxPerf) { - Q_DECLARE_PERFORMANCE_METRIC(XmlParsing); + Q_DECLARE_PERFORMANCE_METRIC(QmlParsing); Q_DECLARE_PERFORMANCE_METRIC(Compile); Q_DECLARE_PERFORMANCE_METRIC(CompileRun); - Q_DECLARE_PERFORMANCE_METRIC(CssParsing); Q_DECLARE_PERFORMANCE_METRIC(CreateComponent); Q_DECLARE_PERFORMANCE_METRIC(BindInit); Q_DECLARE_PERFORMANCE_METRIC(BindCompile); Q_DECLARE_PERFORMANCE_METRIC(BindValue); Q_DECLARE_PERFORMANCE_METRIC(BindValueSSE); Q_DECLARE_PERFORMANCE_METRIC(BindValueQt); + Q_DECLARE_PERFORMANCE_METRIC(ContextQuery); + Q_DECLARE_PERFORMANCE_METRIC(ContextProperty); + Q_DECLARE_PERFORMANCE_METRIC(ObjectQuery); + Q_DECLARE_PERFORMANCE_METRIC(ObjectProperty); + Q_DECLARE_PERFORMANCE_METRIC(ObjectSetProperty); Q_DECLARE_PERFORMANCE_METRIC(BindableValueUpdate); Q_DECLARE_PERFORMANCE_METRIC(PixmapLoad); Q_DECLARE_PERFORMANCE_METRIC(MetaProperty); @@ -71,11 +75,6 @@ Q_DECLARE_PERFORMANCE_LOG(QFxPerf) { Q_DECLARE_PERFORMANCE_METRIC(ComponentInstanceComponentComplete); Q_DECLARE_PERFORMANCE_METRIC(BaseLayoutComponentComplete); Q_DECLARE_PERFORMANCE_METRIC(TextComponentComplete); - Q_DECLARE_PERFORMANCE_METRIC(ContextQuery); - Q_DECLARE_PERFORMANCE_METRIC(ContextProperty); - Q_DECLARE_PERFORMANCE_METRIC(ObjectQuery); - Q_DECLARE_PERFORMANCE_METRIC(ObjectProperty); - Q_DECLARE_PERFORMANCE_METRIC(ObjectSetProperty); Q_DECLARE_PERFORMANCE_METRIC(QFxText_setText); } -- cgit v0.12 From 9852730f6a1fe66aab5a8e6a2b7c139bbd9fb011 Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Wed, 20 May 2009 16:06:58 +1000 Subject: Log performance of adding script to the engine. --- src/declarative/util/qfxperf.cpp | 1 + src/declarative/util/qfxperf.h | 1 + src/declarative/util/qmlscript.cpp | 6 ++++-- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/declarative/util/qfxperf.cpp b/src/declarative/util/qfxperf.cpp index ae51157..01ac878 100644 --- a/src/declarative/util/qfxperf.cpp +++ b/src/declarative/util/qfxperf.cpp @@ -70,5 +70,6 @@ Q_DEFINE_PERFORMANCE_LOG(QFxPerf, "QFx") { Q_DEFINE_PERFORMANCE_METRIC(BaseLayoutComponentComplete, "QFxBaseLayout::componentComplete"); Q_DEFINE_PERFORMANCE_METRIC(TextComponentComplete, "QFxText::componentComplete"); Q_DEFINE_PERFORMANCE_METRIC(QFxText_setText, "QFxText::setText"); + Q_DEFINE_PERFORMANCE_METRIC(AddScript, "QmlScript::addScriptToEngine"); } QT_END_NAMESPACE diff --git a/src/declarative/util/qfxperf.h b/src/declarative/util/qfxperf.h index d1f3a5b..3430658 100644 --- a/src/declarative/util/qfxperf.h +++ b/src/declarative/util/qfxperf.h @@ -76,6 +76,7 @@ Q_DECLARE_PERFORMANCE_LOG(QFxPerf) { Q_DECLARE_PERFORMANCE_METRIC(BaseLayoutComponentComplete); Q_DECLARE_PERFORMANCE_METRIC(TextComponentComplete); Q_DECLARE_PERFORMANCE_METRIC(QFxText_setText); + Q_DECLARE_PERFORMANCE_METRIC(AddScript); } #endif // _QFXPERF_H_ diff --git a/src/declarative/util/qmlscript.cpp b/src/declarative/util/qmlscript.cpp index d986b7a..d6d610a 100644 --- a/src/declarative/util/qmlscript.cpp +++ b/src/declarative/util/qmlscript.cpp @@ -55,11 +55,10 @@ #include #include #include +#include QT_BEGIN_NAMESPACE - - class QmlScriptPrivate : public QObjectPrivate { Q_DECLARE_PUBLIC(QmlScript); @@ -183,6 +182,9 @@ void QmlScript::replyFinished() void QmlScriptPrivate::addScriptToEngine(const QString &script, const QString &fileName) { +#ifdef Q_ENABLE_PERFORMANCE_LOG + QFxPerfTimer pt; +#endif Q_Q(QmlScript); QmlEngine *engine = qmlEngine(q); QmlContext *context = qmlContext(q); -- cgit v0.12