diff --git a/rainbow/Framebuffer/Util.cpp b/rainbow/Framebuffer/Util.cpp index 984717844..007be7b57 100644 --- a/rainbow/Framebuffer/Util.cpp +++ b/rainbow/Framebuffer/Util.cpp @@ -46,6 +46,26 @@ Size GetScreenSize() } */ +static uint64 sGetAniPat(uint64 src, int pos) +{ + uint64 out = 0; + pos &= 7; + for(int i = 8; --i >= 0;) { + byte sr = (byte)(src >> (8 * ((7 - i - pos) & 7))); + out = (out << 8) | (byte)((sr | (sr << 8)) >> pos); + } + return out; +} + +void DrawDragRect(Ctrl& q, const Rect& rect1, const Rect& rect2, const Rect& clip, int n, + Color color, int type, int animation) +{ + ViewDraw w(&q); + uint64 pattern = type == DRAWDRAGRECT_DASHED ? I64(0xf0783c1e0f87c3e1) : + type == DRAWDRAGRECT_NORMAL ? I64(0x55aa55aa55aa55aa) : 0; + DrawDragRect(w, rect1, rect2, clip, n, color, sGetAniPat(pattern, animation)); +} + END_UPP_NAMESPACE #endif diff --git a/rainbow/LinuxFb/Proc.cpp b/rainbow/LinuxFb/Proc.cpp index 450fcc65f..99434e576 100644 --- a/rainbow/LinuxFb/Proc.cpp +++ b/rainbow/LinuxFb/Proc.cpp @@ -69,6 +69,12 @@ void FBUpdate(const Rect& inv) memcpy(fbp, (const char*)~framebuffer, framebuffer.GetLength() * sizeof(RGBA)); } +void FBFlush() +{ +// ::UpdateWindow(fbHWND); +// GdiFlush(); +} + void FBInit(const String& fbdevice) { Ctrl::InitFB(); diff --git a/rainbow/PaintGl/PaintGl.upp b/rainbow/PaintGl/PaintGl.upp index b05f18b44..efe9a57a2 100644 --- a/rainbow/PaintGl/PaintGl.upp +++ b/rainbow/PaintGl/PaintGl.upp @@ -3,9 +3,19 @@ uses uses(WINGL) WinGl; +uses(WINFB) WinFb; + +uses(SDLFB) SDLFb; + +uses(LINUXFB) LinuxFb; + file main.cpp; mainconfig - "" = "GUI WINGL"; + "" = "GUI WINGL", + "" = "GUI WINFB", + "" = "GUI SDLFB", + "" = "GUI LINUXFB", + "" = "GUI"; diff --git a/rainbow/PaintGl/init b/rainbow/PaintGl/init index 3bef89a90..c607e619e 100644 --- a/rainbow/PaintGl/init +++ b/rainbow/PaintGl/init @@ -2,4 +2,7 @@ #define _PaintGl_icpp_init_stub #include "CtrlLib/init" #include "WinGl/init" +#include "WinFb/init" +#include "SDLFb/init" +#include "LinuxFb/init" #endif diff --git a/rainbow/PaintGl/main.cpp b/rainbow/PaintGl/main.cpp index e8736cbeb..76579343f 100644 --- a/rainbow/PaintGl/main.cpp +++ b/rainbow/PaintGl/main.cpp @@ -66,10 +66,15 @@ GUI_APP_MAIN { App app; ChStdSkin(); +#if defined(GUI_FB) || defined(GUI_WINGL) Ctrl::SetDesktop(app); app.SetFocus(); - /*TopWindow top; +#else + //make app a TopWindow, that EventLoop can handle + //not needed it app is a TopWindow itself + TopWindow top; top.Add(app.SizePos()); - top.Open();*/ + top.Open(); +#endif Ctrl::EventLoop(); } diff --git a/rainbow/SDLFb/Win.cpp b/rainbow/SDLFb/Win.cpp index dd7ad8dd1..e50a9e485 100644 --- a/rainbow/SDLFb/Win.cpp +++ b/rainbow/SDLFb/Win.cpp @@ -156,14 +156,37 @@ void FBUpdate(const Rect& inv) { //The invalidated areas accumulate in the update region until the region is processed when the next WM_PAINT message occurs SDL_LockSurface(screen); - const ImageBuffer& framebuffer = Ctrl::GetFrameBuffer(); - memcpy(screen->pixels, (const char*)~framebuffer, framebuffer.GetLength() * sizeof(RGBA)); +#if 1 + memcpy(screen->pixels, ~framebuffer, framebuffer.GetLength() * sizeof(RGBA)); +#endif + +#if 1 + ASSERT(Size(screen->w,screen->h) == framebuffer.GetSize()); + + Size ssz = inv.GetSize(); + Size dsz = framebuffer.GetSize(); + + ASSERT(Rect(dsz).Contains(inv)); + + for(int i = inv.top; i < inv.bottom; i++) + { + uint32 o = i * dsz.cx + inv.left; + memcpy(((RGBA*)screen->pixels) + o, (~framebuffer) + o, ssz.cx * sizeof(RGBA)); + } +#endif + SDL_UnlockSurface(screen); SDL_Flip(screen); } +void FBFlush() +{ +// ::UpdateWindow(fbHWND); +// GdiFlush(); +} + void FBInit() { GuiLock __; diff --git a/rainbow/UWord/UWord.upp b/rainbow/UWord/UWord.upp index 4131c1f9e..f80a8051c 100644 --- a/rainbow/UWord/UWord.upp +++ b/rainbow/UWord/UWord.upp @@ -14,6 +14,8 @@ uses(WINALT) WinAlt; uses(SDLFB) SDLFb; +uses(LINUXFB) LinuxFb; + uses(WINGL) WinGl; file @@ -21,10 +23,11 @@ file UWord.iml; mainconfig + "" = "GUI SKELETON", "" = "GUI WINFB", "" = "GUI WINALT", - "" = "GUI SKELETON", "" = "GUI SDLFB", + "" = "GUI LINUXFB", "" = "GUI WINGL", "" = "GUI"; diff --git a/rainbow/WinGl/Util.cpp b/rainbow/WinGl/Util.cpp index afd19a1c8..74b914d02 100644 --- a/rainbow/WinGl/Util.cpp +++ b/rainbow/WinGl/Util.cpp @@ -15,6 +15,26 @@ Size GetScreenSize() } */ +static uint64 sGetAniPat(uint64 src, int pos) +{ + uint64 out = 0; + pos &= 7; + for(int i = 8; --i >= 0;) { + byte sr = (byte)(src >> (8 * ((7 - i - pos) & 7))); + out = (out << 8) | (byte)((sr | (sr << 8)) >> pos); + } + return out; +} + +void DrawDragRect(Ctrl& q, const Rect& rect1, const Rect& rect2, const Rect& clip, int n, + Color color, int type, int animation) +{ + ViewDraw w(&q); + uint64 pattern = type == DRAWDRAGRECT_DASHED ? I64(0xf0783c1e0f87c3e1) : + type == DRAWDRAGRECT_NORMAL ? I64(0x55aa55aa55aa55aa) : 0; + DrawDragRect(w, rect1, rect2, clip, n, color, sGetAniPat(pattern, animation)); +} + END_UPP_NAMESPACE #endif