summaryrefslogtreecommitdiff
path: root/src/mbgl/renderer/line_bucket.cpp
diff options
context:
space:
mode:
authorJohn Firebaugh <john.firebaugh@gmail.com>2016-10-30 11:06:59 -0700
committerJohn Firebaugh <john.firebaugh@gmail.com>2016-11-17 15:13:38 -0800
commit38fcbe21d48186c4630a3b8a76d1b20e156faadd (patch)
tree098f73bfea98deb5202fe1c13b1277e43e322755 /src/mbgl/renderer/line_bucket.cpp
parentd4fc66af3924805d40576989c1e139ddafcc4670 (diff)
downloadqtlocation-mapboxgl-38fcbe21d48186c4630a3b8a76d1b20e156faadd.tar.gz
[core] Convert style properties to a tuple-based approach
This converts the style property classes (CirclePaintProperties and so on) to the same tuple-based approach as gl::Attribute and gl::Uniform. The approach is outlined in https://github.com/mapbox/cpp/blob/master/C%2B%2B%20Structural%20Metaprogramming.md. The main advantage of this approach is it allows writing algorithms that work on sets of style properties, without resorting to code generation or manually repetitive code. This lets us iterate on approaches to data-driven properties more easily. Another advantage is that the cascading, unevaluated, and evaluated states of a set of properties exist as independent structures, instead of individual properties holding their own state. This is a more functional approach that makes data flow clearer and reduces state.
Diffstat (limited to 'src/mbgl/renderer/line_bucket.cpp')
-rw-r--r--src/mbgl/renderer/line_bucket.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/mbgl/renderer/line_bucket.cpp b/src/mbgl/renderer/line_bucket.cpp
index 554fef5ca7..007060bd1b 100644
--- a/src/mbgl/renderer/line_bucket.cpp
+++ b/src/mbgl/renderer/line_bucket.cpp
@@ -64,7 +64,7 @@ void LineBucket::addGeometry(const GeometryCoordinates& coordinates) {
return;
}
- const float miterLimit = layout.lineJoin == LineJoinType::Bevel ? 1.05f : float(layout.lineMiterLimit);
+ const float miterLimit = layout.get<LineJoin>() == LineJoinType::Bevel ? 1.05f : float(layout.get<LineMiterLimit>());
const double sharpCornerOffset = SHARP_CORNER_OFFSET * (float(util::EXTENT) / (util::tileSize * overscaling));
@@ -77,8 +77,8 @@ void LineBucket::addGeometry(const GeometryCoordinates& coordinates) {
return;
}
- const LineCapType beginCap = layout.lineCap;
- const LineCapType endCap = closed ? LineCapType::Butt : LineCapType(layout.lineCap);
+ const LineCapType beginCap = layout.get<LineCap>();
+ const LineCapType endCap = closed ? LineCapType::Butt : LineCapType(layout.get<LineCap>());
double distance = 0;
bool startOfLine = true;
@@ -171,12 +171,12 @@ void LineBucket::addGeometry(const GeometryCoordinates& coordinates) {
// The join if a middle vertex, otherwise the cap
const bool middleVertex = prevCoordinate && nextCoordinate;
- LineJoinType currentJoin = layout.lineJoin;
+ LineJoinType currentJoin = layout.get<LineJoin>();
const LineCapType currentCap = nextCoordinate ? beginCap : endCap;
if (middleVertex) {
if (currentJoin == LineJoinType::Round) {
- if (miterLength < layout.lineRoundLimit) {
+ if (miterLength < layout.get<LineRoundLimit>()) {
currentJoin = LineJoinType::Miter;
} else if (miterLength <= 2) {
currentJoin = LineJoinType::FakeRound;