Skip to content

Commit

Permalink
Track assert blame
Browse files Browse the repository at this point in the history
  • Loading branch information
kornelski committed Feb 6, 2024
1 parent 3fbbd67 commit 48e5f86
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/collector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ impl Collector {
/// Presentation timestamp is time in seconds (since file start at 0) when this frame is to be displayed.
///
/// If the first frame doesn't start at pts=0, the delay will be used for the last frame.
#[cfg_attr(debug_assertions, track_caller)]
pub fn add_frame_rgba(&self, frame_index: usize, frame: ImgVec<RGBA8>, presentation_timestamp: f64) -> CatResult<()> {
debug_assert!(frame_index == 0 || presentation_timestamp > 0.);
self.queue.send(InputFrame {
Expand Down
1 change: 1 addition & 0 deletions src/encoderust.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ impl<W: Write> RustEncoder<W> {

impl<W: Write> RustEncoder<W> {
#[inline(never)]
#[cfg_attr(debug_assertions, track_caller)]
pub fn compress_frame(f: GIFFrame, settings: &SettingsExt) -> CatResult<gif::Frame<'static>> {
let GIFFrame {left, top, pal, image, dispose, transparent_index} = f;

Expand Down
1 change: 1 addition & 0 deletions src/gifsicle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,7 @@ impl GiflossyWriter {

impl<'a> GiflossyImage<'a> {
#[must_use]
#[cfg_attr(debug_assertions, track_caller)]
pub fn new(
img: &'a [u8],
width: u16,
Expand Down
3 changes: 2 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,7 @@ pub fn new(settings: Settings) -> CatResult<(Collector, Writer)> {
}

#[inline(never)]
#[cfg_attr(debug_assertions, track_caller)]
fn resized_binary_alpha(image: ImgVec<RGBA8>, width: Option<u32>, height: Option<u32>, matte: Option<RGB8>) -> CatResult<ImgVec<RGBA8>> {
let (width, height) = dimensions_for_image((image.width(), image.height()), (width, height));

Expand Down Expand Up @@ -921,8 +922,8 @@ trait PushInCapacity<T> {
}

impl<T> PushInCapacity<T> for Vec<T> {
#[track_caller]
#[inline(always)]
#[cfg_attr(debug_assertions, track_caller)]
fn push_in_cap(&mut self, val: T) {
debug_assert!(self.capacity() != self.len());
if self.capacity() != self.len() {
Expand Down

0 comments on commit 48e5f86

Please sign in to comment.