.developing rainbow

git-svn-id: svn://ultimatepp.org/upp/trunk@3572 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2011-06-27 21:43:40 +00:00
parent bacadf9c6f
commit 76e0cda649
8 changed files with 111 additions and 143 deletions

View file

@ -1,8 +1,10 @@
class ViewDraw : public SystemDraw {
ImageBuffer ib;
Vector<Rect> dummy_invalid;
public:
ViewDraw(Ctrl *ctrl) : SystemDraw(ib) { _DBG_ }
ViewDraw(Ctrl *ctrl) : SystemDraw(ib, dummy_invalid) { _DBG_ }
~ViewDraw() {}
};

View file

@ -7,6 +7,69 @@ NAMESPACE_UPP
#define LLOG(x) // LOG(x)
#define LTIMING(x) // RTIMING(x)
void SystemDraw::Push()
{
Point p = GetOffset();
offset.Add(p);
BufferPainter::BeginOp();
}
void SystemDraw::Pop()
{
if(offset.GetCount())
offset.Drop();
BufferPainter::EndOp();
}
Point SystemDraw::GetOffset() const
{
return offset.GetCount() ? offset.Top() : Point(0, 0);
}
void SystemDraw::BeginOp()
{
Push();
}
void SystemDraw::EndOp()
{
Pop();
}
void SystemDraw::OffsetOp(Point p)
{
Push();
offset.Top() += p;
Translate(p.x, p.y);
}
bool SystemDraw::ClipOp(const Rect& r)
{
Push();
RectPath(r);
Painter::Clip();
return true;
}
bool SystemDraw::ClipoffOp(const Rect& r)
{
Push();
offset.Top() += r.TopLeft();
RectPath(r);
Painter::Clip();
Translate(r.left, r.top);
return true;
}
bool SystemDraw::IsPaintingOp(const Rect& r) const
{
Rect rr = r + GetOffset();
for(int i = 0; i < invalid.GetCount(); i++)
if(invalid[i].Intersects(rr))
return true;
return true;
}
/*Rect SystemDraw::GetVirtualScreenArea()
{
GuiLock __;

View file

@ -136,6 +136,7 @@ void Ctrl::CursorSync()
Over(framebuffer, p, fbCursorImage, sz);
FBUpdate(tr);
FBSync();
}
}

View file

@ -6,19 +6,37 @@ NAMESPACE_UPP
class SystemDraw : public BufferPainter {
public:
Point GetOffset() const { return Point(0, 0); }
bool CanSetSurface() { return false; }
bool Clip(const Rect& r) { return Draw::Clip(r); }
bool Clip(int x, int y, int cx, int cy) { return Draw::Clip(x, y, cx, cy); }
virtual void BeginOp();
virtual void EndOp();
virtual void OffsetOp(Point p);
virtual bool ClipOp(const Rect& r);
virtual bool ClipoffOp(const Rect& r);
virtual bool IsPaintingOp(const Rect& r) const;
private:
Vector<Point> offset;
const Vector<Rect>& invalid;
void Push();
void Pop();
public:
Point GetOffset() const;
bool CanSetSurface() { return false; }
bool Clip(const Rect& r) { return Draw::Clip(r); }
bool Clip(int x, int y, int cx, int cy) { return Draw::Clip(x, y, cx, cy); }
static void Flush() {}
SystemDraw(ImageBuffer& ib, int mode = MODE_ANTIALIASED) : BufferPainter(ib, mode) {}
SystemDraw(ImageBuffer& ib, const Vector<Rect>& invalid, int mode = MODE_ANTIALIASED)
: BufferPainter(ib, mode), invalid(invalid) {}
};
struct BackDraw__ : public SystemDraw {
ImageBuffer h;
Vector<Rect> dummy_invalid;
BackDraw__() : SystemDraw(h) {}
BackDraw__() : SystemDraw(h, dummy_invalid) {}
};
class BackDraw : public BackDraw__ { // Dummy only, as we are running in GlobalBackBuffer mode
@ -89,6 +107,7 @@ bool FBProcessEvent(bool *quit);
void FBSleep(int ms);
bool FBEndSession();
void FBUpdate(const Rect& area);
void FBSync();
// }

View file

@ -17,6 +17,5 @@ file
Top.cpp,
Clip.cpp,
DnD.cpp,
ChSysInit.cpp,
Msg.i;
ChSysInit.cpp;

View file

@ -1,126 +0,0 @@
#pragma BLITZ_APPROVE
x_MSG(WM_CREATE)
x_MSG(WM_DESTROY)
x_MSG(WM_MOVE)
x_MSG(WM_SIZE)
x_MSG(WM_ACTIVATE)
x_MSG(WM_SETFOCUS)
x_MSG(WM_KILLFOCUS)
x_MSG(WM_ENABLE)
x_MSG(WM_SETREDRAW)
x_MSG(WM_SETTEXT)
x_MSG(WM_GETTEXT)
x_MSG(WM_GETTEXTLENGTH)
x_MSG(WM_PAINT)
x_MSG(WM_CLOS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G(WM_WINDOWPOSCHANGED)
#ifndef PLATFORM_WINCE
x_MSG(WM_QUERYENDSESSION)
x_MSG(WM_ENDSESSION)
x_MSG(WM_QUERYOPEN)
x_MSG(WM_DEVMODECHANGE)
x_MSG(WM_ACTIVATEAPP)
x_MSG(WM_TIMECHANGE)
x_MSG(WM_MOUSEACTIVATE)
x_MSG(WM_CHILDACTIVATE)
x_MSG(WM_QUEUESYNC)
x_MSG(WM_GETMINMAXINFO)
x_MSG(WM_ICONERASEBKGND)
x_MSG(WM_SPOOLERSTATUS)
x_MSG(WM_COMPACTING)
x_MSG(WM_NCLBUTTONDOWN)
x_MSG(WM_NCLBUTTONUP)
x_MSG(WM_NCLBUTTONDBLCLK)
x_MSG(WM_NCRBUTTONDOWN)
x_MSG(WM_NCRBUTTONUP)
x_MSG(WM_NCRBUTTONDBLCLK)
x_MSG(WM_NCMBUTTONDOWN)
x_MSG(WM_NCMBUTTONUP)
x_MSG(WM_NCMBUTTONDBLCLK)
x_MSG(WM_NCCREATE)
x_MSG(WM_NCDESTROY)
x_MSG(WM_NCCALCSIZE)
x_MSG(WM_NCPAINT)
x_MSG(WM_NCACTIVATE)
x_MSG(WM_INITMENU)
x_MSG(WM_MENUSELECT)
x_MSG(WM_PARENTNOTIFY)
x_MSG(WM_MDICREATE)
x_MSG(WM_MDIDESTROY)
x_MSG(WM_MDIACTIVATE)
x_MSG(WM_MDIRESTORE)
x_MSG(WM_MDINEXT)
x_MSG(WM_MDIMAXIMIZE)
x_MSG(WM_MDITILE)
x_MSG(WM_MDICASCADE)
x_MSG(WM_MDIICONARRANGE)
x_MSG(WM_MDIGETACTIVE)
x_MSG(WM_MDISETMENU)
x_MSG(WM_DRAWCLIPBOARD)
x_MSG(WM_PAINTCLIPBOARD)
x_MSG(WM_VSCROLLCLIPBOARD)
x_MSG(WM_SIZECLIPBOARD)
x_MSG(WM_ASKCBFORMATNAME)
x_MSG(WM_CHANGECBCHAIN)
x_MSG(WM_HSCROLLCLIPBOARD)
x_MSG(WM_PALETTEISCHANGING)
x_MSG(WM_DROPFILES)
x_MSG(WM_POWER)
x_MSG(WM_WINDOWPOSCHANGING)
#endif

View file

@ -127,16 +127,20 @@ bool Ctrl::ProcessEvents(bool *quit)
if(invalid.GetCount()) {
RemoveCursor();
RemoveCaret();
}
for(int i = 0; i < invalid.GetCount(); i++) { _DBG_ // Optimize for single UpdateArea!
SystemDraw painter(framebuffer);
painter.Draw::Clip(invalid[i]);
SystemDraw painter(framebuffer, invalid);
painter.Begin();
Rect r = invalid[0];
for(int i = 0; i < invalid.GetCount(); i++) {
painter.RectPath(invalid[i]);
r |= invalid[i];
}
painter.Painter::Clip();
if(desktop)
desktop->UpdateArea(painter, invalid[i]);
painter.End();
FBUpdate(invalid[i]);
desktop->UpdateArea(painter, r);
for(int i = 0; i < invalid.GetCount(); i++)
FBUpdate(invalid[i]);
invalid.Clear();
}
invalid.Clear();
CursorSync();
return false;
}

View file

@ -63,4 +63,10 @@ void FBUpdate(const Rect& inv)
::InvalidateRect(fbHWND, inv, false);
}
void FBSync()
{
if(fbHWND)
::UpdateWindow(fbHWND);
}
END_UPP_NAMESPACE