diff options
author | Alexey Andriyashin <alexey.andriyashin@nokia.com> | 2012-03-28 11:19:56 +0300 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-03-29 12:38:27 +0200 |
commit | df03a90db11a2a8bb4a9e5dd6ca05723e0bd3d60 (patch) | |
tree | eae3f038fc55b736a1e82b5954794556bc41d70d | |
parent | db1b772e5722f6e577a518245345e655e9c4a072 (diff) | |
download | qtgraphicaleffects-df03a90db11a2a8bb4a9e5dd6ca05723e0bd3d60.tar.gz |
Fix pngdumper. Reduce execution time. Reduce maximum number of blur samples.
Change-Id: I862d99dc725909aba0eb01fce5622f76eba5153b
Reviewed-by: Sami Hietanen <sami.k.hietanen@nokia.com>
Reviewed-by: Marko Niemelä <marko.a.niemela@nokia.com>
-rw-r--r-- | tools/pngdumper/ItemModel1.qml | 4 | ||||
-rw-r--r-- | tools/pngdumper/ItemModel2.qml | 12 | ||||
-rw-r--r-- | tools/pngdumper/ItemModel3.qml | 16 | ||||
-rw-r--r-- | tools/pngdumper/ItemModel4.qml | 6 | ||||
-rw-r--r-- | tools/pngdumper/pngdumper.cpp | 3 | ||||
-rw-r--r-- | tools/pngdumper/pngdumper.h | 4 | ||||
-rw-r--r-- | tools/pngdumper/pngdumper.qml | 37 |
7 files changed, 48 insertions, 34 deletions
diff --git a/tools/pngdumper/ItemModel1.qml b/tools/pngdumper/ItemModel1.qml index d17767e..191ebcb 100644 --- a/tools/pngdumper/ItemModel1.qml +++ b/tools/pngdumper/ItemModel1.qml @@ -252,7 +252,7 @@ VisualItemModel { //horizontalOffset: 3 verticalOffset: 20 radius: 16 - samples: 32 + samples: 24 property string __name: "DropShadow" property variant __properties: ["radius", "samples", "color", "horizontalOffset", "verticalOffset", "spread", "fast"] property string __varyingProperty: "fast" @@ -299,7 +299,7 @@ VisualItemModel { height: size source: butterfly radius: 16 - samples: 32 + samples: 24 spread: 0.3 property string __name: "Glow" property variant __properties: ["radius", "samples", "color", "spread", "fast"] diff --git a/tools/pngdumper/ItemModel2.qml b/tools/pngdumper/ItemModel2.qml index 9e3c582..907b909 100644 --- a/tools/pngdumper/ItemModel2.qml +++ b/tools/pngdumper/ItemModel2.qml @@ -150,7 +150,7 @@ VisualItemModel { source: butterfly horizontalOffset: 0 verticalOffset: 0 - samples: 32 + samples: 24 property string __name: "InnerShadow" property variant __properties: ["radius", "samples", "color", "horizontalOffset", "verticalOffset", "spread"] property string __varyingProperty: "radius" @@ -163,7 +163,7 @@ VisualItemModel { horizontalOffset: 0 verticalOffset: 0 radius: 16 - samples: 32 + samples: 24 property string __name: "InnerShadow" property variant __properties: ["radius", "samples", "color", "horizontalOffset", "verticalOffset", "spread"] property string __varyingProperty: "horizontalOffset" @@ -176,7 +176,7 @@ VisualItemModel { horizontalOffset: 0 verticalOffset: 0 radius: 16 - samples: 32 + samples: 24 property string __name: "InnerShadow" property variant __properties: ["radius", "samples", "color", "horizontalOffset", "verticalOffset", "spread"] property string __varyingProperty: "verticalOffset" @@ -189,7 +189,7 @@ VisualItemModel { horizontalOffset: 0 verticalOffset: 0 radius: 16 - samples: 32 + samples: 24 property string __name: "InnerShadow" property variant __properties: ["radius", "samples", "color", "horizontalOffset", "verticalOffset", "spread"] property string __varyingProperty: "spread" @@ -203,7 +203,7 @@ VisualItemModel { verticalOffset: 0 radius: 16 spread: 0.2 - samples: 32 + samples: 24 property string __name: "InnerShadow" property variant __properties: ["radius", "samples", "color", "horizontalOffset", "verticalOffset", "spread", "fast"] property string __varyingProperty: "fast" @@ -218,7 +218,7 @@ VisualItemModel { verticalOffset: 0 radius: 16 spread: 0.2 - samples: 32 + samples: 24 property string __name: "InnerShadow" property variant __properties: ["radius", "samples", "color", "horizontalOffset", "verticalOffset", "spread"] property string __varyingProperty: "color" diff --git a/tools/pngdumper/ItemModel3.qml b/tools/pngdumper/ItemModel3.qml index d1ed3f9..441f90e 100644 --- a/tools/pngdumper/ItemModel3.qml +++ b/tools/pngdumper/ItemModel3.qml @@ -114,7 +114,7 @@ VisualItemModel { width: size height: size source: butterfly - samples: 32 + samples: 24 property string __name: "RadialBlur" property variant __properties: ["samples", "angle", "horizontalOffset", "verticalOffset"] property string __varyingProperty: "angle" @@ -125,7 +125,7 @@ VisualItemModel { width: size height: size source: butterfly - samples: 32 + samples: 24 angle: 20 property string __name: "RadialBlur" property variant __properties: ["samples", "angle", "horizontalOffset", "verticalOffset"] @@ -137,7 +137,7 @@ VisualItemModel { width: size height: size source: butterfly - samples: 32 + samples: 24 angle: 20 property string __name: "RadialBlur" property variant __properties: ["samples", "angle", "horizontalOffset", "verticalOffset"] @@ -150,7 +150,7 @@ VisualItemModel { width: size height: size source: butterfly - samples: 32 + samples: 24 length: 32 property string __name: "DirectionalBlur" property variant __properties: ["samples", "angle", "length"] @@ -162,7 +162,7 @@ VisualItemModel { width: size height: size source: butterfly - samples: 32 + samples: 24 property string __name: "DirectionalBlur" property variant __properties: ["samples", "angle", "length"] property string __varyingProperty: "length" @@ -174,7 +174,7 @@ VisualItemModel { width: size height: size source: butterfly - samples: 32 + samples: 24 length: 32 property string __name: "ZoomBlur" property variant __properties: ["samples", "length", "horizontalOffset", "verticalOffset"] @@ -186,7 +186,7 @@ VisualItemModel { width: size height: size source: butterfly - samples: 32 + samples: 24 length: 32 property string __name: "ZoomBlur" property variant __properties: ["samples", "length", "horizontalOffset", "verticalOffset"] @@ -198,7 +198,7 @@ VisualItemModel { width: size height: size source: butterfly - samples: 32 + samples: 24 property string __name: "ZoomBlur" property variant __properties: ["samples", "length", "horizontalOffset", "verticalOffset"] property string __varyingProperty: "length" diff --git a/tools/pngdumper/ItemModel4.qml b/tools/pngdumper/ItemModel4.qml index 01b72a5..48f34eb 100644 --- a/tools/pngdumper/ItemModel4.qml +++ b/tools/pngdumper/ItemModel4.qml @@ -48,7 +48,7 @@ VisualItemModel { height: size source: butterfly maskSource: blurMask - samples: 32 + samples: 24 property string __name: "MaskedBlur" property variant __properties: ["radius", "samples", "transparentBorder", "fast"] property string __varyingProperty: "radius" @@ -60,7 +60,7 @@ VisualItemModel { source: butterfly maskSource: blurMask radius: 16 - samples: 32 + samples: 24 property string __name: "MaskedBlur" property variant __properties: ["radius", "samples", "transparentBorder", "fast"] property string __varyingProperty: "fast" @@ -73,7 +73,7 @@ VisualItemModel { source: bug maskSource: blurMask radius: 64 - samples: 32 + samples: 24 fast: true property string __name: "MaskedBlur" property variant __properties: ["radius", "samples", "transparentBorder", "fast"] diff --git a/tools/pngdumper/pngdumper.cpp b/tools/pngdumper/pngdumper.cpp index bb460e3..971a985 100644 --- a/tools/pngdumper/pngdumper.cpp +++ b/tools/pngdumper/pngdumper.cpp @@ -55,12 +55,15 @@ ItemCapturer::~ItemCapturer() void ItemCapturer::grabItem(QQuickItem *item, QString filename) { QImage img = canvas()->grabFrameBuffer(); + while (img.width() * img.height() == 0) + img = canvas()->grabFrameBuffer(); QQuickItem *rootItem = canvas()->rootItem(); QRectF rectf = rootItem->mapRectFromItem(item, QRectF(0, 0, item->width(), item->height())); QDir pwd = QDir().dirName(); pwd.mkdir("output"); img = img.copy(rectf.toRect()); img.save("output/" + filename); + emit imageSaved(); } void ItemCapturer::document(QString s) diff --git a/tools/pngdumper/pngdumper.h b/tools/pngdumper/pngdumper.h index be5ae0d..c254dc7 100644 --- a/tools/pngdumper/pngdumper.h +++ b/tools/pngdumper/pngdumper.h @@ -55,6 +55,10 @@ public: Q_INVOKABLE void grabItem(QQuickItem *item, QString filename); Q_INVOKABLE void document(QString s); + +signals: + void imageSaved(); + }; QML_DECLARE_TYPE(ItemCapturer) diff --git a/tools/pngdumper/pngdumper.qml b/tools/pngdumper/pngdumper.qml index 544bada..4161262 100644 --- a/tools/pngdumper/pngdumper.qml +++ b/tools/pngdumper/pngdumper.qml @@ -46,7 +46,7 @@ Rectangle { width: 300 height: width property real size: width - property real timerInterval: 200 + property real timerInterval: 1 property color background: "white" property bool checkerboard: false color: background @@ -185,26 +185,21 @@ Rectangle { // Ugly workaround for listview not updating itself list.contentX = 1 eval("list.currentItem."+list.currentItem.__varyingProperty+"=list.currentItem.__values[0]"); - timer.running = true list.contentX = 0 + var filename = list.currentItem.__name + "_" + list.currentItem.__varyingProperty + "1.png" + filename = filename.replace(/\"/g,"") + capturer.grabItem(container, filename) } } - Timer { - id: timer - interval: timerInterval - repeat: true - property int i: 0 - - onTriggered: { - var value = list.currentItem.__values[i]; - var filename = list.currentItem.__name + "_" + list.currentItem.__varyingProperty + (i + 1) + ".png" - filename = filename.replace(/\"/g,"") - //filename = filename.toLowerCase(); - capturer.grabItem(container, filename) - //console.log(filename) + property int i: 0 + Connections { + target: capturer + onImageSaved: { if (i >= list.currentItem.__values.length - 1) { + var filename = list.currentItem.__name + "_" + list.currentItem.__varyingProperty + (i + 1) + ".png" + filename = filename.replace(/\"/g,"") capturer.document("\\table\n") capturer.document("\\header\n") capturer.document("\\o Output examples with different " + list.currentItem.__varyingProperty + " values\n") @@ -241,6 +236,18 @@ Rectangle { } else i++ eval("list.currentItem."+list.currentItem.__varyingProperty+"=list.currentItem.__values[i]"); + timer.running = true + } + } + + Timer { + id: timer + interval: timerInterval + running: false + onTriggered: { + var filename = list.currentItem.__name + "_" + list.currentItem.__varyingProperty + (i + 1) + ".png" + filename = filename.replace(/\"/g,"") + capturer.grabItem(container, filename) } } } |