Skip to content

v0.6.0: Fixes broken permutedims for OffsetArray

Compare
Choose a tag to compare
@Evizero Evizero released this 06 Jun 14:03
A previous commit added type conversion rules for Gray and Color images that are wrapped by an OffsetArray. The conversion process involved copying the contents of a source array into a new destination array with a specified destination type. However, when one calls convert and the destination type equals the current type, then there is no need to copy the contents of the source array into a new destination array. The previous conversion rule did not take this fact into account and made a copy anyway. Consequently, the conversion rule broke `permutedims` which uses a `PermuteDimsArray` to attempt to create a `view` of the original data.  In particular, the previous conversion rule hijacked dispatch and prevented the following default conversion rule from executing:   `convert(::Type{T}, x::T) where {T} = x`

The present commit addresses corrects this oversight by ensuring that no data is copied when the target type equals the current type. This restores the ability for `PermutedDimsArray` to create the requisite view.