mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
auto merge of #4437 : Adenilson/servo/fixInsetOutsetBlack03, r=jdm
Freshly rebased.
This commit is contained in:
commit
4ac8b6a723
5 changed files with 79 additions and 5 deletions
|
@ -642,11 +642,22 @@ impl<'a> PaintContext<'a> {
|
|||
};
|
||||
// original bounds as a Rect<f32>
|
||||
let original_bounds = self.get_scaled_bounds(bounds, border, 0.0);
|
||||
// select and scale the color appropriately.
|
||||
let scaled_color = match direction {
|
||||
Direction::Top | Direction::Left => self.scale_color(color, if is_inset { 2.0/3.0 } else { 1.0 }),
|
||||
Direction::Right | Direction::Bottom => self.scale_color(color, if is_inset { 1.0 } else { 2.0/3.0 })
|
||||
};
|
||||
|
||||
let mut scaled_color;
|
||||
|
||||
// You can't scale black color (i.e. 'scaled = 0 * scale', equals black).
|
||||
if color.r != 0.0 || color.g != 0.0 || color.b != 0.0 {
|
||||
scaled_color = match direction {
|
||||
Direction::Top | Direction::Left => self.scale_color(color, if is_inset { 2.0/3.0 } else { 1.0 }),
|
||||
Direction::Right | Direction::Bottom => self.scale_color(color, if is_inset { 1.0 } else { 2.0/3.0 })
|
||||
};
|
||||
} else {
|
||||
scaled_color = match direction {
|
||||
Direction::Top | Direction::Left => if is_inset { Color::new(0.3, 0.3, 0.3, color.a) } else { Color::new(0.7, 0.7, 0.7, color.a) },
|
||||
Direction::Right | Direction::Bottom => if is_inset { Color::new(0.7, 0.7, 0.7, color.a) } else { Color::new(0.3, 0.3, 0.3, color.a) }
|
||||
};
|
||||
}
|
||||
|
||||
self.draw_border_path(&original_bounds, direction, border, radius, scaled_color);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue