Fix edge cases and consistency issues
This commit is contained in:
@@ -21,7 +21,7 @@ pub struct ProcessingJob {
|
||||
pub metadata: Option<MetadataConfig>,
|
||||
pub watermark: Option<WatermarkConfig>,
|
||||
pub rename: Option<RenameConfig>,
|
||||
pub overwrite_behavior: OverwriteBehavior,
|
||||
pub overwrite_behavior: OverwriteAction,
|
||||
pub preserve_directory_structure: bool,
|
||||
pub progressive_jpeg: bool,
|
||||
pub avif_speed: u8,
|
||||
@@ -44,11 +44,11 @@ impl ProcessingJob {
|
||||
metadata: None,
|
||||
watermark: None,
|
||||
rename: None,
|
||||
overwrite_behavior: OverwriteBehavior::default(),
|
||||
overwrite_behavior: OverwriteAction::default(),
|
||||
preserve_directory_structure: false,
|
||||
progressive_jpeg: false,
|
||||
avif_speed: 6,
|
||||
output_dpi: 72,
|
||||
output_dpi: 0,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -70,6 +70,18 @@ impl ProcessingJob {
|
||||
count
|
||||
}
|
||||
|
||||
/// Returns true if the job requires decoding/encoding pixel data.
|
||||
/// When false, we can use a fast copy-and-rename path.
|
||||
pub fn needs_pixel_processing(&self) -> bool {
|
||||
self.resize.is_some()
|
||||
|| matches!(self.rotation, Some(r) if !matches!(r, Rotation::None))
|
||||
|| matches!(self.flip, Some(f) if !matches!(f, Flip::None))
|
||||
|| self.adjustments.as_ref().is_some_and(|a| !a.is_noop())
|
||||
|| self.convert.is_some()
|
||||
|| self.compress.is_some()
|
||||
|| self.watermark.is_some()
|
||||
}
|
||||
|
||||
pub fn output_path_for(
|
||||
&self,
|
||||
source: &ImageSource,
|
||||
|
||||
Reference in New Issue
Block a user