Skip to content

Conversation

@timholy
Copy link
Member

@timholy timholy commented May 20, 2017

Support colorview(ARGB32, ::Array{C<:Colorant}). Fixes #38. CC @yuyichao.

This takes another step in the direction of discouraging explicit use of reinterpret. This is considerably more careful to check whether the eltype of input arrays matches the eltype of the Colorant before using reinterpret, and consequently is more reliable about falling back to ColorView. It resolves the alignment issue by avoiding calling reinterpret. To fix #38, we also have to introduce the ability to take a colorview of an array that already has Colorant eltype (which it does via channelview).

To simplify the code, this uses triangular dispatch, so this also bumps the minimum required version of Julia. Are folks OK with moving on to 0.6? I was hoping to wait until 0.6 was officially released, but it is a pain in the neck to "fake" triangular dispatch.

@codecov-io
Copy link

codecov-io commented May 20, 2017

Codecov Report

Merging #39 into master will decrease coverage by 0.14%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #39      +/-   ##
==========================================
- Coverage   95.06%   94.92%   -0.15%     
==========================================
  Files           9        9              
  Lines         567      571       +4     
==========================================
+ Hits          539      542       +3     
- Misses         28       29       +1
Impacted Files Coverage Δ
src/stackedviews.jl 100% <ø> (ø) ⬆️
src/colorchannels.jl 97.7% <100%> (+1.23%) ⬆️
src/deprecated.jl 85.84% <0%> (-1.89%) ⬇️
src/show.jl 98.43% <0%> (-1.57%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 45d0959...2204592. Read the comment docs.

timholy added 2 commits May 21, 2017 04:36
This takes another step in the direction of discouraging explicit use of reinterpret. This is considerably more careful to check whether the eltype of input arrays matches the eltype of the Colorant before using reinterpret, and consequently is more reliable about falling back to ColorView. It resolves the alignment issue by avoiding calling reinterpret.

To simplify the code, this uses triangular dispatch, so this also bumps the minimum required version of Julia.
@timholy
Copy link
Member Author

timholy commented May 23, 2017

Alright, 0.6 is officially required for the latest and greatest. Time to move on.

@timholy timholy merged commit 4f39728 into master May 23, 2017
@timholy timholy deleted the teh/fix_38 branch May 23, 2017 02:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Incorrect use of reinterpret

3 participants