lib/chunky_png/palette.rb in chunky_png-0.5.2 vs lib/chunky_png/palette.rb in chunky_png-0.5.3
- old
+ new
@@ -41,15 +41,15 @@
palatte_bytes = palette_chunk.content.unpack('C*')
if transparency_chunk
alpha_channel = transparency_chunk.content.unpack('C*')
else
- alpha_channel = Array.new(palatte_bytes.size / 3, ChunkyPNG::Color::MAX)
+ alpha_channel = []
end
index = 0
palatte_bytes.each_slice(3) do |bytes|
- bytes << alpha_channel[index]
+ bytes << alpha_channel.fetch(index, ChunkyPNG::Color::MAX)
decoding_map << ChunkyPNG::Color.rgba(*bytes)
index += 1
end
self.new(decoding_map, decoding_map)