on xenial help sign in
Dash: Implement OverlayColor support in Cards
c316d84Albert Astals
plugins/Dash/CardCreator.js+3−2
@@ -114,7 +114,7 @@ var kOverlayLoaderCode = 'Loader { \n\
114 sourceComponent: ShaderEffect { \n\
114 sourceComponent: ShaderEffect { \n\
115 id: overlay; \n\
115 id: overlay; \n\
116 height: (fixedHeaderHeight > 0 ? fixedHeaderHeight : headerHeight) + units.gu(2); \n\
116 height: (fixedHeaderHeight > 0 ? fixedHeaderHeight : headerHeight) + units.gu(2); \n\
117− opacity: 0.6; \n\
117+ property color overlayColor: cardData && cardData["overlayColor"] || "#99000000"; \n\
118 property var source: ShaderEffectSource { \n\
118 property var source: ShaderEffectSource { \n\
119 id: shaderSource; \n\
119 id: shaderSource; \n\
120 sourceItem: artShapeLoader.item; \n\
120 sourceItem: artShapeLoader.item; \n\
@@ -135,9 +135,10 @@ var kOverlayLoaderCode = 'Loader { \n\
135 varying highp vec2 coord; \n\
135 varying highp vec2 coord; \n\
136 uniform sampler2D source; \n\
136 uniform sampler2D source; \n\
137 uniform lowp float qt_Opacity; \n\
137 uniform lowp float qt_Opacity; \n\
138+ uniform highp vec4 overlayColor; \n\
138 void main() { \n\
139 void main() { \n\
139 lowp vec4 tex = texture2D(source, coord); \n\
140 lowp vec4 tex = texture2D(source, coord); \n\
140− gl_FragColor = vec4(0, 0, 0, tex.a) * qt_Opacity; \n\
141+ gl_FragColor = vec4(overlayColor.r, overlayColor.g, overlayColor.b, 1) * qt_Opacity * overlayColor.a * tex.a; \n\
141 }"; \n\
142 }"; \n\
142 } \n\
143 } \n\
143 }\n';
144 }\n';
tests/qmltests/Dash/CardHelpers.js+3−1
@@ -16,7 +16,7 @@
16
16
17.pragma library
17.pragma library
18
18
19−var components = ["title", "art", "subtitle", "mascot", "emblem", "old-price", "price", "alt-price", "rating", "alt-rating", "summary", "attributes"]
19+var components = ["title", "art", "subtitle", "mascot", "emblem", "old-price", "price", "alt-price", "rating", "alt-rating", "summary", "attributes", "overlayColor"]
20
20
21var defaultLayout = ' \
21var defaultLayout = ' \
22{ \
22{ \
@@ -35,6 +35,7 @@ var defaultLayout = ' \
35 "fill-mode": "crop" \
35 "fill-mode": "crop" \
36 }, \
36 }, \
37 "subtitle": null, \
37 "subtitle": null, \
38+ "overlayColor": null, \
38 "mascot": null, \
39 "mascot": null, \
39 "emblem": null, \
40 "emblem": null, \
40 "old-price": null, \
41 "old-price": null, \
@@ -60,6 +61,7 @@ var fullMapping = ' \
60 "art": "art", \
61 "art": "art", \
61 "subtitle": "subtitle", \
62 "subtitle": "subtitle", \
62 "mascot": "mascot", \
63 "mascot": "mascot", \
64+ "overlayColor": "overlayColor", \
63 "summary": "summary", \
65 "summary": "summary", \
64 "attributes": "attributes" \
66 "attributes": "attributes" \
65}'
67}'