Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions peniko/src/blend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,23 @@ impl BlendMode {
pub const fn new(mix: Mix, compose: Compose) -> Self {
Self { mix, compose }
}

/// Returns whether this blend mode might cause destructive changes in the backdrop.
///
/// Destructive blend modes disallow certain optimizations, such as skipping
/// transparent paints.
#[must_use]
pub const fn is_destructive(&self) -> bool {
matches!(
self.compose,
Compose::Clear
| Compose::Copy
| Compose::SrcIn
| Compose::DestIn
| Compose::SrcOut
| Compose::DestAtop
)
}
}

impl Default for BlendMode {
Expand Down
Loading