on xenial help sign in
Implement overlayColor support
de2b9e7Albert 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"]
19+var components = ["title", "art", "subtitle", "mascot", "emblem", "old-price", "price", "alt-price", "rating", "alt-rating", "summary", "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, \
@@ -59,6 +60,7 @@ var fullMapping = ' \
59 "art": "art", \
60 "art": "art", \
60 "subtitle": "subtitle", \
61 "subtitle": "subtitle", \
61 "mascot": "mascot", \
62 "mascot": "mascot", \
63+ "overlayColor": "overlayColor", \
62 "summary": "summary" \
64 "summary": "summary" \
63}'
65}'
64
66