Clip inside border region when redraw_quick
This commit is contained in:
parent
d9c786e88c
commit
cc590001d7
2 changed files with 14 additions and 6 deletions
|
@ -35,17 +35,24 @@ impl<'a> Painter<'a> {
|
||||||
ctx.theme_border(&self.theme);
|
ctx.theme_border(&self.theme);
|
||||||
ctx.stroke().unwrap();
|
ctx.stroke().unwrap();
|
||||||
|
|
||||||
// ctx.reset_clip();
|
self.border_clip();
|
||||||
// // finally, clip any future content so the border stays alive
|
}
|
||||||
|
|
||||||
|
pub fn border_clip(&self)
|
||||||
|
{
|
||||||
|
let ctx = self.context;
|
||||||
|
|
||||||
|
ctx.reset_clip();
|
||||||
|
// clip any future content so the border stays alive
|
||||||
let (x1,y1,x2,y2) = ctx.clip_extents().unwrap(); // the path of the clip
|
let (x1,y1,x2,y2) = ctx.clip_extents().unwrap(); // the path of the clip
|
||||||
// // region, i.e. the surface
|
// region, i.e. the surface
|
||||||
|
|
||||||
debug!{"Border extent: {},{},{},{}", x1, y1, x2, y2};
|
debug!{"Border extent: {},{},{},{}", x1, y1, x2, y2};
|
||||||
let border = self.theme.border(ctx); // width of the border, note
|
let border = self.theme.border(ctx); // width of the border, note
|
||||||
// that half of the border is outside
|
// that half of the border is outside
|
||||||
// the clip_extents
|
// the clip_extents
|
||||||
|
|
||||||
// let (x1,y1,x2,y2) = (x1+border, y1+border, x2-border, y2-border);
|
// let (x1,y1,x2,y2) = (x1+border, y1+border, x2-border, y2-border);
|
||||||
debug!{"Border rect: {},{},{},{}", x1, y1, x2, y2};
|
debug!{"Border rect: {},{},{},{}", x1, y1, x2, y2};
|
||||||
let (x1,y1,x2,y2) = (x1+border,y1+border,x2-x1-border,y2-y1-border-border);
|
let (x1,y1,x2,y2) = (x1+border,y1+border,x2-x1-border,y2-y1-border-border);
|
||||||
debug!{"Border clip: {},{},{},{}", x1, y1, x2, y2};
|
debug!{"Border clip: {},{},{},{}", x1, y1, x2, y2};
|
||||||
|
|
|
@ -96,6 +96,7 @@ pub fn redraw_quick(window: &Window, result: Vec<(&Entry, Vec<usize>)>, selectio
|
||||||
context.scale(30.0, 30.0);
|
context.scale(30.0, 30.0);
|
||||||
|
|
||||||
let painter = painter::Painter::new(&context);
|
let painter = painter::Painter::new(&context);
|
||||||
|
painter.border_clip();
|
||||||
|
|
||||||
result.iter().enumerate()
|
result.iter().enumerate()
|
||||||
.for_each(|(i, r)| {
|
.for_each(|(i, r)| {
|
||||||
|
|
Loading…
Reference in a new issue