aboutsummaryrefslogtreecommitdiffstats
path: root/src/imports/shapes
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2017-12-20 08:32:22 +0100
committerLiang Qi <liang.qi@qt.io>2017-12-20 08:50:58 +0100
commit9a38fdcf8f9b734808bb54422e306872f3bfa944 (patch)
tree20fd361db6c505d99a40ab7a695511b97dcdcbd3 /src/imports/shapes
parent1db9405128972d5ba77e33181bee40356f718cea (diff)
parent4fff2bb14e55484eacec0a1b49a2b02958f75eca (diff)
Merge remote-tracking branch 'origin/5.10' into dev
Conflicts: tests/auto/quick/pointerhandlers/flickableinterop/data/FlashAnimation.qml tests/auto/quick/pointerhandlers/flickableinterop/data/Slider.qml tests/auto/quick/pointerhandlers/flickableinterop/data/TapHandlerButton.qml tests/auto/quick/pointerhandlers/flickableinterop/data/flickableWithHandlers.qml tests/auto/quick/pointerhandlers/multipointtoucharea_interop/data/pinchDragMPTA.qml tests/auto/quick/pointerhandlers/qquickdraghandler/data/DragAnywhereSlider.qml tests/auto/quick/pointerhandlers/qquickdraghandler/data/FlashAnimation.qml tests/auto/quick/pointerhandlers/qquickdraghandler/data/Slider.qml tests/auto/quick/pointerhandlers/qquickdraghandler/data/draggables.qml tests/auto/quick/pointerhandlers/qquickdraghandler/data/multipleSliders.qml tests/auto/quick/pointerhandlers/qquicktaphandler/data/Button.qml tests/auto/quick/pointerhandlers/qquicktaphandler/data/FlashAnimation.qml tests/auto/quick/pointerhandlers/qquicktaphandler/data/buttons.qml tests/manual/pointer/content/FakeFlickable.qml tests/manual/pointer/content/FlashAnimation.qml tests/manual/pointer/content/MomentumAnimation.qml tests/manual/pointer/content/MouseAreaButton.qml tests/manual/pointer/content/MouseAreaSlider.qml tests/manual/pointer/content/MptaButton.qml tests/manual/pointer/content/MultiButton.qml tests/manual/pointer/content/ScrollBar.qml tests/manual/pointer/content/Slider.qml tests/manual/pointer/content/TapHandlerButton.qml tests/manual/pointer/fakeFlickable.qml tests/manual/pointer/flickableWithHandlers.qml tests/manual/pointer/flingAnimation.qml tests/manual/pointer/joystick.qml tests/manual/pointer/main.cpp tests/manual/pointer/main.qml tests/manual/pointer/map.qml tests/manual/pointer/map2.qml tests/manual/pointer/mixer.qml tests/manual/pointer/multibuttons.qml tests/manual/pointer/photosurface.qml tests/manual/pointer/pinchDragFlingMPTA.qml tests/manual/pointer/pinchHandler.qml tests/manual/pointer/singlePointHandlerProperties.qml tests/manual/pointer/tapHandler.qml tests/manual/pointer/tapWithModifiers.qml tests/manual/shapestest/main.cpp Change-Id: I4f233a521305fab1ebfecbac801da192434ed524
Diffstat (limited to 'src/imports/shapes')
-rw-r--r--src/imports/shapes/plugin.cpp2
-rw-r--r--src/imports/shapes/plugins.qmltypes24
-rw-r--r--src/imports/shapes/qquickshape.cpp27
-rw-r--r--src/imports/shapes/qquickshape_p_p.h7
-rw-r--r--src/imports/shapes/qtquickshapesplugin.qrc (renamed from src/imports/shapes/shapes.qrc)0
-rw-r--r--src/imports/shapes/shapes.pro2
6 files changed, 57 insertions, 5 deletions
diff --git a/src/imports/shapes/plugin.cpp b/src/imports/shapes/plugin.cpp
index c509d28e33..e24826ee55 100644
--- a/src/imports/shapes/plugin.cpp
+++ b/src/imports/shapes/plugin.cpp
@@ -47,7 +47,7 @@ static void initResources()
#ifdef QT_STATIC
Q_INIT_RESOURCE(qmake_QtQuick_Shapes);
#endif
- Q_INIT_RESOURCE(shapes);
+ Q_INIT_RESOURCE(qtquickshapesplugin);
}
QT_BEGIN_NAMESPACE
diff --git a/src/imports/shapes/plugins.qmltypes b/src/imports/shapes/plugins.qmltypes
index b8a7c532e0..39aab42401 100644
--- a/src/imports/shapes/plugins.qmltypes
+++ b/src/imports/shapes/plugins.qmltypes
@@ -36,6 +36,17 @@ Module {
Property { name: "vendorExtensionsEnabled"; type: "bool" }
Property { name: "status"; type: "Status"; isReadonly: true }
Property { name: "data"; type: "QObject"; isList: true; isReadonly: true }
+ Signal { name: "rendererChanged" }
+ }
+ Component {
+ name: "QQuickShapeConicalGradient"
+ defaultProperty: "stops"
+ prototype: "QQuickShapeGradient"
+ exports: ["QtQuick.Shapes/ConicalGradient 1.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "centerX"; type: "double" }
+ Property { name: "centerY"; type: "double" }
+ Property { name: "angle"; type: "double" }
}
Component {
name: "QQuickShapeGradient"
@@ -114,4 +125,17 @@ Module {
Property { name: "fillGradient"; type: "QQuickShapeGradient"; isPointer: true }
Signal { name: "shapePathChanged" }
}
+ Component {
+ name: "QQuickShapeRadialGradient"
+ defaultProperty: "stops"
+ prototype: "QQuickShapeGradient"
+ exports: ["QtQuick.Shapes/RadialGradient 1.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "centerX"; type: "double" }
+ Property { name: "centerY"; type: "double" }
+ Property { name: "centerRadius"; type: "double" }
+ Property { name: "focalX"; type: "double" }
+ Property { name: "focalY"; type: "double" }
+ Property { name: "focalRadius"; type: "double" }
+ }
}
diff --git a/src/imports/shapes/qquickshape.cpp b/src/imports/shapes/qquickshape.cpp
index 6a76743242..c749357cc5 100644
--- a/src/imports/shapes/qquickshape.cpp
+++ b/src/imports/shapes/qquickshape.cpp
@@ -46,9 +46,12 @@
#include <private/qquicksvgparser_p.h>
#include <QtGui/private/qdrawhelper_p.h>
#include <QOpenGLFunctions>
+#include <QLoggingCategory>
QT_BEGIN_NAMESPACE
+Q_LOGGING_CATEGORY(QQSHAPE_LOG_TIME_DIRTY_SYNC, "qt.shape.time.sync")
+
/*!
\qmlmodule QtQuick.Shapes 1.0
\title Qt Quick Shapes QML Types
@@ -968,18 +971,26 @@ QSGNode *QQuickShapePrivate::createNode()
return node;
}
-static void q_asyncShapeReady(void *data)
+void QQuickShapePrivate::asyncShapeReady(void *data)
{
QQuickShapePrivate *self = static_cast<QQuickShapePrivate *>(data);
self->setStatus(QQuickShape::Ready);
+ if (self->syncTimingActive)
+ qDebug("[Shape %p] [%d] [dirty=0x%x] async update took %lld ms",
+ self->q_func(), self->syncTimeCounter, self->syncTimingTotalDirty, self->syncTimer.elapsed());
}
void QQuickShapePrivate::sync()
{
+ syncTimingTotalDirty = 0;
+ syncTimingActive = QQSHAPE_LOG_TIME_DIRTY_SYNC().isDebugEnabled();
+ if (syncTimingActive)
+ syncTimer.start();
+
const bool useAsync = async && renderer->flags().testFlag(QQuickAbstractPathRenderer::SupportsAsync);
if (useAsync) {
setStatus(QQuickShape::Processing);
- renderer->setAsyncCallback(q_asyncShapeReady, this);
+ renderer->setAsyncCallback(asyncShapeReady, this);
}
const int count = sp.count();
@@ -988,6 +999,7 @@ void QQuickShapePrivate::sync()
for (int i = 0; i < count; ++i) {
QQuickShapePath *p = sp[i];
int &dirty(QQuickShapePathPrivate::get(p)->dirty);
+ syncTimingTotalDirty |= dirty;
if (dirty & QQuickShapePathPrivate::DirtyPath)
renderer->setPath(i, p);
@@ -1011,10 +1023,19 @@ void QQuickShapePrivate::sync()
dirty = 0;
}
+ if (syncTimingTotalDirty)
+ ++syncTimeCounter;
+ else
+ syncTimingActive = false;
+
renderer->endSync(useAsync);
- if (!useAsync)
+ if (!useAsync) {
setStatus(QQuickShape::Ready);
+ if (syncTimingActive)
+ qDebug("[Shape %p] [%d] [dirty=0x%x] update took %lld ms",
+ q_func(), syncTimeCounter, syncTimingTotalDirty, syncTimer.elapsed());
+ }
}
// ***** gradient support *****
diff --git a/src/imports/shapes/qquickshape_p_p.h b/src/imports/shapes/qquickshape_p_p.h
index bbe9a81d4a..f43831516a 100644
--- a/src/imports/shapes/qquickshape_p_p.h
+++ b/src/imports/shapes/qquickshape_p_p.h
@@ -56,6 +56,7 @@
#include <QPainterPath>
#include <QColor>
#include <QBrush>
+#include <QElapsedTimer>
#include <private/qopenglcontext_p.h>
QT_BEGIN_NAMESPACE
@@ -167,6 +168,8 @@ public:
static QQuickShapePrivate *get(QQuickShape *item) { return item->d_func(); }
+ static void asyncShapeReady(void *data);
+
bool spChanged;
QQuickShape::RendererType rendererType;
bool async;
@@ -174,6 +177,10 @@ public:
QQuickAbstractPathRenderer *renderer;
QVector<QQuickShapePath *> sp;
bool enableVendorExts;
+ bool syncTimingActive = false;
+ int syncTimingTotalDirty;
+ int syncTimeCounter = 0;
+ QElapsedTimer syncTimer;
};
#if QT_CONFIG(opengl)
diff --git a/src/imports/shapes/shapes.qrc b/src/imports/shapes/qtquickshapesplugin.qrc
index f139861693..f139861693 100644
--- a/src/imports/shapes/shapes.qrc
+++ b/src/imports/shapes/qtquickshapesplugin.qrc
diff --git a/src/imports/shapes/shapes.pro b/src/imports/shapes/shapes.pro
index 60cc61e974..fee950a529 100644
--- a/src/imports/shapes/shapes.pro
+++ b/src/imports/shapes/shapes.pro
@@ -28,6 +28,6 @@ qtConfig(opengl) {
qquickshapenvprrenderer.cpp
}
-RESOURCES += shapes.qrc
+RESOURCES += qtquickshapesplugin.qrc
load(qml_plugin)