Merge lp:~loic.molinari/ubuntu-ui-toolkit/ubuntu-ui-toolkit-drop-shadow-support-to-shape-overlay into lp:ubuntu-ui-toolkit/staging

Proposed by Loïc Molinari
Status: Merged
Approved by: Tim Peeters
Approved revision: 1587
Merged at revision: 1589
Proposed branch: lp:~loic.molinari/ubuntu-ui-toolkit/ubuntu-ui-toolkit-drop-shadow-support-to-shape-overlay
Merge into: lp:ubuntu-ui-toolkit/staging
Prerequisite: lp:~loic.molinari/ubuntu-ui-toolkit/ubuntu-ui-toolkit-shape-content-orientation-workaround-removal
Diff against target: 36 lines (+17/-2)
1 file modified
src/Ubuntu/Components/plugin/shaders/shapeoverlay.frag (+17/-2)
To merge this branch: bzr merge lp:~loic.molinari/ubuntu-ui-toolkit/ubuntu-ui-toolkit-drop-shadow-support-to-shape-overlay
Reviewer Review Type Date Requested Status
Tim Peeters Approve
PS Jenkins bot continuous-integration Approve
Review via email: mp+266531@code.launchpad.net

Commit message

[UbuntuShape] Added support drop shadow aspect support to UbuntuShapeOverlay.

Description of the change

[UbuntuShape] Added support drop shadow aspect support to UbuntuShapeOverlay.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Tim Peeters (tpeeters) wrote :

good, thanks.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/Ubuntu/Components/plugin/shaders/shapeoverlay.frag'
--- src/Ubuntu/Components/plugin/shaders/shapeoverlay.frag 2015-07-31 10:32:16 +0000
+++ src/Ubuntu/Components/plugin/shaders/shapeoverlay.frag 2015-07-31 10:32:16 +0000
@@ -37,8 +37,9 @@
37varying mediump vec2 overlayCoord;37varying mediump vec2 overlayCoord;
38varying lowp vec4 overlayColor;38varying lowp vec4 overlayColor;
3939
40const mediump int FLAT = 0x08; // 1 << 340const mediump int FLAT = 0x08; // 1 << 3
41const mediump int INSET = 0x10; // 1 << 441const mediump int INSET = 0x10; // 1 << 4
42const mediump int DROP_SHADOW = 0x20; // 1 << 5
4243
43void main(void)44void main(void)
44{45{
@@ -96,6 +97,20 @@
96 // Mask the current color then blend the bevel over the resulting color. We simply use97 // Mask the current color then blend the bevel over the resulting color. We simply use
97 // additive blending since the bevel has already been masked.98 // additive blending since the bevel has already been masked.
98 color = (color * vec4(mask[int(shapeSide)])) + vec4(bevel);99 color = (color * vec4(mask[int(shapeSide)])) + vec4(bevel);
100
101 } else if (aspect == DROP_SHADOW) {
102 // The vertex layout of the shape is made so that the derivative is negative from top to
103 // middle and positive from middle to bottom.
104 lowp int shapeSide = dfdt * dfdtFactor <= 0.0 ? 0 : 1;
105 // Get the anti-aliased and resolution independent shape mask using distance fields.
106 lowp float distanceMin = abs(dfdt) * -distanceAA + 0.5;
107 lowp float distanceMax = abs(dfdt) * distanceAA + 0.5;
108 lowp float mask = smoothstep(distanceMin, distanceMax, shapeData[shapeSide]);
109 // Get the shadow color outside of the shape mask.
110 lowp float shadow = (shapeData.b * -mask) + shapeData.b; // -ab + a = a(1 - b)
111 // Mask the current color then blend the shadow over the resulting color. We simply use
112 // additive blending since the shadow has already been masked.
113 color = (color * vec4(mask)) + vec4(0.0, 0.0, 0.0, shadow);
99 }114 }
100115
101 gl_FragColor = color * opacityFactors.xxxy;116 gl_FragColor = color * opacityFactors.xxxy;

Subscribers

People subscribed via source and target branches