gr: round to UInt not Int

Fixes an error with 32-bit system compatibility
This commit is contained in:
Michael Krabbe Borregaard 2018-08-17 10:49:57 +02:00
parent 1697b99bbc
commit b2c4561a7d

View File

@ -1103,10 +1103,10 @@ function gr_display(sp::Subplot{GRBackend}, w, h, viewport_canvas)
GR.setspace(zmin, zmax, 0, 90) GR.setspace(zmin, zmax, 0, 90)
grad = isa(series[:fillcolor], ColorGradient) ? series[:fillcolor] : cgrad() grad = isa(series[:fillcolor], ColorGradient) ? series[:fillcolor] : cgrad()
colors = [plot_color(grad[clamp((zi-zmin) / (zmax-zmin), 0, 1)], series[:fillalpha]) for zi=z] colors = [plot_color(grad[clamp((zi-zmin) / (zmax-zmin), 0, 1)], series[:fillalpha]) for zi=z]
rgba = map(c -> UInt32( round(Int, alpha(c) * 255) << 24 + rgba = map(c -> UInt32( round(UInt, alpha(c) * 255) << 24 +
round(Int, blue(c) * 255) << 16 + round(UInt, blue(c) * 255) << 16 +
round(Int, green(c) * 255) << 8 + round(UInt, green(c) * 255) << 8 +
round(Int, red(c) * 255) ), colors) round(UInt, red(c) * 255) ), colors)
w, h = length(x), length(y) w, h = length(x), length(y)
GR.drawimage(xmin, xmax, ymax, ymin, w, h, rgba) GR.drawimage(xmin, xmax, ymax, ymin, w, h, rgba)
@ -1210,12 +1210,12 @@ function gr_display(sp::Subplot{GRBackend}, w, h, viewport_canvas)
xmin, xmax = ignorenan_extrema(series[:x]); ymin, ymax = ignorenan_extrema(series[:y]) xmin, xmax = ignorenan_extrema(series[:x]); ymin, ymax = ignorenan_extrema(series[:y])
if eltype(z) <: Colors.AbstractGray if eltype(z) <: Colors.AbstractGray
grey = round.(UInt8, float(z) * 255) grey = round.(UInt8, float(z) * 255)
rgba = map(c -> UInt32( 0xff000000 + Int(c)<<16 + Int(c)<<8 + Int(c) ), grey) rgba = map(c -> UInt32( 0xff000000 + UInt(c)<<16 + UInt(c)<<8 + UInt(c) ), grey)
else else
rgba = map(c -> UInt32( round(Int, alpha(c) * 255) << 24 + rgba = map(c -> UInt32( round(UInt, alpha(c) * 255) << 24 +
round(Int, blue(c) * 255) << 16 + round(UInt, blue(c) * 255) << 16 +
round(Int, green(c) * 255) << 8 + round(UInt, green(c) * 255) << 8 +
round(Int, red(c) * 255) ), z) round(UInt, red(c) * 255) ), z)
end end
GR.drawimage(xmin, xmax, ymax, ymin, w, h, rgba) GR.drawimage(xmin, xmax, ymax, ymin, w, h, rgba)
end end