Merge lp:~loic.molinari/ubuntu-ui-toolkit/ubuntu-ui-toolkit-drop-shadow-aspect into lp:ubuntu-ui-toolkit/staging
- ubuntu-ui-toolkit-drop-shadow-aspect
- Merge into staging
Status: | Merged |
---|---|
Approved by: | Tim Peeters |
Approved revision: | 1582 |
Merged at revision: | 1585 |
Proposed branch: | lp:~loic.molinari/ubuntu-ui-toolkit/ubuntu-ui-toolkit-drop-shadow-aspect |
Merge into: | lp:ubuntu-ui-toolkit/staging |
Prerequisite: | lp:~loic.molinari/ubuntu-ui-toolkit/ubuntu-ui-toolkit-relative-radius |
Diff against target: |
1355 lines (+707/-273) 10 files modified
components.api (+1/-0) examples/ubuntu-ui-toolkit-gallery/UbuntuShape.qml (+92/-64) src/Ubuntu/Components/plugin/shaders/shape.frag (+17/-2) src/Ubuntu/Components/plugin/ucubuntushape.cpp (+85/-47) src/Ubuntu/Components/plugin/ucubuntushape.h (+8/-7) src/Ubuntu/Components/plugin/ucubuntushapetexture.h (+265/-11) src/Ubuntu/Components/tools/createshapetextures.cpp (+233/-136) src/Ubuntu/Components/tools/tools.pro (+2/-2) tests/resources/ubuntushape/UbuntuShapeOverlayTest.qml (+2/-2) tests/resources/ubuntushape/UbuntuShapeTest.qml (+2/-2) |
To merge this branch: | bzr merge lp:~loic.molinari/ubuntu-ui-toolkit/ubuntu-ui-toolkit-drop-shadow-aspect |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Tim Peeters | Approve | ||
PS Jenkins bot | continuous-integration | Approve | |
Loïc Molinari (community) | Abstain | ||
Review via email: mp+265672@code.launchpad.net |
Commit message
[UbuntuShape] Added a DropShadow aspect.
Description of the change
[UbuntuShape] Added a DropShadow aspect.
Loïc Molinari (loic.molinari) : | # |
PS Jenkins bot (ps-jenkins) wrote : | # |
- 1581. By Loïc Molinari
-
Merged parent branch.
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:1581
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Loïc Molinari (loic.molinari) : | # |
- 1582. By Loïc Molinari
-
Fixed incorrect type definition in texture generator.
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:1582
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Tim Peeters (tpeeters) wrote : | # |
Looks good, happroving.
Preview Diff
1 | === modified file 'components.api' | |||
2 | --- components.api 2015-07-27 10:33:47 +0000 | |||
3 | +++ components.api 2015-07-27 16:39:42 +0000 | |||
4 | @@ -1316,6 +1316,7 @@ | |||
5 | 1316 | property bool stretched | 1316 | property bool stretched |
6 | 1317 | property VAlignment verticalAlignment | 1317 | property VAlignment verticalAlignment |
7 | 1318 | Ubuntu.Components.UbuntuShape.Aspect: Enum | 1318 | Ubuntu.Components.UbuntuShape.Aspect: Enum |
8 | 1319 | DropShadow | ||
9 | 1319 | Flat | 1320 | Flat |
10 | 1320 | Inset | 1321 | Inset |
11 | 1321 | Ubuntu.Components.UbuntuShape.BackgroundMode: Enum | 1322 | Ubuntu.Components.UbuntuShape.BackgroundMode: Enum |
12 | 1322 | 1323 | ||
13 | === modified file 'examples/ubuntu-ui-toolkit-gallery/UbuntuShape.qml' | |||
14 | --- examples/ubuntu-ui-toolkit-gallery/UbuntuShape.qml 2015-04-09 09:42:36 +0000 | |||
15 | +++ examples/ubuntu-ui-toolkit-gallery/UbuntuShape.qml 2015-07-27 16:39:42 +0000 | |||
16 | @@ -25,28 +25,95 @@ | |||
17 | 25 | className: "UbuntuShape" | 25 | className: "UbuntuShape" |
18 | 26 | 26 | ||
19 | 27 | TemplateRow { | 27 | TemplateRow { |
36 | 28 | title: i18n.tr("Color") | 28 | title: i18n.tr("Aspect") |
37 | 29 | titleWidth: units.gu(6) | 29 | titleWidth: units.gu(8) |
38 | 30 | height: units.gu(8) | 30 | height: units.gu(8) |
39 | 31 | 31 | ||
40 | 32 | UbuntuShape { | 32 | UbuntuShape { |
41 | 33 | objectName: "ubuntushape_backgroundcolor_orange" | 33 | objectName: "ubuntushape_aspect_inset" |
42 | 34 | backgroundColor: UbuntuColors.orange | 34 | backgroundColor: UbuntuColors.orange |
43 | 35 | } | 35 | radius: "medium" |
44 | 36 | 36 | aspect: UbuntuShape.Inset | |
45 | 37 | UbuntuShape { | 37 | Label { |
46 | 38 | objectName: "ubuntushape_verticalgradient" | 38 | anchors.centerIn: parent |
47 | 39 | backgroundColor: UbuntuColors.lightAubergine | 39 | text: "Inset" |
48 | 40 | secondaryBackgroundColor: Qt.rgba( | 40 | fontSize: "x-small" |
49 | 41 | UbuntuColors.lightAubergine.r, UbuntuColors.lightAubergine.g, | 41 | color: theme.palette.normal.foregroundText |
50 | 42 | UbuntuColors.lightAubergine.b, 0.25) | 42 | } |
51 | 43 | backgroundMode: UbuntuShape.VerticalGradient | 43 | } |
52 | 44 | |||
53 | 45 | UbuntuShape { | ||
54 | 46 | objectName: "ubuntushape_aspect_dropshadow" | ||
55 | 47 | backgroundColor: UbuntuColors.orange | ||
56 | 48 | radius: "medium" | ||
57 | 49 | aspect: UbuntuShape.DropShadow | ||
58 | 50 | Label { | ||
59 | 51 | anchors.centerIn: parent | ||
60 | 52 | text: "DropShadow" | ||
61 | 53 | fontSize: "xx-small" | ||
62 | 54 | color: theme.palette.normal.foregroundText | ||
63 | 55 | } | ||
64 | 56 | } | ||
65 | 57 | |||
66 | 58 | UbuntuShape { | ||
67 | 59 | objectName: "ubuntushape_aspect_flat" | ||
68 | 60 | backgroundColor: UbuntuColors.orange | ||
69 | 61 | radius: "medium" | ||
70 | 62 | aspect: UbuntuShape.Flat | ||
71 | 63 | Label { | ||
72 | 64 | anchors.centerIn: parent | ||
73 | 65 | text: "Flat" | ||
74 | 66 | fontSize: "xx-small" | ||
75 | 67 | color: theme.palette.normal.foregroundText | ||
76 | 68 | } | ||
77 | 69 | } | ||
78 | 70 | } | ||
79 | 71 | |||
80 | 72 | TemplateRow { | ||
81 | 73 | title: i18n.tr("Radius") | ||
82 | 74 | titleWidth: units.gu(8) | ||
83 | 75 | height: units.gu(8) | ||
84 | 76 | |||
85 | 77 | UbuntuShape { | ||
86 | 78 | objectName: "ubuntushape_radius_small" | ||
87 | 79 | backgroundColor: theme.palette.normal.foreground | ||
88 | 80 | radius: "small" | ||
89 | 81 | Label { | ||
90 | 82 | anchors.centerIn: parent | ||
91 | 83 | text: "small" | ||
92 | 84 | fontSize: "xx-small" | ||
93 | 85 | color: theme.palette.normal.foregroundText | ||
94 | 86 | } | ||
95 | 87 | } | ||
96 | 88 | |||
97 | 89 | UbuntuShape { | ||
98 | 90 | objectName: "ubuntushape_radius_medium" | ||
99 | 91 | backgroundColor: theme.palette.normal.foreground | ||
100 | 92 | radius: "medium" | ||
101 | 93 | Label { | ||
102 | 94 | anchors.centerIn: parent | ||
103 | 95 | text: "medium" | ||
104 | 96 | fontSize: "xx-small" | ||
105 | 97 | color: theme.palette.normal.foregroundText | ||
106 | 98 | } | ||
107 | 99 | } | ||
108 | 100 | |||
109 | 101 | UbuntuShape { | ||
110 | 102 | objectName: "ubuntushape_radius_medium" | ||
111 | 103 | backgroundColor: theme.palette.normal.foreground | ||
112 | 104 | radius: "large" | ||
113 | 105 | Label { | ||
114 | 106 | anchors.centerIn: parent | ||
115 | 107 | text: "large" | ||
116 | 108 | fontSize: "xx-small" | ||
117 | 109 | color: theme.palette.normal.foregroundText | ||
118 | 110 | } | ||
119 | 44 | } | 111 | } |
120 | 45 | } | 112 | } |
121 | 46 | 113 | ||
122 | 47 | TemplateRow { | 114 | TemplateRow { |
123 | 48 | title: i18n.tr("Image") | 115 | title: i18n.tr("Image") |
125 | 49 | titleWidth: units.gu(6) | 116 | titleWidth: units.gu(8) |
126 | 50 | height: units.gu(8) | 117 | height: units.gu(8) |
127 | 51 | 118 | ||
128 | 52 | UbuntuShape { | 119 | UbuntuShape { |
129 | @@ -64,56 +131,17 @@ | |||
130 | 64 | } | 131 | } |
131 | 65 | 132 | ||
132 | 66 | TemplateRow { | 133 | TemplateRow { |
135 | 67 | title: i18n.tr("Radius") | 134 | title: i18n.tr("Gradient") |
136 | 68 | titleWidth: units.gu(6) | 135 | titleWidth: units.gu(8) |
137 | 69 | height: units.gu(8) | 136 | height: units.gu(8) |
138 | 70 | 137 | ||
139 | 71 | UbuntuShape { | 138 | UbuntuShape { |
185 | 72 | objectName: "ubuntushape_radius_small" | 139 | objectName: "ubuntushape_verticalgradient" |
186 | 73 | 140 | backgroundColor: UbuntuColors.lightAubergine | |
187 | 74 | backgroundColor: theme.palette.normal.foreground | 141 | secondaryBackgroundColor: Qt.rgba( |
188 | 75 | radius: "small" | 142 | UbuntuColors.lightAubergine.r, UbuntuColors.lightAubergine.g, |
189 | 76 | 143 | UbuntuColors.lightAubergine.b, 0.25) | |
190 | 77 | Label { | 144 | backgroundMode: UbuntuShape.VerticalGradient |
146 | 78 | anchors.centerIn: parent | ||
147 | 79 | text: "small" | ||
148 | 80 | fontSize: "x-small" | ||
149 | 81 | color: theme.palette.normal.foregroundText | ||
150 | 82 | } | ||
151 | 83 | } | ||
152 | 84 | |||
153 | 85 | UbuntuShape { | ||
154 | 86 | objectName: "ubuntushape_radius_medium" | ||
155 | 87 | backgroundColor: theme.palette.normal.foreground | ||
156 | 88 | radius: "medium" | ||
157 | 89 | |||
158 | 90 | Label { | ||
159 | 91 | anchors.centerIn: parent | ||
160 | 92 | text: "medium" | ||
161 | 93 | fontSize: "x-small" | ||
162 | 94 | color: theme.palette.normal.foregroundText | ||
163 | 95 | } | ||
164 | 96 | } | ||
165 | 97 | } | ||
166 | 98 | |||
167 | 99 | TemplateRow { | ||
168 | 100 | title: i18n.tr("Sizes") | ||
169 | 101 | titleWidth: units.gu(6) | ||
170 | 102 | height: units.gu(20) | ||
171 | 103 | |||
172 | 104 | UbuntuShape { | ||
173 | 105 | objectName: "ubuntushape_sizes_15_6" | ||
174 | 106 | backgroundColor: theme.palette.normal.foreground | ||
175 | 107 | width: units.gu(15) | ||
176 | 108 | height: units.gu(6) | ||
177 | 109 | anchors.verticalCenter: parent.verticalCenter | ||
178 | 110 | } | ||
179 | 111 | |||
180 | 112 | UbuntuShape { | ||
181 | 113 | objectName: "ubuntushape_sizes_10_14" | ||
182 | 114 | backgroundColor: theme.palette.normal.foreground | ||
183 | 115 | width: units.gu(10) | ||
184 | 116 | height: units.gu(14) | ||
191 | 117 | } | 145 | } |
192 | 118 | } | 146 | } |
193 | 119 | } | 147 | } |
194 | 120 | 148 | ||
195 | === modified file 'src/Ubuntu/Components/plugin/shaders/shape.frag' | |||
196 | --- src/Ubuntu/Components/plugin/shaders/shape.frag 2015-04-16 11:59:56 +0000 | |||
197 | +++ src/Ubuntu/Components/plugin/shaders/shape.frag 2015-07-27 16:39:42 +0000 | |||
198 | @@ -35,8 +35,9 @@ | |||
199 | 35 | varying mediump vec4 sourceCoord; | 35 | varying mediump vec4 sourceCoord; |
200 | 36 | varying lowp vec4 backgroundColor; | 36 | varying lowp vec4 backgroundColor; |
201 | 37 | 37 | ||
204 | 38 | const mediump int FLAT = 0x08; // 1 << 3 | 38 | const mediump int FLAT = 0x08; // 1 << 3 |
205 | 39 | const mediump int INSET = 0x10; // 1 << 4 | 39 | const mediump int INSET = 0x10; // 1 << 4 |
206 | 40 | const mediump int DROP_SHADOW = 0x20; // 1 << 5 | ||
207 | 40 | 41 | ||
208 | 41 | void main(void) | 42 | void main(void) |
209 | 42 | { | 43 | { |
210 | @@ -88,6 +89,20 @@ | |||
211 | 88 | // Mask the current color then blend the bevel over the resulting color. We simply use | 89 | // Mask the current color then blend the bevel over the resulting color. We simply use |
212 | 89 | // additive blending since the bevel has already been masked. | 90 | // additive blending since the bevel has already been masked. |
213 | 90 | color = (color * vec4(mask[int(shapeSide)])) + vec4(bevel); | 91 | color = (color * vec4(mask[int(shapeSide)])) + vec4(bevel); |
214 | 92 | |||
215 | 93 | } else if (aspect == DROP_SHADOW) { | ||
216 | 94 | // The vertex layout of the shape is made so that the derivative is negative from top to | ||
217 | 95 | // middle and positive from middle to bottom. | ||
218 | 96 | lowp float shapeSide = dfdt * dfdtFactors.y <= 0.0 ? 0.0 : 1.0; | ||
219 | 97 | // Get the anti-aliased and resolution independent shape mask using distance fields. | ||
220 | 98 | lowp float distanceMin = abs(dfdt) * -distanceAA + 0.5; | ||
221 | 99 | lowp float distanceMax = abs(dfdt) * distanceAA + 0.5; | ||
222 | 100 | lowp float mask = smoothstep(distanceMin, distanceMax, shapeData[int(shapeSide)]); | ||
223 | 101 | // Get the shadow color outside of the shape mask. | ||
224 | 102 | lowp float shadow = (shapeData.b * -mask) + shapeData.b; // -ab + a = a(1 - b) | ||
225 | 103 | // Mask the current color then blend the shadow over the resulting color. We simply use | ||
226 | 104 | // additive blending since the shadow has already been masked. | ||
227 | 105 | color = (color * vec4(mask)) + vec4(0.0, 0.0, 0.0, shadow); | ||
228 | 91 | } | 106 | } |
229 | 92 | 107 | ||
230 | 93 | gl_FragColor = color * opacityFactors.xxxy; | 108 | gl_FragColor = color * opacityFactors.xxxy; |
231 | 94 | 109 | ||
232 | === modified file 'src/Ubuntu/Components/plugin/ucubuntushape.cpp' | |||
233 | --- src/Ubuntu/Components/plugin/ucubuntushape.cpp 2015-07-24 17:59:13 +0000 | |||
234 | +++ src/Ubuntu/Components/plugin/ucubuntushape.cpp 2015-07-27 16:39:42 +0000 | |||
235 | @@ -90,7 +90,7 @@ | |||
236 | 90 | const ShapeMaterial::Data* data = static_cast<ShapeMaterial*>(newEffect)->constData(); | 90 | const ShapeMaterial::Data* data = static_cast<ShapeMaterial*>(newEffect)->constData(); |
237 | 91 | 91 | ||
238 | 92 | // Bind shape texture. | 92 | // Bind shape texture. |
240 | 93 | glBindTexture(GL_TEXTURE_2D, data->shapeTexture); | 93 | glBindTexture(GL_TEXTURE_2D, data->shapeTextureId); |
241 | 94 | 94 | ||
242 | 95 | // Bind source texture on the 2nd texture unit and update uniforms. | 95 | // Bind source texture on the 2nd texture unit and update uniforms. |
243 | 96 | bool textured = false; | 96 | bool textured = false; |
244 | @@ -119,8 +119,7 @@ | |||
245 | 119 | } | 119 | } |
246 | 120 | } | 120 | } |
247 | 121 | program()->setUniformValue(m_texturedId, textured); | 121 | program()->setUniformValue(m_texturedId, textured); |
250 | 122 | program()->setUniformValue( | 122 | program()->setUniformValue(m_aspectId, data->flags & ShapeMaterial::Data::AspectMask); |
249 | 123 | m_aspectId, data->flags & (ShapeMaterial::Data::Flat | ShapeMaterial::Data::Inset)); | ||
251 | 124 | 123 | ||
252 | 125 | // The pressed aspect is implemented by scaling the final RGB fragment color. It's not a real | 124 | // The pressed aspect is implemented by scaling the final RGB fragment color. It's not a real |
253 | 126 | // blending as it was done before deprecation, so for instance transparent colors remain the | 125 | // blending as it was done before deprecation, so for instance transparent colors remain the |
254 | @@ -136,7 +135,7 @@ | |||
255 | 136 | // and by 255 for distanceAAFactor dequantization. The factor is 1 most of the time apart when | 135 | // and by 255 for distanceAAFactor dequantization. The factor is 1 most of the time apart when |
256 | 137 | // the radius size is low, it linearly goes from 1 to 0 to make the corners prettier and to | 136 | // the radius size is low, it linearly goes from 1 to 0 to make the corners prettier and to |
257 | 138 | // prevent the opacity of the whole shape to slightly lower. | 137 | // prevent the opacity of the whole shape to slightly lower. |
259 | 139 | const float distanceAA = (shapeTextureInfo.distanceAA * distanceAApx) / (2.0 * 255.0f); | 138 | const float distanceAA = (shapeTextureDistanceAA * distanceAApx) / (2.0 * 255.0f); |
260 | 140 | program()->setUniformValue(m_distanceAAId, data->distanceAAFactor * distanceAA); | 139 | program()->setUniformValue(m_distanceAAId, data->distanceAAFactor * distanceAA); |
261 | 141 | 140 | ||
262 | 142 | // Send screen-space derivative factors. Note that when rendering is redirected to a | 141 | // Send screen-space derivative factors. Note that when rendering is redirected to a |
263 | @@ -246,12 +245,16 @@ | |||
264 | 246 | 245 | ||
265 | 247 | // --- QtQuick item --- | 246 | // --- QtQuick item --- |
266 | 248 | 247 | ||
267 | 249 | static QHash<QOpenGLContext*, quint32> shapeTextureHash; | ||
268 | 250 | static bool isPrimaryOrientationLandscape = false; | ||
269 | 251 | |||
270 | 252 | const float implicitWidthGU = 8.0f; | 248 | const float implicitWidthGU = 8.0f; |
271 | 253 | const float implicitHeightGU = 8.0f; | 249 | const float implicitHeightGU = 8.0f; |
272 | 254 | const float radiusGuMap[3] = { 1.45f, 2.55f, 3.65f }; | 250 | const float radiusGuMap[3] = { 1.45f, 2.55f, 3.65f }; |
273 | 251 | const int maxShapeTextures = 16; | ||
274 | 252 | |||
275 | 253 | static struct { QOpenGLContext* openglContext; quint32 textureId[shapeTextureCount]; } | ||
276 | 254 | shapeTextures[maxShapeTextures]; | ||
277 | 255 | static bool isPrimaryOrientationLandscape = false; | ||
278 | 256 | |||
279 | 257 | static int getShapeTexturesIndex(const QOpenGLContext* openglContext); | ||
280 | 255 | 258 | ||
281 | 256 | /*! \qmltype UbuntuShape | 259 | /*! \qmltype UbuntuShape |
282 | 257 | \instantiates UCUbuntuShape | 260 | \instantiates UCUbuntuShape |
283 | @@ -1003,9 +1006,11 @@ | |||
284 | 1003 | 1006 | ||
285 | 1004 | void UCUbuntuShape::_q_openglContextDestroyed() | 1007 | void UCUbuntuShape::_q_openglContextDestroyed() |
286 | 1005 | { | 1008 | { |
290 | 1006 | // Delete the shape texture that's stored per context and shared by all the shape items. | 1009 | // Delete the shape textures that are stored per context and shared by all the shape items. |
291 | 1007 | quint32 shapeTexture = shapeTextureHash.take(qobject_cast<QOpenGLContext*>(sender())); | 1010 | const int index = getShapeTexturesIndex(qobject_cast<QOpenGLContext*>(sender())); |
292 | 1008 | glDeleteTextures(1, &shapeTexture); | 1011 | Q_ASSERT(index >= 0); |
293 | 1012 | shapeTextures[index].openglContext = NULL; | ||
294 | 1013 | glDeleteTextures(shapeTextureCount, shapeTextures[index].textureId); | ||
295 | 1009 | } | 1014 | } |
296 | 1010 | 1015 | ||
297 | 1011 | void UCUbuntuShape::_q_gridUnitChanged() | 1016 | void UCUbuntuShape::_q_gridUnitChanged() |
298 | @@ -1034,6 +1039,34 @@ | |||
299 | 1034 | m_flags |= DirtySourceTransform; | 1039 | m_flags |= DirtySourceTransform; |
300 | 1035 | } | 1040 | } |
301 | 1036 | 1041 | ||
302 | 1042 | // Gets the shapeTextures' slot used by the given context, or -1 if not stored. | ||
303 | 1043 | static int getShapeTexturesIndex(const QOpenGLContext* openglContext) | ||
304 | 1044 | { | ||
305 | 1045 | int index = 0; | ||
306 | 1046 | while (shapeTextures[index].openglContext != openglContext) { | ||
307 | 1047 | index++; | ||
308 | 1048 | if (index == maxShapeTextures) { | ||
309 | 1049 | return -1; | ||
310 | 1050 | } | ||
311 | 1051 | } | ||
312 | 1052 | return index; | ||
313 | 1053 | } | ||
314 | 1054 | |||
315 | 1055 | // Gets an empty shapeTextures' slot. | ||
316 | 1056 | static int getEmptyShapeTexturesIndex() | ||
317 | 1057 | { | ||
318 | 1058 | int index = 0; | ||
319 | 1059 | while (shapeTextures[index].openglContext) { | ||
320 | 1060 | index++; | ||
321 | 1061 | if (index == maxShapeTextures) { | ||
322 | 1062 | // Don't bother with a dynamic array, let's just set a high enough maxShapeTextures and | ||
323 | 1063 | // increase the static array size if ever needed. | ||
324 | 1064 | qFatal("reached maximum number of OpenGL contexts supported by UbuntuShape"); | ||
325 | 1065 | } | ||
326 | 1066 | } | ||
327 | 1067 | return index; | ||
328 | 1068 | } | ||
329 | 1069 | |||
330 | 1037 | // Gets the nearest boundary to coord in the texel grid of the given size. | 1070 | // Gets the nearest boundary to coord in the texel grid of the given size. |
331 | 1038 | static Q_DECL_CONSTEXPR float roundTextureCoord(float coord, float size) | 1071 | static Q_DECL_CONSTEXPR float roundTextureCoord(float coord, float size) |
332 | 1039 | { | 1072 | { |
333 | @@ -1118,20 +1151,24 @@ | |||
334 | 1118 | Q_ASSERT(window()); | 1151 | Q_ASSERT(window()); |
335 | 1119 | QOpenGLContext* openglContext = window()->openglContext(); | 1152 | QOpenGLContext* openglContext = window()->openglContext(); |
336 | 1120 | Q_ASSERT(openglContext); | 1153 | Q_ASSERT(openglContext); |
348 | 1121 | quint32 shapeTexture = shapeTextureHash[openglContext]; | 1154 | int index = getShapeTexturesIndex(openglContext); |
349 | 1122 | if (!shapeTexture) { | 1155 | if (index < 0) { |
350 | 1123 | glGenTextures(1, &shapeTexture); | 1156 | index = getEmptyShapeTexturesIndex(); |
351 | 1124 | glBindTexture(GL_TEXTURE_2D, shapeTexture); | 1157 | shapeTextures[index].openglContext = openglContext; |
352 | 1125 | glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); | 1158 | glGenTextures(shapeTextureCount, shapeTextures[index].textureId); |
353 | 1126 | glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); | 1159 | for (int i = 0; i < shapeTextureCount; i++) { |
354 | 1127 | glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); | 1160 | glBindTexture(GL_TEXTURE_2D, shapeTextures[index].textureId[i]); |
355 | 1128 | glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); | 1161 | glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); |
356 | 1129 | glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, shapeTextureInfo.size, shapeTextureInfo.size, 0, | 1162 | glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); |
357 | 1130 | GL_RGBA, GL_UNSIGNED_BYTE, shapeTextureInfo.data); | 1163 | glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); |
358 | 1131 | shapeTextureHash[openglContext] = shapeTexture; | 1164 | glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); |
359 | 1165 | glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, shapeTextureSize, shapeTextureSize, 0, GL_RGBA, | ||
360 | 1166 | GL_UNSIGNED_BYTE, shapeTextureData[i]); | ||
361 | 1167 | } | ||
362 | 1132 | QObject::connect(openglContext, SIGNAL(aboutToBeDestroyed()), this, | 1168 | QObject::connect(openglContext, SIGNAL(aboutToBeDestroyed()), this, |
363 | 1133 | SLOT(_q_openglContextDestroyed()), Qt::DirectConnection); | 1169 | SLOT(_q_openglContextDestroyed()), Qt::DirectConnection); |
364 | 1134 | } | 1170 | } |
365 | 1171 | const quint32 shapeTextureId = shapeTextures[index].textureId[m_aspect != DropShadow ? 0 : 1]; | ||
366 | 1135 | 1172 | ||
367 | 1136 | // Get the source texture info and update the source transform if needed. | 1173 | // Get the source texture info and update the source transform if needed. |
368 | 1137 | QSGTextureProvider* provider = m_source ? m_source->textureProvider() : NULL; | 1174 | QSGTextureProvider* provider = m_source ? m_source->textureProvider() : NULL; |
369 | @@ -1187,7 +1224,7 @@ | |||
370 | 1187 | radius = qMin(itemSize.width(), itemSize.height()) * 0.5f * (m_relativeRadius * 0.01f); | 1224 | radius = qMin(itemSize.width(), itemSize.height()) * 0.5f * (m_relativeRadius * 0.01f); |
371 | 1188 | } | 1225 | } |
372 | 1189 | 1226 | ||
374 | 1190 | updateMaterial(node, radius, shapeTexture, sourceTexture && m_sourceOpacity); | 1227 | updateMaterial(node, radius, shapeTextureId, sourceTexture && m_sourceOpacity); |
375 | 1191 | 1228 | ||
376 | 1192 | // Get the affine transformation for the source texture coordinates. | 1229 | // Get the affine transformation for the source texture coordinates. |
377 | 1193 | const QVector4D sourceCoordTransform( | 1230 | const QVector4D sourceCoordTransform( |
378 | @@ -1231,7 +1268,7 @@ | |||
379 | 1231 | }; | 1268 | }; |
380 | 1232 | 1269 | ||
381 | 1233 | updateGeometry( | 1270 | updateGeometry( |
383 | 1234 | node, itemSize, radius, shapeTextureInfo.offset, sourceCoordTransform, sourceMaskTransform, | 1271 | node, itemSize, radius, shapeTextureOffset, sourceCoordTransform, sourceMaskTransform, |
384 | 1235 | backgroundColor); | 1272 | backgroundColor); |
385 | 1236 | 1273 | ||
386 | 1237 | return node; | 1274 | return node; |
387 | @@ -1242,12 +1279,13 @@ | |||
388 | 1242 | return new ShapeNode; | 1279 | return new ShapeNode; |
389 | 1243 | } | 1280 | } |
390 | 1244 | 1281 | ||
392 | 1245 | void UCUbuntuShape::updateMaterial(QSGNode* node, float radius, quint32 shapeTexture, bool textured) | 1282 | void UCUbuntuShape::updateMaterial( |
393 | 1283 | QSGNode* node, float radius, quint32 shapeTextureId, bool textured) | ||
394 | 1246 | { | 1284 | { |
395 | 1247 | ShapeMaterial::Data* materialData = static_cast<ShapeNode*>(node)->material()->data(); | 1285 | ShapeMaterial::Data* materialData = static_cast<ShapeNode*>(node)->material()->data(); |
396 | 1248 | quint8 flags = 0; | 1286 | quint8 flags = 0; |
397 | 1249 | 1287 | ||
399 | 1250 | materialData->shapeTexture = shapeTexture; | 1288 | materialData->shapeTextureId = shapeTextureId; |
400 | 1251 | if (textured) { | 1289 | if (textured) { |
401 | 1252 | materialData->sourceTextureProvider = m_sourceTextureProvider; | 1290 | materialData->sourceTextureProvider = m_sourceTextureProvider; |
402 | 1253 | materialData->sourceOpacity = m_sourceOpacity; | 1291 | materialData->sourceOpacity = m_sourceOpacity; |
403 | @@ -1266,8 +1304,8 @@ | |||
404 | 1266 | // Mapping of radius size range from [0, 4] to [0, 1] with clamping, plus quantization. | 1304 | // Mapping of radius size range from [0, 4] to [0, 1] with clamping, plus quantization. |
405 | 1267 | const float start = 0.0f + radiusSizeOffset; | 1305 | const float start = 0.0f + radiusSizeOffset; |
406 | 1268 | const float end = 4.0f + radiusSizeOffset; | 1306 | const float end = 4.0f + radiusSizeOffset; |
409 | 1269 | materialData->distanceAAFactor = qMin( | 1307 | materialData->distanceAAFactor = |
410 | 1270 | (radius / (end - start)) - (start / (end - start)), 1.0f) * 255.0f; | 1308 | qMin((radius / (end - start)) - (start / (end - start)), 1.0f) * 255.0f; |
411 | 1271 | 1309 | ||
412 | 1272 | // Screen-space derivatives factors for fragment shaders depend on the primary orientation and | 1310 | // Screen-space derivatives factors for fragment shaders depend on the primary orientation and |
413 | 1273 | // content orientation. A flag indicating a 90° rotation around the primary orientation is | 1311 | // content orientation. A flag indicating a 90° rotation around the primary orientation is |
414 | @@ -1293,12 +1331,12 @@ | |||
415 | 1293 | // optimal performance. | 1331 | // optimal performance. |
416 | 1294 | if (radius > radiusSizeOffset) { | 1332 | if (radius > radiusSizeOffset) { |
417 | 1295 | const quint8 aspectFlags[] = { | 1333 | const quint8 aspectFlags[] = { |
419 | 1296 | ShapeMaterial::Data::Flat, ShapeMaterial::Data::Inset, | 1334 | ShapeMaterial::Data::Flat, ShapeMaterial::Data::Inset, ShapeMaterial::Data::DropShadow, |
420 | 1297 | ShapeMaterial::Data::Inset | ShapeMaterial::Data::Pressed | 1335 | ShapeMaterial::Data::Inset | ShapeMaterial::Data::Pressed |
421 | 1298 | }; | 1336 | }; |
422 | 1299 | flags |= aspectFlags[m_aspect]; | 1337 | flags |= aspectFlags[m_aspect]; |
423 | 1300 | } else { | 1338 | } else { |
425 | 1301 | const quint8 aspectFlags[] = { 0, 0, ShapeMaterial::Data::Pressed }; | 1339 | const quint8 aspectFlags[] = { 0, 0, 0, ShapeMaterial::Data::Pressed }; |
426 | 1302 | flags |= aspectFlags[m_aspect]; | 1340 | flags |= aspectFlags[m_aspect]; |
427 | 1303 | } | 1341 | } |
428 | 1304 | 1342 | ||
429 | @@ -1320,8 +1358,8 @@ | |||
430 | 1320 | // Set top row of 3 vertices. | 1358 | // Set top row of 3 vertices. |
431 | 1321 | v[0].position[0] = 0.0f; | 1359 | v[0].position[0] = 0.0f; |
432 | 1322 | v[0].position[1] = 0.0f; | 1360 | v[0].position[1] = 0.0f; |
435 | 1323 | v[0].shapeCoordinate[0] = shapeTextureInfo.offset; | 1361 | v[0].shapeCoordinate[0] = shapeTextureOffset; |
436 | 1324 | v[0].shapeCoordinate[1] = shapeTextureInfo.offset; | 1362 | v[0].shapeCoordinate[1] = shapeTextureOffset; |
437 | 1325 | v[0].sourceCoordinate[0] = sourceCoordTransform.z(); | 1363 | v[0].sourceCoordinate[0] = sourceCoordTransform.z(); |
438 | 1326 | v[0].sourceCoordinate[1] = sourceCoordTransform.w(); | 1364 | v[0].sourceCoordinate[1] = sourceCoordTransform.w(); |
439 | 1327 | v[0].sourceCoordinate[2] = sourceMaskTransform.z(); | 1365 | v[0].sourceCoordinate[2] = sourceMaskTransform.z(); |
440 | @@ -1329,8 +1367,8 @@ | |||
441 | 1329 | v[0].backgroundColor = backgroundColor[0]; | 1367 | v[0].backgroundColor = backgroundColor[0]; |
442 | 1330 | v[1].position[0] = 0.5f * itemSize.width(); | 1368 | v[1].position[0] = 0.5f * itemSize.width(); |
443 | 1331 | v[1].position[1] = 0.0f; | 1369 | v[1].position[1] = 0.0f; |
446 | 1332 | v[1].shapeCoordinate[0] = (0.5f * itemSize.width()) / radius - shapeTextureInfo.offset; | 1370 | v[1].shapeCoordinate[0] = (0.5f * itemSize.width()) / radius - shapeTextureOffset; |
447 | 1333 | v[1].shapeCoordinate[1] = shapeTextureInfo.offset; | 1371 | v[1].shapeCoordinate[1] = shapeTextureOffset; |
448 | 1334 | v[1].sourceCoordinate[0] = 0.5f * sourceCoordTransform.x() + sourceCoordTransform.z(); | 1372 | v[1].sourceCoordinate[0] = 0.5f * sourceCoordTransform.x() + sourceCoordTransform.z(); |
449 | 1335 | v[1].sourceCoordinate[1] = sourceCoordTransform.w(); | 1373 | v[1].sourceCoordinate[1] = sourceCoordTransform.w(); |
450 | 1336 | v[1].sourceCoordinate[2] = 0.5f * sourceMaskTransform.x() + sourceMaskTransform.z(); | 1374 | v[1].sourceCoordinate[2] = 0.5f * sourceMaskTransform.x() + sourceMaskTransform.z(); |
451 | @@ -1338,8 +1376,8 @@ | |||
452 | 1338 | v[1].backgroundColor = backgroundColor[0]; | 1376 | v[1].backgroundColor = backgroundColor[0]; |
453 | 1339 | v[2].position[0] = itemSize.width(); | 1377 | v[2].position[0] = itemSize.width(); |
454 | 1340 | v[2].position[1] = 0.0f; | 1378 | v[2].position[1] = 0.0f; |
457 | 1341 | v[2].shapeCoordinate[0] = shapeTextureInfo.offset; | 1379 | v[2].shapeCoordinate[0] = shapeTextureOffset; |
458 | 1342 | v[2].shapeCoordinate[1] = shapeTextureInfo.offset; | 1380 | v[2].shapeCoordinate[1] = shapeTextureOffset; |
459 | 1343 | v[2].sourceCoordinate[0] = sourceCoordTransform.x() + sourceCoordTransform.z(); | 1381 | v[2].sourceCoordinate[0] = sourceCoordTransform.x() + sourceCoordTransform.z(); |
460 | 1344 | v[2].sourceCoordinate[1] = sourceCoordTransform.w(); | 1382 | v[2].sourceCoordinate[1] = sourceCoordTransform.w(); |
461 | 1345 | v[2].sourceCoordinate[2] = sourceMaskTransform.x() + sourceMaskTransform.z(); | 1383 | v[2].sourceCoordinate[2] = sourceMaskTransform.x() + sourceMaskTransform.z(); |
462 | @@ -1349,8 +1387,8 @@ | |||
463 | 1349 | // Set middle row of 3 vertices. | 1387 | // Set middle row of 3 vertices. |
464 | 1350 | v[3].position[0] = 0.0f; | 1388 | v[3].position[0] = 0.0f; |
465 | 1351 | v[3].position[1] = 0.5f * itemSize.height(); | 1389 | v[3].position[1] = 0.5f * itemSize.height(); |
468 | 1352 | v[3].shapeCoordinate[0] = shapeTextureInfo.offset; | 1390 | v[3].shapeCoordinate[0] = shapeTextureOffset; |
469 | 1353 | v[3].shapeCoordinate[1] = (0.5f * itemSize.height()) / radius - shapeTextureInfo.offset; | 1391 | v[3].shapeCoordinate[1] = (0.5f * itemSize.height()) / radius - shapeTextureOffset; |
470 | 1354 | v[3].sourceCoordinate[0] = sourceCoordTransform.z(); | 1392 | v[3].sourceCoordinate[0] = sourceCoordTransform.z(); |
471 | 1355 | v[3].sourceCoordinate[1] = 0.5f * sourceCoordTransform.y() + sourceCoordTransform.w(); | 1393 | v[3].sourceCoordinate[1] = 0.5f * sourceCoordTransform.y() + sourceCoordTransform.w(); |
472 | 1356 | v[3].sourceCoordinate[2] = sourceMaskTransform.z(); | 1394 | v[3].sourceCoordinate[2] = sourceMaskTransform.z(); |
473 | @@ -1358,8 +1396,8 @@ | |||
474 | 1358 | v[3].backgroundColor = backgroundColor[1]; | 1396 | v[3].backgroundColor = backgroundColor[1]; |
475 | 1359 | v[4].position[0] = 0.5f * itemSize.width(); | 1397 | v[4].position[0] = 0.5f * itemSize.width(); |
476 | 1360 | v[4].position[1] = 0.5f * itemSize.height(); | 1398 | v[4].position[1] = 0.5f * itemSize.height(); |
479 | 1361 | v[4].shapeCoordinate[0] = (0.5f * itemSize.width()) / radius - shapeTextureInfo.offset; | 1399 | v[4].shapeCoordinate[0] = (0.5f * itemSize.width()) / radius - shapeTextureOffset; |
480 | 1362 | v[4].shapeCoordinate[1] = (0.5f * itemSize.height()) / radius - shapeTextureInfo.offset; | 1400 | v[4].shapeCoordinate[1] = (0.5f * itemSize.height()) / radius - shapeTextureOffset; |
481 | 1363 | v[4].sourceCoordinate[0] = 0.5f * sourceCoordTransform.x() + sourceCoordTransform.z(); | 1401 | v[4].sourceCoordinate[0] = 0.5f * sourceCoordTransform.x() + sourceCoordTransform.z(); |
482 | 1364 | v[4].sourceCoordinate[1] = 0.5f * sourceCoordTransform.y() + sourceCoordTransform.w(); | 1402 | v[4].sourceCoordinate[1] = 0.5f * sourceCoordTransform.y() + sourceCoordTransform.w(); |
483 | 1365 | v[4].sourceCoordinate[2] = 0.5f * sourceMaskTransform.x() + sourceMaskTransform.z(); | 1403 | v[4].sourceCoordinate[2] = 0.5f * sourceMaskTransform.x() + sourceMaskTransform.z(); |
484 | @@ -1367,8 +1405,8 @@ | |||
485 | 1367 | v[4].backgroundColor = backgroundColor[1]; | 1405 | v[4].backgroundColor = backgroundColor[1]; |
486 | 1368 | v[5].position[0] = itemSize.width(); | 1406 | v[5].position[0] = itemSize.width(); |
487 | 1369 | v[5].position[1] = 0.5f * itemSize.height(); | 1407 | v[5].position[1] = 0.5f * itemSize.height(); |
490 | 1370 | v[5].shapeCoordinate[0] = shapeTextureInfo.offset; | 1408 | v[5].shapeCoordinate[0] = shapeTextureOffset; |
491 | 1371 | v[5].shapeCoordinate[1] = (0.5f * itemSize.height()) / radius - shapeTextureInfo.offset; | 1409 | v[5].shapeCoordinate[1] = (0.5f * itemSize.height()) / radius - shapeTextureOffset; |
492 | 1372 | v[5].sourceCoordinate[0] = sourceCoordTransform.x() + sourceCoordTransform.z(); | 1410 | v[5].sourceCoordinate[0] = sourceCoordTransform.x() + sourceCoordTransform.z(); |
493 | 1373 | v[5].sourceCoordinate[1] = 0.5f * sourceCoordTransform.y() + sourceCoordTransform.w(); | 1411 | v[5].sourceCoordinate[1] = 0.5f * sourceCoordTransform.y() + sourceCoordTransform.w(); |
494 | 1374 | v[5].sourceCoordinate[2] = sourceMaskTransform.x() + sourceMaskTransform.z(); | 1412 | v[5].sourceCoordinate[2] = sourceMaskTransform.x() + sourceMaskTransform.z(); |
495 | @@ -1378,8 +1416,8 @@ | |||
496 | 1378 | // Set bottom row of 3 vertices. | 1416 | // Set bottom row of 3 vertices. |
497 | 1379 | v[6].position[0] = 0.0f; | 1417 | v[6].position[0] = 0.0f; |
498 | 1380 | v[6].position[1] = itemSize.height(); | 1418 | v[6].position[1] = itemSize.height(); |
501 | 1381 | v[6].shapeCoordinate[0] = shapeTextureInfo.offset; | 1419 | v[6].shapeCoordinate[0] = shapeTextureOffset; |
502 | 1382 | v[6].shapeCoordinate[1] = shapeTextureInfo.offset; | 1420 | v[6].shapeCoordinate[1] = shapeTextureOffset; |
503 | 1383 | v[6].sourceCoordinate[0] = sourceCoordTransform.z(); | 1421 | v[6].sourceCoordinate[0] = sourceCoordTransform.z(); |
504 | 1384 | v[6].sourceCoordinate[1] = sourceCoordTransform.y() + sourceCoordTransform.w(); | 1422 | v[6].sourceCoordinate[1] = sourceCoordTransform.y() + sourceCoordTransform.w(); |
505 | 1385 | v[6].sourceCoordinate[2] = sourceMaskTransform.z(); | 1423 | v[6].sourceCoordinate[2] = sourceMaskTransform.z(); |
506 | @@ -1387,8 +1425,8 @@ | |||
507 | 1387 | v[6].backgroundColor = backgroundColor[2]; | 1425 | v[6].backgroundColor = backgroundColor[2]; |
508 | 1388 | v[7].position[0] = 0.5f * itemSize.width(); | 1426 | v[7].position[0] = 0.5f * itemSize.width(); |
509 | 1389 | v[7].position[1] = itemSize.height(); | 1427 | v[7].position[1] = itemSize.height(); |
512 | 1390 | v[7].shapeCoordinate[0] = (0.5f * itemSize.width()) / radius - shapeTextureInfo.offset; | 1428 | v[7].shapeCoordinate[0] = (0.5f * itemSize.width()) / radius - shapeTextureOffset; |
513 | 1391 | v[7].shapeCoordinate[1] = shapeTextureInfo.offset; | 1429 | v[7].shapeCoordinate[1] = shapeTextureOffset; |
514 | 1392 | v[7].sourceCoordinate[0] = 0.5f * sourceCoordTransform.x() + sourceCoordTransform.z(); | 1430 | v[7].sourceCoordinate[0] = 0.5f * sourceCoordTransform.x() + sourceCoordTransform.z(); |
515 | 1393 | v[7].sourceCoordinate[1] = sourceCoordTransform.y() + sourceCoordTransform.w(); | 1431 | v[7].sourceCoordinate[1] = sourceCoordTransform.y() + sourceCoordTransform.w(); |
516 | 1394 | v[7].sourceCoordinate[2] = 0.5f * sourceMaskTransform.x() + sourceMaskTransform.z(); | 1432 | v[7].sourceCoordinate[2] = 0.5f * sourceMaskTransform.x() + sourceMaskTransform.z(); |
517 | @@ -1396,8 +1434,8 @@ | |||
518 | 1396 | v[7].backgroundColor = backgroundColor[2]; | 1434 | v[7].backgroundColor = backgroundColor[2]; |
519 | 1397 | v[8].position[0] = itemSize.width(); | 1435 | v[8].position[0] = itemSize.width(); |
520 | 1398 | v[8].position[1] = itemSize.height(); | 1436 | v[8].position[1] = itemSize.height(); |
523 | 1399 | v[8].shapeCoordinate[0] = shapeTextureInfo.offset; | 1437 | v[8].shapeCoordinate[0] = shapeTextureOffset; |
524 | 1400 | v[8].shapeCoordinate[1] = shapeTextureInfo.offset; | 1438 | v[8].shapeCoordinate[1] = shapeTextureOffset; |
525 | 1401 | v[8].sourceCoordinate[0] = sourceCoordTransform.x() + sourceCoordTransform.z(); | 1439 | v[8].sourceCoordinate[0] = sourceCoordTransform.x() + sourceCoordTransform.z(); |
526 | 1402 | v[8].sourceCoordinate[1] = sourceCoordTransform.y() + sourceCoordTransform.w(); | 1440 | v[8].sourceCoordinate[1] = sourceCoordTransform.y() + sourceCoordTransform.w(); |
527 | 1403 | v[8].sourceCoordinate[2] = sourceMaskTransform.x() + sourceMaskTransform.z(); | 1441 | v[8].sourceCoordinate[2] = sourceMaskTransform.x() + sourceMaskTransform.z(); |
528 | 1404 | 1442 | ||
529 | === modified file 'src/Ubuntu/Components/plugin/ucubuntushape.h' | |||
530 | --- src/Ubuntu/Components/plugin/ucubuntushape.h 2015-07-22 15:51:14 +0000 | |||
531 | +++ src/Ubuntu/Components/plugin/ucubuntushape.h 2015-07-27 16:39:42 +0000 | |||
532 | @@ -62,10 +62,12 @@ | |||
533 | 62 | Repeated = (HorizontallyRepeated | VerticallyRepeated), | 62 | Repeated = (HorizontallyRepeated | VerticallyRepeated), |
534 | 63 | Flat = (1 << 3), | 63 | Flat = (1 << 3), |
535 | 64 | Inset = (1 << 4), | 64 | Inset = (1 << 4), |
537 | 65 | Pressed = (1 << 5) | 65 | DropShadow = (1 << 5), |
538 | 66 | AspectMask = (Flat | Inset | DropShadow), | ||
539 | 67 | Pressed = (1 << 6) | ||
540 | 66 | }; | 68 | }; |
541 | 67 | QSGTextureProvider* sourceTextureProvider; | 69 | QSGTextureProvider* sourceTextureProvider; |
543 | 68 | quint32 shapeTexture; | 70 | quint32 shapeTextureId; |
544 | 69 | quint8 distanceAAFactor; | 71 | quint8 distanceAAFactor; |
545 | 70 | quint8 sourceOpacity; | 72 | quint8 sourceOpacity; |
546 | 71 | quint8 dfdtFactors; | 73 | quint8 dfdtFactors; |
547 | @@ -178,7 +180,7 @@ | |||
548 | 178 | public: | 180 | public: |
549 | 179 | UCUbuntuShape(QQuickItem* parent=0); | 181 | UCUbuntuShape(QQuickItem* parent=0); |
550 | 180 | 182 | ||
552 | 181 | enum Aspect { Flat = 0, Inset = 1 }; // Don't forget to update private enum if extended. | 183 | enum Aspect { Flat = 0, Inset = 1, DropShadow = 2 }; // Don't forget to update private enum. |
553 | 182 | enum BackgroundMode { SolidColor = 0, VerticalGradient = 1 }; | 184 | enum BackgroundMode { SolidColor = 0, VerticalGradient = 1 }; |
554 | 183 | enum HAlignment { AlignLeft = 0, AlignHCenter = 1, AlignRight = 2 }; | 185 | enum HAlignment { AlignLeft = 0, AlignHCenter = 1, AlignRight = 2 }; |
555 | 184 | enum VAlignment { AlignTop = 0, AlignVCenter = 1, AlignBottom = 2 }; | 186 | enum VAlignment { AlignTop = 0, AlignVCenter = 1, AlignBottom = 2 }; |
556 | @@ -287,7 +289,7 @@ | |||
557 | 287 | 289 | ||
558 | 288 | // Virtual functions for extended shapes. | 290 | // Virtual functions for extended shapes. |
559 | 289 | virtual QSGNode* createSceneGraphNode() const; | 291 | virtual QSGNode* createSceneGraphNode() const; |
561 | 290 | virtual void updateMaterial(QSGNode* node, float radius, quint32 shapeTexture, bool textured); | 292 | virtual void updateMaterial(QSGNode* node, float radius, quint32 shapeTextureId, bool textured); |
562 | 291 | virtual void updateGeometry( | 293 | virtual void updateGeometry( |
563 | 292 | QSGNode* node, const QSizeF& itemSize, float radius, float shapeOffset, | 294 | QSGNode* node, const QSizeF& itemSize, float radius, float shapeOffset, |
564 | 293 | const QVector4D& sourceCoordTransform, const QVector4D& sourceMaskTransform, | 295 | const QVector4D& sourceCoordTransform, const QVector4D& sourceMaskTransform, |
565 | @@ -312,7 +314,7 @@ | |||
566 | 312 | VAlignment verticalAlignment, const QSize& textureSize); | 314 | VAlignment verticalAlignment, const QSize& textureSize); |
567 | 313 | 315 | ||
568 | 314 | enum Radius { Small = 0, Medium = 1, Large = 2 }; | 316 | enum Radius { Small = 0, Medium = 1, Large = 2 }; |
570 | 315 | enum { Pressed = 2 }; // Aspect extension (to keep support for deprecated aspects). | 317 | enum { Pressed = 3 }; // Aspect extension (to keep support for deprecated aspects). |
571 | 316 | enum { | 318 | enum { |
572 | 317 | AspectSet = (1 << 0), | 319 | AspectSet = (1 << 0), |
573 | 318 | GradientColorSet = (1 << 1), | 320 | GradientColorSet = (1 << 1), |
574 | @@ -331,7 +333,7 @@ | |||
575 | 331 | QVector4D m_sourceTransform; | 333 | QVector4D m_sourceTransform; |
576 | 332 | Radius m_radius : 2; | 334 | Radius m_radius : 2; |
577 | 333 | quint8 m_relativeRadius : 6; | 335 | quint8 m_relativeRadius : 6; |
579 | 334 | quint8 m_aspect : 2; | 336 | quint8 m_aspect : 3; |
580 | 335 | HAlignment m_imageHorizontalAlignment : 2; | 337 | HAlignment m_imageHorizontalAlignment : 2; |
581 | 336 | VAlignment m_imageVerticalAlignment : 2; | 338 | VAlignment m_imageVerticalAlignment : 2; |
582 | 337 | BackgroundMode m_backgroundMode : 1; | 339 | BackgroundMode m_backgroundMode : 1; |
583 | @@ -340,7 +342,6 @@ | |||
584 | 340 | FillMode m_sourceFillMode : 2; | 342 | FillMode m_sourceFillMode : 2; |
585 | 341 | WrapMode m_sourceHorizontalWrapMode : 1; | 343 | WrapMode m_sourceHorizontalWrapMode : 1; |
586 | 342 | WrapMode m_sourceVerticalWrapMode : 1; | 344 | WrapMode m_sourceVerticalWrapMode : 1; |
587 | 343 | quint8 __explicit_padding : 1; | ||
588 | 344 | quint8 m_sourceOpacity; | 345 | quint8 m_sourceOpacity; |
589 | 345 | quint8 m_flags; | 346 | quint8 m_flags; |
590 | 346 | 347 | ||
591 | 347 | 348 | ||
592 | === modified file 'src/Ubuntu/Components/plugin/ucubuntushapetexture.h' | |||
593 | --- src/Ubuntu/Components/plugin/ucubuntushapetexture.h 2015-04-08 10:46:56 +0000 | |||
594 | +++ src/Ubuntu/Components/plugin/ucubuntushapetexture.h 2015-07-27 16:39:42 +0000 | |||
595 | @@ -1,15 +1,12 @@ | |||
596 | 1 | // Copyright 2015 Canonical Ltd. | 1 | // Copyright 2015 Canonical Ltd. |
608 | 2 | // Automatically generated by the createshapeimage tool. | 2 | // Automatically generated by the createshapetextures tool. |
609 | 3 | 3 | ||
610 | 4 | static const struct { | 4 | const int shapeTextureCount = 2; |
611 | 5 | float offset; | 5 | const int shapeTextureSize = 32; |
612 | 6 | float distanceAA; | 6 | const float shapeTextureOffset = 0.0625; |
613 | 7 | int size; | 7 | const int shapeTextureDistanceAA = 4; |
614 | 8 | unsigned char data[4097]; | 8 | |
615 | 9 | } shapeTextureInfo = { | 9 | static const unsigned char shapeTextureData[2][4097] = { |
605 | 10 | 0.0625, | ||
606 | 11 | 4, | ||
607 | 12 | 32, | ||
616 | 13 | "\x5e\x5e\x00\x00\x5e\x5e\x00\x00\x5e\x5e\x00\x00\x5e\x5e\x00\x00" | 10 | "\x5e\x5e\x00\x00\x5e\x5e\x00\x00\x5e\x5e\x00\x00\x5e\x5e\x00\x00" |
617 | 14 | "\x5e\x5e\x00\x00\x5e\x5e\x00\x00\x5e\x5e\x00\x00\x5e\x5e\x00\x00" | 11 | "\x5e\x5e\x00\x00\x5e\x5e\x00\x00\x5e\x5e\x00\x00\x5e\x5e\x00\x00" |
618 | 15 | "\x5e\x5e\x00\x00\x5e\x5e\x00\x00\x5e\x5e\x00\x00\x5e\x5e\x06\x00" | 12 | "\x5e\x5e\x00\x00\x5e\x5e\x00\x00\x5e\x5e\x00\x00\x5e\x5e\x06\x00" |
619 | @@ -266,4 +263,261 @@ | |||
620 | 266 | "\x00\x00\xff\xff\x00\x00\xff\xff\x00\x00\xff\xff\x00\x00\xff\xff" | 263 | "\x00\x00\xff\xff\x00\x00\xff\xff\x00\x00\xff\xff\x00\x00\xff\xff" |
621 | 267 | "\x00\x00\xff\xff\x00\x00\xff\xff\x00\x00\xff\xff\x00\x00\xff\xff" | 264 | "\x00\x00\xff\xff\x00\x00\xff\xff\x00\x00\xff\xff\x00\x00\xff\xff" |
622 | 268 | "\x00\x00\xff\xff\x00\x00\xff\xff\x00\x00\xff\xff\x00\x00\xff\xff" | 265 | "\x00\x00\xff\xff\x00\x00\xff\xff\x00\x00\xff\xff\x00\x00\xff\xff" |
623 | 266 | , | ||
624 | 267 | "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" | ||
625 | 268 | "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" | ||
626 | 269 | "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" | ||
627 | 270 | "\x08\x00\x00\x00\x12\x00\x00\x00\x1a\x00\x00\x00\x1f\x00\x00\x00" | ||
628 | 271 | "\x29\x00\x00\x00\x2e\x00\x00\x00\x33\x00\x00\x00\x38\x01\x00\x00" | ||
629 | 272 | "\x3d\x05\x00\x00\x40\x09\x00\x00\x43\x0b\x00\x00\x46\x0e\x00\x00" | ||
630 | 273 | "\x48\x10\x00\x00\x49\x12\x00\x00\x4a\x12\x00\x00\x4b\x13\x00\x00" | ||
631 | 274 | "\x4c\x14\x00\x00\x4d\x15\x00\x00\x4d\x15\x00\x00\x4e\x16\x00\x00" | ||
632 | 275 | "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" | ||
633 | 276 | "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" | ||
634 | 277 | "\x00\x00\x00\x00\x00\x00\x00\x00\x0c\x00\x00\x00\x1a\x00\x00\x00" | ||
635 | 278 | "\x25\x00\x00\x00\x30\x00\x00\x00\x38\x03\x00\x00\x3f\x0a\x00\x00" | ||
636 | 279 | "\x47\x12\x00\x00\x4e\x16\x00\x00\x53\x1b\x00\x00\x58\x20\x00\x00" | ||
637 | 280 | "\x5d\x25\x00\x00\x60\x29\x00\x00\x63\x2b\x00\x00\x66\x2e\x00\x00" | ||
638 | 281 | "\x68\x30\x00\x00\x69\x31\x00\x00\x6a\x32\x00\x00\x6b\x33\x00\x00" | ||
639 | 282 | "\x6c\x34\x00\x00\x6c\x35\x00\x00\x6d\x35\x00\x00\x6e\x36\x00\x00" | ||
640 | 283 | "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" | ||
641 | 284 | "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" | ||
642 | 285 | "\x0b\x00\x00\x00\x1b\x00\x00\x00\x28\x00\x00\x00\x38\x03\x00\x00" | ||
643 | 286 | "\x3f\x0f\x00\x00\x50\x1a\x00\x00\x57\x22\x00\x00\x5f\x27\x00\x00" | ||
644 | 287 | "\x67\x30\x00\x00\x6e\x36\x00\x00\x73\x3b\x00\x00\x78\x40\x00\x00" | ||
645 | 288 | "\x7d\x45\x01\x00\x80\x48\x05\x00\x83\x4b\x0a\x00\x85\x4e\x0e\x00" | ||
646 | 289 | "\x88\x50\x11\x00\x89\x51\x12\x00\x8a\x52\x14\x00\x8b\x53\x15\x00" | ||
647 | 290 | "\x8c\x54\x16\x00\x8c\x54\x17\x00\x8d\x55\x19\x00\x8e\x56\x1a\x00" | ||
648 | 291 | "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" | ||
649 | 292 | "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x13\x00\x00\x00" | ||
650 | 293 | "\x26\x00\x00\x00\x36\x06\x00\x00\x46\x13\x00\x00\x52\x22\x00\x00" | ||
651 | 294 | "\x5f\x2c\x00\x00\x6c\x37\x00\x00\x78\x3f\x00\x00\x7f\x47\x0a\x00" | ||
652 | 295 | "\x86\x50\x17\x00\x8e\x56\x20\x00\x93\x5b\x28\x00\x98\x60\x30\x00" | ||
653 | 296 | "\x9c\x65\x36\x00\xa0\x68\x3a\x00\xa3\x6b\x3e\x00\xa5\x6e\x42\x00" | ||
654 | 297 | "\xa8\x70\x44\x00\xa9\x71\x45\x00\xaa\x72\x46\x00\xab\x73\x47\x00" | ||
655 | 298 | "\xab\x74\x48\x00\xac\x74\x49\x00\xad\x75\x4a\x00\xae\x76\x4c\x00" | ||
656 | 299 | "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" | ||
657 | 300 | "\x00\x00\x00\x00\x03\x00\x00\x00\x18\x00\x00\x00\x2c\x00\x00\x00" | ||
658 | 301 | "\x40\x12\x00\x00\x51\x23\x00\x00\x61\x2f\x00\x00\x71\x3f\x00\x00" | ||
659 | 302 | "\x7f\x47\x10\x00\x8a\x53\x25\x00\x96\x5f\x33\x00\x9f\x67\x3f\x00" | ||
660 | 303 | "\xa6\x6e\x49\x00\xae\x76\x51\x00\xb3\x7b\x58\x00\xb8\x80\x5e\x00" | ||
661 | 304 | "\xbc\x84\x63\x00\xc0\x88\x66\x00\xc3\x8b\x6a\x00\xc5\x8d\x6d\x00" | ||
662 | 305 | "\xc8\x90\x6f\x00\xc9\x91\x70\x00\xca\x92\x71\x00\xcb\x93\x71\x00" | ||
663 | 306 | "\xcb\x93\x72\x00\xcc\x94\x73\x00\xcd\x95\x74\x00\xce\x96\x75\x00" | ||
664 | 307 | "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" | ||
665 | 308 | "\x00\x00\x00\x00\x18\x00\x00\x00\x30\x05\x00\x00\x45\x19\x00\x00" | ||
666 | 309 | "\x59\x2c\x00\x00\x6d\x3e\x00\x00\x7e\x4e\x15\x00\x8e\x59\x31\x00" | ||
667 | 310 | "\x9e\x67\x44\x00\xab\x74\x55\x00\xb6\x7f\x60\x00\xbf\x86\x6a\x00" | ||
668 | 311 | "\xc6\x8f\x73\x00\xcd\x96\x7a\x00\xd3\x9b\x7f\x00\xd7\xa0\x84\x00" | ||
669 | 312 | "\xdc\xa4\x88\x00\xe0\xa8\x8b\x00\xe2\xab\x8d\x00\xe5\xad\x90\x00" | ||
670 | 313 | "\xe8\xb0\x92\x00\xe9\xb1\x92\x00\xea\xb2\x93\x00\xea\xb3\x94\x00" | ||
671 | 314 | "\xeb\xb3\x94\x00\xec\xb4\x95\x00\xed\xb5\x96\x00\xed\xb6\x97\x00" | ||
672 | 315 | "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" | ||
673 | 316 | "\x14\x00\x00\x00\x2c\x09\x00\x00\x45\x1e\x00\x00\x5d\x32\x00\x00" | ||
674 | 317 | "\x72\x46\x07\x00\x86\x57\x2a\x00\x9a\x69\x44\x00\xab\x79\x58\x00" | ||
675 | 318 | "\xb9\x86\x6f\x00\xcb\x93\x77\x00\xd1\x9e\x83\x00\xdc\xa7\x8e\x00" | ||
676 | 319 | "\xe4\xae\x93\x00\xeb\xb6\x9a\x00\xf3\xbb\x9e\x00\xf7\xc0\xa2\x00" | ||
677 | 320 | "\xfb\xc4\xa5\x00\xff\xc8\xa7\x00\xff\xcb\xa9\x00\xff\xcd\xab\x00" | ||
678 | 321 | "\xff\xd0\xac\x00\xff\xd1\xad\x00\xff\xd2\xad\x00\xff\xd2\xae\x00" | ||
679 | 322 | "\xff\xd3\xae\x00\xff\xd4\xaf\x00\xff\xd5\xaf\x00\xff\xd5\xb0\x00" | ||
680 | 323 | "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0d\x00\x00\x00" | ||
681 | 324 | "\x27\x04\x00\x00\x41\x1d\x00\x00\x59\x36\x00\x00\x72\x4b\x0d\x00" | ||
682 | 325 | "\x8a\x5f\x31\x00\x9f\x73\x4e\x00\xb3\x84\x67\x00\xc5\x96\x7d\x00" | ||
683 | 326 | "\xd7\xa6\x8b\x00\xe4\xaf\x96\x00\xef\xbe\xa0\x00\xfa\xc6\xa9\x00" | ||
684 | 327 | "\xff\xcd\xac\x00\xff\xd5\xb2\x00\xff\xdb\xb4\x00\xff\xdf\xb7\x00" | ||
685 | 328 | "\xff\xe4\xba\x00\xff\xe8\xbc\x00\xff\xea\xbd\x00\xff\xed\xbe\x00" | ||
686 | 329 | "\xff\xf0\xbf\x00\xff\xf1\xbf\x00\xff\xf1\xc0\x00\xff\xf2\xc0\x00" | ||
687 | 330 | "\xff\xf3\xc0\x00\xff\xf4\xc0\x00\xff\xf5\xc1\x00\xff\xf5\xc1\x00" | ||
688 | 331 | "\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x1d\x00\x00\x00" | ||
689 | 332 | "\x38\x19\x00\x00\x52\x32\x00\x00\x6e\x4a\x07\x00\x86\x63\x31\x00" | ||
690 | 333 | "\x9f\x78\x54\x00\xb7\x8c\x6f\x00\xcc\xa0\x86\x00\xe0\xb1\x97\x00" | ||
691 | 334 | "\xf1\xbf\xa4\x00\xff\xcf\xaf\x00\xff\xda\xb6\x00\xff\xe3\xbb\x00" | ||
692 | 335 | "\xff\xeb\xbf\x00\xff\xf5\xc2\x00\xff\xfa\xc4\x00\xff\xff\xc5\x00" | ||
693 | 336 | "\xff\xff\xc7\x00\xff\xff\xc8\x00\xff\xff\xc8\x00\xff\xff\xc9\x00" | ||
694 | 337 | "\xff\xff\xc9\x00\xff\xff\xca\x00\xff\xff\xca\x00\xff\xff\xca\x00" | ||
695 | 338 | "\xff\xff\xca\x00\xff\xff\xca\x00\xff\xff\xca\x00\xff\xff\xca\x00" | ||
696 | 339 | "\x00\x00\x00\x00\x00\x00\x00\x00\x0e\x00\x00\x00\x2a\x10\x00\x00" | ||
697 | 340 | "\x48\x2c\x00\x00\x63\x46\x00\x00\x80\x5f\x2a\x00\x9b\x77\x4f\x00" | ||
698 | 341 | "\xb4\x90\x6f\x00\xcc\xa5\x8a\x00\xe4\xb9\x9e\x00\xf9\xcc\xad\x00" | ||
699 | 342 | "\xff\xdd\xb8\x00\xff\xeb\xbf\x00\xff\xf7\xc4\x00\xff\xff\xc7\x00" | ||
700 | 343 | "\xff\xff\xc9\x00\xff\xff\xcb\x00\xff\xff\xcb\x00\xff\xff\xcc\x00" | ||
701 | 344 | "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00" | ||
702 | 345 | "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00" | ||
703 | 346 | "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00" | ||
704 | 347 | "\x00\x00\x00\x00\x00\x00\x00\x00\x1d\x06\x00\x00\x3a\x23\x00\x00" | ||
705 | 348 | "\x54\x3c\x00\x00\x73\x56\x16\x00\x90\x73\x45\x00\xad\x8c\x68\x00" | ||
706 | 349 | "\xc7\xa4\x86\x00\xe1\xbd\x9e\x00\xf9\xd2\xb0\x00\xff\xe6\xbc\x00" | ||
707 | 350 | "\xff\xf7\xc4\x00\xff\xff\xc9\x00\xff\xff\xcb\x00\xff\xff\xcc\x00" | ||
708 | 351 | "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00" | ||
709 | 352 | "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00" | ||
710 | 353 | "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00" | ||
711 | 354 | "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00" | ||
712 | 355 | "\x00\x00\x00\x00\x0a\x00\x00\x00\x27\x11\x00\x00\x42\x2f\x00\x00" | ||
713 | 356 | "\x62\x4e\x00\x00\x81\x69\x31\x00\xa0\x83\x58\x00\xba\xa0\x7d\x00" | ||
714 | 357 | "\xd8\xb9\x97\x00\xf2\xd2\xae\x00\xff\xea\xbc\x00\xff\xff\xc6\x00" | ||
715 | 358 | "\xff\xff\xcb\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00" | ||
716 | 359 | "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00" | ||
717 | 360 | "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00" | ||
718 | 361 | "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00" | ||
719 | 362 | "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00" | ||
720 | 363 | "\x00\x00\x00\x00\x15\x01\x00\x00\x33\x20\x00\x00\x50\x3d\x00\x00" | ||
721 | 364 | "\x6e\x56\x10\x00\x8d\x77\x45\x00\xad\x96\x6f\x00\xcd\xb0\x8b\x00" | ||
722 | 365 | "\xe6\xcb\xa4\x00\xff\xe6\xb8\x00\xff\xff\xc4\x00\xff\xff\xcb\x00" | ||
723 | 366 | "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00" | ||
724 | 367 | "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00" | ||
725 | 368 | "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00" | ||
726 | 369 | "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00" | ||
727 | 370 | "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00" | ||
728 | 371 | "\x00\x00\x00\x00\x1d\x0d\x00\x00\x3b\x2a\x00\x00\x59\x45\x00\x00" | ||
729 | 372 | "\x7b\x65\x25\x00\x99\x83\x55\x00\xb9\xa4\x77\x00\xd4\xbe\x96\x00" | ||
730 | 373 | "\xf2\xdb\xaf\x00\xff\xf6\xbf\x00\xff\xff\xc9\x00\xff\xff\xcc\x00" | ||
731 | 374 | "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00" | ||
732 | 375 | "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00" | ||
733 | 376 | "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00" | ||
734 | 377 | "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00" | ||
735 | 378 | "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00" | ||
736 | 379 | "\x06\x00\x00\x00\x24\x17\x00\x00\x42\x35\x00\x00\x62\x52\x00\x00" | ||
737 | 380 | "\x82\x71\x33\x00\xa2\x91\x60\x00\xc1\xae\x83\x00\xde\xce\xa0\x00" | ||
738 | 381 | "\xfd\xea\xb6\x00\xff\xff\xc4\x00\xff\xff\xcb\x00\xff\xff\xcc\x00" | ||
739 | 382 | "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00" | ||
740 | 383 | "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00" | ||
741 | 384 | "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00" | ||
742 | 385 | "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00" | ||
743 | 386 | "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00" | ||
744 | 387 | "\x0d\x01\x00\x00\x2a\x1f\x00\x00\x4a\x3c\x00\x00\x6a\x5c\x09\x00" | ||
745 | 388 | "\x89\x7d\x3f\x00\xaa\x9c\x6a\x00\xc9\xbc\x8e\x00\xe7\xd7\xa9\x00" | ||
746 | 389 | "\xff\xf4\xbb\x00\xff\xff\xc7\x00\xff\xff\xcc\x00\xff\xff\xcc\x00" | ||
747 | 390 | "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00" | ||
748 | 391 | "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00" | ||
749 | 392 | "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00" | ||
750 | 393 | "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00" | ||
751 | 394 | "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00" | ||
752 | 395 | "\x12\x08\x00\x00\x32\x26\x00\x00\x52\x44\x00\x00\x71\x64\x18\x00" | ||
753 | 396 | "\x91\x83\x4a\x00\xb1\xa4\x73\x00\xd0\xc4\x93\x00\xee\xe1\xac\x00" | ||
754 | 397 | "\xff\xff\xbf\x00\xff\xff\xc9\x00\xff\xff\xcc\x00\xff\xff\xcc\x00" | ||
755 | 398 | "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00" | ||
756 | 399 | "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00" | ||
757 | 400 | "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00" | ||
758 | 401 | "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00" | ||
759 | 402 | "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00" | ||
760 | 403 | "\x17\x0e\x00\x00\x37\x2c\x00\x00\x57\x4c\x00\x00\x78\x6c\x21\x00" | ||
761 | 404 | "\x96\x8b\x51\x00\xb6\xab\x7a\x00\xd6\xcb\x9a\x00\xf5\xe9\xb2\x00" | ||
762 | 405 | "\xff\xff\xc2\x00\xff\xff\xcb\x00\xff\xff\xcc\x00\xff\xff\xcc\x00" | ||
763 | 406 | "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00" | ||
764 | 407 | "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00" | ||
765 | 408 | "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00" | ||
766 | 409 | "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00" | ||
767 | 410 | "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00" | ||
768 | 411 | "\x1c\x13\x00\x00\x3c\x33\x00\x00\x5b\x53\x00\x00\x7c\x73\x28\x00" | ||
769 | 412 | "\x9b\x93\x58\x00\xbb\xb2\x7f\x00\xdb\xd2\x9e\x00\xfb\xf0\xb5\x00" | ||
770 | 413 | "\xff\xff\xc4\x00\xff\xff\xcb\x00\xff\xff\xcc\x00\xff\xff\xcc\x00" | ||
771 | 414 | "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00" | ||
772 | 415 | "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00" | ||
773 | 416 | "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00" | ||
774 | 417 | "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00" | ||
775 | 418 | "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00" | ||
776 | 419 | "\x20\x18\x00\x00\x40\x38\x00\x00\x60\x58\x00\x00\x80\x79\x30\x00" | ||
777 | 420 | "\xa0\x98\x5e\x00\xc0\xb7\x84\x00\xe0\xd7\xa2\x00\xff\xf7\xb7\x00" | ||
778 | 421 | "\xff\xff\xc5\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00" | ||
779 | 422 | "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00" | ||
780 | 423 | "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00" | ||
781 | 424 | "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00" | ||
782 | 425 | "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00" | ||
783 | 426 | "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00" | ||
784 | 427 | "\x24\x1d\x00\x00\x44\x3d\x00\x00\x64\x5d\x01\x00\x83\x7d\x36\x00" | ||
785 | 428 | "\xa4\x9c\x63\x00\xc4\xbc\x88\x00\xe4\xdc\xa5\x00\xff\xfb\xba\x00" | ||
786 | 429 | "\xff\xff\xc7\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00" | ||
787 | 430 | "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00" | ||
788 | 431 | "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00" | ||
789 | 432 | "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00" | ||
790 | 433 | "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00" | ||
791 | 434 | "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00" | ||
792 | 435 | "\x27\x22\x00\x00\x47\x42\x00\x00\x67\x61\x05\x00\x85\x81\x3a\x00" | ||
793 | 436 | "\xa6\xa1\x67\x00\xc6\xc1\x8b\x00\xe6\xe1\xa7\x00\xff\xff\xbc\x00" | ||
794 | 437 | "\xff\xff\xc8\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00" | ||
795 | 438 | "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00" | ||
796 | 439 | "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00" | ||
797 | 440 | "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00" | ||
798 | 441 | "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00" | ||
799 | 442 | "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00" | ||
800 | 443 | "\x2a\x25\x00\x00\x49\x45\x00\x00\x69\x65\x08\x00\x88\x84\x3e\x00" | ||
801 | 444 | "\xa9\xa4\x6a\x00\xc9\xc4\x8e\x00\xe9\xe4\xa9\x00\xff\xff\xbd\x00" | ||
802 | 445 | "\xff\xff\xc8\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00" | ||
803 | 446 | "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00" | ||
804 | 447 | "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00" | ||
805 | 448 | "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00" | ||
806 | 449 | "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00" | ||
807 | 450 | "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00" | ||
808 | 451 | "\x2c\x28\x00\x00\x4c\x47\x00\x00\x6c\x67\x0c\x00\x8b\x86\x42\x00" | ||
809 | 452 | "\xac\xa7\x6d\x00\xcb\xc7\x90\x00\xeb\xe7\xab\x00\xff\xff\xbe\x00" | ||
810 | 453 | "\xff\xff\xc9\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00" | ||
811 | 454 | "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00" | ||
812 | 455 | "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00" | ||
813 | 456 | "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00" | ||
814 | 457 | "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00" | ||
815 | 458 | "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00" | ||
816 | 459 | "\x2e\x2a\x00\x00\x4d\x4a\x00\x00\x6d\x6a\x0f\x00\x8d\x89\x44\x00" | ||
817 | 460 | "\xad\xaa\x6f\x00\xcd\xca\x92\x00\xed\xe9\xac\x00\xff\xff\xbf\x00" | ||
818 | 461 | "\xff\xff\xc9\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00" | ||
819 | 462 | "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00" | ||
820 | 463 | "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00" | ||
821 | 464 | "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00" | ||
822 | 465 | "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00" | ||
823 | 466 | "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00" | ||
824 | 467 | "\x2e\x2d\x00\x00\x4e\x4d\x00\x00\x6e\x6c\x11\x00\x8f\x8c\x45\x00" | ||
825 | 468 | "\xae\xac\x70\x00\xce\xcc\x92\x00\xee\xec\xad\x00\xff\xff\xbf\x00" | ||
826 | 469 | "\xff\xff\xca\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00" | ||
827 | 470 | "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00" | ||
828 | 471 | "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00" | ||
829 | 472 | "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00" | ||
830 | 473 | "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00" | ||
831 | 474 | "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00" | ||
832 | 475 | "\x2f\x2e\x00\x00\x4f\x4e\x00\x00\x6f\x6d\x12\x00\x8f\x8e\x46\x00" | ||
833 | 476 | "\xaf\xad\x71\x00\xcf\xcd\x93\x00\xef\xed\xad\x00\xff\xff\xc0\x00" | ||
834 | 477 | "\xff\xff\xca\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00" | ||
835 | 478 | "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00" | ||
836 | 479 | "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00" | ||
837 | 480 | "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00" | ||
838 | 481 | "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00" | ||
839 | 482 | "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00" | ||
840 | 483 | "\x30\x2e\x00\x00\x50\x4e\x00\x00\x70\x6e\x14\x00\x90\x8f\x47\x00" | ||
841 | 484 | "\xaf\xae\x71\x00\xcf\xce\x94\x00\xef\xee\xae\x00\xff\xff\xc0\x00" | ||
842 | 485 | "\xff\xff\xca\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00" | ||
843 | 486 | "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00" | ||
844 | 487 | "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00" | ||
845 | 488 | "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00" | ||
846 | 489 | "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00" | ||
847 | 490 | "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00" | ||
848 | 491 | "\x30\x2f\x00\x00\x50\x4f\x00\x00\x70\x6f\x16\x00\x90\x8f\x48\x00" | ||
849 | 492 | "\xb0\xaf\x72\x00\xd0\xcf\x94\x00\xf0\xef\xae\x00\xff\xff\xc0\x00" | ||
850 | 493 | "\xff\xff\xca\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00" | ||
851 | 494 | "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00" | ||
852 | 495 | "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00" | ||
853 | 496 | "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00" | ||
854 | 497 | "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00" | ||
855 | 498 | "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00" | ||
856 | 499 | "\x31\x30\x00\x00\x51\x50\x00\x00\x70\x70\x18\x00\x91\x90\x49\x00" | ||
857 | 500 | "\xb1\xb0\x73\x00\xd1\xcf\x95\x00\xf0\xef\xaf\x00\xff\xff\xc0\x00" | ||
858 | 501 | "\xff\xff\xca\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00" | ||
859 | 502 | "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00" | ||
860 | 503 | "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00" | ||
861 | 504 | "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00" | ||
862 | 505 | "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00" | ||
863 | 506 | "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00" | ||
864 | 507 | "\x32\x30\x00\x00\x52\x50\x00\x00\x72\x70\x1a\x00\x92\x90\x4b\x00" | ||
865 | 508 | "\xb2\xb0\x74\x00\xd1\xd0\x96\x00\xf1\xf0\xaf\x00\xff\xff\xc1\x00" | ||
866 | 509 | "\xff\xff\xca\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00" | ||
867 | 510 | "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00" | ||
868 | 511 | "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00" | ||
869 | 512 | "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00" | ||
870 | 513 | "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00" | ||
871 | 514 | "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00" | ||
872 | 515 | "\x33\x31\x00\x00\x53\x51\x00\x00\x73\x71\x1a\x00\x92\x91\x4c\x00" | ||
873 | 516 | "\xb2\xb1\x75\x00\xd2\xd1\x97\x00\xf2\xf1\xb0\x00\xff\xff\xc1\x00" | ||
874 | 517 | "\xff\xff\xca\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00" | ||
875 | 518 | "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00" | ||
876 | 519 | "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00" | ||
877 | 520 | "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00" | ||
878 | 521 | "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00" | ||
879 | 522 | "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00" | ||
880 | 269 | }; | 523 | }; |
881 | 270 | 524 | ||
882 | === renamed file 'src/Ubuntu/Components/tools/createshapeimage.cpp' => 'src/Ubuntu/Components/tools/createshapetextures.cpp' | |||
883 | --- src/Ubuntu/Components/tools/createshapeimage.cpp 2015-04-08 10:51:43 +0000 | |||
884 | +++ src/Ubuntu/Components/tools/createshapetextures.cpp 2015-07-27 16:39:42 +0000 | |||
885 | @@ -24,7 +24,7 @@ | |||
886 | 24 | // In order to generate a new file, the following commands must be used: | 24 | // In order to generate a new file, the following commands must be used: |
887 | 25 | // $ cd tools | 25 | // $ cd tools |
888 | 26 | // $ qmake && make | 26 | // $ qmake && make |
890 | 27 | // $ ./createshapeimage shape.svg ../plugin/ucubuntushapetexture.h | 27 | // $ ./createshapetextures shape.svg ../plugin/ucubuntushapetexture.h |
891 | 28 | 28 | ||
892 | 29 | #include <QtCore/QFile> | 29 | #include <QtCore/QFile> |
893 | 30 | #include <QtCore/QTextStream> | 30 | #include <QtCore/QTextStream> |
894 | @@ -35,16 +35,10 @@ | |||
895 | 35 | #include "3rd_party/edtaa3func.c" | 35 | #include "3rd_party/edtaa3func.c" |
896 | 36 | 36 | ||
897 | 37 | // Input data. | 37 | // Input data. |
898 | 38 | const int textureCount = 2; | ||
899 | 38 | const int textureSize = 32; // Must be a power-of-2. | 39 | const int textureSize = 32; // Must be a power-of-2. |
900 | 39 | const double distanceScale = 4.0; | 40 | const double distanceScale = 4.0; |
901 | 40 | const double shadowScale = 7.5; | ||
902 | 41 | const double shadowTranslucency = 0.37; | ||
903 | 42 | const double shapeOffset = 0.0625; | 41 | const double shapeOffset = 0.0625; |
904 | 43 | const double distanceBottomTY = 0.0546875; // From shapeOffset. | ||
905 | 44 | const double shadowTopTX = -0.01171875; // From shapeOffset. | ||
906 | 45 | const double shadowTopTY = 0.03125; // From shapeOffset. | ||
907 | 46 | const double shadowBottomTX = -0.01171875; // From shapeOffset. | ||
908 | 47 | const double shadowBottomTY = -0.00390625; // From shapeOffset. | ||
909 | 48 | 42 | ||
910 | 49 | // Sizes. | 43 | // Sizes. |
911 | 50 | const int width = textureSize; | 44 | const int width = textureSize; |
912 | @@ -66,13 +60,224 @@ | |||
913 | 66 | static double gradientX[size]; | 60 | static double gradientX[size]; |
914 | 67 | static double gradientY[size]; | 61 | static double gradientY[size]; |
915 | 68 | 62 | ||
918 | 69 | // Final image buffer. | 63 | // Final texture buffers. |
919 | 70 | static uint imageData[size]; | 64 | static uint textureData[2][size]; |
920 | 65 | |||
921 | 66 | // Creates the inset and flat aspect texture. | ||
922 | 67 | static void createTexture1(QSvgRenderer* svg, QPainter* painter) | ||
923 | 68 | { | ||
924 | 69 | // Input data. | ||
925 | 70 | const double shadowScale = 7.5; | ||
926 | 71 | const double shadowTranslucency = 0.37; | ||
927 | 72 | const double distanceBottomTY = 0.0546875; // From shapeOffset. | ||
928 | 73 | const double shadowTopTX = -0.01171875; // From shapeOffset. | ||
929 | 74 | const double shadowTopTY = 0.03125; // From shapeOffset. | ||
930 | 75 | const double shadowBottomTX = -0.01171875; // From shapeOffset. | ||
931 | 76 | const double shadowBottomTY = -0.00390625; // From shapeOffset. | ||
932 | 77 | |||
933 | 78 | // Render and store the distance field used for masking the top of the shape, for masking the | ||
934 | 79 | // bevel and for masking the unstyled shape. | ||
935 | 80 | painter->translate(shapeOffset * width, shapeOffset * width); | ||
936 | 81 | svg->render(painter); | ||
937 | 82 | for (int i = 0; i < size; i++) { | ||
938 | 83 | shapeNormalized[i] = static_cast<double>(shapeData[i] >> 24) / 255.0; | ||
939 | 84 | } | ||
940 | 85 | computegradient(shapeNormalized, width, height, gradientX, gradientY); | ||
941 | 86 | edtaa3(shapeNormalized, gradientX, gradientY, width, height, distanceX, distanceY, | ||
942 | 87 | distanceOut); | ||
943 | 88 | for (int i = 0; i < size; i++) { | ||
944 | 89 | shapeNormalized[i] = 1.0 - shapeNormalized[i]; | ||
945 | 90 | } | ||
946 | 91 | memset(gradientX, 0, size * sizeof(double)); | ||
947 | 92 | memset(gradientY, 0, size * sizeof(double)); | ||
948 | 93 | computegradient(shapeNormalized, width, height, gradientX, gradientY); | ||
949 | 94 | edtaa3(shapeNormalized, gradientX, gradientY, width, height, distanceX, distanceY, | ||
950 | 95 | distanceIn); | ||
951 | 96 | for (int i = 0; i < size; i++) { | ||
952 | 97 | const double distance = qMax(0.0, distanceIn[i]) - qMax(0.0, distanceOut[i]); | ||
953 | 98 | const uint value = qBound(0, qRound(distance * distanceScale * imageScale + 127.5), 255); | ||
954 | 99 | textureData[0][i] = value << 16; // Stored in channel R (exposed as B in the shaders). | ||
955 | 100 | } | ||
956 | 101 | |||
957 | 102 | // Render and store the distance field used for masking the bottom of the shape and for masking | ||
958 | 103 | // the bevel. | ||
959 | 104 | memset(shapeData, 0, size * sizeof(uint)); | ||
960 | 105 | painter->resetTransform(); | ||
961 | 106 | painter->translate(shapeOffset * width, (shapeOffset + distanceBottomTY) * width); | ||
962 | 107 | svg->render(painter); | ||
963 | 108 | for (int i = 0; i < size; i++) { | ||
964 | 109 | shapeNormalized[i] = static_cast<double>(shapeData[i] >> 24) / 255.0; | ||
965 | 110 | } | ||
966 | 111 | computegradient(shapeNormalized, width, height, gradientX, gradientY); | ||
967 | 112 | edtaa3(shapeNormalized, gradientX, gradientY, width, height, distanceX, distanceY, | ||
968 | 113 | distanceOut); | ||
969 | 114 | for (int i = 0; i < size; i++) { | ||
970 | 115 | shapeNormalized[i] = 1.0 - shapeNormalized[i]; | ||
971 | 116 | } | ||
972 | 117 | memset(gradientX, 0, size * sizeof(double)); | ||
973 | 118 | memset(gradientY, 0, size * sizeof(double)); | ||
974 | 119 | computegradient(shapeNormalized, width, height, gradientX, gradientY); | ||
975 | 120 | edtaa3(shapeNormalized, gradientX, gradientY, width, height, distanceX, distanceY, | ||
976 | 121 | distanceIn); | ||
977 | 122 | for (int i = 0; i < size; i++) { | ||
978 | 123 | const double distance = qMax(0.0, distanceIn[i]) - qMax(0.0, distanceOut[i]); | ||
979 | 124 | const uint value = qBound(0, qRound(distance * distanceScale * imageScale + 127.5), 255); | ||
980 | 125 | textureData[0][i] |= value << 24; // Stored in channel A. | ||
981 | 126 | } | ||
982 | 127 | |||
983 | 128 | // Render and store the top inner shadow. | ||
984 | 129 | memset(shapeData, 0, size * sizeof(uint)); | ||
985 | 130 | painter->resetTransform(); | ||
986 | 131 | painter->translate((shapeOffset + shadowTopTX) * width, (shapeOffset + shadowTopTY) * width); | ||
987 | 132 | svg->render(painter); | ||
988 | 133 | for (int i = 0; i < size; i++) { | ||
989 | 134 | shapeNormalized[i] = 1.0 - (static_cast<double>(shapeData[i] >> 24) / 255.0); | ||
990 | 135 | } | ||
991 | 136 | computegradient(shapeNormalized, width, height, gradientX, gradientY); | ||
992 | 137 | edtaa3(shapeNormalized, gradientX, gradientY, width, height, distanceX, distanceY, | ||
993 | 138 | distanceIn); | ||
994 | 139 | for (int i = 0; i < size; i++) { | ||
995 | 140 | double shadow = qBound(0.0, (distanceIn[i] * shadowScale * imageScale) / 255.0, 1.0); | ||
996 | 141 | shadow = (1.0 - (2.0 * shadow - shadow * shadow)) * 255.0; | ||
997 | 142 | const uint value = qBound(0, qRound(shadow * shadowTranslucency), 255); | ||
998 | 143 | textureData[0][i] |= value << 0; // Stored in channel B (exposed as R in the shaders). | ||
999 | 144 | } | ||
1000 | 145 | |||
1001 | 146 | // Render and store the bottom inner shadow. | ||
1002 | 147 | memset(shapeData, 0, size * sizeof(uint)); | ||
1003 | 148 | painter->resetTransform(); | ||
1004 | 149 | painter->translate( | ||
1005 | 150 | (shapeOffset + shadowBottomTX) * width, (shapeOffset + shadowBottomTY) * width); | ||
1006 | 151 | svg->render(painter); | ||
1007 | 152 | for (int i = 0; i < size; i++) { | ||
1008 | 153 | shapeNormalized[i] = 1.0 - (static_cast<double>(shapeData[i] >> 24) / 255.0); | ||
1009 | 154 | } | ||
1010 | 155 | computegradient(shapeNormalized, width, height, gradientX, gradientY); | ||
1011 | 156 | edtaa3(shapeNormalized, gradientX, gradientY, width, height, distanceX, distanceY, | ||
1012 | 157 | distanceIn); | ||
1013 | 158 | for (int i = 0; i < size; i++) { | ||
1014 | 159 | double shadow = qBound(0.0, (distanceIn[i] * shadowScale * imageScale) / 255.0, 1.0); | ||
1015 | 160 | shadow = (1.0 - (2.0 * shadow - shadow * shadow)) * 255.0; | ||
1016 | 161 | const uint value = qBound(0, qRound(shadow * shadowTranslucency), 255); | ||
1017 | 162 | textureData[0][i] |= value << 8; // Stored in channel G. | ||
1018 | 163 | } | ||
1019 | 164 | } | ||
1020 | 165 | |||
1021 | 166 | // Creates the drop shadow aspect texture. | ||
1022 | 167 | static void createTexture2(QSvgRenderer* svg, QPainter* painter) | ||
1023 | 168 | { | ||
1024 | 169 | // Input data. | ||
1025 | 170 | const double shadowScale = 4.5; | ||
1026 | 171 | const double shadowTranslucency = 0.8; | ||
1027 | 172 | const double distanceBottomTY = 0.0546875; // From shapeOffset. | ||
1028 | 173 | const double distanceTx = distanceBottomTY * 0.5; // From shapeOffset. | ||
1029 | 174 | |||
1030 | 175 | // Render and store the distance field used for masking the top of the shape. | ||
1031 | 176 | memset(shapeData, 0, size * sizeof(uint)); | ||
1032 | 177 | painter->resetTransform(); | ||
1033 | 178 | painter->translate((shapeOffset + distanceTx) * width, shapeOffset * width); | ||
1034 | 179 | svg->render(painter); | ||
1035 | 180 | for (int i = 0; i < size; i++) { | ||
1036 | 181 | shapeNormalized[i] = static_cast<double>(shapeData[i] >> 24) / 255.0; | ||
1037 | 182 | } | ||
1038 | 183 | computegradient(shapeNormalized, width, height, gradientX, gradientY); | ||
1039 | 184 | edtaa3(shapeNormalized, gradientX, gradientY, width, height, distanceX, distanceY, | ||
1040 | 185 | distanceOut); | ||
1041 | 186 | for (int i = 0; i < size; i++) { | ||
1042 | 187 | shapeNormalized[i] = 1.0 - shapeNormalized[i]; | ||
1043 | 188 | } | ||
1044 | 189 | memset(gradientX, 0, size * sizeof(double)); | ||
1045 | 190 | memset(gradientY, 0, size * sizeof(double)); | ||
1046 | 191 | computegradient(shapeNormalized, width, height, gradientX, gradientY); | ||
1047 | 192 | edtaa3(shapeNormalized, gradientX, gradientY, width, height, distanceX, distanceY, | ||
1048 | 193 | distanceIn); | ||
1049 | 194 | for (int i = 0; i < size; i++) { | ||
1050 | 195 | const double distance = qMax(0.0, distanceIn[i]) - qMax(0.0, distanceOut[i]); | ||
1051 | 196 | const uint value = qBound(0, qRound(distance * distanceScale * imageScale + 127.5), 255); | ||
1052 | 197 | textureData[1][i] = value << 0; // Stored in channel B (exposed as R in the shaders). | ||
1053 | 198 | } | ||
1054 | 199 | |||
1055 | 200 | // Render and store the distance field used for masking the bottom of the shape. | ||
1056 | 201 | memset(shapeData, 0, size * sizeof(uint)); | ||
1057 | 202 | painter->resetTransform(); | ||
1058 | 203 | painter->translate((shapeOffset + distanceTx) * width, | ||
1059 | 204 | (shapeOffset + distanceBottomTY) * width); | ||
1060 | 205 | svg->render(painter); | ||
1061 | 206 | for (int i = 0; i < size; i++) { | ||
1062 | 207 | shapeNormalized[i] = static_cast<double>(shapeData[i] >> 24) / 255.0; | ||
1063 | 208 | } | ||
1064 | 209 | computegradient(shapeNormalized, width, height, gradientX, gradientY); | ||
1065 | 210 | edtaa3(shapeNormalized, gradientX, gradientY, width, height, distanceX, distanceY, | ||
1066 | 211 | distanceOut); | ||
1067 | 212 | for (int i = 0; i < size; i++) { | ||
1068 | 213 | shapeNormalized[i] = 1.0 - shapeNormalized[i]; | ||
1069 | 214 | } | ||
1070 | 215 | memset(gradientX, 0, size * sizeof(double)); | ||
1071 | 216 | memset(gradientY, 0, size * sizeof(double)); | ||
1072 | 217 | computegradient(shapeNormalized, width, height, gradientX, gradientY); | ||
1073 | 218 | edtaa3(shapeNormalized, gradientX, gradientY, width, height, distanceX, distanceY, | ||
1074 | 219 | distanceIn); | ||
1075 | 220 | for (int i = 0; i < size; i++) { | ||
1076 | 221 | const double distance = qMax(0.0, distanceIn[i]) - qMax(0.0, distanceOut[i]); | ||
1077 | 222 | const uint value = qBound(0, qRound(distance * distanceScale * imageScale + 127.5), 255); | ||
1078 | 223 | textureData[1][i] |= value << 8; // Stored in channel G. | ||
1079 | 224 | } | ||
1080 | 225 | |||
1081 | 226 | // Render and store the top inner shadow. | ||
1082 | 227 | memset(shapeData, 0, size * sizeof(uint)); | ||
1083 | 228 | painter->resetTransform(); | ||
1084 | 229 | painter->translate(shapeOffset * width, shapeOffset * width); | ||
1085 | 230 | svg->render(painter); | ||
1086 | 231 | for (int i = 0; i < size; i++) { | ||
1087 | 232 | shapeNormalized[i] = 1.0 - (static_cast<double>(shapeData[i] >> 24) / 255.0); | ||
1088 | 233 | } | ||
1089 | 234 | computegradient(shapeNormalized, width, height, gradientX, gradientY); | ||
1090 | 235 | edtaa3(shapeNormalized, gradientX, gradientY, width, height, distanceX, distanceY, | ||
1091 | 236 | distanceIn); | ||
1092 | 237 | for (int i = 0; i < size; i++) { | ||
1093 | 238 | double shadow = qBound(0.0, (distanceIn[i] * shadowScale * imageScale) / 255.0, 1.0); | ||
1094 | 239 | shadow = (2.0 * shadow - shadow * shadow) * 255.0; | ||
1095 | 240 | const uint value = qBound(0, qRound(shadow * shadowTranslucency), 255); | ||
1096 | 241 | textureData[1][i] |= value << 16; // Stored in channel R (exposed as B in the shaders). | ||
1097 | 242 | } | ||
1098 | 243 | } | ||
1099 | 244 | |||
1100 | 245 | static void dumpTexture(QTextStream& cppOut, const uint* textureData) | ||
1101 | 246 | { | ||
1102 | 247 | cppOut.setIntegerBase(16); | ||
1103 | 248 | cppOut.setFieldWidth(2); | ||
1104 | 249 | cppOut.setPadChar('0'); | ||
1105 | 250 | for (int i = 0; i < size; i += 4) { | ||
1106 | 251 | cppOut << " \"" | ||
1107 | 252 | << "\\x" << (textureData[i] & 0xff) | ||
1108 | 253 | << "\\x" << ((textureData[i] >> 8) & 0xff) | ||
1109 | 254 | << "\\x" << ((textureData[i] >> 16) & 0xff) | ||
1110 | 255 | << "\\x" << ((textureData[i] >> 24) & 0xff) | ||
1111 | 256 | << "\\x" << (textureData[i+1] & 0xff) | ||
1112 | 257 | << "\\x" << ((textureData[i+1] >> 8) & 0xff) | ||
1113 | 258 | << "\\x" << ((textureData[i+1] >> 16) & 0xff) | ||
1114 | 259 | << "\\x" << ((textureData[i+1] >> 24) & 0xff) | ||
1115 | 260 | << "\\x" << (textureData[i+2] & 0xff) | ||
1116 | 261 | << "\\x" << ((textureData[i+2] >> 8) & 0xff) | ||
1117 | 262 | << "\\x" << ((textureData[i+2] >> 16) & 0xff) | ||
1118 | 263 | << "\\x" << ((textureData[i+2] >> 24) & 0xff) | ||
1119 | 264 | << "\\x" << (textureData[i+3] & 0xff) | ||
1120 | 265 | << "\\x" << ((textureData[i+3] >> 8) & 0xff) | ||
1121 | 266 | << "\\x" << ((textureData[i+3] >> 16) & 0xff) | ||
1122 | 267 | << "\\x" << ((textureData[i+3] >> 24) & 0xff); | ||
1123 | 268 | cppOut.setFieldWidth(1); | ||
1124 | 269 | cppOut << "\"\n"; | ||
1125 | 270 | cppOut.setFieldWidth(2); | ||
1126 | 271 | } | ||
1127 | 272 | cppOut.setIntegerBase(10); | ||
1128 | 273 | cppOut.setFieldWidth(0); | ||
1129 | 274 | cppOut.setPadChar(' '); | ||
1130 | 275 | } | ||
1131 | 71 | 276 | ||
1132 | 72 | int main(int argc, char* argv[]) | 277 | int main(int argc, char* argv[]) |
1133 | 73 | { | 278 | { |
1134 | 74 | if (argc != 3) { | 279 | if (argc != 3) { |
1136 | 75 | qWarning("Usage: createshapeimage input_svg output_cpp"); | 280 | qWarning("Usage: createshapetextures input_svg output_cpp"); |
1137 | 76 | return 1; | 281 | return 1; |
1138 | 77 | } | 282 | } |
1139 | 78 | const char* svgFilename = argv[1]; | 283 | const char* svgFilename = argv[1]; |
1140 | @@ -90,142 +295,34 @@ | |||
1141 | 90 | return 1; | 295 | return 1; |
1142 | 91 | } | 296 | } |
1143 | 92 | 297 | ||
1144 | 298 | // Create the textures. | ||
1145 | 93 | QImage shape(reinterpret_cast<uchar*>(shapeData), width, height, width * 4, | 299 | QImage shape(reinterpret_cast<uchar*>(shapeData), width, height, width * 4, |
1146 | 94 | QImage::Format_ARGB32_Premultiplied); | 300 | QImage::Format_ARGB32_Premultiplied); |
1147 | 95 | QPainter painter(&shape); | 301 | QPainter painter(&shape); |
1235 | 96 | 302 | createTexture1(&svg, &painter); | |
1236 | 97 | // Render and store the distance field used for masking the top of the shape, for masking the | 303 | createTexture2(&svg, &painter); |
1150 | 98 | // bevel and for masking the unstyled shape. | ||
1151 | 99 | painter.translate(shapeOffset * width, shapeOffset * width); | ||
1152 | 100 | svg.render(&painter); | ||
1153 | 101 | for (int i = 0; i < size; i++) { | ||
1154 | 102 | shapeNormalized[i] = static_cast<double>(shapeData[i] >> 24) / 255.0; | ||
1155 | 103 | } | ||
1156 | 104 | computegradient(shapeNormalized, width, height, gradientX, gradientY); | ||
1157 | 105 | edtaa3(shapeNormalized, gradientX, gradientY, width, height, distanceX, distanceY, | ||
1158 | 106 | distanceOut); | ||
1159 | 107 | for (int i = 0; i < size; i++) { | ||
1160 | 108 | shapeNormalized[i] = 1.0 - shapeNormalized[i]; | ||
1161 | 109 | } | ||
1162 | 110 | memset(gradientX, 0, size * sizeof(double)); | ||
1163 | 111 | memset(gradientY, 0, size * sizeof(double)); | ||
1164 | 112 | computegradient(shapeNormalized, width, height, gradientX, gradientY); | ||
1165 | 113 | edtaa3(shapeNormalized, gradientX, gradientY, width, height, distanceX, distanceY, | ||
1166 | 114 | distanceIn); | ||
1167 | 115 | for (int i = 0; i < size; i++) { | ||
1168 | 116 | const double distance = qMax(0.0, distanceIn[i]) - qMax(0.0, distanceOut[i]); | ||
1169 | 117 | const uint value = qBound(0, qRound(distance * distanceScale * imageScale + 127.5), 255); | ||
1170 | 118 | imageData[i] = value << 16; // Stored in channel R (exposed as B in the shaders). | ||
1171 | 119 | } | ||
1172 | 120 | |||
1173 | 121 | // Render and store the distance field used for masking the bottom of the shape and for masking | ||
1174 | 122 | // the bevel. | ||
1175 | 123 | memset(shapeData, 0, size * sizeof(uint)); | ||
1176 | 124 | painter.resetTransform(); | ||
1177 | 125 | painter.translate(shapeOffset * width, (shapeOffset + distanceBottomTY) * width); | ||
1178 | 126 | svg.render(&painter); | ||
1179 | 127 | for (int i = 0; i < size; i++) { | ||
1180 | 128 | shapeNormalized[i] = static_cast<double>(shapeData[i] >> 24) / 255.0; | ||
1181 | 129 | } | ||
1182 | 130 | computegradient(shapeNormalized, width, height, gradientX, gradientY); | ||
1183 | 131 | edtaa3(shapeNormalized, gradientX, gradientY, width, height, distanceX, distanceY, | ||
1184 | 132 | distanceOut); | ||
1185 | 133 | for (int i = 0; i < size; i++) { | ||
1186 | 134 | shapeNormalized[i] = 1.0 - shapeNormalized[i]; | ||
1187 | 135 | } | ||
1188 | 136 | memset(gradientX, 0, size * sizeof(double)); | ||
1189 | 137 | memset(gradientY, 0, size * sizeof(double)); | ||
1190 | 138 | computegradient(shapeNormalized, width, height, gradientX, gradientY); | ||
1191 | 139 | edtaa3(shapeNormalized, gradientX, gradientY, width, height, distanceX, distanceY, | ||
1192 | 140 | distanceIn); | ||
1193 | 141 | for (int i = 0; i < size; i++) { | ||
1194 | 142 | const double distance = qMax(0.0, distanceIn[i]) - qMax(0.0, distanceOut[i]); | ||
1195 | 143 | const uint value = qBound(0, qRound(distance * distanceScale * imageScale + 127.5), 255); | ||
1196 | 144 | imageData[i] |= value << 24; // Stored in channel A. | ||
1197 | 145 | } | ||
1198 | 146 | |||
1199 | 147 | // Render and store the top inner shadow. | ||
1200 | 148 | memset(shapeData, 0, size * sizeof(uint)); | ||
1201 | 149 | painter.resetTransform(); | ||
1202 | 150 | painter.translate((shapeOffset + shadowTopTX) * width, (shapeOffset + shadowTopTY) * width); | ||
1203 | 151 | svg.render(&painter); | ||
1204 | 152 | for (int i = 0; i < size; i++) { | ||
1205 | 153 | shapeNormalized[i] = 1.0 - (static_cast<double>(shapeData[i] >> 24) / 255.0); | ||
1206 | 154 | } | ||
1207 | 155 | computegradient(shapeNormalized, width, height, gradientX, gradientY); | ||
1208 | 156 | edtaa3(shapeNormalized, gradientX, gradientY, width, height, distanceX, distanceY, | ||
1209 | 157 | distanceIn); | ||
1210 | 158 | for (int i = 0; i < size; i++) { | ||
1211 | 159 | double shadow = qBound(0.0, (distanceIn[i] * shadowScale * imageScale) / 255.0, 1.0); | ||
1212 | 160 | shadow = (1.0 - (2.0 * shadow - shadow * shadow)) * 255.0; | ||
1213 | 161 | const uint value = qBound(0, qRound(shadow * shadowTranslucency), 255); | ||
1214 | 162 | imageData[i] |= value << 0; // Stored in channel B (exposed as R in the shaders). | ||
1215 | 163 | } | ||
1216 | 164 | |||
1217 | 165 | // Render and store the bottom inner shadow. | ||
1218 | 166 | memset(shapeData, 0, size * sizeof(uint)); | ||
1219 | 167 | painter.resetTransform(); | ||
1220 | 168 | painter.translate( | ||
1221 | 169 | (shapeOffset + shadowBottomTX) * width, (shapeOffset + shadowBottomTY) * width); | ||
1222 | 170 | svg.render(&painter); | ||
1223 | 171 | for (int i = 0; i < size; i++) { | ||
1224 | 172 | shapeNormalized[i] = 1.0 - (static_cast<double>(shapeData[i] >> 24) / 255.0); | ||
1225 | 173 | } | ||
1226 | 174 | computegradient(shapeNormalized, width, height, gradientX, gradientY); | ||
1227 | 175 | edtaa3(shapeNormalized, gradientX, gradientY, width, height, distanceX, distanceY, | ||
1228 | 176 | distanceIn); | ||
1229 | 177 | for (int i = 0; i < size; i++) { | ||
1230 | 178 | double shadow = qBound(0.0, (distanceIn[i] * shadowScale * imageScale) / 255.0, 1.0); | ||
1231 | 179 | shadow = (1.0 - (2.0 * shadow - shadow * shadow)) * 255.0; | ||
1232 | 180 | const uint value = qBound(0, qRound(shadow * shadowTranslucency), 255); | ||
1233 | 181 | imageData[i] |= value << 8; // Stored in channel G. | ||
1234 | 182 | } | ||
1237 | 183 | 304 | ||
1238 | 184 | // Write the C++ file. | 305 | // Write the C++ file. |
1239 | 185 | QTextStream cppOut(&cppFile); | 306 | QTextStream cppOut(&cppFile); |
1240 | 186 | cppOut << "// Copyright 2015 Canonical Ltd.\n" | 307 | cppOut << "// Copyright 2015 Canonical Ltd.\n" |
1277 | 187 | << "// Automatically generated by the createshapeimage tool.\n" | 308 | << "// Automatically generated by the createshapetextures tool.\n" |
1278 | 188 | << "\n" | 309 | << "\n" |
1279 | 189 | << "static const struct {\n" | 310 | << "const int shapeTextureCount = " << textureCount << ";\n" |
1280 | 190 | << " float offset;\n" | 311 | << "const int shapeTextureSize = " << textureSize << ";\n" |
1281 | 191 | << " float distanceAA;\n" | 312 | << "const float shapeTextureOffset = " << shapeOffset << ";\n" |
1282 | 192 | << " int size;\n" | 313 | << "const int shapeTextureDistanceAA = " << distanceScale << ";\n" |
1283 | 193 | << " unsigned char data[" << size * 4 + 1 << "];\n" // + 1 for the string terminator. | 314 | << "\n" |
1284 | 194 | << "} shapeTextureInfo = {\n" | 315 | << "static const unsigned char shapeTextureData[" << textureCount |
1285 | 195 | << " " << shapeOffset << ",\n" | 316 | << "][" << size * 4 + 1 << "] = {\n"; // + 1 for the string terminator. |
1286 | 196 | << " " << distanceScale << ",\n" | 317 | dumpTexture(cppOut, textureData[0]); |
1287 | 197 | << " " << width << ",\n"; | 318 | cppOut << " ,\n"; |
1288 | 198 | cppOut.setIntegerBase(16); | 319 | dumpTexture(cppOut, textureData[1]); |
1253 | 199 | cppOut.setFieldWidth(2); | ||
1254 | 200 | cppOut.setPadChar('0'); | ||
1255 | 201 | for (int i = 0; i < size; i += 4) { | ||
1256 | 202 | cppOut << " \"" | ||
1257 | 203 | << "\\x" << (imageData[i] & 0xff) | ||
1258 | 204 | << "\\x" << ((imageData[i] >> 8) & 0xff) | ||
1259 | 205 | << "\\x" << ((imageData[i] >> 16) & 0xff) | ||
1260 | 206 | << "\\x" << ((imageData[i] >> 24) & 0xff) | ||
1261 | 207 | << "\\x" << (imageData[i+1] & 0xff) | ||
1262 | 208 | << "\\x" << ((imageData[i+1] >> 8) & 0xff) | ||
1263 | 209 | << "\\x" << ((imageData[i+1] >> 16) & 0xff) | ||
1264 | 210 | << "\\x" << ((imageData[i+1] >> 24) & 0xff) | ||
1265 | 211 | << "\\x" << (imageData[i+2] & 0xff) | ||
1266 | 212 | << "\\x" << ((imageData[i+2] >> 8) & 0xff) | ||
1267 | 213 | << "\\x" << ((imageData[i+2] >> 16) & 0xff) | ||
1268 | 214 | << "\\x" << ((imageData[i+2] >> 24) & 0xff) | ||
1269 | 215 | << "\\x" << (imageData[i+3] & 0xff) | ||
1270 | 216 | << "\\x" << ((imageData[i+3] >> 8) & 0xff) | ||
1271 | 217 | << "\\x" << ((imageData[i+3] >> 16) & 0xff) | ||
1272 | 218 | << "\\x" << ((imageData[i+3] >> 24) & 0xff); | ||
1273 | 219 | cppOut.setFieldWidth(1); | ||
1274 | 220 | cppOut << "\"\n"; | ||
1275 | 221 | cppOut.setFieldWidth(2); | ||
1276 | 222 | } | ||
1289 | 223 | cppOut << "};\n"; | 320 | cppOut << "};\n"; |
1290 | 224 | 321 | ||
1291 | 225 | // Save the file as a PNG for debugging purpose. | 322 | // Save the file as a PNG for debugging purpose. |
1293 | 226 | // QImage image(reinterpret_cast<uchar*>(imageData), width, height, width * 4, | 323 | // QImage image(reinterpret_cast<uchar*>(textureData[0]), width, height, width * 4, |
1294 | 227 | // QImage::Format_ARGB32); | 324 | // QImage::Format_ARGB32); |
1296 | 228 | // image.save("test.png"); | 325 | // image.save("texture1.png"); |
1297 | 229 | 326 | ||
1298 | 230 | return 0; | 327 | return 0; |
1299 | 231 | } | 328 | } |
1300 | 232 | 329 | ||
1301 | === modified file 'src/Ubuntu/Components/tools/tools.pro' | |||
1302 | --- src/Ubuntu/Components/tools/tools.pro 2015-03-02 18:16:02 +0000 | |||
1303 | +++ src/Ubuntu/Components/tools/tools.pro 2015-07-27 16:39:42 +0000 | |||
1304 | @@ -1,5 +1,5 @@ | |||
1305 | 1 | TEMPLATE = app | 1 | TEMPLATE = app |
1307 | 2 | TARGET = createshapeimage | 2 | TARGET = createshapetextures |
1308 | 3 | QT += gui svg | 3 | QT += gui svg |
1309 | 4 | QMAKE_CXXFLAGS += -Werror -Wno-unused-variable | 4 | QMAKE_CXXFLAGS += -Werror -Wno-unused-variable |
1311 | 5 | SOURCES += createshapeimage.cpp | 5 | SOURCES += createshapetextures.cpp |
1312 | 6 | 6 | ||
1313 | === modified file 'tests/resources/ubuntushape/UbuntuShapeOverlayTest.qml' | |||
1314 | --- tests/resources/ubuntushape/UbuntuShapeOverlayTest.qml 2015-07-23 11:49:38 +0000 | |||
1315 | +++ tests/resources/ubuntushape/UbuntuShapeOverlayTest.qml 2015-07-27 16:39:42 +0000 | |||
1316 | @@ -25,7 +25,7 @@ | |||
1317 | 25 | 25 | ||
1318 | 26 | // Enum to string tables. | 26 | // Enum to string tables. |
1319 | 27 | property variant aspectTable: [ | 27 | property variant aspectTable: [ |
1321 | 28 | "Flat", "Inset" | 28 | "Flat", "Inset", "DropShadow" |
1322 | 29 | ] | 29 | ] |
1323 | 30 | property variant backgroundModeTable: [ | 30 | property variant backgroundModeTable: [ |
1324 | 31 | "SolidColor", "VerticalGradient" | 31 | "SolidColor", "VerticalGradient" |
1325 | @@ -225,7 +225,7 @@ | |||
1326 | 225 | shape.radius = (shape.radius == "large") ? "small" : | 225 | shape.radius = (shape.radius == "large") ? "small" : |
1327 | 226 | ((shape.radius == "small") ? "medium" : "large"); | 226 | ((shape.radius == "small") ? "medium" : "large"); |
1328 | 227 | } else if (event.key == Qt.Key_T) { | 227 | } else if (event.key == Qt.Key_T) { |
1330 | 228 | shape.aspect = (shape.aspect + 1) % 2; | 228 | shape.aspect = (shape.aspect + 1) % 3; |
1331 | 229 | } else if (event.key == Qt.Key_Y) { | 229 | } else if (event.key == Qt.Key_Y) { |
1332 | 230 | shape.relativeRadius = Math.max(0.0, Math.min( | 230 | shape.relativeRadius = Math.max(0.0, Math.min( |
1333 | 231 | 1.0, shape.relativeRadius + ((event.modifiers & shift) ? 0.01 : -0.01))); | 231 | 1.0, shape.relativeRadius + ((event.modifiers & shift) ? 0.01 : -0.01))); |
1334 | 232 | 232 | ||
1335 | === modified file 'tests/resources/ubuntushape/UbuntuShapeTest.qml' | |||
1336 | --- tests/resources/ubuntushape/UbuntuShapeTest.qml 2015-07-23 11:49:38 +0000 | |||
1337 | +++ tests/resources/ubuntushape/UbuntuShapeTest.qml 2015-07-27 16:39:42 +0000 | |||
1338 | @@ -25,7 +25,7 @@ | |||
1339 | 25 | 25 | ||
1340 | 26 | // Enum to string tables. | 26 | // Enum to string tables. |
1341 | 27 | property variant aspectTable: [ | 27 | property variant aspectTable: [ |
1343 | 28 | "Flat", "Inset" | 28 | "Flat", "Inset", "DropShadow" |
1344 | 29 | ] | 29 | ] |
1345 | 30 | property variant backgroundModeTable: [ | 30 | property variant backgroundModeTable: [ |
1346 | 31 | "SolidColor", "VerticalGradient" | 31 | "SolidColor", "VerticalGradient" |
1347 | @@ -222,7 +222,7 @@ | |||
1348 | 222 | shape.radius = (shape.radius == "large") ? "small" : | 222 | shape.radius = (shape.radius == "large") ? "small" : |
1349 | 223 | ((shape.radius == "small") ? "medium" : "large"); | 223 | ((shape.radius == "small") ? "medium" : "large"); |
1350 | 224 | } else if (event.key == Qt.Key_T) { | 224 | } else if (event.key == Qt.Key_T) { |
1352 | 225 | shape.aspect = (shape.aspect + 1) % 2; | 225 | shape.aspect = (shape.aspect + 1) % 3; |
1353 | 226 | } else if (event.key == Qt.Key_Y) { | 226 | } else if (event.key == Qt.Key_Y) { |
1354 | 227 | shape.relativeRadius = Math.max(0.0, Math.min( | 227 | shape.relativeRadius = Math.max(0.0, Math.min( |
1355 | 228 | 1.0, shape.relativeRadius + ((event.modifiers & shift) ? 0.01 : -0.01))); | 228 | 1.0, shape.relativeRadius + ((event.modifiers & shift) ? 0.01 : -0.01))); |
FAILED: Continuous integration, rev:1580 jenkins. qa.ubuntu. com/job/ ubuntu- sdk-team- ubuntu- ui-toolkit- staging- ci/2045/ jenkins. qa.ubuntu. com/job/ ubuntu- sdk-team- ubuntu- ui-toolkit- staging- vivid-amd64- ci/773/ console jenkins. qa.ubuntu. com/job/ ubuntu- sdk-team- ubuntu- ui-toolkit- staging- vivid-armhf- ci/775/ console jenkins. qa.ubuntu. com/job/ ubuntu- sdk-team- ubuntu- ui-toolkit- staging- vivid-i386- ci/772/ console
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild: s-jenkins. ubuntu- ci:8080/ job/ubuntu- sdk-team- ubuntu- ui-toolkit- staging- ci/2045/ rebuild
http://