diff options
author | Martin Jones <martin.jones@nokia.com> | 2009-05-20 06:16:04 (GMT) |
---|---|---|
committer | Martin Jones <martin.jones@nokia.com> | 2009-05-20 06:16:04 (GMT) |
commit | 1af763ed729ff5ee8847963a6a5e6774e108a4b7 (patch) | |
tree | 22c33ea6eb927b0d3f657b04bdd8285d03cc6dff /src/declarative | |
parent | 74fd2979aed842bee3b841974c6b13c466d272a6 (diff) | |
parent | 3f1fd73a606c21042c819584ecb3efdd98c5ce98 (diff) | |
download | Qt-1af763ed729ff5ee8847963a6a5e6774e108a4b7.zip Qt-1af763ed729ff5ee8847963a6a5e6774e108a4b7.tar.gz Qt-1af763ed729ff5ee8847963a6a5e6774e108a4b7.tar.bz2 |
Merge branch 'kinetic-declarativeui' of git@scm.dev.nokia.troll.no:qt/kinetic into kinetic-declarativeui
Diffstat (limited to 'src/declarative')
-rw-r--r-- | src/declarative/fx/qfximage.cpp | 3 | ||||
-rw-r--r-- | src/declarative/fx/qfxrect.cpp | 10 | ||||
-rw-r--r-- | src/declarative/qml/qmlscriptparser.cpp | 22 | ||||
-rw-r--r-- | src/declarative/util/qfxperf.cpp | 18 | ||||
-rw-r--r-- | src/declarative/util/qfxperf.h | 14 | ||||
-rw-r--r-- | src/declarative/util/qmlscript.cpp | 6 |
6 files changed, 46 insertions, 27 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<QFxPerf::PixmapLoad> perf; +#endif Q_D(QFxImage); if (url == d->source) return; 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 diff --git a/src/declarative/qml/qmlscriptparser.cpp b/src/declarative/qml/qmlscriptparser.cpp index ead7ee5..01600b9 100644 --- a/src/declarative/qml/qmlscriptparser.cpp +++ b/src/declarative/qml/qmlscriptparser.cpp @@ -12,6 +12,8 @@ #include <QStack> #include <QtDebug> +#include <qfxperf.h> + QT_BEGIN_NAMESPACE using namespace JavaScript; @@ -203,7 +205,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 +239,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) { @@ -621,6 +632,9 @@ QmlScriptParser::~QmlScriptParser() bool QmlScriptParser::parse(const QByteArray &data, const QUrl &url) { +#ifdef Q_ENABLE_PERFORMANCE_LOG + QFxPerfTimer<QFxPerf::QmlParsing> 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..01ac878 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,7 @@ 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"); + 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 b1f9bd0..3430658 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,12 +75,8 @@ 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); + 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 <QNetworkReply> #include <QNetworkRequest> #include <QtDeclarative/qmlinfo.h> +#include <qfxperf.h> 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<QFxPerf::AddScript> pt; +#endif Q_Q(QmlScript); QmlEngine *engine = qmlEngine(q); QmlContext *context = qmlContext(q); |