Merge lp:~unity-team/unity8/croppedImageMinimumSourceSize into lp:unity8

Proposed by Michał Sawicz
Status: Merged
Approved by: kevin gunn
Approved revision: 1213
Merged at revision: 1325
Proposed branch: lp:~unity-team/unity8/croppedImageMinimumSourceSize
Merge into: lp:unity8
Prerequisite: lp:~unity-team/unity8/scopes_more_things_on_memory
Diff against target: 239 lines (+55/-28)
9 files modified
plugins/Dash/CardCreator.js (+4/-7)
plugins/Dash/CroppedImageMinimumSourceSize.qml (+38/-0)
plugins/Dash/qmldir (+2/-1)
tests/plugins/Dash/cardcreator/1.res (+2/-2)
tests/plugins/Dash/cardcreator/2.res (+2/-5)
tests/plugins/Dash/cardcreator/3.res (+2/-2)
tests/plugins/Dash/cardcreator/4.res (+1/-4)
tests/plugins/Dash/cardcreator/5.res (+2/-2)
tests/plugins/Dash/cardcreator/7.res (+2/-5)
To merge this branch: bzr merge lp:~unity-team/unity8/croppedImageMinimumSourceSize
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Needs Fixing
Mirco Müller (community) Approve
Albert Astals Cid (community) is my code Abstain
Lars Karlitski Pending
Andrea Cimitan Pending
Review via email: mp+233319@code.launchpad.net

This proposal supersedes a proposal from 2014-08-25.

Commit message

Save texture memory by limiting sourceSize

Description of the change

* Are there any related MPs required for this MP to build/function as expected?
https://code.launchpad.net/~aacid/ubuntu-ui-toolkit/scaling_image_provider_respect_one_requested_size_zero/+merge/235098

 * Did you perform an exploratory manual test run of your code change and any related functionality?
Yes

 * Did you make sure that your branch does not contain spurious tags?
Yes

 * If you changed the packaging (debian), did you subscribe the ubuntu-unity team to this MP?
N/A

 * If you changed the UI, has there been a design review?
N/A

To post a comment you must log in.
Revision history for this message
Andrea Cimitan (cimi) : Posted in a previous version of this proposal
Revision history for this message
Andrea Cimitan (cimi) : Posted in a previous version of this proposal
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal
review: Approve (continuous-integration)
Revision history for this message
Andrea Cimitan (cimi) wrote : Posted in a previous version of this proposal

Instead of using resized and resizing, shall we use a string property (or int) representing "none" "resizing" "resized" states?

review: Needs Information
Revision history for this message
Albert Astals Cid (aacid) wrote : Posted in a previous version of this proposal

> Instead of using resized and resizing, shall we use a string property (or int)
> representing "none" "resizing" "resized" states?

I think this way is easier, the "resizing" is an internal state, the outer world only cares for none and resized, thus that boolean is the one they should be using directly.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Albert Astals Cid (aacid) :
review: Abstain (is my code)
Revision history for this message
Andrea Cimitan (cimi) :
1207. By Albert Astals Cid

properties at the begnning

1208. By Albert Astals Cid

Merge

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
1209. By Albert Astals Cid

Do not rename

1210. By Albert Astals Cid

merge

1211. By Albert Astals Cid

This seems to come from a broken merge

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Mirco Müller (macslow) wrote :

Code looks good, but I still need to run it on the device for testing/measuring. Depencency-problems currently keep me from installing the .debs from output.zip.

This qml-test fails:
- qmltestrunner::Card::test_paddings

review: Needs Fixing
Revision history for this message
Albert Astals Cid (aacid) wrote :

> Code looks good, but I still need to run it on the device for
> testing/measuring. Depencency-problems currently keep me from installing the
> .debs from output.zip.
>
> This qml-test fails:
> - qmltestrunner::Card::test_paddings

Are you running with the pre-requisite?

1212. By Albert Astals Cid

Merge

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
1213. By Albert Astals Cid

Merge

Revision history for this message
Mirco Müller (macslow) wrote :

Still trying to get lp:ubuntu-ui-toolkit/staging compiled (into a .deb) so I can properly test.

Revision history for this message
Mirco Müller (macslow) wrote :

Ok, finally got the prerequisite lp:ubuntu-ui-toolkit/staging working and was able to properly test this locally. All fine and qmltests pass too. Now all we need is to wait for Jenkins to get its act together and I'm fine with top-approving.

review: Approve
Revision history for this message
Andrea Cimitan (cimi) wrote :

on my side, used this many times, works fine indeed...

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'plugins/Dash/CardCreator.js'
2--- plugins/Dash/CardCreator.js 2014-09-23 13:39:16 +0000
3+++ plugins/Dash/CardCreator.js 2014-09-23 13:39:16 +0000
4@@ -82,13 +82,13 @@
5 height = Qt.binding(function() { return image.status !== Image.Ready ? 0 : image.height }); \n\
6 } \n\
7 } \n\
8- image: Image { \n\
9+ image: CroppedImageMinimumSourceSize { \n\
10 objectName: "artImage"; \n\
11 property bool doLoadSource: !NetworkingStatus.limitedBandwith; \n\
12 source: { if (root.visible) doLoadSource = true; return doLoadSource && cardData && cardData["art"] || ""; } \n\
13 cache: true; \n\
14 asynchronous: root.asynchronous; \n\
15- fillMode: Image.PreserveAspectCrop; \n\
16+ visible: false; \n\
17 width: %2; \n\
18 height: %3; \n\
19 } \n\
20@@ -191,17 +191,14 @@
21
22 // %1 is used as anchors of mascotImage
23 // %2 is used as visible of mascotImage
24-var kMascotImageCode = 'Image { \n\
25+var kMascotImageCode = 'CroppedImageMinimumSourceSize { \n\
26 id: mascotImage; \n\
27 objectName: "mascotImage"; \n\
28 anchors { %1 } \n\
29- readonly property int maxSize: Math.max(width, height) * 4; \n\
30 property bool doLoadSource: !NetworkingStatus.limitedBandwith; \n\
31 source: { if (root.visible) doLoadSource = true; return doLoadSource && cardData && cardData["mascot"] || ""; } \n\
32 width: units.gu(6); \n\
33 height: units.gu(5.625); \n\
34- sourceSize { width: maxSize; height: maxSize } \n\
35- fillMode: Image.PreserveAspectCrop; \n\
36 horizontalAlignment: Image.AlignHCenter; \n\
37 verticalAlignment: Image.AlignVCenter; \n\
38 visible: %2; \n\
39@@ -438,7 +435,7 @@
40 mascotShapeCode = kMascotShapeLoaderCode.arg(mascotAnchors);
41 }
42
43- var mascotImageVisible = useMascotShape ? 'false' : 'showHeader';
44+ var mascotImageVisible = useMascotShape ? 'false' : 'showHeader && resized';
45 mascotCode = kMascotImageCode.arg(mascotAnchors).arg(mascotImageVisible);
46 }
47
48
49=== added file 'plugins/Dash/CroppedImageMinimumSourceSize.qml'
50--- plugins/Dash/CroppedImageMinimumSourceSize.qml 1970-01-01 00:00:00 +0000
51+++ plugins/Dash/CroppedImageMinimumSourceSize.qml 2014-09-23 13:39:16 +0000
52@@ -0,0 +1,38 @@
53+/*
54+ * Copyright (C) 2014 Canonical, Ltd.
55+ *
56+ * This program is free software; you can redistribute it and/or modify
57+ * it under the terms of the GNU General Public License as published by
58+ * the Free Software Foundation; version 3.
59+ *
60+ * This program is distributed in the hope that it will be useful,
61+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
62+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
63+ * GNU General Public License for more details.
64+ *
65+ * You should have received a copy of the GNU General Public License
66+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
67+ */
68+
69+import QtQuick 2.3
70+
71+Image {
72+ property bool resized: false
73+ property bool resizing: false
74+ fillMode: Image.PreserveAspectCrop
75+ visible: resized
76+ onSourceSizeChanged: {
77+ if (!resized && !resizing) {
78+ resizing = true;
79+ var ar = width / height;
80+ var ssar = sourceSize.width / sourceSize.height;
81+ if (ar > ssar) {
82+ sourceSize = Qt.size(width, 0);
83+ } else {
84+ sourceSize = Qt.size(0, height);
85+ }
86+ resizing = false;
87+ resized = true;
88+ }
89+ }
90+}
91
92=== modified file 'plugins/Dash/qmldir'
93--- plugins/Dash/qmldir 2014-07-22 10:03:37 +0000
94+++ plugins/Dash/qmldir 2014-09-23 13:39:16 +0000
95@@ -3,4 +3,5 @@
96 typeinfo Dash.qmltypes
97 singleton CardCreatorCache 0.1 CardCreatorCache.qml
98 ScopeStyle 0.1 ScopeStyle.qml
99-CardAttributes 0.1 CardAttributes.qml
100\ No newline at end of file
101+CardAttributes 0.1 CardAttributes.qml
102+CroppedImageMinimumSourceSize 0.1 CroppedImageMinimumSourceSize.qml
103
104=== modified file 'tests/plugins/Dash/cardcreator/1.res'
105--- tests/plugins/Dash/cardcreator/1.res 2014-09-23 13:39:16 +0000
106+++ tests/plugins/Dash/cardcreator/1.res 2014-09-23 13:39:16 +0000
107@@ -44,13 +44,13 @@
108 height = Qt.binding(function() { return image.status !== Image.Ready ? 0 : image.height });
109 }
110 }
111- image: Image {
112+ image: CroppedImageMinimumSourceSize {
113 objectName: "artImage";
114 property bool doLoadSource: !NetworkingStatus.limitedBandwith;
115 source: { if (root.visible) doLoadSource = true; return doLoadSource && cardData && cardData["art"] || ""; }
116 cache: true;
117 asynchronous: root.asynchronous;
118- fillMode: Image.PreserveAspectCrop;
119+ visible: false;
120 width: root.width;
121 height: width / artShape.aspect;
122 }
123
124=== modified file 'tests/plugins/Dash/cardcreator/2.res'
125--- tests/plugins/Dash/cardcreator/2.res 2014-09-23 13:39:16 +0000
126+++ tests/plugins/Dash/cardcreator/2.res 2014-09-23 13:39:16 +0000
127@@ -62,20 +62,17 @@
128 anchors.margins: margins;
129 anchors.rightMargin: 0;
130 data: [
131-Image {
132+CroppedImageMinimumSourceSize {
133 id: mascotImage;
134 objectName: "mascotImage";
135 anchors { verticalCenter: parent.verticalCenter; }
136- readonly property int maxSize: Math.max(width, height) * 4;
137 property bool doLoadSource: !NetworkingStatus.limitedBandwith;
138 source: { if (root.visible) doLoadSource = true; return doLoadSource && cardData && cardData["mascot"] || ""; }
139 width: units.gu(6);
140 height: units.gu(5.625);
141- sourceSize { width: maxSize; height: maxSize }
142- fillMode: Image.PreserveAspectCrop;
143 horizontalAlignment: Image.AlignHCenter;
144 verticalAlignment: Image.AlignVCenter;
145- visible: showHeader;
146+ visible: showHeader && resized;
147 }
148 ,Item {
149 id: headerTitleContainer;
150
151=== modified file 'tests/plugins/Dash/cardcreator/3.res'
152--- tests/plugins/Dash/cardcreator/3.res 2014-09-23 13:39:16 +0000
153+++ tests/plugins/Dash/cardcreator/3.res 2014-09-23 13:39:16 +0000
154@@ -44,13 +44,13 @@
155 height = Qt.binding(function() { return image.status !== Image.Ready ? 0 : image.height });
156 }
157 }
158- image: Image {
159+ image: CroppedImageMinimumSourceSize {
160 objectName: "artImage";
161 property bool doLoadSource: !NetworkingStatus.limitedBandwith;
162 source: { if (root.visible) doLoadSource = true; return doLoadSource && cardData && cardData["art"] || ""; }
163 cache: true;
164 asynchronous: root.asynchronous;
165- fillMode: Image.PreserveAspectCrop;
166+ visible: false;
167 width: root.width;
168 height: width / artShape.aspect;
169 }
170
171=== modified file 'tests/plugins/Dash/cardcreator/4.res'
172--- tests/plugins/Dash/cardcreator/4.res 2014-09-23 13:39:16 +0000
173+++ tests/plugins/Dash/cardcreator/4.res 2014-09-23 13:39:16 +0000
174@@ -41,17 +41,14 @@
175 anchors { verticalCenter: parent.verticalCenter; }
176 }
177
178-,Image {
179+,CroppedImageMinimumSourceSize {
180 id: mascotImage;
181 objectName: "mascotImage";
182 anchors { verticalCenter: parent.verticalCenter; }
183- readonly property int maxSize: Math.max(width, height) * 4;
184 property bool doLoadSource: !NetworkingStatus.limitedBandwith;
185 source: { if (root.visible) doLoadSource = true; return doLoadSource && cardData && cardData["mascot"] || ""; }
186 width: units.gu(6);
187 height: units.gu(5.625);
188- sourceSize { width: maxSize; height: maxSize }
189- fillMode: Image.PreserveAspectCrop;
190 horizontalAlignment: Image.AlignHCenter;
191 verticalAlignment: Image.AlignVCenter;
192 visible: false;
193
194=== modified file 'tests/plugins/Dash/cardcreator/5.res'
195--- tests/plugins/Dash/cardcreator/5.res 2014-09-23 13:39:16 +0000
196+++ tests/plugins/Dash/cardcreator/5.res 2014-09-23 13:39:16 +0000
197@@ -44,13 +44,13 @@
198 height = Qt.binding(function() { return image.status !== Image.Ready ? 0 : image.height });
199 }
200 }
201- image: Image {
202+ image: CroppedImageMinimumSourceSize {
203 objectName: "artImage";
204 property bool doLoadSource: !NetworkingStatus.limitedBandwith;
205 source: { if (root.visible) doLoadSource = true; return doLoadSource && cardData && cardData["art"] || ""; }
206 cache: true;
207 asynchronous: root.asynchronous;
208- fillMode: Image.PreserveAspectCrop;
209+ visible: false;
210 width: root.width;
211 height: width / artShape.aspect;
212 }
213
214=== modified file 'tests/plugins/Dash/cardcreator/7.res'
215--- tests/plugins/Dash/cardcreator/7.res 2014-09-23 13:39:16 +0000
216+++ tests/plugins/Dash/cardcreator/7.res 2014-09-23 13:39:16 +0000
217@@ -62,20 +62,17 @@
218 anchors.margins: margins;
219 anchors.rightMargin: 0;
220 data: [
221-Image {
222+CroppedImageMinimumSourceSize {
223 id: mascotImage;
224 objectName: "mascotImage";
225 anchors { verticalCenter: parent.verticalCenter; }
226- readonly property int maxSize: Math.max(width, height) * 4;
227 property bool doLoadSource: !NetworkingStatus.limitedBandwith;
228 source: { if (root.visible) doLoadSource = true; return doLoadSource && cardData && cardData["mascot"] || ""; }
229 width: units.gu(6);
230 height: units.gu(5.625);
231- sourceSize { width: maxSize; height: maxSize }
232- fillMode: Image.PreserveAspectCrop;
233 horizontalAlignment: Image.AlignHCenter;
234 verticalAlignment: Image.AlignVCenter;
235- visible: showHeader;
236+ visible: showHeader && resized;
237 }
238
239 ,Item {

Subscribers

People subscribed via source and target branches