[librsvg] lighting: get w,h just once
- From: Paolo Borelli <pborelli src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg] lighting: get w,h just once
- Date: Tue, 10 Dec 2019 16:48:52 +0000 (UTC)
commit 445f5ab3d9b72279f6745e5d12753765e80f924a
Author: Paolo Borelli <pborelli gnome org>
Date: Tue Dec 10 17:33:14 2019 +0100
lighting: get w,h just once
rsvg_internals/src/filters/light/lighting.rs | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
---
diff --git a/rsvg_internals/src/filters/light/lighting.rs b/rsvg_internals/src/filters/light/lighting.rs
index 3e31a931..20a6dbae 100644
--- a/rsvg_internals/src/filters/light/lighting.rs
+++ b/rsvg_internals/src/filters/light/lighting.rs
@@ -311,9 +311,11 @@ macro_rules! impl_lighting_filter {
bounds = new_bounds;
}
+ let (bounds_w, bounds_h) = bounds.size();
+
// Check if the surface is too small for normal computation. This case is unspecified;
// WebKit doesn't render anything in this case.
- if bounds.width() < 2 || bounds.height() < 2 {
+ if bounds_w < 2 || bounds_h < 2 {
return Err(FilterError::LightingInputTooSmall);
}
@@ -390,7 +392,7 @@ macro_rules! impl_lighting_filter {
bottom_right_normal(&input_surface, bounds),
);
- if bounds.x1 - bounds.x0 >= 3 {
+ if bounds_w >= 3 {
// Top row.
for x in bounds.x0 as u32 + 1..bounds.x1 as u32 - 1 {
compute_output_pixel(
@@ -414,7 +416,7 @@ macro_rules! impl_lighting_filter {
}
}
- if bounds.y1 - bounds.y0 >= 3 {
+ if bounds_h >= 3 {
// Left column.
for y in bounds.y0 as u32 + 1..bounds.y1 as u32 - 1 {
compute_output_pixel(
@@ -438,7 +440,7 @@ macro_rules! impl_lighting_filter {
}
}
- if bounds.width() >= 3 && bounds.height() >= 3 {
+ if bounds_w >= 3 && bounds_h >= 3 {
// Interior pixels.
let first_row = bounds.y0 as u32 + 1;
let one_past_last_row = bounds.y1 as u32 - 1;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]