Skip to content

Commit

Permalink
core: Make applyFilter with zero-sized rects noops
Browse files Browse the repository at this point in the history
  • Loading branch information
adrian17 committed Sep 18, 2024
1 parent 7d13733 commit de83609
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions core/src/bitmap/operations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1206,6 +1206,17 @@ pub fn apply_filter<'gc>(
dest_point: (u32, u32),
filter: Filter,
) {
// Prevent creating 0x0 textures.
// FIXME: this is not correct.
// Currently at minimum, applyFilter(blur) is bugged in that
// it doesn't include the blur's dimensions (see calculate_dest_rect).
// In other words, blur with 0x0 source rect is not supposed to be a noop.
// Once it is fixed, this check should be removed or replaced by
// "if after including size adjustment the size is still 0, return".
if source_size.0 == 0 || source_size.1 == 0 {
return;
}

if !context.renderer.is_filter_supported(&filter) {
let mut source_region = PixelRegion::for_whole_size(source.width(), source.height());
let mut dest_region = PixelRegion::for_whole_size(target.width(), target.height());
Expand Down

0 comments on commit de83609

Please sign in to comment.