Verticle fonts less blurry now

This commit is contained in:
Mark Watkins 2011-06-15 21:44:02 +10:00
parent 3c27f6d4e5
commit ef4c67fe49
5 changed files with 39 additions and 24 deletions

View File

@ -8300,7 +8300,7 @@
<map>
"tinyxml/tinyxml.h"
1308121582 /home/mark/projects/git/sleepyhead/src/graphs/graph.h
1308134632 /home/mark/projects/git/sleepyhead/src/graphs/graph.h
"gl_pbuffer.h"
<wx/glcanvas.h>
<wx/geometry.h>
@ -8309,7 +8309,7 @@
1308026543 D
1308133991 /home/mark/projects/git/sleepyhead/src/version.h
1308138209 /home/mark/projects/git/sleepyhead/src/version.h
1308003040 ent of cb2ab33... Linux wx2.8 & wx2.9 builds fixed
<wx/dcbuffer.h>
@ -8341,7 +8341,7 @@
"preferences.h"
"tinyxml/tinyxml.h"
1308122573 source:/home/mark/projects/git/sleepyhead/src/SleepyHeadMain.cpp
1308135385 source:/home/mark/projects/git/sleepyhead/src/SleepyHeadMain.cpp
"wx_pch.h"
"version.h"
<wx/app.h>
@ -8362,7 +8362,7 @@
"sleeplib/profiles.h"
"sleeplib/machine_loader.h"
1308133983 source:/home/mark/projects/git/sleepyhead/src/graphs/graph.cpp
1308135663 source:/home/mark/projects/git/sleepyhead/src/graphs/graph.cpp
"freetype-gl/font-manager.h"
"freetype-gl/texture-font.h"
"graph.h"

View File

