From 0d6bca0e7e46588f57b178a4593fdb02f5c4592f Mon Sep 17 00:00:00 2001 From: Lauren Budorick Date: Sun, 26 Oct 2014 17:31:06 -0400 Subject: [PATCH] line-offset -> line-gap-width --- include/mbgl/style/property_key.hpp | 2 +- include/mbgl/style/style_properties.hpp | 2 +- src/renderer/painter_line.cpp | 3 ++- src/style/property_fallback.cpp | 2 +- src/style/style_layer.cpp | 2 +- src/style/style_parser.cpp | 4 ++-- 6 files changed, 8 insertions(+), 7 deletions(-) diff --git a/include/mbgl/style/property_key.hpp b/include/mbgl/style/property_key.hpp index cbf9ad2ac..efeebf024 100644 --- a/include/mbgl/style/property_key.hpp +++ b/include/mbgl/style/property_key.hpp @@ -21,7 +21,7 @@ enum class PropertyKey { LineTranslateY, LineTranslateAnchor, LineWidth, - LineOffset, + LineGapWidth, LineBlur, LineDashArray, // for transitions only LineDashLand, diff --git a/include/mbgl/style/style_properties.hpp b/include/mbgl/style/style_properties.hpp index 0a5e99341..c44b7c34c 100644 --- a/include/mbgl/style/style_properties.hpp +++ b/include/mbgl/style/style_properties.hpp @@ -34,7 +34,7 @@ struct LineProperties { std::array translate = {{ 0, 0 }}; TranslateAnchorType translateAnchor = TranslateAnchorType::Map; float width = 1; - float offset = 0; + float gap_width = 0; float blur = 0; std::array dash_array = {{ 1, -1 }}; std::string image; diff --git a/src/renderer/painter_line.cpp b/src/renderer/painter_line.cpp index 9893f032d..93d8db1a5 100644 --- a/src/renderer/painter_line.cpp +++ b/src/renderer/painter_line.cpp @@ -17,7 +17,8 @@ void Painter::renderLine(LineBucket& bucket, util::ptr layer_desc, c float antialiasing = 1 / state.getPixelRatio(); float width = properties.width; - float offset = properties.offset / 2; + float offset = properties.gap_width / 2; + offset = offset == 0 ? offset : offset + width / 2; float blur = properties.blur + antialiasing; // These are the radii of the line. We are limiting it to 16, which will result diff --git a/src/style/property_fallback.cpp b/src/style/property_fallback.cpp index 572c4b7a8..965baf6c4 100644 --- a/src/style/property_fallback.cpp +++ b/src/style/property_fallback.cpp @@ -18,7 +18,7 @@ const std::map PropertyFallbackValue::properties = { { PropertyKey::LineTranslateY, defaultStyleProperties().translate[1] }, { PropertyKey::LineTranslateAnchor, defaultStyleProperties().translateAnchor }, { PropertyKey::LineWidth, defaultStyleProperties().width }, - { PropertyKey::LineOffset, defaultStyleProperties().offset }, + { PropertyKey::LineGapWidth, defaultStyleProperties().gap_width }, { PropertyKey::LineBlur, defaultStyleProperties().blur }, { PropertyKey::LineDashLand, defaultStyleProperties().dash_array[0] }, { PropertyKey::LineDashGap, defaultStyleProperties().dash_array[1] }, diff --git a/src/style/style_layer.cpp b/src/style/style_layer.cpp index ded73c044..e58756afa 100644 --- a/src/style/style_layer.cpp +++ b/src/style/style_layer.cpp @@ -183,7 +183,7 @@ void StyleLayer::applyStyleProperties(const float z, const times applyTransitionedStyleProperty(PropertyKey::LineTranslateY, line.translate[1], z, now); applyStyleProperty(PropertyKey::LineTranslateAnchor, line.translateAnchor, z, now); applyTransitionedStyleProperty(PropertyKey::LineWidth, line.width, z, now); - applyTransitionedStyleProperty(PropertyKey::LineOffset, line.offset, z, now); + applyTransitionedStyleProperty(PropertyKey::LineGapWidth, line.gap_width, z, now); applyTransitionedStyleProperty(PropertyKey::LineBlur, line.blur, z, now); applyTransitionedStyleProperty(PropertyKey::LineDashLand, line.dash_array[0], z, now); applyTransitionedStyleProperty(PropertyKey::LineDashGap, line.dash_array[1], z, now); diff --git a/src/style/style_parser.cpp b/src/style/style_parser.cpp index 47ff0c30a..5c4ed0cb1 100644 --- a/src/style/style_parser.cpp +++ b/src/style/style_parser.cpp @@ -586,8 +586,8 @@ void StyleParser::parseStyle(JSVal value, ClassProperties &klass) { parseOptionalProperty("line-translate-anchor", Key::LineTranslateAnchor, klass, value); parseOptionalProperty>("line-width", Key::LineWidth, klass, value); parseOptionalProperty("line-width-transition", Key::LineWidth, klass, value); - parseOptionalProperty>("line-offset", Key::LineOffset, klass, value); - parseOptionalProperty("line-offset-transition", Key::LineOffset, klass, value); + parseOptionalProperty>("line-gap-width", Key::LineGapWidth, klass, value); + parseOptionalProperty("line-gap-width-transition", Key::LineGapWidth, klass, value); parseOptionalProperty>("line-blur", Key::LineBlur, klass, value); parseOptionalProperty("line-blur-transition", Key::LineBlur, klass, value); parseOptionalProperty>("line-dasharray", { Key::LineDashLand, Key::LineDashGap }, klass, value);