Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

core: Make applyFilter with zero-sized rects noops #17965

Merged
merged 1 commit into from
Sep 25, 2024
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
core: Make applyFilter with zero-sized rects noops
  • Loading branch information
adrian17 authored and danielhjacobs committed Sep 25, 2024
commit 242acbf4eaa583c5fe2002bec1b94a4fcf5cc20b
11 changes: 11 additions & 0 deletions core/src/bitmap/operations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1210,6 +1210,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