Skip to content

Commit

Permalink
[PATCH] Added offsets to GenericImageView to compensate for the now-d…
Browse files Browse the repository at this point in the history
…eprecated bounds call.

Fixes #2118
  • Loading branch information
brykgroup-andrews committed Feb 2, 2024
1 parent 445970c commit e20eeba
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/image.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1026,6 +1026,11 @@ pub trait GenericImageView {
h
}

/// The offsets of this image view relative to the underlying image buffer.
fn offsets(&self) -> (u32, u32) {
(0, 0)
}

/// The bounding rectangle of this image.
#[deprecated = "This method has inconsistent behavior between implementations (#1829). Use `dimensions` instead"]
fn bounds(&self) -> (u32, u32, u32, u32);
Expand Down Expand Up @@ -1420,6 +1425,10 @@ where
(self.xstride, self.ystride)
}

fn offsets(&self) -> (u32, u32) {
(self.xoffset, self.yoffset)
}

fn bounds(&self) -> (u32, u32, u32, u32) {
(self.xoffset, self.yoffset, self.xstride, self.ystride)
}
Expand Down

0 comments on commit e20eeba

Please sign in to comment.