@ -350,6 +350,7 @@ void SleepyHeadFrame::OnViewMenuDaily( wxCommandEvent& event )
} else {
main_auinotebook->SetSelection(idx);
daily->Refresh(true);
}
@ -366,6 +367,11 @@ void SleepyHeadFrame::OnViewMenuSummary( wxCommandEvent& event )
summary->Refresh();
} else {
main_auinotebook->SetSelection(idx);
summary->Refresh(true);
summary->AHI->Refresh(true);
summary->USAGE->Refresh(true);
summary->LEAK->Refresh(true);
summary->PRESSURE->Refresh(true);
}
}
@ -821,6 +827,7 @@ Daily::Daily(wxWindow *win,Profile *p)
//Update();
ResetDate();
}
Daily::~Daily()
{
if (ahi_bmp) {
@ -840,12 +847,12 @@ Daily::~Daily()
delete teap_bmp;
}
this->Disconnect(wxEVT_SCROLLWIN_THUMBTRACK, wxScrollWinEventHandler(Daily::OnWinScroll));
//this->Disconnect(wxEVT_SCROLLWIN_THUMBTRACK, wxScrollWinEventHandler(Daily::OnWinScroll));
//this->Disconnect(wxEVT_SCROLLWIN_THUMBTRACK, EVT_SCROLLWIN_THUMBTRACK(Daily::OnWinScroll));
//this->Disconnect(wxEVT_SCROLLWIN_THUMBRELEASE, EVT_SCROLLWIN_THUMBRELEASE(Daily::OnWinScroll));
//this->Disconnect(wxID_ANY, wxEVT_REFRESH_DAILY, wxCommandEventHandler(Daily::RefreshData));
//this->Disconnect(wxEVT_COMMAND_TREE_SEL_CHANGED, wxTreeEventHandler( Daily::OnEventTreeSelection), NULL, this);
this->Disconnect(wxID_ANY, wxEVT_REFRESH_DAILY, wxCommandEventHandler(Daily::RefreshData));
this->Disconnect(wxEVT_COMMAND_TREE_SEL_CHANGED, wxTreeEventHandler( Daily::OnEventTreeSelection), NULL, this);
}
void Daily::OnWinScroll(wxScrollWinEvent &event)
{

View File

@ -65,13 +65,17 @@ TextMarkup *markup=NULL;
void GraphInit()
{
#if defined(__WXMSW__)
glewInit(); // Dont forget this nasty little sucker.. :)
static bool glewinit_called=false;
if (!glewinit_called) {
glewInit(); // Dont forget this nasty little sucker.. :)
glewinit_called=true;
}
#endif
if (!gfont_init) {
font_manager=new FontManager();
vbuffer=new VertexBuffer((char *)"v3i:t2f:c4f");
zfont=font_manager->GetFromFilename(pref.Get("{home}{sep}FreeSans.ttf"),14);
zfont=font_manager->GetFromFilename(pref.Get("{home}{sep}FreeSans.ttf"),12);
markup=new TextMarkup();
glBindTexture( GL_TEXTURE_2D, font_manager->m_atlas->m_texid );
@ -102,6 +106,11 @@ void GraphDone()
delete shared_context;
shared_context=NULL;
}
if (pbuffer) {
delete pbuffer;
pbuffer=NULL;
}
}
void GetTextExtent(wxString text, float & width, float & height, TextureFont *font=zfont)
@ -135,7 +144,7 @@ void DrawText2(wxString text, float x, float y,TextureFont *font)
}
//glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
glEnable( GL_BLEND );
glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
//glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
glEnable( GL_TEXTURE_2D );
glColor4f(1,1,1,1);
vbuffer->Render(GL_TRIANGLES, (char *)"vtc" );
@ -162,10 +171,10 @@ void DrawText(wxString text, float x, float y, float angle=0, const wxColor & co
//glColor4ub(color.Red(),color.Green(),color.Blue(),color.Alpha());
glPushMatrix();
glTranslatef(x,y,0);
glTranslatef(floor(x),floor(y),0);
glRotatef(angle, 0.0f, 0.0f, 1.0f);
DrawText2(text,-w/2.0,-h/2.0,font);
glTranslatef(-x,-y,0);
DrawText2(text,floor(-w/2.0),floor(-h/2.0),font);
glTranslatef(floor(-x),floor(-y),0);
glPopMatrix();
}
@ -442,7 +451,6 @@ void gGraphWindow::SetXBounds(double minx, double maxx)
SetMinX(minx);
SetMaxX(maxx);
Refresh(false);
Update();
}
void gGraphWindow::ResetXBounds()
{
@ -964,7 +972,7 @@ void gGraphWindow::OnPaint(wxPaintEvent& event)
SwapBuffers(); // Dump to screen.
event.Skip();
//event.Skip();
}
void gGraphWindow::OnSize(wxSizeEvent& event)
{
@ -1737,12 +1745,12 @@ void gBarChart::Plot(gGraphWindow & w,float scrx,float scry)
str=FormatX(data->point[0][i].m_x);
GetTextExtent(str, textX, textY);
if (t2>textY) {
if (t2>textY+6) {
int j=t1+((t2/2)-(textY/2));
if (m_direction==wxVERTICAL) {
DrawText(str,start_px-textX-8,j);
} else {
DrawText(str,j,start_py-16-(textX/2),90,*wxBLACK);
DrawText(str,j,start_py-18-(textX/2),90,*wxBLACK);
}
} else draw_xticks_instead=true;

View File

@ -8,7 +8,7 @@ License: LGPL
#define GRAPH_H
#include "gl_pbuffer.h"
extern pBuffer *buffer;
extern pBuffer *pbuffer;
//#undef Yield

View File

@ -16,14 +16,14 @@ namespace AutoVersion{
//Standard Version Type
static const long _MAJOR = 0;
static const long _MINOR = 7;
static const long _BUILD = 6037;
static const long _REVISION = 16269;
static const long _BUILD = 6060;
static const long _REVISION = 16387;
//Miscellaneous Version Types
static const long _BUILDS_COUNT = 6615;
#define _RC_FILEVERSION 0,7,6037,16269
#define _RC_FILEVERSION_STRING "0, 7, 6037, 16269\0"
static const char _FULLVERSION_STRING[] = "0.7.6037.16269";
static const long _BUILDS_COUNT = 6665;
#define _RC_FILEVERSION 0,7,6060,16387
#define _RC_FILEVERSION_STRING "0, 7, 6060, 16387\0"
static const char _FULLVERSION_STRING[] = "0.7.6060.16387";
//These values are to keep track of your versioning state, don't modify them.
static const long _BUILD_HISTORY = 0;