Merge lp:~verzegnassi-stefano/ubuntu-docviewer-app/fix-zoom-performance into lp:ubuntu-docviewer-app/trunk

Proposed by Stefano Verzegnassi
Status: Merged
Approved by: Nicholas Skaggs
Approved revision: 77
Merged at revision: 83
Proposed branch: lp:~verzegnassi-stefano/ubuntu-docviewer-app/fix-zoom-performance
Merge into: lp:ubuntu-docviewer-app/trunk
Diff against target: 53 lines (+10/-12)
1 file modified
src/app/qml/PdfView.qml (+10/-12)
To merge this branch: bzr merge lp:~verzegnassi-stefano/ubuntu-docviewer-app/fix-zoom-performance
Reviewer Review Type Date Requested Status
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve
Alan Pope 🍺🐧🐱 πŸ¦„ (community) Approve
Review via email: mp+249060@code.launchpad.net

Commit message

Fixed zoom performance

Description of the change

QQuickView::releaseResources() is a bit expensive.

In the current trunk code, it's called whenever _zoomHelper.scale value changes, one call for each delegate currently loaded.
That means that (on phones) we have ~5 calls for each pinchUpdated event, and it's too much.

In the proposed patch, QQuickView::releaseResources() has been moved in the onPinchFinished slot, so that it's called just one time per zoom event.

To post a comment you must log in.
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Alan Pope 🍺🐧🐱 πŸ¦„ (popey) wrote :

LGTM

review: Approve
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/app/qml/PdfView.qml'
2--- src/app/qml/PdfView.qml 2015-02-05 19:30:53 +0000
3+++ src/app/qml/PdfView.qml 2015-02-09 12:10:55 +0000
4@@ -37,25 +37,24 @@
5 PDF.VerticalView {
6 id: pdfView
7 objectName: "pdfView"
8-
9 anchors.fill: parent
10 spacing: units.gu(2)
11
12 clip: true
13 boundsBehavior: Flickable.StopAtBounds
14-
15- cacheBuffer: height * poppler.providersNumber * _zoomHelper.scale * 0.5
16-
17 flickDeceleration: 1500 * units.gridUnit / 8
18 maximumFlickVelocity: 2500 * units.gridUnit / 8
19
20+ contentWidth: parent.width * _zoomHelper.scale
21+ cacheBuffer: height * poppler.providersNumber * _zoomHelper.scale * 0.5
22+ interactive: !pinchy.pinch.active
23+
24 model: poppler
25 delegate: PdfViewDelegate {
26- onWidthChanged: QQuickView.releaseResources()
27 Component.onDestruction: QQuickView.releaseResources()
28 }
29
30- contentWidth: parent.width * _zoomHelper.scale
31+ // FIXME: On zooming, keep the same content position.
32 PinchArea {
33 id: pinchy
34 anchors.fill: parent
35@@ -66,14 +65,13 @@
36 maximumScale: 2.5
37 }
38
39- onPinchStarted: pdfView.interactive = false;
40-
41- // FIXME: On zooming, keep the same content position.
42- // onPinchUpdated: {}
43-
44 onPinchFinished: {
45- pdfView.interactive = true;
46 pdfView.returnToBounds();
47+
48+ // This is a bit expensive, so it's safer to put it here.
49+ // It won't be called on desktop (where PinchArea is not used),
50+ // but it's not a problem at the moment (our target is phone).
51+ QQuickView.releaseResources();
52 }
53 }
54

Subscribers

People subscribed via source and target branches