Skip to content
This repository was archived by the owner on Aug 8, 2023. It is now read-only.

Commit 5499913

Browse files
committed
[core] Double maximum label width by reducing glyph precision.
Fixes issue #11507. Port of GL JS PR #6375.
1 parent 61e6e62 commit 5499913

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

src/mbgl/programs/symbol_program.hpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ struct SymbolLayoutAttributes : gl::Attributes<
6161
{{
6262
static_cast<int16_t>(labelAnchor.x),
6363
static_cast<int16_t>(labelAnchor.y),
64-
static_cast<int16_t>(::round(o.x * 64)), // use 1/64 pixels for placement
65-
static_cast<int16_t>(::round((o.y + glyphOffsetY) * 64))
64+
static_cast<int16_t>(::round(o.x * 32)), // use 1/32 pixels for placement
65+
static_cast<int16_t>(::round((o.y + glyphOffsetY) * 32))
6666
}},
6767
{{
6868
tx,

src/mbgl/shaders/symbol_icon.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ void main() {
105105
mat2 rotation_matrix = mat2(angle_cos, -1.0 * angle_sin, angle_sin, angle_cos);
106106
107107
vec4 projected_pos = u_label_plane_matrix * vec4(a_projected_pos.xy, 0.0, 1.0);
108-
gl_Position = u_gl_coord_matrix * vec4(projected_pos.xy / projected_pos.w + rotation_matrix * (a_offset / 64.0 * fontScale), 0.0, 1.0);
108+
gl_Position = u_gl_coord_matrix * vec4(projected_pos.xy / projected_pos.w + rotation_matrix * (a_offset / 32.0 * fontScale), 0.0, 1.0);
109109
110110
v_tex = a_tex / u_texsize;
111111
vec2 fade_opacity = unpack_opacity(a_fade_opacity);

src/mbgl/shaders/symbol_sdf.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ void main() {
183183
mat2 rotation_matrix = mat2(angle_cos, -1.0 * angle_sin, angle_sin, angle_cos);
184184
185185
vec4 projected_pos = u_label_plane_matrix * vec4(a_projected_pos.xy, 0.0, 1.0);
186-
gl_Position = u_gl_coord_matrix * vec4(projected_pos.xy / projected_pos.w + rotation_matrix * (a_offset / 64.0 * fontScale), 0.0, 1.0);
186+
gl_Position = u_gl_coord_matrix * vec4(projected_pos.xy / projected_pos.w + rotation_matrix * (a_offset / 32.0 * fontScale), 0.0, 1.0);
187187
float gamma_scale = gl_Position.w;
188188
189189
vec2 tex = a_tex / u_texsize;

0 commit comments

Comments
 (0)