Skip to content
This repository was archived by the owner on Mar 23, 2019. It is now read-only.

Add support for circle-stroke-* properties - #39

Merged
lucaswoj merged 3 commits into
masterfrom
circle-stroke
Nov 29, 2016
Merged

lucaswoj merged 3 commits into
masterfrom
circle-stroke

Conversation

@lucaswoj

Copy link
Copy Markdown

No description provided.

Comment thread src/circle.vertex.glsl Outdated
uniform mat4 u_matrix;
uniform bool u_scale_with_map;
uniform vec2 u_extrude_scale;
uniform float u_devicepixelratio;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we use a uniform here instead of DEVICE_PIXEL_RATIO?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch! I think these lines were introduced by a git merge. I'll remove them now.

Comment thread src/circle.vertex.glsl Outdated
#define lowp
#define mediump
#define highp
#endif

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These lines were also erroneously introduced by a merge ☝️

Comment thread src/circle.fragment.glsl Outdated
float color_t = stroke_width < 0.01 ? 0.0 : smoothstep(
-max(blur, v_antialiasblur),
0.0,
length(v_extrude) - radius / (radius + stroke_width)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we cache -max(blur, v_antialiasblur) and length(v_extrude) so that they're not computed twice?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes! From a little research, that doesn't appear that all GLSL compilers implement common subexpression elimination.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in the latest commit.

Comment thread src/circle.fragment.glsl Outdated
color * opacity,
stroke_color * stroke_opacity,
color_t
);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I personally find one-line constructs like this easier to read and skim through.

gl_FragColor = opacity_t * mix(color * opacity, stroke_color * stroke_opacity, color_t);

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in the latest commit.

@lucaswoj
lucaswoj merged commit 2673353 into master Nov 29, 2016
@lucaswoj
lucaswoj deleted the circle-stroke branch November 29, 2016 21:16
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants