on xenial help sign in
Implement overlayColor support
commitde2b9e7774380b1f5535362f0100a58989fae465 authorAlbert Astals <albert.astals@canonical.com> dateThu 24 Jul 2014, 17:46 (12 years ago) parentb6247b4
2 files changed+6−3
plugins/Dash/CardCreator.js+3−2 tests/qmltests/Dash/CardHelpers.js+3−1
plugins/Dash/CardCreator.js+3−2
@@ -114,7 +114,7 @@ var kOverlayLoaderCode = 'Loader { \n\
114114 sourceComponent: ShaderEffect { \n\
115115 id: overlay; \n\
116116 height: (fixedHeaderHeight > 0 ? fixedHeaderHeight : headerHeight) + units.gu(2); \n\
117− opacity: 0.6; \n\
117+ property color overlayColor: cardData && cardData["overlayColor"] || "#99000000"; \n\
118118 property var source: ShaderEffectSource { \n\
119119 id: shaderSource; \n\
120120 sourceItem: artShapeLoader.item; \n\
@@ -135,9 +135,10 @@ var kOverlayLoaderCode = 'Loader { \n\
135135 varying highp vec2 coord; \n\
136136 uniform sampler2D source; \n\
137137 uniform lowp float qt_Opacity; \n\
138+ uniform highp vec4 overlayColor; \n\
138139 void main() { \n\
139140 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\
141142 }"; \n\
142143 } \n\
143144 }\n';
tests/qmltests/Dash/CardHelpers.js+3−1
@@ -16,7 +16,7 @@
1616
1717.pragma library
1818
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"]
2020
2121var defaultLayout = ' \
2222{ \
@@ -35,6 +35,7 @@ var defaultLayout = ' \
3535 "fill-mode": "crop" \
3636 }, \
3737 "subtitle": null, \
38+ "overlayColor": null, \
3839 "mascot": null, \
3940 "emblem": null, \
4041 "old-price": null, \
@@ -59,6 +60,7 @@ var fullMapping = ' \
5960 "art": "art", \
6061 "subtitle": "subtitle", \
6162 "mascot": "mascot", \
63+ "overlayColor": "overlayColor", \
6264 "summary": "summary" \
6365}'
6466