-
-
Notifications
You must be signed in to change notification settings - Fork 313
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
Check converted as well as input args in polygon drawing in CairoMakie #3605
Conversation
Compile Times benchmarkNote, that these numbers may fluctuate on the CI servers, so take them with a grain of salt. All benchmark results are based on the mean time and negative percent mean faster than the base branch. Note, that GLMakie + WGLMakie run on an emulated GPU, so the runtime benchmark is much slower. Results are from running: using_time = @ctime using Backend
# Compile time
create_time = @ctime fig = scatter(1:4; color=1:4, colormap=:turbo, markersize=20, visible=true)
display_time = @ctime Makie.colorbuffer(display(fig))
# Runtime
create_time = @benchmark fig = scatter(1:4; color=1:4, colormap=:turbo, markersize=20, visible=true)
display_time = @benchmark Makie.colorbuffer(fig)
|
Ah interesting, it used to be that the conversion went down to meshes, which is why I didn't use it at the time. But if it stops at Polygons now, that's useful. |
Description
CairoMakie decided whether or not to draw polygons as meshes based on the type of the input arguments. However, this excluded types which are later converted to polygons via
convert_arguments
from the direct polygon drawing path, forcing them to be meshed and rasterized.This PR enables CairoMakie to decide whether to use meshes or not based on both the input and converted argument types. It first checks whether there is an available
draw_poly
method for the input types (plot.args...
), if there is then it proceeds. If not, it checks whether there is an availabledraw_poly
method for the converted types (plot.converted...
), and proceeds there. The last/base case is of course a call todraw_poly_as_mesh
.This has eliminated the generic fallback for
draw_poly(scene, screen, plot)
as the decision-making is now done indraw_plot
.As an example:
Rect
,BezierPath
,Vector{<: Point}
, orPolygon
input will be processed directly. Inputs from other geometry packages like ArchGDAL, GeoJSON, etc which were previously interpreted as requiring meshing will now be drawn as polygons, since after conversion they are usuallyGeometryBasics.Polygon
or similar which have dispatches indraw_poly
.I also added some tests to make sure this behaviour stays consistent!
Type of change
Bug fix (non-breaking change which fixes an issue)
Checklist
Fixes #3600
Fixes MakieOrg/GeoMakie.jl#181