[core] Replaced raw values with util::tileSize
This commit is contained in:
@@ -58,7 +58,7 @@ void LineBucket::addGeometry(const GeometryCoordinates& vertices) {
|
||||
|
||||
const float miterLimit = layout.join == JoinType::Bevel ? 1.05f : float(layout.miterLimit);
|
||||
|
||||
const double sharpCornerOffset = SHARP_CORNER_OFFSET * (util::EXTENT / (512.0 * overscaling));
|
||||
const double sharpCornerOffset = SHARP_CORNER_OFFSET * (util::EXTENT / (util::tileSize * overscaling));
|
||||
|
||||
const GeometryCoordinate firstVertex = vertices.front();
|
||||
const GeometryCoordinate lastVertex = vertices[len - 1];
|
||||
|
||||
@@ -99,13 +99,11 @@ void Painter::renderFill(FillBucket& bucket, const FillLayer& layer, const TileI
|
||||
(int)((*posB).size[1] * properties.pattern.value.toScale)
|
||||
}};
|
||||
|
||||
int tileSize = 512;
|
||||
float offsetAx = (std::fmod(util::tileSize, imageSizeScaledA[0]) * id.x) / (float)imageSizeScaledA[0];
|
||||
float offsetAy = (std::fmod(util::tileSize, imageSizeScaledA[1]) * id.y) / (float)imageSizeScaledA[1];
|
||||
|
||||
float offsetAx = ((tileSize % imageSizeScaledA[0]) * id.x) / (float)imageSizeScaledA[0];
|
||||
float offsetAy = ((tileSize % imageSizeScaledA[1]) * id.y) / (float)imageSizeScaledA[1];
|
||||
|
||||
float offsetBx = ((tileSize % imageSizeScaledB[0]) * id.x) / (float)imageSizeScaledB[0];
|
||||
float offsetBy = ((tileSize % imageSizeScaledB[1]) * id.y) / (float)imageSizeScaledB[1];
|
||||
float offsetBx = (std::fmod(util::tileSize, imageSizeScaledB[0]) * id.x) / (float)imageSizeScaledB[0];
|
||||
float offsetBy = (std::fmod(util::tileSize, imageSizeScaledB[1]) * id.y) / (float)imageSizeScaledB[1];
|
||||
|
||||
patternShader->u_offset_a = std::array<float, 2>{{offsetAx, offsetAy}};
|
||||
patternShader->u_offset_b = std::array<float, 2>{{offsetBx, offsetBy}};
|
||||
|
||||
@@ -51,7 +51,7 @@ void Painter::renderLine(LineBucket& bucket, const LineLayer& layer, const TileI
|
||||
color[2] *= properties.opacity;
|
||||
color[3] *= properties.opacity;
|
||||
|
||||
float ratio = state.getScale() / std::pow(2, id.z) / (util::EXTENT / (512.0 * id.overscaling()));
|
||||
float ratio = state.getScale() / std::pow(2, id.z) / (util::EXTENT / (util::tileSize * id.overscaling()));
|
||||
|
||||
mat2 antialiasingMatrix;
|
||||
matrix::identity(antialiasingMatrix);
|
||||
@@ -111,7 +111,7 @@ void Painter::renderLine(LineBucket& bucket, const LineLayer& layer, const TileI
|
||||
if (!imagePosA || !imagePosB)
|
||||
return;
|
||||
|
||||
float factor = util::EXTENT / (512 * id.overscaling()) / std::pow(2, state.getIntegerZoom() - id.z);
|
||||
float factor = util::EXTENT / (util::tileSize * id.overscaling()) / std::pow(2, state.getIntegerZoom() - id.z);
|
||||
|
||||
config.program = linepatternShader->getID();
|
||||
|
||||
|
||||
@@ -57,8 +57,11 @@ SymbolInstance::SymbolInstance(Anchor& anchor, const GeometryCoordinates& line,
|
||||
|
||||
|
||||
SymbolBucket::SymbolBucket(float overscaling_, float zoom_, const MapMode mode_)
|
||||
: overscaling(overscaling_), zoom(zoom_), tileSize(512 * overscaling_), tilePixelRatio(util::EXTENT / tileSize), mode(mode_) {
|
||||
}
|
||||
: overscaling(overscaling_),
|
||||
zoom(zoom_),
|
||||
tileSize(util::tileSize * overscaling_),
|
||||
tilePixelRatio(util::EXTENT / tileSize),
|
||||
mode(mode_) {}
|
||||
|
||||
SymbolBucket::~SymbolBucket() {
|
||||
// Do not remove. header file only contains forward definitions to unique pointers.
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#include <mbgl/util/mapbox.hpp>
|
||||
#include <mbgl/util/constants.hpp>
|
||||
#include <mbgl/platform/log.hpp>
|
||||
|
||||
#include <stdexcept>
|
||||
@@ -162,7 +163,7 @@ std::string canonicalizeTileURL(const std::string& url, SourceType type, uint16_
|
||||
std::string result = "mapbox://tiles/" + tileset + "/{z}/{x}/{y}";
|
||||
|
||||
if (type == SourceType::Raster) {
|
||||
result += tileSize == 512 ? "@2x" : "{ratio}";
|
||||
result += tileSize == util::tileSize ? "@2x" : "{ratio}";
|
||||
}
|
||||
|
||||
result += "." + extension;
|
||||
|
||||
Reference in New Issue
Block a user