Skip to content

Commit

Permalink
Merge pull request image-rs#369 from nwin/master
Browse files Browse the repository at this point in the history
bump version
  • Loading branch information
nwin committed Apr 3, 2015
2 parents 3b70146 + 6282bb3 commit 73ed44f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "image"
version = "0.3.4"
version = "0.3.5"
license = "MIT"
description = "Imaging library written in Rust. Provides basic filters and decoders for the most common image formats."
authors = [
Expand All @@ -22,13 +22,13 @@ name = "image"
path = "./src/lib.rs"

[dependencies.byteorder]
version = "0.3.3"
version = "0.3.5"

[dependencies.num]
version = "0.1.18"
version = "0.1.20"

[dev-dependencies.glob]
version = "0.2.7"
version = "0.2.9"

[features]
default = ["gif", "jpeg", "png", "ppm", "tga", "tiff", "webp"]
Expand Down
8 changes: 3 additions & 5 deletions src/png/decoder.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use std::io::{ self, Read };
use std::{ cmp, mem, iter, str, slice };
use std::{ cmp, iter, str, slice };
use std::iter::repeat;
use std::num::{ FromPrimitive, Float };
use byteorder::{ ReadBytesExt, BigEndian };
Expand Down Expand Up @@ -436,14 +436,12 @@ impl<R: Read> PNGDecoder<R> {
expand_trns_line_nbits(
buf,
trns[0],
rlength as usize,
self.bit_depth
);
} else {
expand_trns_line(
buf,
trns,
rlength as usize,
color::num_components(self.data_pixel_type)
);
}
Expand Down Expand Up @@ -595,7 +593,7 @@ where F: Fn(u8, &mut[u8]) {
}
}

fn expand_trns_line(buf: &mut[u8], trns: &[u8], entries: usize, channels: usize) {
fn expand_trns_line(buf: &mut[u8], trns: &[u8], channels: usize) {
let channels = channels as isize;
let i = (buf.len() as isize / (channels+1) * channels - channels..-(channels)).step_by(-channels);
let j = (buf.len() as isize - (channels+1)..-(channels+1)).step_by(-(channels+1));
Expand All @@ -614,7 +612,7 @@ fn expand_trns_line(buf: &mut[u8], trns: &[u8], entries: usize, channels: usize)
}
}

fn expand_trns_line_nbits(buf: &mut[u8], trns: u8, entries: usize, bit_depth: u8) {
fn expand_trns_line_nbits(buf: &mut[u8], trns: u8, bit_depth: u8) {
let scaling_factor = (255)/((1u16 << bit_depth) - 1) as u8;
expand_packed(buf, 2, bit_depth, |pixel, chunk| {
if pixel == trns {
Expand Down

0 comments on commit 73ed44f

Please sign in to comment.