Skip to content

Commit

Permalink
Fix border rendering in transparent views (#147)
Browse files Browse the repository at this point in the history
* Fix border rendering in transparent views

* This馃憦is馃憦why馃憦you馃憦don't馃憦push馃憦untested馃憦code
  • Loading branch information
OhadRau authored and bryphe committed Dec 24, 2018
1 parent 99c6908 commit cca02e3
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions src/UI/ViewNode.re
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ let renderBorders =
Shaders.CompiledShader.setUniformMatrix4fv(solidShader, "uProjection", m);
Shaders.CompiledShader.setUniformMatrix4fv(solidShader, "uWorld", world);

if (topBorderWidth != 0.) {
if (topBorderWidth != 0. && tbc.a > 0.001) {
Shaders.CompiledShader.setUniform4fv(
solidShader,
"uColor",
Expand Down Expand Up @@ -85,7 +85,7 @@ let renderBorders =
};
};

if (leftBorderWidth != 0.) {
if (leftBorderWidth != 0. && lbc.a > 0.001) {
Shaders.CompiledShader.setUniform4fv(
solidShader,
"uColor",
Expand Down Expand Up @@ -126,7 +126,7 @@ let renderBorders =
};
};

if (rightBorderWidth != 0.) {
if (rightBorderWidth != 0. && rbc.a > 0.001) {
Shaders.CompiledShader.setUniform4fv(
solidShader,
"uColor",
Expand Down Expand Up @@ -167,7 +167,7 @@ let renderBorders =
};
};

if (bottomBorderWidth != 0.) {
if (bottomBorderWidth != 0. && bbc.a > 0.001) {
Shaders.CompiledShader.setUniform4fv(
solidShader,
"uColor",
Expand Down Expand Up @@ -237,20 +237,20 @@ class viewNode (()) = {

let c = Color.multiplyAlpha(opacity, style.backgroundColor);

let world = _this#getWorldTransform();
let borderedWorld =
renderBorders(
~style,
~width,
~height,
~opacity,
~solidShader,
~m,
~world,
);

/* Only render if _not_ transparent */
if (c.a > 0.001) {
let world = _this#getWorldTransform();
let borderedWorld =
renderBorders(
~style,
~width,
~height,
~opacity,
~solidShader,
~m,
~world,
);

Shaders.CompiledShader.use(solidShader);
Shaders.CompiledShader.setUniformMatrix4fv(
solidShader,
Expand Down

0 comments on commit cca02e3

Please sign in to comment.