Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix stack overflow in offset_bezierpath #3969

Merged
merged 3 commits into from
Jun 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Changelog

## [Unreleased]

- Fix stack overflows when using `markerspace = :data` with `scatter` [#3960](https://github.com/MakieOrg/Makie.jl/issues/3960).
- CairoMakie: Fix broken SVGs when using non-interpolated image primitives, for example Colorbars, with recent Cairo versions [#3967](https://github.com/MakieOrg/Makie.jl/pull/3967).
- CairoMakie: Add argument `pdf_version` to restrict the PDF version when saving a figure as a PDF [#3845](https://github.com/MakieOrg/Makie.jl/pull/3845).
- CairoMakie: Fix incorrect scaling factor for SVGs with Cairo_jll 1.18 [#3964](https://github.com/MakieOrg/Makie.jl/pull/3964).
Expand Down
4 changes: 2 additions & 2 deletions src/utilities/texture_atlas.jl
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,7 @@ function primitive_uv_offset_width(atlas::TextureAtlas, marker::Observable, font
return lift((m, f)-> primitive_uv_offset_width(atlas, m, f), marker, font; ignore_equal_values=true)
end

_bcast(x::Vec) = (x,)
_bcast(x::Vec) = Ref(x)
_bcast(x) = x

# Calculates the scaling factor from unpadded size -> padded size
Expand Down Expand Up @@ -534,7 +534,7 @@ function offset_bezierpath(atlas::TextureAtlas, bp::BezierPath, markersize::Vec2
end

function offset_bezierpath(atlas::TextureAtlas, bp, scale, offset)
return offset_bezierpath.(Ref(atlas), bp, _bcast(scale), _bcast(offset))
return offset_bezierpath.(Ref(atlas), bp, Vec2d.(_bcast(scale)), Vec2d.(_bcast(offset)))
end

function offset_marker(atlas::TextureAtlas, marker::Union{T, AbstractVector{T}}, font, markersize, markeroffset) where T <: BezierPath
Expand Down
13 changes: 13 additions & 0 deletions test/boundingboxes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -145,3 +145,16 @@ end
@test data_limits(p) ≈ bb1
@test boundingbox(p) ≈ bb3
end

@testset "issue 3960" begin
fig = Figure()
ax = Axis(fig[1, 1])
triangle = BezierPath([
MoveTo(Point(0, 0)),
LineTo(Point(1, 0)),
LineTo(Point(0, 1)),
ClosePath()
])
sc = scatter!(ax, Point(0, 0), marker=triangle, markerspace=:data)
data_limits(sc) # doesn't stackoverflow
end
Loading