Intel Graphics fixes

This commit is contained in:
Mark Watkins 2011-06-27 17:45:59 +10:00
parent 6fef5c0b32
commit da8bf0ad38
8 changed files with 49 additions and 85 deletions

View File

@ -55,7 +55,7 @@ void gFlagsLine::Plot(gGraphWindow & w,float scrx,float scry)
float line_top=(start_py+height-line_h)-line_num*line_h;
if ((line_num==total_lines-1)) { // last lines responsibility to draw the title.
if ((line_num==total_lines-1)) { // last lines responsibility to draw the bounding box
glColor3f (0.1F, 0.1F, 0.1F);
glLineWidth (1);
@ -65,8 +65,6 @@ void gFlagsLine::Plot(gGraphWindow & w,float scrx,float scry)
glVertex2f (start_px+width,start_py+height);
glVertex2f (start_px+width, start_py);
glEnd ();
}
// Alternating box color
@ -78,10 +76,10 @@ void gFlagsLine::Plot(gGraphWindow & w,float scrx,float scry)
// Filled rectangle
glColor4ub(barcol->red(),barcol->green(),barcol->blue(),barcol->alpha());
glBegin(GL_QUADS);
glVertex2f(start_px, line_top);
glVertex2f(start_px, line_top+line_h);
glVertex2f(start_px+width, line_top+line_h);
glVertex2f(start_px+width, line_top);
glVertex2f(start_px-1, line_top);
glVertex2f(start_px-1, line_top+line_h);
glVertex2f(start_px+width-1, line_top+line_h);
glVertex2f(start_px+width-1, line_top);
glEnd();
const int maxverts=65536;

View File

@ -25,7 +25,7 @@ void gFooBar::Plot(gGraphWindow & w,float scrx,float scry)
if (xx==0)
return;
int start_px=w.GetLeftMargin();
int start_px=w.GetLeftMargin()-1;
int width=scrx - (w.GetLeftMargin() + w.GetRightMargin());
int height=scry - (w.GetTopMargin() + w.GetBottomMargin());
@ -56,8 +56,10 @@ void gFooBar::Plot(gGraphWindow & w,float scrx,float scry)
if ((m_funkbar)) { // && ((w.min_x>w.rmin_x) || (w.max_x<w.rmax_x))) {
glEnable(GL_BLEND);
glBegin(GL_QUADS);
glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
glColor4f(.2,.2,.2,.4);
glBegin(GL_QUADS);
glVertex2f(start_px+px, w.GetBottomMargin());
glVertex2f(start_px+px, w.GetBottomMargin()+height);
glVertex2f(start_px+py, w.GetBottomMargin()+height);

View File

@ -12,7 +12,7 @@
class gFooBar:public gLayer
{
public:
gFooBar(int offset=10,QColor color1=QColor("lime green"),QColor color2=QColor("dark grey"),bool funkbar=false);
gFooBar(int offset=10,QColor color1=QColor("orange"),QColor color2=QColor("dark grey"),bool funkbar=false);
virtual ~gFooBar();
virtual void Plot(gGraphWindow & w,float scrx,float scry);
static const int Margin=15;

View File

@ -306,12 +306,15 @@ void gLineChart::Plot(gGraphWindow & w,float scrx,float scry)
// Crop to inside the margins.
glScissor(w.GetLeftMargin(),w.GetBottomMargin(),width,height);
glEnable(GL_SCISSOR_TEST);
//glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
glDisable(GL_TEXTURE_2D);
glDisable(GL_DEPTH_TEST);
glLineWidth (1);
bool antialias=pref["UseAntiAliasing"].toBool();
if (antialias) {
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); //_MINUS_SRC_ALPHA);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
//glBlendFunc(GL_ONE, GL_SRC_ALPHA);
glEnable(GL_LINE_SMOOTH);
glHint(GL_LINE_SMOOTH_HINT, GL_NICEST);

View File

@ -141,7 +141,7 @@ void gGraphWindow::ResetXBounds()
//max_x=maxx;
SetMinX(RealMinX());
SetMaxX(RealMaxX());
updateGL();
// updateGL();
}
void gGraphWindow::ZoomXPixels(int x1, int x2)
@ -665,62 +665,6 @@ void gGraphWindow::SetMargins(float top, float right, float bottom, float left)
m_marginRight=right;
}
/*wxBitmap * gGraphWindow::RenderBitmap(int width,int height)
{
if (!graph_init) {
// Damn you WX Update the
return NULL;
}
wxBitmap *bmp;
//Update();
if (!pbuffer) {
wxSize res=wxGetDisplaySize(); // Not entirely sure if this is the limit..
try {
#if defined(__WXMSW__)
pbuffer=new pBufferWGL(res.GetWidth(),res.GetHeight(),shared_context);
#elif defined(__WXMAC__) || defined(__WXDARWIN__)
// Do nothing and load the FBO
throw GLException(wxT("Macintrash"));
//pbuffer=new pBufferAGL(width,height);
#elif defined(__UNIX__)
throw GLException(wxT("Linux pBuffer Sucks on some cards"));
//pbuffer=new pBufferGLX(res.GetWidth(),res.GetHeight(),shared_context);
#endif
} catch(GLException e) {
// Should log already if failed..
wxLogDebug(wxT("pBuffers not implemented or functional on this platform.. Trying FBO"));
pbuffer=NULL;
}
if (!pbuffer) {
try {
// This will fail the first run on GTK
// The solution is to get a damn screen refresh event to occur BEFORE the RefreshData() event callback.
// Trickier than it sounds, and I didn't want to kludge
pbuffer=new FBO(res.GetWidth(),res.GetHeight(),shared_context);
} catch(GLException e) {
wxLogError(wxT("No offscreen rendering capabilities detected on this machine."));
pbuffer=NULL;
return NULL;
}
}
}
if (pbuffer) {
pbuffer->SelectBuffer();
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
// Can't use font's in multiple contexts
Render(width,height);
bmp=pbuffer->Snapshot(width,height);
glFlush();
pbuffer->SelectContext(this);
} else bmp=NULL;
return bmp;
} */
void gGraphWindow::initializeGL()
{
setAutoFillBackground(false);
@ -1021,7 +965,7 @@ void gGraphWindow::DataChanged(gLayer *layer)
//long l=t.GetMilliseconds().GetLo();
//wxLogMessage(wxString::Format(wxT("%li"),l));
if ((t<1) && (layer!=lastlayer)) {
if ((t<2) && (layer!=lastlayer)) {
lastlayer=layer;
return;
}
@ -1031,7 +975,7 @@ void gGraphWindow::DataChanged(gLayer *layer)
// Assmption currently is Refresh que does skip
updateGL();
// updateGL();
}

View File

@ -98,7 +98,7 @@ map<MachineCode,QString> DefaultMCLongNames;
{PRS1_VSnore2, wxT("Vibratory Snore")},
{PRS1_PressurePulse,wxT("Pressue Pulse")}
}; */
inline const QString & _(QString q) { return q; };
inline const QString & _(const QString q) { return q; };
void InitMapsWithoutAwesomeInitializerLists()
{
@ -375,7 +375,10 @@ bool Machine::Load()
int size=sessfiles.size();
int cnt=0;
for (s=sessfiles.begin(); s!=sessfiles.end(); s++) {
if (qprogress) qprogress->setValue((float(++cnt)/float(size)*100.0));
cnt++;
if ((cnt % 10)==0)
if (qprogress) qprogress->setValue((float(cnt)/float(size)*100.0));
Session *sess=new Session(this,s->first);
if (sess->LoadSummary(s->second[0])) {
sess->SetEventFile(s->second[1]);
@ -386,6 +389,7 @@ bool Machine::Load()
delete sess;
}
}
if (qprogress) qprogress->setValue(100);
return true;
}
bool Machine::SaveSession(Session *sess)

View File

@ -66,7 +66,7 @@ Daily::Daily(QWidget *parent,QGLContext *context) :
AddCPAPData(flags[8]=new FlagData(PRS1_VSnore2,1));
AddCPAPData(flags[9]=new FlagData(PRS1_Unknown0E,1));
AddCPAPData(frw=new WaveData(CPAP_FlowRate));
SF=new gGraphWindow(gSplitter,"Event Flags",(QGLWidget *)NULL); //
AddGraph(SF=new gGraphWindow(gSplitter,"Event Flags",(QGLWidget *)NULL));
int sfc=7;
SF->SetLeftMargin(SF->GetLeftMargin()+gYAxis::Margin);
SF->SetBlockZoom(true);
@ -84,14 +84,14 @@ Daily::Daily(QWidget *parent,QGLContext *context) :
SF->AddLayer(new gFlagsLine(flags[2],QColor("aqua"),"OA",2,sfc));
SF->AddLayer(new gFlagsLine(flags[1],QColor("purple"),"CA",1,sfc));
SF->AddLayer(new gFlagsLine(flags[0],QColor("light green"),"CSR",0,sfc));
SF->AddLayer(new gFooBar(10,QColor("lime green"),QColor("dark grey"),true));
SF->AddLayer(new gFooBar(10,QColor("orange"),QColor("dark grey"),true));
SF->setMinimumHeight(150+(extras ? 20 : 0));
// SF->setMaximumHeight(350);
AddCPAPData(pressure_iap=new EventData(CPAP_IAP));
AddCPAPData(pressure_eap=new EventData(CPAP_EAP));
AddCPAPData(prd=new EventData(CPAP_Pressure));
PRD=new gGraphWindow(gSplitter,"Pressure",SF);
AddGraph(PRD=new gGraphWindow(gSplitter,"Pressure",SF));
PRD->AddLayer(new gXAxis());
PRD->AddLayer(new gYAxis());
PRD->AddLayer(new gFooBar());
@ -101,7 +101,7 @@ Daily::Daily(QWidget *parent,QGLContext *context) :
PRD->setMinimumHeight(150);
FRW=new gGraphWindow(gSplitter,"Flow Rate",SF); //shared_context);
AddGraph(FRW=new gGraphWindow(gSplitter,"Flow Rate",SF));
FRW->AddLayer(new gXAxis());
FRW->AddLayer(new gYAxis());
FRW->AddLayer(new gFooBar());
@ -124,7 +124,7 @@ Daily::Daily(QWidget *parent,QGLContext *context) :
AddCPAPData(leakdata=new EventData(CPAP_Leak,0));
//leakdata->ForceMinY(0);
//leakdata->ForceMaxY(120);
LEAK=new gGraphWindow(gSplitter,"Leaks",SF);
AddGraph(LEAK=new gGraphWindow(gSplitter,"Leaks",SF));
LEAK->AddLayer(new gXAxis());
LEAK->AddLayer(new gYAxis());
LEAK->AddLayer(new gFooBar());
@ -135,7 +135,7 @@ Daily::Daily(QWidget *parent,QGLContext *context) :
AddCPAPData(snore=new EventData(CPAP_SnoreGraph,0));
//snore->ForceMinY(0);
//snore->ForceMaxY(15);
SNORE=new gGraphWindow(gSplitter,"Snore",SF);
AddGraph(SNORE=new gGraphWindow(gSplitter,"Snore",SF));
SNORE->AddLayer(new gXAxis());
SNORE->AddLayer(new gYAxis());
SNORE->AddLayer(new gFooBar());
@ -146,7 +146,7 @@ Daily::Daily(QWidget *parent,QGLContext *context) :
AddOXIData(pulse=new EventData(OXI_Pulse,0,65536,true));
//pulse->ForceMinY(40);
//pulse->ForceMaxY(120);
PULSE=new gGraphWindow(gSplitter,"Pulse",SF);
AddGraph(PULSE=new gGraphWindow(gSplitter,"Pulse",SF));
PULSE->AddLayer(new gXAxis());
PULSE->AddLayer(new gYAxis());
PULSE->AddLayer(new gFooBar());
@ -157,7 +157,7 @@ Daily::Daily(QWidget *parent,QGLContext *context) :
AddOXIData(spo2=new EventData(OXI_SPO2,0,65536,true));
//spo2->ForceMinY(60);
//spo2->ForceMaxY(100);
SPO2=new gGraphWindow(gSplitter,"SpO2",SF);
AddGraph(SPO2=new gGraphWindow(gSplitter,"SpO2",SF));
SPO2->AddLayer(new gXAxis());
SPO2->AddLayer(new gYAxis());
SPO2->AddLayer(new gFooBar());
@ -395,13 +395,12 @@ void Daily::Load(QDate date)
html+="<table cellspacing=0 cellpadding=2 border=0 width='100%'>\n";
QString tmp;
const int gwwidth=270;
const int gwheight=25;
UpdateCPAPGraphs(cpap);
UpdateOXIGraphs(oxi);
UpdateEventsTree(ui->treeWidget,cpap);
const int gwwidth=270;
const int gwheight=25;
QString epr,modestr;
@ -604,6 +603,7 @@ void Daily::Load(QDate date)
if (journal) {
ui->JournalNotes->setHtml(journal->summary[GEN_Notes].toString());
}
RedrawGraphs();
}
void Daily::Unload(QDate date)
@ -770,8 +770,17 @@ void Daily::UpdateOXIGraphs(Day *day)
for (list<gPointData *>::iterator g=OXIData.begin();g!=OXIData.end();g++) {
(*g)->Update(day);
}
};
}
void Daily::RedrawGraphs()
{
// could recall Min & Max stuff here to reset cache
// instead of using the dodgy notify calls.
for (list<gGraphWindow *>::iterator g=Graphs.begin();g!=Graphs.end();g++) {
(*g)->updateGL();
}
}
void Daily::on_treeWidget_itemSelectionChanged()
{

View File

@ -60,10 +60,14 @@ private:
list<gPointData *> OXIData;
list<gPointData *> CPAPData;
list<gGraphWindow *> Graphs;
void AddCPAPData(gPointData *d) { CPAPData.push_back(d); };
void AddOXIData(gPointData *d) { OXIData.push_back(d); };
void AddGraph(gGraphWindow *w) { Graphs.push_back(w); };
void UpdateCPAPGraphs(Day *day);
void UpdateOXIGraphs(Day *day);
void RedrawGraphs();
gPointData *flags[10];