Skip to content

Commit

Permalink
Merge branch 'master' into delaunay_recipes
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonDanisch authored Aug 22, 2023
2 parents 6bd87fa + 7ad6ad2 commit c7baef4
Show file tree
Hide file tree
Showing 5 changed files with 126 additions and 8 deletions.
14 changes: 9 additions & 5 deletions GLMakie/src/GLAbstraction/GLTexture.jl
Original file line number Diff line number Diff line change
Expand Up @@ -352,14 +352,19 @@ function similar(t::TextureBuffer{T}, newdims::NTuple{1, Int}) where T
buff = similar(t.buffer, newdims...)
return TextureBuffer(buff)
end

function similar(t::Texture{T, NDim}, newdims::NTuple{NDim, Int}) where {T, NDim}
Texture(
Ptr{T}(C_NULL),
newdims, t.texturetype,
id = glGenTextures()
glBindTexture(t.texturetype, id)
glTexImage(t.texturetype, 0, t.internalformat, newdims..., 0, t.format, t.pixeltype, C_NULL)
return Texture{T, NDim}(
id,
t.texturetype,
t.pixeltype,
t.internalformat,
t.format,
t.parameters
t.parameters,
newdims
)
end
# Resize Texture
Expand Down Expand Up @@ -399,7 +404,6 @@ texsubimage(t::Texture{T, 3}, newvalue::Array{T, 3}, xrange::UnitRange, yrange::
t.format, t.pixeltype, newvalue
)


Base.iterate(t::TextureBuffer{T}) where {T} = iterate(t.buffer)
function Base.iterate(t::TextureBuffer{T}, state::Tuple{Ptr{T}, Int}) where T
v_idx = iterate(t.buffer, state)
Expand Down
2 changes: 1 addition & 1 deletion GLMakie/src/drawing_primitives.jl
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ function handle_intensities!(attributes, plot)
if color[] isa Makie.ColorMap
attributes[:intensity] = color[].color_scaled
interp = color[].categorical[] ? :nearest : :linear
attributes[:color_map] = Sampler(color[].colormap; minfilter=interp)
attributes[:color_map] = Texture(color[].colormap; minfilter=interp)
attributes[:color_norm] = color[].colorrange_scaled
attributes[:nan_color] = color[].nan_color
attributes[:highclip] = Makie.highclip(color[])
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/plotting_functions/heatmap.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ function mandelbrot(x, y)
for i in 1:30.0; abs(z) > 2 && return i; z = z^2 + c; end; 0
end

heatmap(-2:0.1:1, -1.1:0.1:1.1, mandelbrot,
heatmap(-2:0.001:1, -1.1:0.001:1.1, mandelbrot,
colormap = Reverse(:deep))
```
\end{examplefigure}
Expand Down
4 changes: 3 additions & 1 deletion src/makielayout/blocks/polaraxis.jl
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,7 @@ function draw_axis!(po::PolarAxis, axis_radius)
color = po.rticklabelcolor,
strokewidth = po.rticklabelstrokewidth,
strokecolor = rstrokecolor,
visible = po.rticklabelsvisible,
align = map(po.direction, po.theta_0, po.rtickangle) do dir, theta_0, angle
s, c = sincos(dir * (angle + theta_0))
scale = 1 / max(abs(s), abs(c)) # point on ellipse -> point on bbox
Expand All @@ -273,7 +274,8 @@ function draw_axis!(po::PolarAxis, axis_radius)
color = po.thetaticklabelcolor,
strokewidth = po.thetaticklabelstrokewidth,
strokecolor = thetastrokecolor,
align = thetatick_align[]
align = thetatick_align[],
visible = po.thetaticklabelsvisible
)

# Hack to deal with synchronous update problems
Expand Down
112 changes: 112 additions & 0 deletions tooling/bump_versions.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
using REPL.TerminalMenus
using TOML
using Pkg

dictmap(f, d) = Dict(key => f(key, value) for (key, value) in d)

bump_patch(v::VersionNumber) = VersionNumber(v.major, v.minor, v.patch+1)
bump_minor(v::VersionNumber) = VersionNumber(v.major, v.minor+1, 0)
bump_major(v::VersionNumber) = VersionNumber(v.major+1, 0, 0)

function bump_versions()

names = ["MakieCore", "Makie", "CairoMakie", "GLMakie", "WGLMakie", "RPRMakie"]
paths = map(names) do name
name == "Makie" ? "." : name
end

packages = Dict(names .=> paths)

root = joinpath(@__DIR__, "..")

tomlpaths = dictmap(packages) do _, dir
joinpath(root, dir, "Project.toml")
end

tomls = dictmap(tomlpaths) do _, tomlfile
TOML.parsefile(tomlfile)
end

versions = dictmap(tomls) do _, toml
VersionNumber(toml["version"])
end
current_version = versions["Makie"]
current_tag = "v$current_version"

src_changes = dictmap(packages) do _, dir
srcdir = joinpath(root, dir, "src")
read(`git diff $current_tag HEAD --stat -- $srcdir`, String)
end

has_changed_src = dictmap((key, changes) -> !isempty(changes), src_changes)

selected = findall(map(names) do name
if has_changed_src["MakieCore"]
true
elseif has_changed_src["Makie"]
name != "MakieCore"
else
has_changed_src[name]
end
end)

println("Which packages' versions do you want to bump? All packages with nonempty git diffs in their `src` directory are preselected, or those who depend on others that have changes.")
bumps_requested = request(MultiSelectMenu(names; selected))

if 1 in bumps_requested
if !isempty(setdiff(2:6, bumps_requested))
@warn "Because MakieCore is bumped, all other packages will be bumped as well."
union!(bumps_requested, 2:6)
end
elseif 2 in bumps_requested
if !isempty(setdiff(3:6, bumps_requested))
@warn "Because Makie is bumped, all backend packages will be bumped as well."
union!(bumps_requested, 3:6)
end
end

println("How do you want to bump the versions:")
version_selection = request(RadioMenu(["All patch", "All minor", "All major", "Custom"]))

version_types = map(sort(collect(bumps_requested))) do i
if version_selection == 4
name = names[i]
version = versions[name]
v_patch = bump_patch(version)
v_minor = bump_minor(version)
v_major = bump_major(version)
println("How do you want to bump $(names[i]) (currently $version)?")
request(RadioMenu(["Patch ($v_patch)", "Minor ($v_minor)", "Major ($v_major)"]))
else
version_selection
end
end

new_versions = Dict(map(zip(bumps_requested, version_types)) do (i, vtype)
name = names[i]
version = versions[name]
new_version = (bump_patch, bump_minor, bump_major)[vtype](version)
name => new_version
end)

for (name, new_version) in new_versions
new_toml = deepcopy(tomls[name])
new_toml["version"] = new_version

compat = new_toml["compat"]
if haskey(compat, "Makie")
compat["Makie"] = "=$(new_versions["Makie"])"
end
if haskey(compat, "MakieCore")
compat["MakieCore"] = "=$(new_versions["MakieCore"])"
end

println("Writing $(tomlpaths[name])")
open(tomlpaths[name], "w") do io
Pkg.Types.write_project(io, new_toml)
end
end
println("Done")
end

bump_versions()

0 comments on commit c7baef4

Please sign in to comment.