mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-08-21 22:04:56 -06:00
Draw: AddRefreshRect (extracted from X11 Invalidate)
git-svn-id: svn://ultimatepp.org/upp/trunk@3558 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
620735a96c
commit
17a01d00cf
4 changed files with 29 additions and 22 deletions
|
|
@ -33,7 +33,6 @@ Vector<Rect> Subtract(const Vector<Rect>& r1, const Vector<Rect>& r2)
|
|||
return q;
|
||||
}
|
||||
|
||||
|
||||
Vector<Rect> Xor(const Vector<Rect>& r1, const Vector<Rect>& r2)
|
||||
{
|
||||
Vector<Rect> is = Intersect(r1, r2);
|
||||
|
|
|
|||
|
|
@ -964,27 +964,7 @@ void Ctrl::Invalidate(XWindow& xw, const Rect& _r)
|
|||
GuiLock __;
|
||||
LTIMING("Invalidate");
|
||||
LLOG("Invalidate " << UPP::Name(xw.ctrl) << " " << _r);
|
||||
Vector<Rect> inv;
|
||||
Rect r = _r;
|
||||
int ra = r.Width() * r.Height();
|
||||
for(int i = 0; i < xw.invalid.GetCount(); i++) {
|
||||
const Rect& ir = xw.invalid[i];
|
||||
Rect ur = r | ir;
|
||||
if(ur.Width() * ur.Height() < 2 * (ir.Width() * ir.Height() + ra))
|
||||
r = ur;
|
||||
else
|
||||
if(!r.Contains(xw.invalid[i]))
|
||||
inv.Add(xw.invalid[i]);
|
||||
}
|
||||
Vector<Rect> rs;
|
||||
rs.Add(r);
|
||||
for(int i = 0; i < inv.GetCount(); i++) {
|
||||
bool ch = false;
|
||||
Vector<Rect> rs1 = Subtract(rs, inv[i], ch);
|
||||
if(ch) rs = rs1;
|
||||
}
|
||||
inv.AppendPick(rs);
|
||||
xw.invalid = inv;
|
||||
AddRefreshRect(xw.invalid, _r);
|
||||
}
|
||||
|
||||
void Ctrl::AddGlobalRepaint()
|
||||
|
|
|
|||
|
|
@ -792,6 +792,9 @@ Vector<Rect> Intersect(const Vector<Rect>& b, const Rect& a, bool& changed);
|
|||
void Subtract(Vector<Rect>& rr, const Rect& sub);
|
||||
void Union(Vector<Rect>& rr, const Rect& add);
|
||||
|
||||
void AddRefreshRect(Vector<Rect>& invalid, const Rect& _r);
|
||||
|
||||
|
||||
void DrawRect(Draw& w, const Rect& rect, const Image& img, bool ralgn = false); //??? TODO
|
||||
void DrawRect(Draw& w, int x, int y, int cx, int cy, const Image& img, bool ra = false);
|
||||
|
||||
|
|
|
|||
|
|
@ -88,6 +88,31 @@ Vector<Rect> Intersect(const Vector<Rect>& b, const Rect& a, bool& changed)
|
|||
return result;
|
||||
}
|
||||
|
||||
void AddRefreshRect(Vector<Rect>& invalid, const Rect& _r)
|
||||
{
|
||||
Vector<Rect> inv;
|
||||
Rect r = _r;
|
||||
int ra = r.Width() * r.Height();
|
||||
for(int i = 0; i < invalid.GetCount(); i++) {
|
||||
const Rect& ir = invalid[i];
|
||||
Rect ur = r | ir;
|
||||
if(ur.Width() * ur.Height() < 2 * (ir.Width() * ir.Height() + ra))
|
||||
r = ur;
|
||||
else
|
||||
if(!r.Contains(ir))
|
||||
inv.Add(ir);
|
||||
}
|
||||
Vector<Rect> rs;
|
||||
rs.Add(r);
|
||||
for(int i = 0; i < inv.GetCount(); i++) {
|
||||
bool ch = false;
|
||||
Vector<Rect> rs1 = Subtract(rs, inv[i], ch);
|
||||
if(ch) rs = rs1;
|
||||
}
|
||||
inv.AppendPick(rs);
|
||||
invalid = inv;
|
||||
}
|
||||
|
||||
void DrawFatFrame(Draw& w, int x, int y, int cx, int cy, Color color, int n) {
|
||||
if(n < 0) {
|
||||
x += n;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue