Skip to content

Commit

Permalink
Rebased version of beta 0.20 (#3113)
Browse files Browse the repository at this point in the history
Continues #2831 !
Still needs to check, if I rebased correctly and didn't incorrectly
apply some of the changes!

## Merged PRs
- #2598
- #2746
- #2346
- #2544
- #3082
- #2868
- #3062
- #3106
- #3281
- #3246

## TODOS

- [x] fix flaky test `@test GLMakie.window_size(screen.glscreen) ==
scaled(screen, (W, H))`
- [x] Merge axis type inferences from #2220 
- [x] Test on different resolution screens, IJulia, Pluto, VSCode,
Windowed
- [x] rebase to only have merge commits from the PRs 
- [x] investigate unexpected speed ups
- [x] reset camera settings from tests
- [ ] check doc image generation
- [x] rethink default near/far in Camera3D (compatability with OIT)
- [x] merge #3246
- [x] fix WGLMakie issues/tests:
- [x] fix line depth issues (see tests: ~~hexbin colorrange~~ (not new),
LaTeXStrings in Axis3, Axis3 axis reversal)
  - [x] fix lighting of surface with nan points (fixed in #3246)
- ~~volume/3D contour artifacts (see 3D Contour with 2D contour
slices)~~ not new
  - ~~artifacting in "colorscale (lines)"~~ not new
- [x] GLMakie:
  - [x] slight outline in "scatter image markers" test
  - ~~clipping/z-fighting in "volume translated"~~ not new
- [x] CairoMakie:
  -  ~~Artfiacting in `colorscale (lines)"~~ not new
  - ~~markersize in "scatter rotations" changed?~~ not new
  - ~~color change in "colorscale (poly)"~~ not new
  - ~~transparency/render order of "OldAxis + Surface"~~ not new
  - ~~render order in "Merged color mesh"~~ not new
  - ~~render order of "Surface + wireframe + contour"~~ not new
- [x] Check "SpecApi in convert_arguments" (colors swapped?)


## Fixes the following errors

- fixes #2721 via #2746
- fixes #1600 via #2746
- fixes #1236 via #2746
- fixes MakieOrg/GeoMakie.jl#133 via #2598
- closes #2522
- closes #3239 via #3246
- fixes #3238 via #3246
- fixes #2985 via #3246
- fixes #3307 via #3281
  • Loading branch information
SimonDanisch authored Nov 17, 2023
2 parents 7027768 + 2707505 commit 090a3fb
Show file tree
Hide file tree
Showing 255 changed files with 14,234 additions and 4,199 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/compilation-benchmark.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ on:
branches:
- master
- sd/beta-20
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
benchmark:
name: ${{ matrix.package }}
Expand All @@ -26,6 +29,7 @@ jobs:
- uses: julia-actions/setup-julia@v1
with:
version: '1'
include-all-prereleases: true
arch: x64
- uses: julia-actions/cache@v1
- name: Benchmark
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/wglmakie.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ on:
- '*'
branches:
- master

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
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.10.12"
version = "0.11.0"

[deps]
Base64 = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"
Expand All @@ -23,7 +23,7 @@ FFTW = "1"
FileIO = "1.1"
FreeType = "3, 4.0"
GeometryBasics = "0.4.1"
Makie = "=0.19.12"
Makie = "=0.20.0"
PrecompileTools = "1.0"
SHA = "0.7, 1.6, 1.7"
julia = "1.3"
Expand Down
2 changes: 1 addition & 1 deletion CairoMakie/src/CairoMakie.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import Cairo

using Makie: Scene, Lines, Text, Image, Heatmap, Scatter, @key_str, broadcast_foreach
using Makie: convert_attribute, @extractvalue, LineSegments, to_ndim, NativeFont
using Makie: @info, @get_attribute, Combined, MakieScreen
using Makie: @info, @get_attribute, Plot, MakieScreen
using Makie: to_value, to_colormap, extrema_nan
using Makie.Observables
using Makie: spaces, is_data_space, is_pixel_space, is_relative_space, is_clip_space
Expand Down
1 change: 1 addition & 0 deletions CairoMakie/src/display.jl
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ end

const DISABLED_MIMES = Set{String}()
const SUPPORTED_MIMES = Set([
map(x->string(x()), Makie.WEB_MIMES)...,
"image/svg+xml",
"application/pdf",
"application/postscript",
Expand Down
32 changes: 17 additions & 15 deletions CairoMakie/src/infrastructure.jl
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ function cairo_draw(screen::Screen, scene::Scene)
end

"""
is_cairomakie_atomic_plot(plot::Combined)::Bool
is_cairomakie_atomic_plot(plot::Plot)::Bool
Returns whether the plot is considered atomic for the CairoMakie backend.
This is overridden for `Poly`, `Band`, and `Tricontourf` so we can apply
Expand All @@ -66,14 +66,14 @@ CairoMakie can treat them as atomic plots and render them directly.
Plots with children are by default recursed into. This can be overridden
by defining specific dispatches for `is_cairomakie_atomic_plot` for a given plot type.
"""
is_cairomakie_atomic_plot(plot::Combined) = isempty(plot.plots) || to_value(get(plot, :rasterize, false)) != false
is_cairomakie_atomic_plot(plot::Plot) = isempty(plot.plots) || to_value(get(plot, :rasterize, false)) != false

"""
check_parent_plots(f, plot::Combined)::Bool
check_parent_plots(f, plot::Plot)::Bool
Returns whether the plot's parent tree satisfies the predicate `f`.
`f` must return a `Bool` and take a plot as its only argument.
"""
function check_parent_plots(f, plot::Combined)
function check_parent_plots(f, plot::Plot)
if f(plot)
check_parent_plots(f, parent(plot))
else
Expand All @@ -87,11 +87,9 @@ end

function prepare_for_scene(screen::Screen, scene::Scene)

# get the root area to correct for its pixel size when translating
root_area = Makie.root(scene).px_area[]

root_area_height = widths(root_area)[2]
scene_area = pixelarea(scene)[]
# get the root area to correct for its size when translating
root_area_height = widths(Makie.root(scene))[2]
scene_area = viewport(scene)[]
scene_height = widths(scene_area)[2]
scene_x_origin, scene_y_origin = scene_area.origin

Expand All @@ -103,7 +101,7 @@ function prepare_for_scene(screen::Screen, scene::Scene)
top_offset = root_area_height - scene_height - scene_y_origin
Cairo.translate(screen.context, scene_x_origin, top_offset)

# clip the scene to its pixelarea
# clip the scene to its viewport
Cairo.rectangle(screen.context, 0, 0, widths(scene_area)...)
Cairo.clip(screen.context)

Expand All @@ -116,15 +114,15 @@ function draw_background(screen::Screen, scene::Scene)
if scene.clear[]
bg = scene.backgroundcolor[]
Cairo.set_source_rgba(cr, red(bg), green(bg), blue(bg), alpha(bg));
r = pixelarea(scene)[]
r = viewport(scene)[]
Cairo.rectangle(cr, origin(r)..., widths(r)...) # background
fill(cr)
end
Cairo.restore(cr)
foreach(child_scene-> draw_background(screen, child_scene), scene.children)
end

function draw_plot(scene::Scene, screen::Screen, primitive::Combined)
function draw_plot(scene::Scene, screen::Screen, primitive::Plot)
if to_value(get(primitive, :visible, true))
if isempty(primitive.plots)
Cairo.save(screen.context)
Expand All @@ -145,11 +143,11 @@ end
# instead of the whole Scene
# - Recognize when a screen is an image surface, and set scale to render the plot
# at the scale of the device pixel
function draw_plot_as_image(scene::Scene, screen::Screen, primitive::Combined, scale::Number = 1)
function draw_plot_as_image(scene::Scene, screen::Screen, primitive::Plot, scale::Number = 1)
# you can provide `p.rasterize = scale::Int` or `p.rasterize = true`, both of which are numbers

# Extract scene width in pixels
w, h = Int.(scene.px_area[].widths)
# Extract scene width in device indepentent units
w, h = size(scene)
# Create a new Screen which renders directly to an image surface,
# specifically for the plot's parent scene.
scr = Screen(scene; px_per_unit = scale)
Expand Down Expand Up @@ -178,3 +176,7 @@ end
function draw_atomic(::Scene, ::Screen, x)
@warn "$(typeof(x)) is not supported by cairo right now"
end

function draw_atomic(::Scene, ::Screen, x::Makie.PlotList)
# Doesn't need drawing
end
2 changes: 1 addition & 1 deletion CairoMakie/src/overrides.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ complex and slower to draw than standard paths with single color.
function draw_plot(scene::Scene, screen::Screen, poly::Poly)
# dispatch on input arguments to poly to use smarter drawing methods than
# meshes if possible
draw_poly(scene, screen, poly, to_value.(poly.input_args)...)
return draw_poly(scene, screen, poly, to_value.(poly.args)...)
end

# Override `is_cairomakie_atomic_plot` to allow `poly` to remain a unit,
Expand Down
6 changes: 6 additions & 0 deletions CairoMakie/src/precompiles.jl
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,9 @@ let
include(shared_precompile)
end
end
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,
Mat4f, Vector{Point{2,Float32}},
Mat4f, Makie.FreeTypeAbstraction.FTFont, Symbol,
Symbol))
Loading

0 comments on commit 090a3fb

Please sign in to comment.