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

Breaking release 0.22 #4477

Draft
wants to merge 19 commits into
base: master
Choose a base branch
from
Draft
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
4 changes: 2 additions & 2 deletions .github/workflows/Docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ on:
pull_request:
branches:
- master
- breaking-0.21
- breaking-0.22
push:
tags:
- '*'
branches:
- master
- breaking-0.21

workflow_dispatch:

concurrency:
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:
- '*.md'
branches:
- master
- breaking-0.22
push:
tags:
- '*'
Expand Down Expand Up @@ -46,6 +47,9 @@ jobs:
pkg"registry up"
Pkg.update()
pkg"dev . ./MakieCore"
pkg"add GeometryBasics#master"
pkg"add MeshIO#ff/GeometryBasics_refactor"
pkg"add ShaderAbstractions#ff/GeometryBasics_refactor"
Pkg.test("Makie"; coverage=true)
- uses: julia-actions/julia-processcoverage@v1
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/compilation-benchmark.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:
- '*.md'
branches:
- master
- breaking-0.22

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
Expand Down
10 changes: 10 additions & 0 deletions .github/workflows/reference_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:
- '*.md'
branches:
- master
- breaking-0.22
push:
tags:
- '*'
Expand Down Expand Up @@ -45,6 +46,9 @@ jobs:
# dev mono repo versions
pkg"registry up"
Pkg.update()
pkg"add MeshIO#ff/GeometryBasics_refactor"
pkg"add GeometryBasics#master"
pkg"add ShaderAbstractions#ff/GeometryBasics_refactor"
pkg"dev . ./MakieCore ./CairoMakie ./ReferenceTests"
- name: Run the tests
continue-on-error: true
Expand Down Expand Up @@ -95,6 +99,9 @@ jobs:
# dev mono repo versions
pkg"registry up"
Pkg.update()
pkg"add MeshIO#ff/GeometryBasics_refactor"
pkg"add GeometryBasics#master"
pkg"add ShaderAbstractions#ff/GeometryBasics_refactor"
pkg"dev . ./MakieCore ./GLMakie ./ReferenceTests"
- name: Run the tests
id: referencetests
Expand Down Expand Up @@ -145,6 +152,9 @@ jobs:
# dev mono repo versions
pkg"registry up"
Pkg.update()
pkg"add MeshIO#ff/GeometryBasics_refactor"
pkg"add GeometryBasics#master"
pkg"add ShaderAbstractions#ff/GeometryBasics_refactor"
pkg"dev . ./MakieCore ./WGLMakie ./ReferenceTests"
- name: Run the tests
continue-on-error: true
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/relocatability.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:
- '*.md'
branches:
- master
- breaking-0.22
push:
tags:
- '*'
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/rprmakie.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:
- '*.md'
branches:
- master
- breaking-0.22
push:
tags:
- '*'
Expand Down Expand Up @@ -43,6 +44,9 @@ jobs:
using Pkg;
pkg"registry up"
Pkg.update()
pkg"add GeometryBasics#master"
pkg"add MeshIO#ff/GeometryBasics_refactor"
pkg"add ShaderAbstractions#ff/GeometryBasics_refactor"
# dev mono repo versions
pkg"dev . ./MakieCore ./RPRMakie ./ReferenceTests"
- name: Run the tests
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
if the width is exceeded [#4293](https://github.com/MakieOrg/Makie.jl/pull/4293)
- Changed image, heatmap and surface picking indices to correctly index the relevant matrix arguments. [#4459](https://github.com/MakieOrg/Makie.jl/pull/4459)
- Improved performance of `record` by avoiding unnecessary copying in common cases [#4475](https://github.com/MakieOrg/Makie.jl/pull/4475).
- Updated to GeoemtryBasic 0.5 [#4319](https://github.com/MakieOrg/Makie.jl/pull/4319)
- Fix usage of `AggMean()` and other aggregations operating on 3d data for `datashader` [#4346](https://github.com/MakieOrg/Makie.jl/pull/4346).
- Use polys for axis3 [#4463](https://github.com/MakieOrg/Makie.jl/pull/4463).
- Changed default for `circular_rotation` in Camera3D to false, so that the camera doesn't change rotation direction anymore [4492](https://github.com/MakieOrg/Makie.jl/pull/4492)
Expand Down
4 changes: 2 additions & 2 deletions CairoMakie/Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "CairoMakie"
uuid = "13f3f980-e62b-5c42-98c6-ff1f3baf88f0"
author = ["Simon Danisch <[email protected]>"]
version = "0.12.14"
version = "0.13.0"

[deps]
CRC32c = "8bf52ea8-c179-5cab-976a-9e18b702a9bc"
Expand All @@ -24,7 +24,7 @@ FileIO = "1.1"
FreeType = "3, 4.0"
GeometryBasics = "0.4.11"
LinearAlgebra = "1.0, 1.6"
Makie = "=0.21.14"
Makie = "=0.22.0"
PrecompileTools = "1.0"
julia = "1.3"

Expand Down
2 changes: 1 addition & 1 deletion CairoMakie/src/display.jl
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ function Makie.backend_show(screen::Screen{SVG}, io::IO, ::MIME"image/svg+xml",
# xlink:href="someid" (but not xlink:href="data:someothercontent" which is how image data is attached)
# url(#someid)
svg = replace(svg, r"((?:(?:id|xlink:href)=\"(?!data:)[^\"]+)|url\(#[^)]+)" => SubstitutionString("\\1-$salt"))

print(io, svg)
return screen
end
Expand Down
16 changes: 10 additions & 6 deletions CairoMakie/src/overrides.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ function draw_plot(scene::Scene, screen::Screen, poly::Poly)
# dispatch on input arguments to poly to use smarter drawing methods than
# meshes if possible.
# however, since recipes exist, we can't explicitly handle all cases here
# so, we should also take a look at converted
# so, we should also take a look at converted
# First, we check whether a `draw_poly` method exists for the input arguments
# before conversion:
return if Base.hasmethod(draw_poly, Tuple{Scene, Screen, typeof(poly), typeof.(to_value.(poly.args))...})
Expand Down Expand Up @@ -85,10 +85,14 @@ draw_poly(scene::Scene, screen::Screen, poly, rect::Rect2) = draw_poly(scene, sc
draw_poly(scene::Scene, screen::Screen, poly, bezierpath::BezierPath) = draw_poly(scene, screen, poly, [bezierpath])

function draw_poly(scene::Scene, screen::Screen, poly, shapes::Vector{<:Union{Rect2, BezierPath}})
model = poly.model[]
space = to_value(get(poly, :space, :data))
clipped_shapes = clip_shape.(Ref(poly.clip_planes[]), shapes, space, Ref(model))
projected_shapes = project_shape.(Ref(poly), space, clipped_shapes, Ref(model))
model = poly.model[]::Mat4d
space = to_value(get(poly, :space, :data))::Symbol
planes = poly.clip_planes[]::Vector{Plane3f}

projected_shapes = map(shapes) do shape
clipped = clip_shape(planes, shape, space, model)
return project_shape(poly, space, clipped, model)
end

color = to_cairo_color(poly.color[], poly)

Expand Down Expand Up @@ -188,7 +192,7 @@ end
function draw_poly(scene::Scene, screen::Screen, poly, polygons::AbstractArray{<: MultiPolygon})
model = poly.model[]
space = to_value(get(poly, :space, :data))
projected_polys = map(polygons) do polygon
projected_polys = map(polygons) do polygon
project_multipolygon(poly, space, polygon, poly.clip_planes[], model)
end

Expand Down
1 change: 1 addition & 0 deletions CairoMakie/src/precompiles.jl
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ let
include(shared_precompile)
end
end
precompile(openurl, (String,))
precompile(draw_atomic_scatter, (Scene, Cairo.CairoContext, Tuple{typeof(identity),typeof(identity)},
Vector{ColorTypes.RGBA{Float32}}, Vec{2,Float32}, ColorTypes.RGBA{Float32},
Float32, BezierPath, Vec{2,Float32}, Quaternionf,
Expand Down
28 changes: 6 additions & 22 deletions CairoMakie/src/primitives.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,6 @@ function draw_atomic(scene::Scene, screen::Screen, @nospecialize(primitive::Unio

isempty(positions) && return

# workaround for a LineSegments object created from a GLNormalMesh
# the input argument is a view of points using faces, which results in
# a vector of tuples of two points. we convert those to a list of points
# so they don't trip up the rest of the pipeline
# TODO this shouldn't be necessary anymore!
if positions isa SubArray{<:Point3, 1, P, <:Tuple{Array{<:AbstractFace}}} where P
positions = let
pos = Point3f[]
for tup in positions
push!(pos, tup[1])
push!(pos, tup[2])
end
pos
end
end

# color is now a color or an array of colors
# if it's an array of colors, each segment must be stroked separately
color = to_color(primitive.calculated_colors[])
Expand Down Expand Up @@ -912,7 +896,7 @@ function draw_mesh2D(scene, screen, @nospecialize(plot::Makie.Mesh), @nospeciali
space = to_value(get(plot, :space, :data))::Symbol
transform_func = Makie.transform_func(plot)
model = plot.model[]::Mat4d
vs = project_position(scene, transform_func, space, GeometryBasics.metafree(GeometryBasics.coordinates(mesh)), model)::Vector{Point2f}
vs = project_position(scene, transform_func, space, GeometryBasics.coordinates(mesh), model)::Vector{Point2f}
fs = decompose(GLTriangleFace, mesh)::Vector{GLTriangleFace}
uv = decompose_uv(mesh)::Union{Nothing, Vector{Vec2f}}
# Note: This assume the function is only called from mesh plots
Expand Down Expand Up @@ -1200,7 +1184,7 @@ function draw_atomic(scene::Scene, screen::Screen, @nospecialize(primitive::Maki

pos = primitive[1][]
# For correct z-ordering we need to be in view/camera or screen space
model = copy(model)
model = copy(model)::Mat4d
view = scene.camera.view[]

zorder = sortperm(pos, by = p -> begin
Expand Down Expand Up @@ -1253,17 +1237,17 @@ function draw_atomic(scene::Scene, screen::Screen, @nospecialize(primitive::Maki
pos = Makie.voxel_positions(primitive)
scale = Makie.voxel_size(primitive)
colors = Makie.voxel_colors(primitive)
marker = GeometryBasics.normal_mesh(Rect3f(Point3f(-0.5), Vec3f(1)))
# Face culling
marker = GeometryBasics.expand_faceviews(normal_mesh(Rect3f(Point3f(-0.5), Vec3f(1))))


if !isempty(primitive.clip_planes[]) && Makie.is_data_space(primitive.space[])
valid = [is_visible(primitive.clip_planes[], p) for p in pos]
pos = pos[valid]
colors = colors[valid]
end

# For correct z-ordering we need to be in view/camera or screen space
model = copy(primitive.model[])
model = copy(primitive.model[])::Mat4d
view = scene.camera.view[]

zorder = sortperm(pos, by = p -> begin
Expand Down
39 changes: 20 additions & 19 deletions CairoMakie/src/utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ end

# much faster than dot-ing `project_position` because it skips all the repeated mat * mat
function project_position(
scene::Scene, space::Symbol, ps::Vector{<: VecTypes{N, T1}},
scene::Scene, space::Symbol, ps::Vector{<: VecTypes{N, T1}},
indices::Vector{<:Integer}, model::Mat4, yflip::Bool = true
) where {N, T1}

Expand Down Expand Up @@ -44,7 +44,7 @@ function _project_position(scene::Scene, space, ps::AbstractArray{<: VecTypes{N,
end

function project_position(
scene::Scene, space::Symbol, ps::AbstractArray{<: VecTypes{N, T1}},
scene::Scene, space::Symbol, ps::AbstractArray{<: VecTypes{N, T1}},
indices::Base.OneTo, model::Mat4, yflip::Bool = true
) where {N, T1}

Expand Down Expand Up @@ -149,14 +149,15 @@ function clip_shape(clip_planes::Vector{Plane3f}, shape::Rect2, space::Symbol, m
if !Makie.is_data_space(space) || isempty(clip_planes)
return shape
end

xy = origin(shape)
w, h = widths(shape)
ps = [xy, xy + Vec2(w, 0), xy + Vec2f(w, h), xy + Vec2(0, h)]
ps = Vec2f[xy, xy + Vec2f(w, 0), xy + Vec2f(w, h), xy + Vec2f(0, h)]
if any(p -> Makie.is_clipped(clip_planes, p), ps)
push!(ps, xy)
ps = clip_poly(clip_planes, ps, space, model)
return BezierPath([MoveTo(ps[1]), LineTo.(ps[2:end])..., ClosePath()])
commands = Makie.PathCommand[MoveTo(ps[1]), LineTo.(ps[2:end])..., ClosePath()]
return BezierPath(commands::Vector{Makie.PathCommand})
else
return shape
end
Expand All @@ -173,7 +174,7 @@ function project_polygon(@nospecialize(scenelike), space, poly::Polygon{N, T}, c

ext_proj = PT[project(p) for p in clip_poly(clip_planes, ext, space, model)]
interiors_proj = Vector{PT}[
PT[project(p) for p in clip_poly(clip_planes, decompose(PT, points), space, model)]
PT[project(p) for p in clip_poly(clip_planes, decompose(PT, points), space, model)]
for points in poly.interiors]

return Polygon(ext_proj, interiors_proj)
Expand All @@ -195,7 +196,7 @@ end
# at clip planes
per_point_colors = colors <: AbstractArray
per_point_linewidths = (T <: Lines) && (linewidths <: AbstractArray)

quote
@get_attribute(plot, (space, model))

Expand All @@ -207,7 +208,7 @@ end
@inbounds for (i, point) in enumerate(points)
clip_points[i] = transform * to_ndim(Vec4d, to_ndim(Vec3d, point, 0), 1)
end

# yflip and clip -> screen/pixel coords
res = scene.camera.resolution[]

Expand All @@ -219,14 +220,14 @@ end
end

# Fix lines with points far outside the clipped region not drawing at all
# TODO this can probably be done more efficiently by checking -1 ≤ x, y ≤ 1
# TODO this can probably be done more efficiently by checking -1 ≤ x, y ≤ 1
# directly and calculating intersections directly (1D)
push!(clip_planes,
Plane3f(Vec3f(-1, 0, 0), -1f0), Plane3f(Vec3f(+1, 0, 0), -1f0),
Plane3f(Vec3f(0, -1, 0), -1f0), Plane3f(Vec3f(0, +1, 0), -1f0)
)


# outputs
screen_points = sizehint!(Vec2f[], length(clip_points))
$(if per_point_colors
Expand Down Expand Up @@ -314,8 +315,8 @@ end
end)
elseif !hidden
# if not hidden, always push the first element to 1:end-1 line points
# if the start of the segment is disconnected (moved), make sure the

# if the start of the segment is disconnected (moved), make sure the
# line separates before it
if disconnect1 && !last_is_nan
push!(screen_points, Vec2f(NaN))
Expand All @@ -326,7 +327,7 @@ end
:(push!(color_output, c1))
end)
end

last_is_nan = false
push!(screen_points, clip2screen(p1, res))
$(if per_point_linewidths
Expand All @@ -336,7 +337,7 @@ end
:(push!(color_output, c1))
end)

# if the end of the segment is disconnected (moved), add the adjusted
# if the end of the segment is disconnected (moved), add the adjusted
# point and separate it from from the next segment
if disconnect2
last_is_nan = true
Expand All @@ -351,8 +352,8 @@ end
end
end

# If last_is_nan == true, the last segment is either hidden or the moved
# end point has been added. If it is false we're missing the last regular
# If last_is_nan == true, the last segment is either hidden or the moved
# end point has been added. If it is false we're missing the last regular
# clip_points
if !last_is_nan
push!(screen_points, clip2screen(clip_points[end], res))
Expand All @@ -365,7 +366,7 @@ end
end

else # LineSegments

for i in 1:2:length(clip_points)-1
$(if per_point_colors
quote
Expand Down Expand Up @@ -525,8 +526,8 @@ end
"""
cairo_scatter_marker(marker)

Convert a Makie marker to a Cairo-compatible marker. This defaults to calling
`Makie.to_spritemarker`, but can be overridden for specific markers that can
Convert a Makie marker to a Cairo-compatible marker. This defaults to calling
`Makie.to_spritemarker`, but can be overridden for specific markers that can
be directly rendered to vector formats using Cairo.
"""
cairo_scatter_marker(marker) = Makie.to_spritemarker(marker)
Expand Down
Loading
Loading