Skip to content

Commit

Permalink
item_stride -> t_stride, items_per_pixel -> t_per_pixel
Browse files Browse the repository at this point in the history
  • Loading branch information
lilith committed Jan 29, 2025
1 parent 185e9a6 commit fbc447e
Show file tree
Hide file tree
Showing 13 changed files with 100 additions and 100 deletions.
2 changes: 1 addition & 1 deletion imageflow_core/src/codecs/gif/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ impl Encoder for GifEncoder{

let window = bitmap.get_window_u8().unwrap();
let (w, h) = window.size_16()?;
let stride = window.item_stride();
let stride = window.t_stride();
let fmt = window.pixel_format();

// We gotta copy to mutate
Expand Down
2 changes: 1 addition & 1 deletion imageflow_core/src/codecs/jpeg_decoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ impl Decoder for JpegDecoder {

let mut window = bitmap.get_window_u8().unwrap();
let (w, h) = window.size_usize();
let stride = window.item_stride();
let stride = window.t_stride();

//TODO: Shouldn't this be Bgr24
match self.pixel_format.unwrap(){
Expand Down
2 changes: 1 addition & 1 deletion imageflow_core/src/codecs/lode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ impl LodepngEncoder {

pub fn write_png_auto<W: Write>(writer: W, window: &mut crate::graphics::bitmaps::BitmapWindowMut<u8>, use_highest_compression: Option<bool>) -> Result<()> {

let bytes_per_pixel = window.items_per_pixel() as usize;
let bytes_per_pixel = window.t_per_pixel() as usize;
let w = window.w() as usize;
let h = window.h() as usize;
let proper_len = w * h * bytes_per_pixel;
Expand Down
2 changes: 1 addition & 1 deletion imageflow_core/src/codecs/mozjpeg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ impl Encoder for MozjpegEncoder {
.map_err(|io_error| nerror!(ErrorKind::EncodingIoError, "{:?}", io_error))?;


if window.w() as usize == window.item_stride() {
if window.w() as usize == window.t_stride() {
compressor.write_scanlines(window.get_slice())
.map_err(|io_error| nerror!(ErrorKind::EncodingIoError, "{:?}", io_error))?;
} else {
Expand Down
4 changes: 2 additions & 2 deletions imageflow_core/src/codecs/webp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ impl Decoder for WebPDecoder {

let mut window = bitmap.get_window_u8().unwrap();

let stride = window.info().item_stride();
let stride = window.info().t_stride();
let slice = window.slice_mut();
let slice_len = slice.len();

Expand Down Expand Up @@ -232,7 +232,7 @@ impl Encoder for WebPEncoder {
let mut window = bitmap.get_window_u8().unwrap();
let (w, h) = window.size_i32();
let layout = window.info().pixel_layout();
let stride = window.info().item_stride() as i32;
let stride = window.info().t_stride() as i32;
window.normalize_unused_alpha()?;

let mut_slice = window.slice_mut();
Expand Down
2 changes: 1 addition & 1 deletion imageflow_core/src/flow/nodes/scale_render.rs
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ impl NodeDefOneInputOneCanvas for DrawImageDef {
return Err(nerror!(crate::ErrorKind::InvalidNodeParams, "DrawImageExact target rect x1={},y1={},w={},h={} does not fit canvas size {}x{}.",
x,y, w, h, canvas_bitmap.w(), canvas_bitmap.h()));
}
if input_bitmap.info().items_per_pixel() != 4 || canvas_bitmap.info().items_per_pixel() != 4 {
if input_bitmap.info().t_per_pixel() != 4 || canvas_bitmap.info().t_per_pixel() != 4 {
return Err(nerror!(crate::ErrorKind::InvalidNodeConnections,
"DrawImageExact can only operate on Rgb32 and Rgba32 bitmaps. Input pixel format {:?}. Canvas pixel format {:?}.", input_bitmap.frame_info().fmt, canvas_bitmap.frame_info().fmt));
}
Expand Down
Loading

0 comments on commit fbc447e

Please sign in to comment.