mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-08-11 22:03:09 -06:00
CtrlCore: gtk be IsPainting implemented (RM #398)
git-svn-id: svn://ultimatepp.org/upp/trunk@5703 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
79fc0d8eff
commit
9e68b88807
2 changed files with 15 additions and 1 deletions
|
|
@ -44,14 +44,18 @@ private:
|
|||
void Push();
|
||||
void Pop();
|
||||
Vector<Point> offset;
|
||||
Vector<Rect> clip;
|
||||
|
||||
cairo_t *cr;
|
||||
|
||||
SystemDraw() {}
|
||||
|
||||
friend class ImageDraw;
|
||||
friend class BackDraw;
|
||||
friend class ViewDraw;
|
||||
|
||||
Rect GetClip() const;
|
||||
|
||||
public:
|
||||
void SetColor(Color c);
|
||||
operator cairo_t*() { return cr; }
|
||||
|
|
|
|||
|
|
@ -21,16 +21,24 @@ Point SystemDraw::GetOffset() const
|
|||
return offset.GetCount() ? offset.Top() : Point(0, 0);
|
||||
}
|
||||
|
||||
Rect SystemDraw::GetClip() const
|
||||
{
|
||||
return clip.GetCount() ? clip.Top() : Rect(-999999, -999999, 999999, 999999);
|
||||
}
|
||||
|
||||
void SystemDraw::Push()
|
||||
{
|
||||
cairo_save(cr);
|
||||
offset.Add(GetOffset());
|
||||
clip.Add(GetClip());
|
||||
}
|
||||
|
||||
void SystemDraw::Pop()
|
||||
{
|
||||
if(offset.GetCount())
|
||||
offset.Drop();
|
||||
if(clip.GetCount())
|
||||
clip.Drop();
|
||||
cairo_restore(cr);
|
||||
}
|
||||
|
||||
|
|
@ -59,6 +67,7 @@ void SystemDraw::RectPath(const Rect& r)
|
|||
bool SystemDraw::ClipOp(const Rect& r)
|
||||
{
|
||||
Push();
|
||||
clip.Top() &= r.Offseted(GetOffset());
|
||||
RectPath(r);
|
||||
cairo_clip(cr);
|
||||
return true;
|
||||
|
|
@ -67,6 +76,7 @@ bool SystemDraw::ClipOp(const Rect& r)
|
|||
bool SystemDraw::ClipoffOp(const Rect& r)
|
||||
{
|
||||
Push();
|
||||
clip.Top() &= r.Offseted(GetOffset());
|
||||
offset.Top() += r.TopLeft();
|
||||
RectPath(r);
|
||||
cairo_clip(cr);
|
||||
|
|
@ -93,7 +103,7 @@ bool SystemDraw::IntersectClipOp(const Rect& r)
|
|||
|
||||
bool SystemDraw::IsPaintingOp(const Rect& r) const
|
||||
{
|
||||
return true;
|
||||
return r.Offseted(GetOffset()).Intersects(GetClip());
|
||||
}
|
||||
|
||||
Rect SystemDraw::GetPaintRect() const
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue