Rainbow: WinGL..

git-svn-id: svn://ultimatepp.org/upp/trunk@3677 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
unodgs 2011-07-19 18:12:50 +00:00
parent ef7fbfb40b
commit cde2305fc9
10 changed files with 39 additions and 56 deletions

View file

@ -107,7 +107,7 @@ void InfoPanel::Paint(Draw& w)
Size sz = GetSize();
Size wsz = screenRect.GetSize();
Color frameColor = Color(183, 183, 183);
Color bgColor = Color(102, 102, 102);// Color(74, 125, 153);
Color bgColor = Color(102, 102, 102);
w.DrawRect(sz, bgColor);
w.DrawRect(0, 0, 1, sz.cy, frameColor);
w.DrawRect(0, 0, sz.cx, 1, frameColor);
@ -118,7 +118,6 @@ void InfoPanel::Paint(Draw& w)
void InfoPanel::Init(Ctrl& parent, float angle, float scale, float alpha)
{
int screenWidth = screenRect.Width();
int width = 585;
int distance = (screenWidth - width) / 2;
@ -128,10 +127,11 @@ void InfoPanel::Init(Ctrl& parent, float angle, float scale, float alpha)
return;
init = false;
parent.Add(*this);
//parent.Add(*this);
PopUp(&parent, true, false);
alphaSlider.SetPos(alpha, 0.f, 255.f);
angleSlider.SetPos(angle, 0.f, 360.f);
scaleSlider.SetPos(scale, 1.f, 10.f);
scaleSlider.SetPos(scale, 1.f, 5.f);
}
float InfoPanel::GetAlpha()

View file

@ -30,7 +30,7 @@
friend class TopWindowFrame;
friend class SystemDraw;
void SetOpen(bool b) { isopen = b; }
void SetOpen(bool b) { isopen = b; }
public:
static Rect screenRect;
@ -41,9 +41,10 @@ public:
static void DoMouseGl(int event, Point p, int zdelta = 0);
static bool DoKeyGl(dword key, int cnt);
static void CursorSync(Draw& w);
static void MouseSync(Draw& w);
static void SetDesktop(Ctrl& q);
static Ctrl *GetDesktop() { return desktop; }
static Ctrl *GetDesktop() { return desktop; }
static void SetWindowSize(Size sz);
static void DrawScreen();

View file

@ -7,7 +7,7 @@ NAMESPACE_UPP
void OpenGLFont::LoadBrc(const byte* xml, const byte* image)
{
Parse((const char*) xml, false);
compiledFiles.Add(image);
compiledFiles.Add((byte*) image);
pages.Add();
}

View file

@ -1,4 +1,3 @@
//#include <CtrlCore/CtrlCore.h>
#include "TopFrame.h"
#ifdef GUI_WINGL
@ -99,12 +98,13 @@ void Ctrl::CursorSync(Draw& w)
glCaretRect = cr;
if(!cr.IsEmpty())
w.DrawRect(cr, Black);
}
void Ctrl::MouseSync(Draw& w)
{
glCursorPos = GetMousePos() - glCursorImage.GetHotSpot();
Size sz = glCursorImage.GetSize();
glPushMatrix();
glLoadIdentity();
w.DrawImage(glCursorPos.x, glCursorPos.y, sz.cx, sz.cy, glCursorImage);
glPopMatrix();
}
void Ctrl::SetMouseCursor(const Image& image)

View file

@ -29,7 +29,7 @@ struct OpenGLFont : Moveable<OpenGLFont>
Vector<CharInfo> chars;
VectorMap<int, VectorMap<int, float> > kerns;
Vector<String> files;
Array<const byte> compiledFiles;
Array<byte> compiledFiles;
Vector<int64> pages;
OpenGLFont() : texturesUpdated(false)

View file

@ -64,7 +64,6 @@ void TopWindow::SyncRect()
void TopWindow::Open(Ctrl *owner)
{
GuiLock __;
DLOG("Open " << Upp::Name(owner));
Rect r = GetRect();
if(r.IsEmpty())
SetRect(GetDefaultWindowRect());

View file

@ -140,7 +140,6 @@ void TopWindowFrame::StartDrag()
SetCapture();
startrect = GetRect();
startpos = GetMousePos();
DLOG("START DRAG ---------------");
}
void TopWindowFrame::GripResize()
@ -163,8 +162,6 @@ void TopWindowFrame::LeftDouble(Point p, dword keyflags)
void TopWindowFrame::MouseMove(Point, dword)
{
//DDUMP(HasWndCapture());
DDUMP(HasCapture());
if(!HasCapture())
return;
Size msz = ComputeClient(minsize).GetSize();

View file

@ -47,10 +47,8 @@ void Ctrl::InitGl()
void Ctrl::EndSession()
{
GuiLock __;
DLOG("Ctrl::EndSession");
glEndSession = true;
glEndSessionLoop = glEventLoop;
DDUMP(glEndSessionLoop);
}
void Ctrl::ExitGl()
{
@ -96,7 +94,6 @@ Ctrl *Ctrl::GetOwner()
int q = FindTopCtrl();
if(q > 0 && topctrl[q]->top) {
Ctrl *x = topctrl[q]->top->owner_window;
DDUMP(Upp::Name(x));
return dynamic_cast<TopWindowFrame *>(x) ? x->GetOwner() : x;
}
return NULL;
@ -105,6 +102,8 @@ Ctrl *Ctrl::GetOwner()
Ctrl *Ctrl::GetActiveCtrl()
{
GuiLock __;
if(focusCtrl == &infoPanel)
return desktop;
return focusCtrl ? focusCtrl->GetTopCtrl() : NULL;
}
@ -156,7 +155,6 @@ void Ctrl::SyncTopWindows()
bool Ctrl::ProcessEvent(bool *quit)
{
DLOG("@ ProcessEvent");
ASSERT(IsMainThread());
if(DoCall()) {
SyncTopWindows();
@ -165,7 +163,6 @@ bool Ctrl::ProcessEvent(bool *quit)
if(!GetMouseLeft() && !GetMouseRight() && !GetMouseMiddle())
ReleaseCtrlCapture();
if(GlProcessEvent(quit)) {
DLOG("GlProcesEvent returned true");
SyncTopWindows();
DefferedFocusSync();
SyncCaret();
@ -188,9 +185,10 @@ void Ctrl::DrawScreen()
draw.FlatView();
draw.Clear();
desktop->ApplyTransform(TS_BEFORE_PAINT);
desktop->CtrlPaint(draw, clip, &infoPanel);
//desktop->UpdateArea(draw, clip);
desktop->CtrlPaint(draw, clip);
for(int i = 0; i < topctrl.GetCount(); i++) {
if(topctrl[i] == &infoPanel)
continue;
Rect r = topctrl[i]->GetRect();
draw.Clipoff(r);
topctrl[i]->CtrlPaint(draw, clip);
@ -198,6 +196,18 @@ void Ctrl::DrawScreen()
}
CursorSync(draw);
desktop->ApplyTransform(TS_AFTER_PAINT);
glLoadIdentity();
#if CLIP_MODE == 2
glDisable(GL_STENCIL_TEST);
#endif
draw.alpha = 255.f;
draw.Offset(infoPanel.GetRect().TopLeft());
infoPanel.CtrlPaint(draw, clip, NULL);
draw.End();
#if CLIP_MODE == 2
glEnable(GL_STENCIL_TEST);
#endif
MouseSync(draw);
SwapBuffers(hDC);
painting = false;
LOGF("Fps %.2f\n", GetFps());
@ -272,8 +282,6 @@ void Ctrl::EventLoop0(Ctrl *ctrl)
bool quit = false;
ProcessEvents(&quit);
int64 loopno = ++glEventLoop;
DDUMP(loopno);
DDUMP(glEndSessionLoop);
while(loopno > glEndSessionLoop && !quit && (ctrl ? ctrl->IsOpen() && ctrl->InLoop() : GetTopCtrls().GetCount()))
{
// LLOG(GetSysTime() << " % " << (unsigned)msecs() % 10000 << ": EventLoop / GuiSleep");
@ -282,8 +290,6 @@ void Ctrl::EventLoop0(Ctrl *ctrl)
// LLOG(GetSysTime() << " % " << (unsigned)msecs() % 10000 << ": EventLoop / ProcessEvents");
ProcessEvents(&quit);
// LLOG(GetSysTime() << " % " << (unsigned)msecs() % 10000 << ": EventLoop / after ProcessEvents");
DDUMP(loopno);
DDUMP(glEndSessionLoop);
}
if(ctrl)
@ -491,7 +497,6 @@ void Ctrl::WndSetPos0(const Rect& rect)
void Ctrl::WndScrollView0(const Rect& r, int dx, int dy)
{
GuiLock __;
//Refresh(r);
}
void Ctrl::PopUp(Ctrl *owner, bool savebits, bool activate, bool dropshadow, bool topmost)

View file

@ -562,7 +562,7 @@ private:
void SyncScroll();
void PaintCaret(SystemDraw& w);
#ifdef flagWINGL
void CtrlPaint(SystemDraw& w, const Rect& clip, Ctrl* debugctrl = NULL, int depth = 0);
void CtrlPaint(SystemDraw& w, const Rect& clip, int depth = 0);
#else
void CtrlPaint(SystemDraw& w, const Rect& clip);
#endif

View file

@ -241,7 +241,7 @@ struct sDrawLevelCheck {
#define DOLEVELCHECK
#endif
#ifdef flagWINGL
void Ctrl::CtrlPaint(SystemDraw& w, const Rect& clip, Ctrl* debugctrl, int depth) {
void Ctrl::CtrlPaint(SystemDraw& w, const Rect& clip, int depth) {
GuiLock __;
LEVELCHECK(w, this);
LTIMING("CtrlPaint");
@ -251,18 +251,8 @@ void Ctrl::CtrlPaint(SystemDraw& w, const Rect& clip, Ctrl* debugctrl, int depth
if(!IsShown() || orect.IsEmpty() || clip.IsEmpty() || !clip.Intersects(orect))
return;
if(debugctrl == this)
{
#if CLIP_MODE == 2
glDisable(GL_STENCIL_TEST);
#endif
w.FlatView(false);
}
else
{
glPushMatrix();
ApplyTransform(TS_BEFORE_CTRL_PAINT);
}
glPushMatrix();
ApplyTransform(TS_BEFORE_CTRL_PAINT);
Ctrl *q;
Rect view = rect;
@ -286,7 +276,7 @@ void Ctrl::CtrlPaint(SystemDraw& w, const Rect& clip, Ctrl* debugctrl, int depth
LEVELCHECK(w, q);
Point off = q->GetRect().TopLeft();
w.Offset(off);
q->CtrlPaint(w, clip - off, debugctrl, depth + 1);
q->CtrlPaint(w, clip - off, depth + 1);
w.End();
}
else
@ -333,7 +323,7 @@ void Ctrl::CtrlPaint(SystemDraw& w, const Rect& clip, Ctrl* debugctrl, int depth
Rect ocl = cl - off;
if(ocl.Intersects(Rect(qr.GetSize()).Inflated(overpaint))) {
w.Offset(off);
q->CtrlPaint(w, rr - off, debugctrl, depth + 1);
q->CtrlPaint(w, rr - off, depth + 1);
w.End();
}
//if(q->cliptobounds)
@ -341,17 +331,8 @@ void Ctrl::CtrlPaint(SystemDraw& w, const Rect& clip, Ctrl* debugctrl, int depth
}
}
if(debugctrl != this)
{
ApplyTransform(TS_AFTER_CTRL_PAINT);
glPopMatrix();
}
else
{
#if CLIP_MODE == 2
glEnable(GL_STENCIL_TEST);
#endif
}
ApplyTransform(TS_AFTER_CTRL_PAINT);
glPopMatrix();
}
#else
void Ctrl::CtrlPaint(SystemDraw& w, const Rect& clip) {