Merge lp:~loic.molinari/ubuntu-ui-toolkit/ubuntu-ui-toolkit-drop-shadow-aspect into lp:ubuntu-ui-toolkit/staging

Proposed by Loïc Molinari
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
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.

To post a comment you must log in.
Revision history for this message
Loïc Molinari (loic.molinari) :
review: Needs Fixing
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
1581. By Loïc Molinari

Merged parent branch.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Loïc Molinari (loic.molinari) :
review: Abstain
1582. By Loïc Molinari

Fixed incorrect type definition in texture generator.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Tim Peeters (tpeeters) wrote :

Looks good, happroving.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'components.api'
--- components.api 2015-07-27 10:33:47 +0000
+++ components.api 2015-07-27 16:39:42 +0000
@@ -1316,6 +1316,7 @@
1316 property bool stretched1316 property bool stretched
1317 property VAlignment verticalAlignment1317 property VAlignment verticalAlignment
1318Ubuntu.Components.UbuntuShape.Aspect: Enum1318Ubuntu.Components.UbuntuShape.Aspect: Enum
1319 DropShadow
1319 Flat1320 Flat
1320 Inset1321 Inset
1321Ubuntu.Components.UbuntuShape.BackgroundMode: Enum1322Ubuntu.Components.UbuntuShape.BackgroundMode: Enum
13221323
=== modified file 'examples/ubuntu-ui-toolkit-gallery/UbuntuShape.qml'
--- examples/ubuntu-ui-toolkit-gallery/UbuntuShape.qml 2015-04-09 09:42:36 +0000
+++ examples/ubuntu-ui-toolkit-gallery/UbuntuShape.qml 2015-07-27 16:39:42 +0000
@@ -25,28 +25,95 @@
25 className: "UbuntuShape"25 className: "UbuntuShape"
2626
27 TemplateRow {27 TemplateRow {
28 title: i18n.tr("Color")28 title: i18n.tr("Aspect")
29 titleWidth: units.gu(6)29 titleWidth: units.gu(8)
30 height: units.gu(8)30 height: units.gu(8)
3131
32 UbuntuShape {32 UbuntuShape {
33 objectName: "ubuntushape_backgroundcolor_orange"33 objectName: "ubuntushape_aspect_inset"
34 backgroundColor: UbuntuColors.orange34 backgroundColor: UbuntuColors.orange
35 }35 radius: "medium"
3636 aspect: UbuntuShape.Inset
37 UbuntuShape {37 Label {
38 objectName: "ubuntushape_verticalgradient"38 anchors.centerIn: parent
39 backgroundColor: UbuntuColors.lightAubergine39 text: "Inset"
40 secondaryBackgroundColor: Qt.rgba(40 fontSize: "x-small"
41 UbuntuColors.lightAubergine.r, UbuntuColors.lightAubergine.g,41 color: theme.palette.normal.foregroundText
42 UbuntuColors.lightAubergine.b, 0.25)42 }
43 backgroundMode: UbuntuShape.VerticalGradient43 }
44
45 UbuntuShape {
46 objectName: "ubuntushape_aspect_dropshadow"
47 backgroundColor: UbuntuColors.orange
48 radius: "medium"
49 aspect: UbuntuShape.DropShadow
50 Label {
51 anchors.centerIn: parent
52 text: "DropShadow"
53 fontSize: "xx-small"
54 color: theme.palette.normal.foregroundText
55 }
56 }
57
58 UbuntuShape {
59 objectName: "ubuntushape_aspect_flat"
60 backgroundColor: UbuntuColors.orange
61 radius: "medium"
62 aspect: UbuntuShape.Flat
63 Label {
64 anchors.centerIn: parent
65 text: "Flat"
66 fontSize: "xx-small"
67 color: theme.palette.normal.foregroundText
68 }
69 }
70 }
71
72 TemplateRow {
73 title: i18n.tr("Radius")
74 titleWidth: units.gu(8)
75 height: units.gu(8)
76
77 UbuntuShape {
78 objectName: "ubuntushape_radius_small"
79 backgroundColor: theme.palette.normal.foreground
80 radius: "small"
81 Label {
82 anchors.centerIn: parent
83 text: "small"
84 fontSize: "xx-small"
85 color: theme.palette.normal.foregroundText
86 }
87 }
88
89 UbuntuShape {
90 objectName: "ubuntushape_radius_medium"
91 backgroundColor: theme.palette.normal.foreground
92 radius: "medium"
93 Label {
94 anchors.centerIn: parent
95 text: "medium"
96 fontSize: "xx-small"
97 color: theme.palette.normal.foregroundText
98 }
99 }
100
101 UbuntuShape {
102 objectName: "ubuntushape_radius_medium"
103 backgroundColor: theme.palette.normal.foreground
104 radius: "large"
105 Label {
106 anchors.centerIn: parent
107 text: "large"
108 fontSize: "xx-small"
109 color: theme.palette.normal.foregroundText
110 }
44 }111 }
45 }112 }
46113
47 TemplateRow {114 TemplateRow {
48 title: i18n.tr("Image")115 title: i18n.tr("Image")
49 titleWidth: units.gu(6)116 titleWidth: units.gu(8)
50 height: units.gu(8)117 height: units.gu(8)
51118
52 UbuntuShape {119 UbuntuShape {
@@ -64,56 +131,17 @@
64 }131 }
65132
66 TemplateRow {133 TemplateRow {
67 title: i18n.tr("Radius")134 title: i18n.tr("Gradient")
68 titleWidth: units.gu(6)135 titleWidth: units.gu(8)
69 height: units.gu(8)136 height: units.gu(8)
70137
71 UbuntuShape {138 UbuntuShape {
72 objectName: "ubuntushape_radius_small"139 objectName: "ubuntushape_verticalgradient"
73140 backgroundColor: UbuntuColors.lightAubergine
74 backgroundColor: theme.palette.normal.foreground141 secondaryBackgroundColor: Qt.rgba(
75 radius: "small"142 UbuntuColors.lightAubergine.r, UbuntuColors.lightAubergine.g,
76143 UbuntuColors.lightAubergine.b, 0.25)
77 Label {144 backgroundMode: UbuntuShape.VerticalGradient
78 anchors.centerIn: parent
79 text: "small"
80 fontSize: "x-small"
81 color: theme.palette.normal.foregroundText
82 }
83 }
84
85 UbuntuShape {
86 objectName: "ubuntushape_radius_medium"
87 backgroundColor: theme.palette.normal.foreground
88 radius: "medium"
89
90 Label {
91 anchors.centerIn: parent
92 text: "medium"
93 fontSize: "x-small"
94 color: theme.palette.normal.foregroundText
95 }
96 }
97 }
98
99 TemplateRow {
100 title: i18n.tr("Sizes")
101 titleWidth: units.gu(6)
102 height: units.gu(20)
103
104 UbuntuShape {
105 objectName: "ubuntushape_sizes_15_6"
106 backgroundColor: theme.palette.normal.foreground
107 width: units.gu(15)
108 height: units.gu(6)
109 anchors.verticalCenter: parent.verticalCenter
110 }
111
112 UbuntuShape {
113 objectName: "ubuntushape_sizes_10_14"
114 backgroundColor: theme.palette.normal.foreground
115 width: units.gu(10)
116 height: units.gu(14)
117 }145 }
118 }146 }
119 }147 }
120148
=== modified file 'src/Ubuntu/Components/plugin/shaders/shape.frag'
--- src/Ubuntu/Components/plugin/shaders/shape.frag 2015-04-16 11:59:56 +0000
+++ src/Ubuntu/Components/plugin/shaders/shape.frag 2015-07-27 16:39:42 +0000
@@ -35,8 +35,9 @@
35varying mediump vec4 sourceCoord;35varying mediump vec4 sourceCoord;
36varying lowp vec4 backgroundColor;36varying lowp vec4 backgroundColor;
3737
38const mediump int FLAT = 0x08; // 1 << 338const mediump int FLAT = 0x08; // 1 << 3
39const mediump int INSET = 0x10; // 1 << 439const mediump int INSET = 0x10; // 1 << 4
40const mediump int DROP_SHADOW = 0x20; // 1 << 5
4041
41void main(void)42void main(void)
42{43{
@@ -88,6 +89,20 @@
88 // Mask the current color then blend the bevel over the resulting color. We simply use89 // Mask the current color then blend the bevel over the resulting color. We simply use
89 // additive blending since the bevel has already been masked.90 // additive blending since the bevel has already been masked.
90 color = (color * vec4(mask[int(shapeSide)])) + vec4(bevel);91 color = (color * vec4(mask[int(shapeSide)])) + vec4(bevel);
92
93 } else if (aspect == DROP_SHADOW) {
94 // The vertex layout of the shape is made so that the derivative is negative from top to
95 // middle and positive from middle to bottom.
96 lowp float shapeSide = dfdt * dfdtFactors.y <= 0.0 ? 0.0 : 1.0;
97 // Get the anti-aliased and resolution independent shape mask using distance fields.
98 lowp float distanceMin = abs(dfdt) * -distanceAA + 0.5;
99 lowp float distanceMax = abs(dfdt) * distanceAA + 0.5;
100 lowp float mask = smoothstep(distanceMin, distanceMax, shapeData[int(shapeSide)]);
101 // Get the shadow color outside of the shape mask.
102 lowp float shadow = (shapeData.b * -mask) + shapeData.b; // -ab + a = a(1 - b)
103 // Mask the current color then blend the shadow over the resulting color. We simply use
104 // additive blending since the shadow has already been masked.
105 color = (color * vec4(mask)) + vec4(0.0, 0.0, 0.0, shadow);
91 }106 }
92107
93 gl_FragColor = color * opacityFactors.xxxy;108 gl_FragColor = color * opacityFactors.xxxy;
94109
=== modified file 'src/Ubuntu/Components/plugin/ucubuntushape.cpp'
--- src/Ubuntu/Components/plugin/ucubuntushape.cpp 2015-07-24 17:59:13 +0000
+++ src/Ubuntu/Components/plugin/ucubuntushape.cpp 2015-07-27 16:39:42 +0000
@@ -90,7 +90,7 @@
90 const ShapeMaterial::Data* data = static_cast<ShapeMaterial*>(newEffect)->constData();90 const ShapeMaterial::Data* data = static_cast<ShapeMaterial*>(newEffect)->constData();
9191
92 // Bind shape texture.92 // Bind shape texture.
93 glBindTexture(GL_TEXTURE_2D, data->shapeTexture);93 glBindTexture(GL_TEXTURE_2D, data->shapeTextureId);
9494
95 // Bind source texture on the 2nd texture unit and update uniforms.95 // Bind source texture on the 2nd texture unit and update uniforms.
96 bool textured = false;96 bool textured = false;
@@ -119,8 +119,7 @@
119 }119 }
120 }120 }
121 program()->setUniformValue(m_texturedId, textured);121 program()->setUniformValue(m_texturedId, textured);
122 program()->setUniformValue(122 program()->setUniformValue(m_aspectId, data->flags & ShapeMaterial::Data::AspectMask);
123 m_aspectId, data->flags & (ShapeMaterial::Data::Flat | ShapeMaterial::Data::Inset));
124123
125 // The pressed aspect is implemented by scaling the final RGB fragment color. It's not a real124 // The pressed aspect is implemented by scaling the final RGB fragment color. It's not a real
126 // blending as it was done before deprecation, so for instance transparent colors remain the125 // blending as it was done before deprecation, so for instance transparent colors remain the
@@ -136,7 +135,7 @@
136 // and by 255 for distanceAAFactor dequantization. The factor is 1 most of the time apart when135 // and by 255 for distanceAAFactor dequantization. The factor is 1 most of the time apart when
137 // the radius size is low, it linearly goes from 1 to 0 to make the corners prettier and to136 // the radius size is low, it linearly goes from 1 to 0 to make the corners prettier and to
138 // prevent the opacity of the whole shape to slightly lower.137 // prevent the opacity of the whole shape to slightly lower.
139 const float distanceAA = (shapeTextureInfo.distanceAA * distanceAApx) / (2.0 * 255.0f);138 const float distanceAA = (shapeTextureDistanceAA * distanceAApx) / (2.0 * 255.0f);
140 program()->setUniformValue(m_distanceAAId, data->distanceAAFactor * distanceAA);139 program()->setUniformValue(m_distanceAAId, data->distanceAAFactor * distanceAA);
141140
142 // Send screen-space derivative factors. Note that when rendering is redirected to a141 // Send screen-space derivative factors. Note that when rendering is redirected to a
@@ -246,12 +245,16 @@
246245
247// --- QtQuick item ---246// --- QtQuick item ---
248247
249static QHash<QOpenGLContext*, quint32> shapeTextureHash;
250static bool isPrimaryOrientationLandscape = false;
251
252const float implicitWidthGU = 8.0f;248const float implicitWidthGU = 8.0f;
253const float implicitHeightGU = 8.0f;249const float implicitHeightGU = 8.0f;
254const float radiusGuMap[3] = { 1.45f, 2.55f, 3.65f };250const float radiusGuMap[3] = { 1.45f, 2.55f, 3.65f };
251const int maxShapeTextures = 16;
252
253static struct { QOpenGLContext* openglContext; quint32 textureId[shapeTextureCount]; }
254 shapeTextures[maxShapeTextures];
255static bool isPrimaryOrientationLandscape = false;
256
257static int getShapeTexturesIndex(const QOpenGLContext* openglContext);
255258
256/*! \qmltype UbuntuShape259/*! \qmltype UbuntuShape
257 \instantiates UCUbuntuShape260 \instantiates UCUbuntuShape
@@ -1003,9 +1006,11 @@
10031006
1004void UCUbuntuShape::_q_openglContextDestroyed()1007void UCUbuntuShape::_q_openglContextDestroyed()
1005{1008{
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.
1007 quint32 shapeTexture = shapeTextureHash.take(qobject_cast<QOpenGLContext*>(sender()));1010 const int index = getShapeTexturesIndex(qobject_cast<QOpenGLContext*>(sender()));
1008 glDeleteTextures(1, &shapeTexture);1011 Q_ASSERT(index >= 0);
1012 shapeTextures[index].openglContext = NULL;
1013 glDeleteTextures(shapeTextureCount, shapeTextures[index].textureId);
1009}1014}
10101015
1011void UCUbuntuShape::_q_gridUnitChanged()1016void UCUbuntuShape::_q_gridUnitChanged()
@@ -1034,6 +1039,34 @@
1034 m_flags |= DirtySourceTransform;1039 m_flags |= DirtySourceTransform;
1035}1040}
10361041
1042// Gets the shapeTextures' slot used by the given context, or -1 if not stored.
1043static int getShapeTexturesIndex(const QOpenGLContext* openglContext)
1044{
1045 int index = 0;
1046 while (shapeTextures[index].openglContext != openglContext) {
1047 index++;
1048 if (index == maxShapeTextures) {
1049 return -1;
1050 }
1051 }
1052 return index;
1053}
1054
1055// Gets an empty shapeTextures' slot.
1056static int getEmptyShapeTexturesIndex()
1057{
1058 int index = 0;
1059 while (shapeTextures[index].openglContext) {
1060 index++;
1061 if (index == maxShapeTextures) {
1062 // Don't bother with a dynamic array, let's just set a high enough maxShapeTextures and
1063 // increase the static array size if ever needed.
1064 qFatal("reached maximum number of OpenGL contexts supported by UbuntuShape");
1065 }
1066 }
1067 return index;
1068}
1069
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.
1038static Q_DECL_CONSTEXPR float roundTextureCoord(float coord, float size)1071static Q_DECL_CONSTEXPR float roundTextureCoord(float coord, float size)
1039{1072{
@@ -1118,20 +1151,24 @@
1118 Q_ASSERT(window());1151 Q_ASSERT(window());
1119 QOpenGLContext* openglContext = window()->openglContext();1152 QOpenGLContext* openglContext = window()->openglContext();
1120 Q_ASSERT(openglContext);1153 Q_ASSERT(openglContext);
1121 quint32 shapeTexture = shapeTextureHash[openglContext];1154 int index = getShapeTexturesIndex(openglContext);
1122 if (!shapeTexture) {1155 if (index < 0) {
1123 glGenTextures(1, &shapeTexture);1156 index = getEmptyShapeTexturesIndex();
1124 glBindTexture(GL_TEXTURE_2D, shapeTexture);1157 shapeTextures[index].openglContext = openglContext;
1125 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);1158 glGenTextures(shapeTextureCount, shapeTextures[index].textureId);
1126 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);1159 for (int i = 0; i < shapeTextureCount; i++) {
1127 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);1160 glBindTexture(GL_TEXTURE_2D, shapeTextures[index].textureId[i]);
1128 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);1161 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
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);
1130 GL_RGBA, GL_UNSIGNED_BYTE, shapeTextureInfo.data);1163 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
1131 shapeTextureHash[openglContext] = shapeTexture;1164 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
1165 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, shapeTextureSize, shapeTextureSize, 0, GL_RGBA,
1166 GL_UNSIGNED_BYTE, shapeTextureData[i]);
1167 }
1132 QObject::connect(openglContext, SIGNAL(aboutToBeDestroyed()), this,1168 QObject::connect(openglContext, SIGNAL(aboutToBeDestroyed()), this,
1133 SLOT(_q_openglContextDestroyed()), Qt::DirectConnection);1169 SLOT(_q_openglContextDestroyed()), Qt::DirectConnection);
1134 }1170 }
1171 const quint32 shapeTextureId = shapeTextures[index].textureId[m_aspect != DropShadow ? 0 : 1];
11351172
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.
1137 QSGTextureProvider* provider = m_source ? m_source->textureProvider() : NULL;1174 QSGTextureProvider* provider = m_source ? m_source->textureProvider() : NULL;
@@ -1187,7 +1224,7 @@
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);
1188 }1225 }
11891226
1190 updateMaterial(node, radius, shapeTexture, sourceTexture && m_sourceOpacity);1227 updateMaterial(node, radius, shapeTextureId, sourceTexture && m_sourceOpacity);
11911228
1192 // Get the affine transformation for the source texture coordinates.1229 // Get the affine transformation for the source texture coordinates.
1193 const QVector4D sourceCoordTransform(1230 const QVector4D sourceCoordTransform(
@@ -1231,7 +1268,7 @@
1231 };1268 };
12321269
1233 updateGeometry(1270 updateGeometry(
1234 node, itemSize, radius, shapeTextureInfo.offset, sourceCoordTransform, sourceMaskTransform,1271 node, itemSize, radius, shapeTextureOffset, sourceCoordTransform, sourceMaskTransform,
1235 backgroundColor);1272 backgroundColor);
12361273
1237 return node;1274 return node;
@@ -1242,12 +1279,13 @@
1242 return new ShapeNode;1279 return new ShapeNode;
1243}1280}
12441281
1245void UCUbuntuShape::updateMaterial(QSGNode* node, float radius, quint32 shapeTexture, bool textured)1282void UCUbuntuShape::updateMaterial(
1283 QSGNode* node, float radius, quint32 shapeTextureId, bool textured)
1246{1284{
1247 ShapeMaterial::Data* materialData = static_cast<ShapeNode*>(node)->material()->data();1285 ShapeMaterial::Data* materialData = static_cast<ShapeNode*>(node)->material()->data();
1248 quint8 flags = 0;1286 quint8 flags = 0;
12491287
1250 materialData->shapeTexture = shapeTexture;1288 materialData->shapeTextureId = shapeTextureId;
1251 if (textured) {1289 if (textured) {
1252 materialData->sourceTextureProvider = m_sourceTextureProvider;1290 materialData->sourceTextureProvider = m_sourceTextureProvider;
1253 materialData->sourceOpacity = m_sourceOpacity;1291 materialData->sourceOpacity = m_sourceOpacity;
@@ -1266,8 +1304,8 @@
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.
1267 const float start = 0.0f + radiusSizeOffset;1305 const float start = 0.0f + radiusSizeOffset;
1268 const float end = 4.0f + radiusSizeOffset;1306 const float end = 4.0f + radiusSizeOffset;
1269 materialData->distanceAAFactor = qMin(1307 materialData->distanceAAFactor =
1270 (radius / (end - start)) - (start / (end - start)), 1.0f) * 255.0f;1308 qMin((radius / (end - start)) - (start / (end - start)), 1.0f) * 255.0f;
12711309
1272 // Screen-space derivatives factors for fragment shaders depend on the primary orientation and1310 // Screen-space derivatives factors for fragment shaders depend on the primary orientation and
1273 // content orientation. A flag indicating a 90° rotation around the primary orientation is1311 // content orientation. A flag indicating a 90° rotation around the primary orientation is
@@ -1293,12 +1331,12 @@
1293 // optimal performance.1331 // optimal performance.
1294 if (radius > radiusSizeOffset) {1332 if (radius > radiusSizeOffset) {
1295 const quint8 aspectFlags[] = {1333 const quint8 aspectFlags[] = {
1296 ShapeMaterial::Data::Flat, ShapeMaterial::Data::Inset,1334 ShapeMaterial::Data::Flat, ShapeMaterial::Data::Inset, ShapeMaterial::Data::DropShadow,
1297 ShapeMaterial::Data::Inset | ShapeMaterial::Data::Pressed1335 ShapeMaterial::Data::Inset | ShapeMaterial::Data::Pressed
1298 };1336 };
1299 flags |= aspectFlags[m_aspect];1337 flags |= aspectFlags[m_aspect];
1300 } else {1338 } else {
1301 const quint8 aspectFlags[] = { 0, 0, ShapeMaterial::Data::Pressed };1339 const quint8 aspectFlags[] = { 0, 0, 0, ShapeMaterial::Data::Pressed };
1302 flags |= aspectFlags[m_aspect];1340 flags |= aspectFlags[m_aspect];
1303 }1341 }
13041342
@@ -1320,8 +1358,8 @@
1320 // Set top row of 3 vertices.1358 // Set top row of 3 vertices.
1321 v[0].position[0] = 0.0f;1359 v[0].position[0] = 0.0f;
1322 v[0].position[1] = 0.0f;1360 v[0].position[1] = 0.0f;
1323 v[0].shapeCoordinate[0] = shapeTextureInfo.offset;1361 v[0].shapeCoordinate[0] = shapeTextureOffset;
1324 v[0].shapeCoordinate[1] = shapeTextureInfo.offset;1362 v[0].shapeCoordinate[1] = shapeTextureOffset;
1325 v[0].sourceCoordinate[0] = sourceCoordTransform.z();1363 v[0].sourceCoordinate[0] = sourceCoordTransform.z();
1326 v[0].sourceCoordinate[1] = sourceCoordTransform.w();1364 v[0].sourceCoordinate[1] = sourceCoordTransform.w();
1327 v[0].sourceCoordinate[2] = sourceMaskTransform.z();1365 v[0].sourceCoordinate[2] = sourceMaskTransform.z();
@@ -1329,8 +1367,8 @@
1329 v[0].backgroundColor = backgroundColor[0];1367 v[0].backgroundColor = backgroundColor[0];
1330 v[1].position[0] = 0.5f * itemSize.width();1368 v[1].position[0] = 0.5f * itemSize.width();
1331 v[1].position[1] = 0.0f;1369 v[1].position[1] = 0.0f;
1332 v[1].shapeCoordinate[0] = (0.5f * itemSize.width()) / radius - shapeTextureInfo.offset;1370 v[1].shapeCoordinate[0] = (0.5f * itemSize.width()) / radius - shapeTextureOffset;
1333 v[1].shapeCoordinate[1] = shapeTextureInfo.offset;1371 v[1].shapeCoordinate[1] = shapeTextureOffset;
1334 v[1].sourceCoordinate[0] = 0.5f * sourceCoordTransform.x() + sourceCoordTransform.z();1372 v[1].sourceCoordinate[0] = 0.5f * sourceCoordTransform.x() + sourceCoordTransform.z();
1335 v[1].sourceCoordinate[1] = sourceCoordTransform.w();1373 v[1].sourceCoordinate[1] = sourceCoordTransform.w();
1336 v[1].sourceCoordinate[2] = 0.5f * sourceMaskTransform.x() + sourceMaskTransform.z();1374 v[1].sourceCoordinate[2] = 0.5f * sourceMaskTransform.x() + sourceMaskTransform.z();
@@ -1338,8 +1376,8 @@
1338 v[1].backgroundColor = backgroundColor[0];1376 v[1].backgroundColor = backgroundColor[0];
1339 v[2].position[0] = itemSize.width();1377 v[2].position[0] = itemSize.width();
1340 v[2].position[1] = 0.0f;1378 v[2].position[1] = 0.0f;
1341 v[2].shapeCoordinate[0] = shapeTextureInfo.offset;1379 v[2].shapeCoordinate[0] = shapeTextureOffset;
1342 v[2].shapeCoordinate[1] = shapeTextureInfo.offset;1380 v[2].shapeCoordinate[1] = shapeTextureOffset;
1343 v[2].sourceCoordinate[0] = sourceCoordTransform.x() + sourceCoordTransform.z();1381 v[2].sourceCoordinate[0] = sourceCoordTransform.x() + sourceCoordTransform.z();
1344 v[2].sourceCoordinate[1] = sourceCoordTransform.w();1382 v[2].sourceCoordinate[1] = sourceCoordTransform.w();
1345 v[2].sourceCoordinate[2] = sourceMaskTransform.x() + sourceMaskTransform.z();1383 v[2].sourceCoordinate[2] = sourceMaskTransform.x() + sourceMaskTransform.z();
@@ -1349,8 +1387,8 @@
1349 // Set middle row of 3 vertices.1387 // Set middle row of 3 vertices.
1350 v[3].position[0] = 0.0f;1388 v[3].position[0] = 0.0f;
1351 v[3].position[1] = 0.5f * itemSize.height();1389 v[3].position[1] = 0.5f * itemSize.height();
1352 v[3].shapeCoordinate[0] = shapeTextureInfo.offset;1390 v[3].shapeCoordinate[0] = shapeTextureOffset;
1353 v[3].shapeCoordinate[1] = (0.5f * itemSize.height()) / radius - shapeTextureInfo.offset;1391 v[3].shapeCoordinate[1] = (0.5f * itemSize.height()) / radius - shapeTextureOffset;
1354 v[3].sourceCoordinate[0] = sourceCoordTransform.z();1392 v[3].sourceCoordinate[0] = sourceCoordTransform.z();
1355 v[3].sourceCoordinate[1] = 0.5f * sourceCoordTransform.y() + sourceCoordTransform.w();1393 v[3].sourceCoordinate[1] = 0.5f * sourceCoordTransform.y() + sourceCoordTransform.w();
1356 v[3].sourceCoordinate[2] = sourceMaskTransform.z();1394 v[3].sourceCoordinate[2] = sourceMaskTransform.z();
@@ -1358,8 +1396,8 @@
1358 v[3].backgroundColor = backgroundColor[1];1396 v[3].backgroundColor = backgroundColor[1];
1359 v[4].position[0] = 0.5f * itemSize.width();1397 v[4].position[0] = 0.5f * itemSize.width();
1360 v[4].position[1] = 0.5f * itemSize.height();1398 v[4].position[1] = 0.5f * itemSize.height();
1361 v[4].shapeCoordinate[0] = (0.5f * itemSize.width()) / radius - shapeTextureInfo.offset;1399 v[4].shapeCoordinate[0] = (0.5f * itemSize.width()) / radius - shapeTextureOffset;
1362 v[4].shapeCoordinate[1] = (0.5f * itemSize.height()) / radius - shapeTextureInfo.offset;1400 v[4].shapeCoordinate[1] = (0.5f * itemSize.height()) / radius - shapeTextureOffset;
1363 v[4].sourceCoordinate[0] = 0.5f * sourceCoordTransform.x() + sourceCoordTransform.z();1401 v[4].sourceCoordinate[0] = 0.5f * sourceCoordTransform.x() + sourceCoordTransform.z();
1364 v[4].sourceCoordinate[1] = 0.5f * sourceCoordTransform.y() + sourceCoordTransform.w();1402 v[4].sourceCoordinate[1] = 0.5f * sourceCoordTransform.y() + sourceCoordTransform.w();
1365 v[4].sourceCoordinate[2] = 0.5f * sourceMaskTransform.x() + sourceMaskTransform.z();1403 v[4].sourceCoordinate[2] = 0.5f * sourceMaskTransform.x() + sourceMaskTransform.z();
@@ -1367,8 +1405,8 @@
1367 v[4].backgroundColor = backgroundColor[1];1405 v[4].backgroundColor = backgroundColor[1];
1368 v[5].position[0] = itemSize.width();1406 v[5].position[0] = itemSize.width();
1369 v[5].position[1] = 0.5f * itemSize.height();1407 v[5].position[1] = 0.5f * itemSize.height();
1370 v[5].shapeCoordinate[0] = shapeTextureInfo.offset;1408 v[5].shapeCoordinate[0] = shapeTextureOffset;
1371 v[5].shapeCoordinate[1] = (0.5f * itemSize.height()) / radius - shapeTextureInfo.offset;1409 v[5].shapeCoordinate[1] = (0.5f * itemSize.height()) / radius - shapeTextureOffset;
1372 v[5].sourceCoordinate[0] = sourceCoordTransform.x() + sourceCoordTransform.z();1410 v[5].sourceCoordinate[0] = sourceCoordTransform.x() + sourceCoordTransform.z();
1373 v[5].sourceCoordinate[1] = 0.5f * sourceCoordTransform.y() + sourceCoordTransform.w();1411 v[5].sourceCoordinate[1] = 0.5f * sourceCoordTransform.y() + sourceCoordTransform.w();
1374 v[5].sourceCoordinate[2] = sourceMaskTransform.x() + sourceMaskTransform.z();1412 v[5].sourceCoordinate[2] = sourceMaskTransform.x() + sourceMaskTransform.z();
@@ -1378,8 +1416,8 @@
1378 // Set bottom row of 3 vertices.1416 // Set bottom row of 3 vertices.
1379 v[6].position[0] = 0.0f;1417 v[6].position[0] = 0.0f;
1380 v[6].position[1] = itemSize.height();1418 v[6].position[1] = itemSize.height();
1381 v[6].shapeCoordinate[0] = shapeTextureInfo.offset;1419 v[6].shapeCoordinate[0] = shapeTextureOffset;
1382 v[6].shapeCoordinate[1] = shapeTextureInfo.offset;1420 v[6].shapeCoordinate[1] = shapeTextureOffset;
1383 v[6].sourceCoordinate[0] = sourceCoordTransform.z();1421 v[6].sourceCoordinate[0] = sourceCoordTransform.z();
1384 v[6].sourceCoordinate[1] = sourceCoordTransform.y() + sourceCoordTransform.w();1422 v[6].sourceCoordinate[1] = sourceCoordTransform.y() + sourceCoordTransform.w();
1385 v[6].sourceCoordinate[2] = sourceMaskTransform.z();1423 v[6].sourceCoordinate[2] = sourceMaskTransform.z();
@@ -1387,8 +1425,8 @@
1387 v[6].backgroundColor = backgroundColor[2];1425 v[6].backgroundColor = backgroundColor[2];
1388 v[7].position[0] = 0.5f * itemSize.width();1426 v[7].position[0] = 0.5f * itemSize.width();
1389 v[7].position[1] = itemSize.height();1427 v[7].position[1] = itemSize.height();
1390 v[7].shapeCoordinate[0] = (0.5f * itemSize.width()) / radius - shapeTextureInfo.offset;1428 v[7].shapeCoordinate[0] = (0.5f * itemSize.width()) / radius - shapeTextureOffset;
1391 v[7].shapeCoordinate[1] = shapeTextureInfo.offset;1429 v[7].shapeCoordinate[1] = shapeTextureOffset;
1392 v[7].sourceCoordinate[0] = 0.5f * sourceCoordTransform.x() + sourceCoordTransform.z();1430 v[7].sourceCoordinate[0] = 0.5f * sourceCoordTransform.x() + sourceCoordTransform.z();
1393 v[7].sourceCoordinate[1] = sourceCoordTransform.y() + sourceCoordTransform.w();1431 v[7].sourceCoordinate[1] = sourceCoordTransform.y() + sourceCoordTransform.w();
1394 v[7].sourceCoordinate[2] = 0.5f * sourceMaskTransform.x() + sourceMaskTransform.z();1432 v[7].sourceCoordinate[2] = 0.5f * sourceMaskTransform.x() + sourceMaskTransform.z();
@@ -1396,8 +1434,8 @@
1396 v[7].backgroundColor = backgroundColor[2];1434 v[7].backgroundColor = backgroundColor[2];
1397 v[8].position[0] = itemSize.width();1435 v[8].position[0] = itemSize.width();
1398 v[8].position[1] = itemSize.height();1436 v[8].position[1] = itemSize.height();
1399 v[8].shapeCoordinate[0] = shapeTextureInfo.offset;1437 v[8].shapeCoordinate[0] = shapeTextureOffset;
1400 v[8].shapeCoordinate[1] = shapeTextureInfo.offset;1438 v[8].shapeCoordinate[1] = shapeTextureOffset;
1401 v[8].sourceCoordinate[0] = sourceCoordTransform.x() + sourceCoordTransform.z();1439 v[8].sourceCoordinate[0] = sourceCoordTransform.x() + sourceCoordTransform.z();
1402 v[8].sourceCoordinate[1] = sourceCoordTransform.y() + sourceCoordTransform.w();1440 v[8].sourceCoordinate[1] = sourceCoordTransform.y() + sourceCoordTransform.w();
1403 v[8].sourceCoordinate[2] = sourceMaskTransform.x() + sourceMaskTransform.z();1441 v[8].sourceCoordinate[2] = sourceMaskTransform.x() + sourceMaskTransform.z();
14041442
=== modified file 'src/Ubuntu/Components/plugin/ucubuntushape.h'
--- src/Ubuntu/Components/plugin/ucubuntushape.h 2015-07-22 15:51:14 +0000
+++ src/Ubuntu/Components/plugin/ucubuntushape.h 2015-07-27 16:39:42 +0000
@@ -62,10 +62,12 @@
62 Repeated = (HorizontallyRepeated | VerticallyRepeated),62 Repeated = (HorizontallyRepeated | VerticallyRepeated),
63 Flat = (1 << 3),63 Flat = (1 << 3),
64 Inset = (1 << 4),64 Inset = (1 << 4),
65 Pressed = (1 << 5)65 DropShadow = (1 << 5),
66 AspectMask = (Flat | Inset | DropShadow),
67 Pressed = (1 << 6)
66 };68 };
67 QSGTextureProvider* sourceTextureProvider;69 QSGTextureProvider* sourceTextureProvider;
68 quint32 shapeTexture;70 quint32 shapeTextureId;
69 quint8 distanceAAFactor;71 quint8 distanceAAFactor;
70 quint8 sourceOpacity;72 quint8 sourceOpacity;
71 quint8 dfdtFactors;73 quint8 dfdtFactors;
@@ -178,7 +180,7 @@
178public:180public:
179 UCUbuntuShape(QQuickItem* parent=0);181 UCUbuntuShape(QQuickItem* parent=0);
180182
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.
182 enum BackgroundMode { SolidColor = 0, VerticalGradient = 1 };184 enum BackgroundMode { SolidColor = 0, VerticalGradient = 1 };
183 enum HAlignment { AlignLeft = 0, AlignHCenter = 1, AlignRight = 2 };185 enum HAlignment { AlignLeft = 0, AlignHCenter = 1, AlignRight = 2 };
184 enum VAlignment { AlignTop = 0, AlignVCenter = 1, AlignBottom = 2 };186 enum VAlignment { AlignTop = 0, AlignVCenter = 1, AlignBottom = 2 };
@@ -287,7 +289,7 @@
287289
288 // Virtual functions for extended shapes.290 // Virtual functions for extended shapes.
289 virtual QSGNode* createSceneGraphNode() const;291 virtual QSGNode* createSceneGraphNode() const;
290 virtual void updateMaterial(QSGNode* node, float radius, quint32 shapeTexture, bool textured);292 virtual void updateMaterial(QSGNode* node, float radius, quint32 shapeTextureId, bool textured);
291 virtual void updateGeometry(293 virtual void updateGeometry(
292 QSGNode* node, const QSizeF& itemSize, float radius, float shapeOffset,294 QSGNode* node, const QSizeF& itemSize, float radius, float shapeOffset,
293 const QVector4D& sourceCoordTransform, const QVector4D& sourceMaskTransform,295 const QVector4D& sourceCoordTransform, const QVector4D& sourceMaskTransform,
@@ -312,7 +314,7 @@
312 VAlignment verticalAlignment, const QSize& textureSize);314 VAlignment verticalAlignment, const QSize& textureSize);
313315
314 enum Radius { Small = 0, Medium = 1, Large = 2 };316 enum Radius { Small = 0, Medium = 1, Large = 2 };
315 enum { Pressed = 2 }; // Aspect extension (to keep support for deprecated aspects).317 enum { Pressed = 3 }; // Aspect extension (to keep support for deprecated aspects).
316 enum {318 enum {
317 AspectSet = (1 << 0),319 AspectSet = (1 << 0),
318 GradientColorSet = (1 << 1),320 GradientColorSet = (1 << 1),
@@ -331,7 +333,7 @@
331 QVector4D m_sourceTransform;333 QVector4D m_sourceTransform;
332 Radius m_radius : 2;334 Radius m_radius : 2;
333 quint8 m_relativeRadius : 6;335 quint8 m_relativeRadius : 6;
334 quint8 m_aspect : 2;336 quint8 m_aspect : 3;
335 HAlignment m_imageHorizontalAlignment : 2;337 HAlignment m_imageHorizontalAlignment : 2;
336 VAlignment m_imageVerticalAlignment : 2;338 VAlignment m_imageVerticalAlignment : 2;
337 BackgroundMode m_backgroundMode : 1;339 BackgroundMode m_backgroundMode : 1;
@@ -340,7 +342,6 @@
340 FillMode m_sourceFillMode : 2;342 FillMode m_sourceFillMode : 2;
341 WrapMode m_sourceHorizontalWrapMode : 1;343 WrapMode m_sourceHorizontalWrapMode : 1;
342 WrapMode m_sourceVerticalWrapMode : 1;344 WrapMode m_sourceVerticalWrapMode : 1;
343 quint8 __explicit_padding : 1;
344 quint8 m_sourceOpacity;345 quint8 m_sourceOpacity;
345 quint8 m_flags;346 quint8 m_flags;
346347
347348
=== modified file 'src/Ubuntu/Components/plugin/ucubuntushapetexture.h'
--- src/Ubuntu/Components/plugin/ucubuntushapetexture.h 2015-04-08 10:46:56 +0000
+++ src/Ubuntu/Components/plugin/ucubuntushapetexture.h 2015-07-27 16:39:42 +0000
@@ -1,15 +1,12 @@
1// Copyright 2015 Canonical Ltd.1// Copyright 2015 Canonical Ltd.
2// Automatically generated by the createshapeimage tool.2// Automatically generated by the createshapetextures tool.
33
4static const struct {4const int shapeTextureCount = 2;
5 float offset;5const int shapeTextureSize = 32;
6 float distanceAA;6const float shapeTextureOffset = 0.0625;
7 int size;7const int shapeTextureDistanceAA = 4;
8 unsigned char data[4097];8
9} shapeTextureInfo = {9static const unsigned char shapeTextureData[2][4097] = {
10 0.0625,
11 4,
12 32,
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"
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"
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"
@@ -266,4 +263,261 @@
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"
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"
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"
266 ,
267 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
268 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
269 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
270 "\x08\x00\x00\x00\x12\x00\x00\x00\x1a\x00\x00\x00\x1f\x00\x00\x00"
271 "\x29\x00\x00\x00\x2e\x00\x00\x00\x33\x00\x00\x00\x38\x01\x00\x00"
272 "\x3d\x05\x00\x00\x40\x09\x00\x00\x43\x0b\x00\x00\x46\x0e\x00\x00"
273 "\x48\x10\x00\x00\x49\x12\x00\x00\x4a\x12\x00\x00\x4b\x13\x00\x00"
274 "\x4c\x14\x00\x00\x4d\x15\x00\x00\x4d\x15\x00\x00\x4e\x16\x00\x00"
275 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
276 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
277 "\x00\x00\x00\x00\x00\x00\x00\x00\x0c\x00\x00\x00\x1a\x00\x00\x00"
278 "\x25\x00\x00\x00\x30\x00\x00\x00\x38\x03\x00\x00\x3f\x0a\x00\x00"
279 "\x47\x12\x00\x00\x4e\x16\x00\x00\x53\x1b\x00\x00\x58\x20\x00\x00"
280 "\x5d\x25\x00\x00\x60\x29\x00\x00\x63\x2b\x00\x00\x66\x2e\x00\x00"
281 "\x68\x30\x00\x00\x69\x31\x00\x00\x6a\x32\x00\x00\x6b\x33\x00\x00"
282 "\x6c\x34\x00\x00\x6c\x35\x00\x00\x6d\x35\x00\x00\x6e\x36\x00\x00"
283 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
284 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
285 "\x0b\x00\x00\x00\x1b\x00\x00\x00\x28\x00\x00\x00\x38\x03\x00\x00"
286 "\x3f\x0f\x00\x00\x50\x1a\x00\x00\x57\x22\x00\x00\x5f\x27\x00\x00"
287 "\x67\x30\x00\x00\x6e\x36\x00\x00\x73\x3b\x00\x00\x78\x40\x00\x00"
288 "\x7d\x45\x01\x00\x80\x48\x05\x00\x83\x4b\x0a\x00\x85\x4e\x0e\x00"
289 "\x88\x50\x11\x00\x89\x51\x12\x00\x8a\x52\x14\x00\x8b\x53\x15\x00"
290 "\x8c\x54\x16\x00\x8c\x54\x17\x00\x8d\x55\x19\x00\x8e\x56\x1a\x00"
291 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
292 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x13\x00\x00\x00"
293 "\x26\x00\x00\x00\x36\x06\x00\x00\x46\x13\x00\x00\x52\x22\x00\x00"
294 "\x5f\x2c\x00\x00\x6c\x37\x00\x00\x78\x3f\x00\x00\x7f\x47\x0a\x00"
295 "\x86\x50\x17\x00\x8e\x56\x20\x00\x93\x5b\x28\x00\x98\x60\x30\x00"
296 "\x9c\x65\x36\x00\xa0\x68\x3a\x00\xa3\x6b\x3e\x00\xa5\x6e\x42\x00"
297 "\xa8\x70\x44\x00\xa9\x71\x45\x00\xaa\x72\x46\x00\xab\x73\x47\x00"
298 "\xab\x74\x48\x00\xac\x74\x49\x00\xad\x75\x4a\x00\xae\x76\x4c\x00"
299 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
300 "\x00\x00\x00\x00\x03\x00\x00\x00\x18\x00\x00\x00\x2c\x00\x00\x00"
301 "\x40\x12\x00\x00\x51\x23\x00\x00\x61\x2f\x00\x00\x71\x3f\x00\x00"
302 "\x7f\x47\x10\x00\x8a\x53\x25\x00\x96\x5f\x33\x00\x9f\x67\x3f\x00"
303 "\xa6\x6e\x49\x00\xae\x76\x51\x00\xb3\x7b\x58\x00\xb8\x80\x5e\x00"
304 "\xbc\x84\x63\x00\xc0\x88\x66\x00\xc3\x8b\x6a\x00\xc5\x8d\x6d\x00"
305 "\xc8\x90\x6f\x00\xc9\x91\x70\x00\xca\x92\x71\x00\xcb\x93\x71\x00"
306 "\xcb\x93\x72\x00\xcc\x94\x73\x00\xcd\x95\x74\x00\xce\x96\x75\x00"
307 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
308 "\x00\x00\x00\x00\x18\x00\x00\x00\x30\x05\x00\x00\x45\x19\x00\x00"
309 "\x59\x2c\x00\x00\x6d\x3e\x00\x00\x7e\x4e\x15\x00\x8e\x59\x31\x00"
310 "\x9e\x67\x44\x00\xab\x74\x55\x00\xb6\x7f\x60\x00\xbf\x86\x6a\x00"
311 "\xc6\x8f\x73\x00\xcd\x96\x7a\x00\xd3\x9b\x7f\x00\xd7\xa0\x84\x00"
312 "\xdc\xa4\x88\x00\xe0\xa8\x8b\x00\xe2\xab\x8d\x00\xe5\xad\x90\x00"
313 "\xe8\xb0\x92\x00\xe9\xb1\x92\x00\xea\xb2\x93\x00\xea\xb3\x94\x00"
314 "\xeb\xb3\x94\x00\xec\xb4\x95\x00\xed\xb5\x96\x00\xed\xb6\x97\x00"
315 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
316 "\x14\x00\x00\x00\x2c\x09\x00\x00\x45\x1e\x00\x00\x5d\x32\x00\x00"
317 "\x72\x46\x07\x00\x86\x57\x2a\x00\x9a\x69\x44\x00\xab\x79\x58\x00"
318 "\xb9\x86\x6f\x00\xcb\x93\x77\x00\xd1\x9e\x83\x00\xdc\xa7\x8e\x00"
319 "\xe4\xae\x93\x00\xeb\xb6\x9a\x00\xf3\xbb\x9e\x00\xf7\xc0\xa2\x00"
320 "\xfb\xc4\xa5\x00\xff\xc8\xa7\x00\xff\xcb\xa9\x00\xff\xcd\xab\x00"
321 "\xff\xd0\xac\x00\xff\xd1\xad\x00\xff\xd2\xad\x00\xff\xd2\xae\x00"
322 "\xff\xd3\xae\x00\xff\xd4\xaf\x00\xff\xd5\xaf\x00\xff\xd5\xb0\x00"
323 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0d\x00\x00\x00"
324 "\x27\x04\x00\x00\x41\x1d\x00\x00\x59\x36\x00\x00\x72\x4b\x0d\x00"
325 "\x8a\x5f\x31\x00\x9f\x73\x4e\x00\xb3\x84\x67\x00\xc5\x96\x7d\x00"
326 "\xd7\xa6\x8b\x00\xe4\xaf\x96\x00\xef\xbe\xa0\x00\xfa\xc6\xa9\x00"
327 "\xff\xcd\xac\x00\xff\xd5\xb2\x00\xff\xdb\xb4\x00\xff\xdf\xb7\x00"
328 "\xff\xe4\xba\x00\xff\xe8\xbc\x00\xff\xea\xbd\x00\xff\xed\xbe\x00"
329 "\xff\xf0\xbf\x00\xff\xf1\xbf\x00\xff\xf1\xc0\x00\xff\xf2\xc0\x00"
330 "\xff\xf3\xc0\x00\xff\xf4\xc0\x00\xff\xf5\xc1\x00\xff\xf5\xc1\x00"
331 "\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x1d\x00\x00\x00"
332 "\x38\x19\x00\x00\x52\x32\x00\x00\x6e\x4a\x07\x00\x86\x63\x31\x00"
333 "\x9f\x78\x54\x00\xb7\x8c\x6f\x00\xcc\xa0\x86\x00\xe0\xb1\x97\x00"
334 "\xf1\xbf\xa4\x00\xff\xcf\xaf\x00\xff\xda\xb6\x00\xff\xe3\xbb\x00"
335 "\xff\xeb\xbf\x00\xff\xf5\xc2\x00\xff\xfa\xc4\x00\xff\xff\xc5\x00"
336 "\xff\xff\xc7\x00\xff\xff\xc8\x00\xff\xff\xc8\x00\xff\xff\xc9\x00"
337 "\xff\xff\xc9\x00\xff\xff\xca\x00\xff\xff\xca\x00\xff\xff\xca\x00"
338 "\xff\xff\xca\x00\xff\xff\xca\x00\xff\xff\xca\x00\xff\xff\xca\x00"
339 "\x00\x00\x00\x00\x00\x00\x00\x00\x0e\x00\x00\x00\x2a\x10\x00\x00"
340 "\x48\x2c\x00\x00\x63\x46\x00\x00\x80\x5f\x2a\x00\x9b\x77\x4f\x00"
341 "\xb4\x90\x6f\x00\xcc\xa5\x8a\x00\xe4\xb9\x9e\x00\xf9\xcc\xad\x00"
342 "\xff\xdd\xb8\x00\xff\xeb\xbf\x00\xff\xf7\xc4\x00\xff\xff\xc7\x00"
343 "\xff\xff\xc9\x00\xff\xff\xcb\x00\xff\xff\xcb\x00\xff\xff\xcc\x00"
344 "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00"
345 "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00"
346 "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00"
347 "\x00\x00\x00\x00\x00\x00\x00\x00\x1d\x06\x00\x00\x3a\x23\x00\x00"
348 "\x54\x3c\x00\x00\x73\x56\x16\x00\x90\x73\x45\x00\xad\x8c\x68\x00"
349 "\xc7\xa4\x86\x00\xe1\xbd\x9e\x00\xf9\xd2\xb0\x00\xff\xe6\xbc\x00"
350 "\xff\xf7\xc4\x00\xff\xff\xc9\x00\xff\xff\xcb\x00\xff\xff\xcc\x00"
351 "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00"
352 "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00"
353 "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00"
354 "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00"
355 "\x00\x00\x00\x00\x0a\x00\x00\x00\x27\x11\x00\x00\x42\x2f\x00\x00"
356 "\x62\x4e\x00\x00\x81\x69\x31\x00\xa0\x83\x58\x00\xba\xa0\x7d\x00"
357 "\xd8\xb9\x97\x00\xf2\xd2\xae\x00\xff\xea\xbc\x00\xff\xff\xc6\x00"
358 "\xff\xff\xcb\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00"
359 "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00"
360 "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00"
361 "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00"
362 "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00"
363 "\x00\x00\x00\x00\x15\x01\x00\x00\x33\x20\x00\x00\x50\x3d\x00\x00"
364 "\x6e\x56\x10\x00\x8d\x77\x45\x00\xad\x96\x6f\x00\xcd\xb0\x8b\x00"
365 "\xe6\xcb\xa4\x00\xff\xe6\xb8\x00\xff\xff\xc4\x00\xff\xff\xcb\x00"
366 "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00"
367 "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00"
368 "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00"
369 "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00"
370 "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00"
371 "\x00\x00\x00\x00\x1d\x0d\x00\x00\x3b\x2a\x00\x00\x59\x45\x00\x00"
372 "\x7b\x65\x25\x00\x99\x83\x55\x00\xb9\xa4\x77\x00\xd4\xbe\x96\x00"
373 "\xf2\xdb\xaf\x00\xff\xf6\xbf\x00\xff\xff\xc9\x00\xff\xff\xcc\x00"
374 "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00"
375 "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00"
376 "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00"
377 "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00"
378 "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00"
379 "\x06\x00\x00\x00\x24\x17\x00\x00\x42\x35\x00\x00\x62\x52\x00\x00"
380 "\x82\x71\x33\x00\xa2\x91\x60\x00\xc1\xae\x83\x00\xde\xce\xa0\x00"
381 "\xfd\xea\xb6\x00\xff\xff\xc4\x00\xff\xff\xcb\x00\xff\xff\xcc\x00"
382 "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00"
383 "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00"
384 "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00"
385 "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00"
386 "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00"
387 "\x0d\x01\x00\x00\x2a\x1f\x00\x00\x4a\x3c\x00\x00\x6a\x5c\x09\x00"
388 "\x89\x7d\x3f\x00\xaa\x9c\x6a\x00\xc9\xbc\x8e\x00\xe7\xd7\xa9\x00"
389 "\xff\xf4\xbb\x00\xff\xff\xc7\x00\xff\xff\xcc\x00\xff\xff\xcc\x00"
390 "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00"
391 "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00"
392 "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00"
393 "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00"
394 "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00"
395 "\x12\x08\x00\x00\x32\x26\x00\x00\x52\x44\x00\x00\x71\x64\x18\x00"
396 "\x91\x83\x4a\x00\xb1\xa4\x73\x00\xd0\xc4\x93\x00\xee\xe1\xac\x00"
397 "\xff\xff\xbf\x00\xff\xff\xc9\x00\xff\xff\xcc\x00\xff\xff\xcc\x00"
398 "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00"
399 "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00"
400 "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00"
401 "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00"
402 "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00"
403 "\x17\x0e\x00\x00\x37\x2c\x00\x00\x57\x4c\x00\x00\x78\x6c\x21\x00"
404 "\x96\x8b\x51\x00\xb6\xab\x7a\x00\xd6\xcb\x9a\x00\xf5\xe9\xb2\x00"
405 "\xff\xff\xc2\x00\xff\xff\xcb\x00\xff\xff\xcc\x00\xff\xff\xcc\x00"
406 "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00"
407 "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00"
408 "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00"
409 "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00"
410 "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00"
411 "\x1c\x13\x00\x00\x3c\x33\x00\x00\x5b\x53\x00\x00\x7c\x73\x28\x00"
412 "\x9b\x93\x58\x00\xbb\xb2\x7f\x00\xdb\xd2\x9e\x00\xfb\xf0\xb5\x00"
413 "\xff\xff\xc4\x00\xff\xff\xcb\x00\xff\xff\xcc\x00\xff\xff\xcc\x00"
414 "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00"
415 "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00"
416 "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00"
417 "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00"
418 "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00"
419 "\x20\x18\x00\x00\x40\x38\x00\x00\x60\x58\x00\x00\x80\x79\x30\x00"
420 "\xa0\x98\x5e\x00\xc0\xb7\x84\x00\xe0\xd7\xa2\x00\xff\xf7\xb7\x00"
421 "\xff\xff\xc5\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00"
422 "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00"
423 "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00"
424 "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00"
425 "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00"
426 "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00"
427 "\x24\x1d\x00\x00\x44\x3d\x00\x00\x64\x5d\x01\x00\x83\x7d\x36\x00"
428 "\xa4\x9c\x63\x00\xc4\xbc\x88\x00\xe4\xdc\xa5\x00\xff\xfb\xba\x00"
429 "\xff\xff\xc7\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00"
430 "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00"
431 "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00"
432 "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00"
433 "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00"
434 "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00"
435 "\x27\x22\x00\x00\x47\x42\x00\x00\x67\x61\x05\x00\x85\x81\x3a\x00"
436 "\xa6\xa1\x67\x00\xc6\xc1\x8b\x00\xe6\xe1\xa7\x00\xff\xff\xbc\x00"
437 "\xff\xff\xc8\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00"
438 "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00"
439 "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00"
440 "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00"
441 "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00"
442 "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00"
443 "\x2a\x25\x00\x00\x49\x45\x00\x00\x69\x65\x08\x00\x88\x84\x3e\x00"
444 "\xa9\xa4\x6a\x00\xc9\xc4\x8e\x00\xe9\xe4\xa9\x00\xff\xff\xbd\x00"
445 "\xff\xff\xc8\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00"
446 "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00"
447 "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00"
448 "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00"
449 "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00"
450 "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00"
451 "\x2c\x28\x00\x00\x4c\x47\x00\x00\x6c\x67\x0c\x00\x8b\x86\x42\x00"
452 "\xac\xa7\x6d\x00\xcb\xc7\x90\x00\xeb\xe7\xab\x00\xff\xff\xbe\x00"
453 "\xff\xff\xc9\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00"
454 "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00"
455 "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00"
456 "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00"
457 "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00"
458 "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00"
459 "\x2e\x2a\x00\x00\x4d\x4a\x00\x00\x6d\x6a\x0f\x00\x8d\x89\x44\x00"
460 "\xad\xaa\x6f\x00\xcd\xca\x92\x00\xed\xe9\xac\x00\xff\xff\xbf\x00"
461 "\xff\xff\xc9\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00"
462 "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00"
463 "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00"
464 "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00"
465 "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00"
466 "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00"
467 "\x2e\x2d\x00\x00\x4e\x4d\x00\x00\x6e\x6c\x11\x00\x8f\x8c\x45\x00"
468 "\xae\xac\x70\x00\xce\xcc\x92\x00\xee\xec\xad\x00\xff\xff\xbf\x00"
469 "\xff\xff\xca\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00"
470 "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00"
471 "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00"
472 "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00"
473 "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00"
474 "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00"
475 "\x2f\x2e\x00\x00\x4f\x4e\x00\x00\x6f\x6d\x12\x00\x8f\x8e\x46\x00"
476 "\xaf\xad\x71\x00\xcf\xcd\x93\x00\xef\xed\xad\x00\xff\xff\xc0\x00"
477 "\xff\xff\xca\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00"
478 "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00"
479 "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00"
480 "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00"
481 "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00"
482 "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00"
483 "\x30\x2e\x00\x00\x50\x4e\x00\x00\x70\x6e\x14\x00\x90\x8f\x47\x00"
484 "\xaf\xae\x71\x00\xcf\xce\x94\x00\xef\xee\xae\x00\xff\xff\xc0\x00"
485 "\xff\xff\xca\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00"
486 "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00"
487 "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00"
488 "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00"
489 "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00"
490 "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00"
491 "\x30\x2f\x00\x00\x50\x4f\x00\x00\x70\x6f\x16\x00\x90\x8f\x48\x00"
492 "\xb0\xaf\x72\x00\xd0\xcf\x94\x00\xf0\xef\xae\x00\xff\xff\xc0\x00"
493 "\xff\xff\xca\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00"
494 "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00"
495 "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00"
496 "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00"
497 "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00"
498 "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00"
499 "\x31\x30\x00\x00\x51\x50\x00\x00\x70\x70\x18\x00\x91\x90\x49\x00"
500 "\xb1\xb0\x73\x00\xd1\xcf\x95\x00\xf0\xef\xaf\x00\xff\xff\xc0\x00"
501 "\xff\xff\xca\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00"
502 "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00"
503 "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00"
504 "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00"
505 "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00"
506 "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00"
507 "\x32\x30\x00\x00\x52\x50\x00\x00\x72\x70\x1a\x00\x92\x90\x4b\x00"
508 "\xb2\xb0\x74\x00\xd1\xd0\x96\x00\xf1\xf0\xaf\x00\xff\xff\xc1\x00"
509 "\xff\xff\xca\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00"
510 "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00"
511 "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00"
512 "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00"
513 "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00"
514 "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00"
515 "\x33\x31\x00\x00\x53\x51\x00\x00\x73\x71\x1a\x00\x92\x91\x4c\x00"
516 "\xb2\xb1\x75\x00\xd2\xd1\x97\x00\xf2\xf1\xb0\x00\xff\xff\xc1\x00"
517 "\xff\xff\xca\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00"
518 "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00"
519 "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00"
520 "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00"
521 "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00"
522 "\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00\xff\xff\xcc\x00"
269};523};
270524
=== renamed file 'src/Ubuntu/Components/tools/createshapeimage.cpp' => 'src/Ubuntu/Components/tools/createshapetextures.cpp'
--- src/Ubuntu/Components/tools/createshapeimage.cpp 2015-04-08 10:51:43 +0000
+++ src/Ubuntu/Components/tools/createshapetextures.cpp 2015-07-27 16:39:42 +0000
@@ -24,7 +24,7 @@
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:
25// $ cd tools25// $ cd tools
26// $ qmake && make26// $ qmake && make
27// $ ./createshapeimage shape.svg ../plugin/ucubuntushapetexture.h27// $ ./createshapetextures shape.svg ../plugin/ucubuntushapetexture.h
2828
29#include <QtCore/QFile>29#include <QtCore/QFile>
30#include <QtCore/QTextStream>30#include <QtCore/QTextStream>
@@ -35,16 +35,10 @@
35#include "3rd_party/edtaa3func.c"35#include "3rd_party/edtaa3func.c"
3636
37// Input data.37// Input data.
38const int textureCount = 2;
38const int textureSize = 32; // Must be a power-of-2.39const int textureSize = 32; // Must be a power-of-2.
39const double distanceScale = 4.0;40const double distanceScale = 4.0;
40const double shadowScale = 7.5;
41const double shadowTranslucency = 0.37;
42const double shapeOffset = 0.0625;41const double shapeOffset = 0.0625;
43const double distanceBottomTY = 0.0546875; // From shapeOffset.
44const double shadowTopTX = -0.01171875; // From shapeOffset.
45const double shadowTopTY = 0.03125; // From shapeOffset.
46const double shadowBottomTX = -0.01171875; // From shapeOffset.
47const double shadowBottomTY = -0.00390625; // From shapeOffset.
4842
49// Sizes.43// Sizes.
50const int width = textureSize;44const int width = textureSize;
@@ -66,13 +60,224 @@
66static double gradientX[size];60static double gradientX[size];
67static double gradientY[size];61static double gradientY[size];
6862
69// Final image buffer.63// Final texture buffers.
70static uint imageData[size];64static uint textureData[2][size];
65
66// Creates the inset and flat aspect texture.
67static void createTexture1(QSvgRenderer* svg, QPainter* painter)
68{
69 // Input data.
70 const double shadowScale = 7.5;
71 const double shadowTranslucency = 0.37;
72 const double distanceBottomTY = 0.0546875; // From shapeOffset.
73 const double shadowTopTX = -0.01171875; // From shapeOffset.
74 const double shadowTopTY = 0.03125; // From shapeOffset.
75 const double shadowBottomTX = -0.01171875; // From shapeOffset.
76 const double shadowBottomTY = -0.00390625; // From shapeOffset.
77
78 // Render and store the distance field used for masking the top of the shape, for masking the
79 // bevel and for masking the unstyled shape.
80 painter->translate(shapeOffset * width, shapeOffset * width);
81 svg->render(painter);
82 for (int i = 0; i < size; i++) {
83 shapeNormalized[i] = static_cast<double>(shapeData[i] >> 24) / 255.0;
84 }
85 computegradient(shapeNormalized, width, height, gradientX, gradientY);
86 edtaa3(shapeNormalized, gradientX, gradientY, width, height, distanceX, distanceY,
87 distanceOut);
88 for (int i = 0; i < size; i++) {
89 shapeNormalized[i] = 1.0 - shapeNormalized[i];
90 }
91 memset(gradientX, 0, size * sizeof(double));
92 memset(gradientY, 0, size * sizeof(double));
93 computegradient(shapeNormalized, width, height, gradientX, gradientY);
94 edtaa3(shapeNormalized, gradientX, gradientY, width, height, distanceX, distanceY,
95 distanceIn);
96 for (int i = 0; i < size; i++) {
97 const double distance = qMax(0.0, distanceIn[i]) - qMax(0.0, distanceOut[i]);
98 const uint value = qBound(0, qRound(distance * distanceScale * imageScale + 127.5), 255);
99 textureData[0][i] = value << 16; // Stored in channel R (exposed as B in the shaders).
100 }
101
102 // Render and store the distance field used for masking the bottom of the shape and for masking
103 // the bevel.
104 memset(shapeData, 0, size * sizeof(uint));
105 painter->resetTransform();
106 painter->translate(shapeOffset * width, (shapeOffset + distanceBottomTY) * width);
107 svg->render(painter);
108 for (int i = 0; i < size; i++) {
109 shapeNormalized[i] = static_cast<double>(shapeData[i] >> 24) / 255.0;
110 }
111 computegradient(shapeNormalized, width, height, gradientX, gradientY);
112 edtaa3(shapeNormalized, gradientX, gradientY, width, height, distanceX, distanceY,
113 distanceOut);
114 for (int i = 0; i < size; i++) {
115 shapeNormalized[i] = 1.0 - shapeNormalized[i];
116 }
117 memset(gradientX, 0, size * sizeof(double));
118 memset(gradientY, 0, size * sizeof(double));
119 computegradient(shapeNormalized, width, height, gradientX, gradientY);
120 edtaa3(shapeNormalized, gradientX, gradientY, width, height, distanceX, distanceY,
121 distanceIn);
122 for (int i = 0; i < size; i++) {
123 const double distance = qMax(0.0, distanceIn[i]) - qMax(0.0, distanceOut[i]);
124 const uint value = qBound(0, qRound(distance * distanceScale * imageScale + 127.5), 255);
125 textureData[0][i] |= value << 24; // Stored in channel A.
126 }
127
128 // Render and store the top inner shadow.
129 memset(shapeData, 0, size * sizeof(uint));
130 painter->resetTransform();
131 painter->translate((shapeOffset + shadowTopTX) * width, (shapeOffset + shadowTopTY) * width);
132 svg->render(painter);
133 for (int i = 0; i < size; i++) {
134 shapeNormalized[i] = 1.0 - (static_cast<double>(shapeData[i] >> 24) / 255.0);
135 }
136 computegradient(shapeNormalized, width, height, gradientX, gradientY);
137 edtaa3(shapeNormalized, gradientX, gradientY, width, height, distanceX, distanceY,
138 distanceIn);
139 for (int i = 0; i < size; i++) {
140 double shadow = qBound(0.0, (distanceIn[i] * shadowScale * imageScale) / 255.0, 1.0);
141 shadow = (1.0 - (2.0 * shadow - shadow * shadow)) * 255.0;
142 const uint value = qBound(0, qRound(shadow * shadowTranslucency), 255);
143 textureData[0][i] |= value << 0; // Stored in channel B (exposed as R in the shaders).
144 }
145
146 // Render and store the bottom inner shadow.
147 memset(shapeData, 0, size * sizeof(uint));
148 painter->resetTransform();
149 painter->translate(
150 (shapeOffset + shadowBottomTX) * width, (shapeOffset + shadowBottomTY) * width);
151 svg->render(painter);
152 for (int i = 0; i < size; i++) {
153 shapeNormalized[i] = 1.0 - (static_cast<double>(shapeData[i] >> 24) / 255.0);
154 }
155 computegradient(shapeNormalized, width, height, gradientX, gradientY);
156 edtaa3(shapeNormalized, gradientX, gradientY, width, height, distanceX, distanceY,
157 distanceIn);
158 for (int i = 0; i < size; i++) {
159 double shadow = qBound(0.0, (distanceIn[i] * shadowScale * imageScale) / 255.0, 1.0);
160 shadow = (1.0 - (2.0 * shadow - shadow * shadow)) * 255.0;
161 const uint value = qBound(0, qRound(shadow * shadowTranslucency), 255);
162 textureData[0][i] |= value << 8; // Stored in channel G.
163 }
164}
165
166// Creates the drop shadow aspect texture.
167static void createTexture2(QSvgRenderer* svg, QPainter* painter)
168{
169 // Input data.
170 const double shadowScale = 4.5;
171 const double shadowTranslucency = 0.8;
172 const double distanceBottomTY = 0.0546875; // From shapeOffset.
173 const double distanceTx = distanceBottomTY * 0.5; // From shapeOffset.
174
175 // Render and store the distance field used for masking the top of the shape.
176 memset(shapeData, 0, size * sizeof(uint));
177 painter->resetTransform();
178 painter->translate((shapeOffset + distanceTx) * width, shapeOffset * width);
179 svg->render(painter);
180 for (int i = 0; i < size; i++) {
181 shapeNormalized[i] = static_cast<double>(shapeData[i] >> 24) / 255.0;
182 }
183 computegradient(shapeNormalized, width, height, gradientX, gradientY);
184 edtaa3(shapeNormalized, gradientX, gradientY, width, height, distanceX, distanceY,
185 distanceOut);
186 for (int i = 0; i < size; i++) {
187 shapeNormalized[i] = 1.0 - shapeNormalized[i];
188 }
189 memset(gradientX, 0, size * sizeof(double));
190 memset(gradientY, 0, size * sizeof(double));
191 computegradient(shapeNormalized, width, height, gradientX, gradientY);
192 edtaa3(shapeNormalized, gradientX, gradientY, width, height, distanceX, distanceY,
193 distanceIn);
194 for (int i = 0; i < size; i++) {
195 const double distance = qMax(0.0, distanceIn[i]) - qMax(0.0, distanceOut[i]);
196 const uint value = qBound(0, qRound(distance * distanceScale * imageScale + 127.5), 255);
197 textureData[1][i] = value << 0; // Stored in channel B (exposed as R in the shaders).
198 }
199
200 // Render and store the distance field used for masking the bottom of the shape.
201 memset(shapeData, 0, size * sizeof(uint));
202 painter->resetTransform();
203 painter->translate((shapeOffset + distanceTx) * width,
204 (shapeOffset + distanceBottomTY) * width);
205 svg->render(painter);
206 for (int i = 0; i < size; i++) {
207 shapeNormalized[i] = static_cast<double>(shapeData[i] >> 24) / 255.0;
208 }
209 computegradient(shapeNormalized, width, height, gradientX, gradientY);
210 edtaa3(shapeNormalized, gradientX, gradientY, width, height, distanceX, distanceY,
211 distanceOut);
212 for (int i = 0; i < size; i++) {
213 shapeNormalized[i] = 1.0 - shapeNormalized[i];
214 }
215 memset(gradientX, 0, size * sizeof(double));
216 memset(gradientY, 0, size * sizeof(double));
217 computegradient(shapeNormalized, width, height, gradientX, gradientY);
218 edtaa3(shapeNormalized, gradientX, gradientY, width, height, distanceX, distanceY,
219 distanceIn);
220 for (int i = 0; i < size; i++) {
221 const double distance = qMax(0.0, distanceIn[i]) - qMax(0.0, distanceOut[i]);
222 const uint value = qBound(0, qRound(distance * distanceScale * imageScale + 127.5), 255);
223 textureData[1][i] |= value << 8; // Stored in channel G.
224 }
225
226 // Render and store the top inner shadow.
227 memset(shapeData, 0, size * sizeof(uint));
228 painter->resetTransform();
229 painter->translate(shapeOffset * width, shapeOffset * width);
230 svg->render(painter);
231 for (int i = 0; i < size; i++) {
232 shapeNormalized[i] = 1.0 - (static_cast<double>(shapeData[i] >> 24) / 255.0);
233 }
234 computegradient(shapeNormalized, width, height, gradientX, gradientY);
235 edtaa3(shapeNormalized, gradientX, gradientY, width, height, distanceX, distanceY,
236 distanceIn);
237 for (int i = 0; i < size; i++) {
238 double shadow = qBound(0.0, (distanceIn[i] * shadowScale * imageScale) / 255.0, 1.0);
239 shadow = (2.0 * shadow - shadow * shadow) * 255.0;
240 const uint value = qBound(0, qRound(shadow * shadowTranslucency), 255);
241 textureData[1][i] |= value << 16; // Stored in channel R (exposed as B in the shaders).
242 }
243}
244
245static void dumpTexture(QTextStream& cppOut, const uint* textureData)
246{
247 cppOut.setIntegerBase(16);
248 cppOut.setFieldWidth(2);
249 cppOut.setPadChar('0');
250 for (int i = 0; i < size; i += 4) {
251 cppOut << " \""
252 << "\\x" << (textureData[i] & 0xff)
253 << "\\x" << ((textureData[i] >> 8) & 0xff)
254 << "\\x" << ((textureData[i] >> 16) & 0xff)
255 << "\\x" << ((textureData[i] >> 24) & 0xff)
256 << "\\x" << (textureData[i+1] & 0xff)
257 << "\\x" << ((textureData[i+1] >> 8) & 0xff)
258 << "\\x" << ((textureData[i+1] >> 16) & 0xff)
259 << "\\x" << ((textureData[i+1] >> 24) & 0xff)
260 << "\\x" << (textureData[i+2] & 0xff)
261 << "\\x" << ((textureData[i+2] >> 8) & 0xff)
262 << "\\x" << ((textureData[i+2] >> 16) & 0xff)
263 << "\\x" << ((textureData[i+2] >> 24) & 0xff)
264 << "\\x" << (textureData[i+3] & 0xff)
265 << "\\x" << ((textureData[i+3] >> 8) & 0xff)
266 << "\\x" << ((textureData[i+3] >> 16) & 0xff)
267 << "\\x" << ((textureData[i+3] >> 24) & 0xff);
268 cppOut.setFieldWidth(1);
269 cppOut << "\"\n";
270 cppOut.setFieldWidth(2);
271 }
272 cppOut.setIntegerBase(10);
273 cppOut.setFieldWidth(0);
274 cppOut.setPadChar(' ');
275}
71276
72int main(int argc, char* argv[])277int main(int argc, char* argv[])
73{278{
74 if (argc != 3) {279 if (argc != 3) {
75 qWarning("Usage: createshapeimage input_svg output_cpp");280 qWarning("Usage: createshapetextures input_svg output_cpp");
76 return 1;281 return 1;
77 }282 }
78 const char* svgFilename = argv[1];283 const char* svgFilename = argv[1];
@@ -90,142 +295,34 @@
90 return 1;295 return 1;
91 }296 }
92297
298 // Create the textures.
93 QImage shape(reinterpret_cast<uchar*>(shapeData), width, height, width * 4,299 QImage shape(reinterpret_cast<uchar*>(shapeData), width, height, width * 4,
94 QImage::Format_ARGB32_Premultiplied);300 QImage::Format_ARGB32_Premultiplied);
95 QPainter painter(&shape);301 QPainter painter(&shape);
96302 createTexture1(&svg, &painter);
97 // Render and store the distance field used for masking the top of the shape, for masking the303 createTexture2(&svg, &painter);
98 // bevel and for masking the unstyled shape.
99 painter.translate(shapeOffset * width, shapeOffset * width);
100 svg.render(&painter);
101 for (int i = 0; i < size; i++) {
102 shapeNormalized[i] = static_cast<double>(shapeData[i] >> 24) / 255.0;
103 }
104 computegradient(shapeNormalized, width, height, gradientX, gradientY);
105 edtaa3(shapeNormalized, gradientX, gradientY, width, height, distanceX, distanceY,
106 distanceOut);
107 for (int i = 0; i < size; i++) {
108 shapeNormalized[i] = 1.0 - shapeNormalized[i];
109 }
110 memset(gradientX, 0, size * sizeof(double));
111 memset(gradientY, 0, size * sizeof(double));
112 computegradient(shapeNormalized, width, height, gradientX, gradientY);
113 edtaa3(shapeNormalized, gradientX, gradientY, width, height, distanceX, distanceY,
114 distanceIn);
115 for (int i = 0; i < size; i++) {
116 const double distance = qMax(0.0, distanceIn[i]) - qMax(0.0, distanceOut[i]);
117 const uint value = qBound(0, qRound(distance * distanceScale * imageScale + 127.5), 255);
118 imageData[i] = value << 16; // Stored in channel R (exposed as B in the shaders).
119 }
120
121 // Render and store the distance field used for masking the bottom of the shape and for masking
122 // the bevel.
123 memset(shapeData, 0, size * sizeof(uint));
124 painter.resetTransform();
125 painter.translate(shapeOffset * width, (shapeOffset + distanceBottomTY) * width);
126 svg.render(&painter);
127 for (int i = 0; i < size; i++) {
128 shapeNormalized[i] = static_cast<double>(shapeData[i] >> 24) / 255.0;
129 }
130 computegradient(shapeNormalized, width, height, gradientX, gradientY);
131 edtaa3(shapeNormalized, gradientX, gradientY, width, height, distanceX, distanceY,
132 distanceOut);
133 for (int i = 0; i < size; i++) {
134 shapeNormalized[i] = 1.0 - shapeNormalized[i];
135 }
136 memset(gradientX, 0, size * sizeof(double));
137 memset(gradientY, 0, size * sizeof(double));
138 computegradient(shapeNormalized, width, height, gradientX, gradientY);
139 edtaa3(shapeNormalized, gradientX, gradientY, width, height, distanceX, distanceY,
140 distanceIn);
141 for (int i = 0; i < size; i++) {
142 const double distance = qMax(0.0, distanceIn[i]) - qMax(0.0, distanceOut[i]);
143 const uint value = qBound(0, qRound(distance * distanceScale * imageScale + 127.5), 255);
144 imageData[i] |= value << 24; // Stored in channel A.
145 }
146
147 // Render and store the top inner shadow.
148 memset(shapeData, 0, size * sizeof(uint));
149 painter.resetTransform();
150 painter.translate((shapeOffset + shadowTopTX) * width, (shapeOffset + shadowTopTY) * width);
151 svg.render(&painter);
152 for (int i = 0; i < size; i++) {
153 shapeNormalized[i] = 1.0 - (static_cast<double>(shapeData[i] >> 24) / 255.0);
154 }
155 computegradient(shapeNormalized, width, height, gradientX, gradientY);
156 edtaa3(shapeNormalized, gradientX, gradientY, width, height, distanceX, distanceY,
157 distanceIn);
158 for (int i = 0; i < size; i++) {
159 double shadow = qBound(0.0, (distanceIn[i] * shadowScale * imageScale) / 255.0, 1.0);
160 shadow = (1.0 - (2.0 * shadow - shadow * shadow)) * 255.0;
161 const uint value = qBound(0, qRound(shadow * shadowTranslucency), 255);
162 imageData[i] |= value << 0; // Stored in channel B (exposed as R in the shaders).
163 }
164
165 // Render and store the bottom inner shadow.
166 memset(shapeData, 0, size * sizeof(uint));
167 painter.resetTransform();
168 painter.translate(
169 (shapeOffset + shadowBottomTX) * width, (shapeOffset + shadowBottomTY) * width);
170 svg.render(&painter);
171 for (int i = 0; i < size; i++) {
172 shapeNormalized[i] = 1.0 - (static_cast<double>(shapeData[i] >> 24) / 255.0);
173 }
174 computegradient(shapeNormalized, width, height, gradientX, gradientY);
175 edtaa3(shapeNormalized, gradientX, gradientY, width, height, distanceX, distanceY,
176 distanceIn);
177 for (int i = 0; i < size; i++) {
178 double shadow = qBound(0.0, (distanceIn[i] * shadowScale * imageScale) / 255.0, 1.0);
179 shadow = (1.0 - (2.0 * shadow - shadow * shadow)) * 255.0;
180 const uint value = qBound(0, qRound(shadow * shadowTranslucency), 255);
181 imageData[i] |= value << 8; // Stored in channel G.
182 }
183304
184 // Write the C++ file.305 // Write the C++ file.
185 QTextStream cppOut(&cppFile);306 QTextStream cppOut(&cppFile);
186 cppOut << "// Copyright 2015 Canonical Ltd.\n"307 cppOut << "// Copyright 2015 Canonical Ltd.\n"
187 << "// Automatically generated by the createshapeimage tool.\n"308 << "// Automatically generated by the createshapetextures tool.\n"
188 << "\n"309 << "\n"
189 << "static const struct {\n"310 << "const int shapeTextureCount = " << textureCount << ";\n"
190 << " float offset;\n"311 << "const int shapeTextureSize = " << textureSize << ";\n"
191 << " float distanceAA;\n"312 << "const float shapeTextureOffset = " << shapeOffset << ";\n"
192 << " int size;\n"313 << "const int shapeTextureDistanceAA = " << distanceScale << ";\n"
193 << " unsigned char data[" << size * 4 + 1 << "];\n" // + 1 for the string terminator.314 << "\n"
194 << "} shapeTextureInfo = {\n"315 << "static const unsigned char shapeTextureData[" << textureCount
195 << " " << shapeOffset << ",\n"316 << "][" << size * 4 + 1 << "] = {\n"; // + 1 for the string terminator.
196 << " " << distanceScale << ",\n"317 dumpTexture(cppOut, textureData[0]);
197 << " " << width << ",\n";318 cppOut << " ,\n";
198 cppOut.setIntegerBase(16);319 dumpTexture(cppOut, textureData[1]);
199 cppOut.setFieldWidth(2);
200 cppOut.setPadChar('0');
201 for (int i = 0; i < size; i += 4) {
202 cppOut << " \""
203 << "\\x" << (imageData[i] & 0xff)
204 << "\\x" << ((imageData[i] >> 8) & 0xff)
205 << "\\x" << ((imageData[i] >> 16) & 0xff)
206 << "\\x" << ((imageData[i] >> 24) & 0xff)
207 << "\\x" << (imageData[i+1] & 0xff)
208 << "\\x" << ((imageData[i+1] >> 8) & 0xff)
209 << "\\x" << ((imageData[i+1] >> 16) & 0xff)
210 << "\\x" << ((imageData[i+1] >> 24) & 0xff)
211 << "\\x" << (imageData[i+2] & 0xff)
212 << "\\x" << ((imageData[i+2] >> 8) & 0xff)
213 << "\\x" << ((imageData[i+2] >> 16) & 0xff)
214 << "\\x" << ((imageData[i+2] >> 24) & 0xff)
215 << "\\x" << (imageData[i+3] & 0xff)
216 << "\\x" << ((imageData[i+3] >> 8) & 0xff)
217 << "\\x" << ((imageData[i+3] >> 16) & 0xff)
218 << "\\x" << ((imageData[i+3] >> 24) & 0xff);
219 cppOut.setFieldWidth(1);
220 cppOut << "\"\n";
221 cppOut.setFieldWidth(2);
222 }
223 cppOut << "};\n";320 cppOut << "};\n";
224321
225 // Save the file as a PNG for debugging purpose.322 // Save the file as a PNG for debugging purpose.
226 // QImage image(reinterpret_cast<uchar*>(imageData), width, height, width * 4,323 // QImage image(reinterpret_cast<uchar*>(textureData[0]), width, height, width * 4,
227 // QImage::Format_ARGB32);324 // QImage::Format_ARGB32);
228 // image.save("test.png");325 // image.save("texture1.png");
229326
230 return 0;327 return 0;
231}328}
232329
=== modified file 'src/Ubuntu/Components/tools/tools.pro'
--- src/Ubuntu/Components/tools/tools.pro 2015-03-02 18:16:02 +0000
+++ src/Ubuntu/Components/tools/tools.pro 2015-07-27 16:39:42 +0000
@@ -1,5 +1,5 @@
1TEMPLATE = app1TEMPLATE = app
2TARGET = createshapeimage2TARGET = createshapetextures
3QT += gui svg3QT += gui svg
4QMAKE_CXXFLAGS += -Werror -Wno-unused-variable4QMAKE_CXXFLAGS += -Werror -Wno-unused-variable
5SOURCES += createshapeimage.cpp5SOURCES += createshapetextures.cpp
66
=== modified file 'tests/resources/ubuntushape/UbuntuShapeOverlayTest.qml'
--- tests/resources/ubuntushape/UbuntuShapeOverlayTest.qml 2015-07-23 11:49:38 +0000
+++ tests/resources/ubuntushape/UbuntuShapeOverlayTest.qml 2015-07-27 16:39:42 +0000
@@ -25,7 +25,7 @@
2525
26 // Enum to string tables.26 // Enum to string tables.
27 property variant aspectTable: [27 property variant aspectTable: [
28 "Flat", "Inset"28 "Flat", "Inset", "DropShadow"
29 ]29 ]
30 property variant backgroundModeTable: [30 property variant backgroundModeTable: [
31 "SolidColor", "VerticalGradient"31 "SolidColor", "VerticalGradient"
@@ -225,7 +225,7 @@
225 shape.radius = (shape.radius == "large") ? "small" :225 shape.radius = (shape.radius == "large") ? "small" :
226 ((shape.radius == "small") ? "medium" : "large");226 ((shape.radius == "small") ? "medium" : "large");
227 } else if (event.key == Qt.Key_T) {227 } else if (event.key == Qt.Key_T) {
228 shape.aspect = (shape.aspect + 1) % 2;228 shape.aspect = (shape.aspect + 1) % 3;
229 } else if (event.key == Qt.Key_Y) {229 } else if (event.key == Qt.Key_Y) {
230 shape.relativeRadius = Math.max(0.0, Math.min(230 shape.relativeRadius = Math.max(0.0, Math.min(
231 1.0, shape.relativeRadius + ((event.modifiers & shift) ? 0.01 : -0.01)));231 1.0, shape.relativeRadius + ((event.modifiers & shift) ? 0.01 : -0.01)));
232232
=== modified file 'tests/resources/ubuntushape/UbuntuShapeTest.qml'
--- tests/resources/ubuntushape/UbuntuShapeTest.qml 2015-07-23 11:49:38 +0000
+++ tests/resources/ubuntushape/UbuntuShapeTest.qml 2015-07-27 16:39:42 +0000
@@ -25,7 +25,7 @@
2525
26 // Enum to string tables.26 // Enum to string tables.
27 property variant aspectTable: [27 property variant aspectTable: [
28 "Flat", "Inset"28 "Flat", "Inset", "DropShadow"
29 ]29 ]
30 property variant backgroundModeTable: [30 property variant backgroundModeTable: [
31 "SolidColor", "VerticalGradient"31 "SolidColor", "VerticalGradient"
@@ -222,7 +222,7 @@
222 shape.radius = (shape.radius == "large") ? "small" :222 shape.radius = (shape.radius == "large") ? "small" :
223 ((shape.radius == "small") ? "medium" : "large");223 ((shape.radius == "small") ? "medium" : "large");
224 } else if (event.key == Qt.Key_T) {224 } else if (event.key == Qt.Key_T) {
225 shape.aspect = (shape.aspect + 1) % 2;225 shape.aspect = (shape.aspect + 1) % 3;
226 } else if (event.key == Qt.Key_Y) {226 } else if (event.key == Qt.Key_Y) {
227 shape.relativeRadius = Math.max(0.0, Math.min(227 shape.relativeRadius = Math.max(0.0, Math.min(
228 1.0, shape.relativeRadius + ((event.modifiers & shift) ? 0.01 : -0.01)));228 1.0, shape.relativeRadius + ((event.modifiers & shift) ? 0.01 : -0.01)));

Subscribers

People subscribed via source and target branches