rainbow: compile errors, porting some restructure, no new code

git-svn-id: svn://ultimatepp.org/upp/trunk@3644 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
kohait 2011-07-11 20:01:25 +00:00
parent 5d80e3e0a4
commit ca8f753457
8 changed files with 96 additions and 6 deletions

View file

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

View file

@ -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();

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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