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:
cxl 2013-01-03 21:25:42 +00:00
parent 79fc0d8eff
commit 9e68b88807
2 changed files with 15 additions and 1 deletions

View file

@ -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; }

View file

@ -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