mirror of https://github.com/BOINC/boinc.git
Fixes for command line compile.
Fixed some type warnings on windows. Fixed missing graphics_threadh definition on WIN32. svn path=/trunk/boinc/; revision=13282
This commit is contained in:
parent
db1fc98b51
commit
b6952dcd20
|
@ -184,7 +184,7 @@ double boinc_worker_thread_cpu_time() {
|
||||||
static double last_cpu=0;
|
static double last_cpu=0;
|
||||||
static time_t last_time=0;
|
static time_t last_time=0;
|
||||||
time_t now = time(0);
|
time_t now = time(0);
|
||||||
double cpu, time_diff = now - last_time;
|
double cpu, time_diff = (double)(now - last_time);
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
int retval;
|
int retval;
|
||||||
if (options.all_threads_cpu_time) {
|
if (options.all_threads_cpu_time) {
|
||||||
|
@ -763,6 +763,7 @@ static void timer_handler() {
|
||||||
static HANDLE timer_quit_event;
|
static HANDLE timer_quit_event;
|
||||||
|
|
||||||
UINT WINAPI timer_thread(void *) {
|
UINT WINAPI timer_thread(void *) {
|
||||||
|
|
||||||
diagnostics_set_thread_name("Timer");
|
diagnostics_set_thread_name("Timer");
|
||||||
while (1) {
|
while (1) {
|
||||||
Sleep(TIMER_PERIOD*1000);
|
Sleep(TIMER_PERIOD*1000);
|
||||||
|
|
|
@ -17,7 +17,10 @@
|
||||||
// or write to the Free Software Foundation, Inc.,
|
// or write to the Free Software Foundation, Inc.,
|
||||||
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
|
#ifndef _WIN32
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "graphics_data.h"
|
#include "graphics_data.h"
|
||||||
|
|
||||||
void GRAPHICS_BUFFER::clear() {
|
void GRAPHICS_BUFFER::clear() {
|
||||||
|
|
|
@ -23,6 +23,10 @@
|
||||||
// and thus can be put in a shared library,
|
// and thus can be put in a shared library,
|
||||||
// separate from the application.
|
// separate from the application.
|
||||||
|
|
||||||
|
#ifndef _WIN32
|
||||||
|
#include "config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(_WIN32) && !defined(__STDWX_H__) && !defined(_BOINC_WIN_) && !defined(_AFX_STDAFX_H_)
|
#if defined(_WIN32) && !defined(__STDWX_H__) && !defined(_BOINC_WIN_) && !defined(_AFX_STDAFX_H_)
|
||||||
#include "boinc_win.h"
|
#include "boinc_win.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
54
api/gutil.C
54
api/gutil.C
|
@ -190,7 +190,7 @@ void HLStoRGB( double H, double L, double S, COLOR& c) {
|
||||||
double m1, m2;
|
double m1, m2;
|
||||||
|
|
||||||
if(S==0) {
|
if(S==0) {
|
||||||
c.r=c.g=c.b=L;
|
c.r=c.g=c.b=(float)L;
|
||||||
} else {
|
} else {
|
||||||
if(L <=0.5) {
|
if(L <=0.5) {
|
||||||
m2 = L*(1.0+S);
|
m2 = L*(1.0+S);
|
||||||
|
@ -198,9 +198,9 @@ void HLStoRGB( double H, double L, double S, COLOR& c) {
|
||||||
m2 = L+S-L*S;
|
m2 = L+S-L*S;
|
||||||
}
|
}
|
||||||
m1 = 2.0*L-m2;
|
m1 = 2.0*L-m2;
|
||||||
c.r = HuetoRGB(m1,m2,H+1.0/3.0);
|
c.r = (float)HuetoRGB(m1,m2,(H+1.0/3.0));
|
||||||
c.g = HuetoRGB(m1,m2,H);
|
c.g = (float)HuetoRGB(m1,m2,H);
|
||||||
c.b = HuetoRGB(m1,m2,H-1.0/3.0);
|
c.b = (float)HuetoRGB(m1,m2,H-1.0/3.0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -209,26 +209,26 @@ static inline float frand() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void scale_screen(int iw, int ih) {
|
void scale_screen(int iw, int ih) {
|
||||||
double aspect_ratio = 4.0/3.0;
|
float aspect_ratio = 4.0f/3.0f;
|
||||||
double w=iw, h=ih;
|
float w=(float)iw, h=(float)ih;
|
||||||
double xs, ys;
|
float xs, ys;
|
||||||
if (h*aspect_ratio > w) {
|
if (h*aspect_ratio > w) {
|
||||||
xs = 1.0;
|
xs = 1.0f;
|
||||||
ys = (w/aspect_ratio)/h;
|
ys = (w/aspect_ratio)/h;
|
||||||
} else {
|
} else {
|
||||||
xs = (h*aspect_ratio)/w;
|
xs = (h*aspect_ratio)/w;
|
||||||
ys = 1.0;
|
ys = 1.0f;
|
||||||
}
|
}
|
||||||
glScalef(xs, ys*4./3., 1);
|
glScalef(xs, ys*aspect_ratio, 1.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
void center_screen(int iw, int ih) {
|
void center_screen(int iw, int ih) {
|
||||||
double aspect_ratio = 4.0/3.0;
|
float aspect_ratio = 4.0f/3.0f;
|
||||||
double w=iw, h=ih;
|
float w=(float)iw, h=(float)ih;
|
||||||
if (h*aspect_ratio > w) {
|
if (h*aspect_ratio > w) {
|
||||||
glTranslatef(0.0, (h/2.0-(w/aspect_ratio/2.0))/h, 0.0);
|
glTranslatef(0.0f, (h/2.0f-(w/aspect_ratio/2.0f))/h, 0.0f);
|
||||||
} else {
|
} else {
|
||||||
glTranslatef((w/2.0-(h*aspect_ratio/2.0))/w, 0.0, 0.0);
|
glTranslatef((w/2.0f-(h*aspect_ratio/2.0f))/w, 0.0f, 0.0f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -299,7 +299,7 @@ void PROGRESS_2D::draw(float x) {
|
||||||
glEnd();
|
glEnd();
|
||||||
|
|
||||||
float dif=width-inner_width;
|
float dif=width-inner_width;
|
||||||
float zoffset=.01;
|
float zoffset=.01f;
|
||||||
glBegin(GL_QUADS);
|
glBegin(GL_QUADS);
|
||||||
glColor4d(inner_color[0],inner_color[1],inner_color[2],inner_color[3]);
|
glColor4d(inner_color[0],inner_color[1],inner_color[2],inner_color[3]);
|
||||||
glVertex3d(pos[0],pos[1]-(dif/2.),pos[2]+zoffset);
|
glVertex3d(pos[0],pos[1]-(dif/2.),pos[2]+zoffset);
|
||||||
|
@ -346,8 +346,8 @@ static float zvec[] = {0, 0, 1};
|
||||||
//
|
//
|
||||||
void RIBBON_GRAPH::draw_x(int i) {
|
void RIBBON_GRAPH::draw_x(int i) {
|
||||||
GLfloat pt[3];
|
GLfloat pt[3];
|
||||||
double r1 = i/(double)len;
|
float r1 = i/(float)len;
|
||||||
double r2 = (i+1)/(double)len;
|
float r2 = (i+1)/(float)len;
|
||||||
|
|
||||||
glNormal3fv(yvec);
|
glNormal3fv(yvec);
|
||||||
pt[0] = pos[0] + r1*size[0];
|
pt[0] = pos[0] + r1*size[0];
|
||||||
|
@ -379,7 +379,7 @@ void RIBBON_GRAPH::draw_x(int i) {
|
||||||
//
|
//
|
||||||
void RIBBON_GRAPH::draw_y(int i) {
|
void RIBBON_GRAPH::draw_y(int i) {
|
||||||
GLfloat pt[3];
|
GLfloat pt[3];
|
||||||
double r1 = i/(double)len;
|
float r1 = i/(float)len;
|
||||||
|
|
||||||
(data[i]>data[i-1])?glNormal3fv(xvecneg):glNormal3fv(xvec);
|
(data[i]>data[i-1])?glNormal3fv(xvecneg):glNormal3fv(xvec);
|
||||||
pt[0] = pos[0] + r1*size[0];
|
pt[0] = pos[0] + r1*size[0];
|
||||||
|
@ -396,17 +396,17 @@ void RIBBON_GRAPH::draw_y(int i) {
|
||||||
|
|
||||||
void RIBBON_GRAPH::draw_tick(int i) {
|
void RIBBON_GRAPH::draw_tick(int i) {
|
||||||
GLfloat pt[3];
|
GLfloat pt[3];
|
||||||
double r1 = ticks[i]/(double)len;
|
float r1 = ticks[i]/(float)len;
|
||||||
|
|
||||||
pt[0] = pos[0] + r1*size[0];
|
pt[0] = pos[0] + r1*size[0];
|
||||||
pt[1] = pos[1] + (1.-tick_yfrac)*size[1];
|
pt[1] = pos[1] + (1.0f-tick_yfrac)*size[1];
|
||||||
pt[2] = pos[2];
|
pt[2] = pos[2];
|
||||||
glVertex3fv(pt);
|
glVertex3fv(pt);
|
||||||
pt[1] = pos[1] + size[1]*1.1;
|
pt[1] = pos[1] + size[1]*1.1f;
|
||||||
glVertex3fv(pt);
|
glVertex3fv(pt);
|
||||||
pt[2] = pos[2] + size[2];
|
pt[2] = pos[2] + size[2];
|
||||||
glVertex3fv(pt);
|
glVertex3fv(pt);
|
||||||
pt[1] = pos[1] + (1.-tick_yfrac)*size[1];
|
pt[1] = pos[1] + (1.0f-tick_yfrac)*size[1];
|
||||||
glVertex3fv(pt);
|
glVertex3fv(pt);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -520,7 +520,7 @@ void STARFIELD::update_stars(float dt) {
|
||||||
if (stars[i].z > zmax/2) glPointSize(1);
|
if (stars[i].z > zmax/2) glPointSize(1);
|
||||||
else glPointSize(2);
|
else glPointSize(2);
|
||||||
glBegin(GL_POINTS);
|
glBegin(GL_POINTS);
|
||||||
glVertex2f(x, y);
|
glVertex2f((GLfloat)x, (GLfloat)y);
|
||||||
glEnd();
|
glEnd();
|
||||||
}
|
}
|
||||||
ortho_done();
|
ortho_done();
|
||||||
|
@ -601,24 +601,24 @@ int read_ppm_file(const char* name, int& w, int& h, unsigned char** arrayp) {
|
||||||
//
|
//
|
||||||
void TEXTURE_DESC::draw(float* p, float* size, int xalign, int yalign) {
|
void TEXTURE_DESC::draw(float* p, float* size, int xalign, int yalign) {
|
||||||
float pos[3];
|
float pos[3];
|
||||||
double tratio, sratio, new_size;
|
float tratio, sratio, new_size;
|
||||||
memcpy(pos, p, sizeof(pos));
|
memcpy(pos, p, sizeof(pos));
|
||||||
glColor4f(1.,1.,1.,1.);
|
glColor4f(1.,1.,1.,1.);
|
||||||
glEnable(GL_TEXTURE_2D);
|
glEnable(GL_TEXTURE_2D);
|
||||||
glBindTexture(GL_TEXTURE_2D, id);
|
glBindTexture(GL_TEXTURE_2D, id);
|
||||||
|
|
||||||
tratio = xsize/ysize;
|
tratio = static_cast<float>(xsize/ysize);
|
||||||
sratio = size[0]/size[1];
|
sratio = size[0]/size[1];
|
||||||
|
|
||||||
if (tratio > sratio) { // texture is wider than space
|
if (tratio > sratio) { // texture is wider than space
|
||||||
new_size = size[0]/tratio;
|
new_size = size[0]/tratio;
|
||||||
if (yalign == ALIGN_CENTER) pos[1] += (size[1]-new_size)/2;
|
if (yalign == ALIGN_CENTER) pos[1] += (size[1]-new_size)/2.0f;
|
||||||
if (yalign == ALIGN_TOP) pos[1] += size[1]-new_size;
|
if (yalign == ALIGN_TOP) pos[1] += size[1]-new_size;
|
||||||
size[1] = new_size;
|
size[1] = new_size;
|
||||||
}
|
}
|
||||||
if (sratio > tratio) { // space is wider than texture
|
if (sratio > tratio) { // space is wider than texture
|
||||||
new_size = size[1]*tratio;
|
new_size = size[1]*tratio;
|
||||||
if (xalign == ALIGN_CENTER) pos[0] += (size[0]-new_size)/2;
|
if (xalign == ALIGN_CENTER) pos[0] += (size[0]-new_size)/2.0f;
|
||||||
if (xalign == ALIGN_TOP) pos[0] += size[0]-new_size;
|
if (xalign == ALIGN_TOP) pos[0] += size[0]-new_size;
|
||||||
size[0] = new_size;
|
size[0] = new_size;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
@ -224,11 +225,11 @@ int checkSize (int x){
|
||||||
|
|
||||||
unsigned int texFormat;
|
unsigned int texFormat;
|
||||||
|
|
||||||
unsigned char* getRGBA (FILE *s, int size){
|
unsigned char* getRGBA (FILE *s, size_t size){
|
||||||
unsigned char *rgba;
|
unsigned char *rgba;
|
||||||
unsigned char temp;
|
unsigned char temp;
|
||||||
int bread;
|
size_t bread;
|
||||||
int i;
|
size_t i;
|
||||||
rgba=(unsigned char*)malloc(size * 4);
|
rgba=(unsigned char*)malloc(size * 4);
|
||||||
if (rgba == NULL) return 0;
|
if (rgba == NULL) return 0;
|
||||||
bread = fread (rgba, sizeof (unsigned char), size * 4, s);
|
bread = fread (rgba, sizeof (unsigned char), size * 4, s);
|
||||||
|
@ -250,11 +251,11 @@ unsigned char* getRGBA (FILE *s, int size){
|
||||||
// getRGB
|
// getRGB
|
||||||
// Reads in RGB data for a 24bit image.
|
// Reads in RGB data for a 24bit image.
|
||||||
// =============
|
// =============
|
||||||
unsigned char* getRGB (FILE *s, int size){
|
unsigned char* getRGB (FILE *s, size_t size){
|
||||||
unsigned char *rgb;
|
unsigned char *rgb;
|
||||||
unsigned char temp;
|
unsigned char temp;
|
||||||
int bread;
|
size_t bread;
|
||||||
int i;
|
size_t i;
|
||||||
rgb=(unsigned char*)malloc(size * 3);
|
rgb=(unsigned char*)malloc(size * 3);
|
||||||
if (rgb == NULL) return 0;
|
if (rgb == NULL) return 0;
|
||||||
bread = fread (rgb, sizeof (unsigned char), size * 3, s);
|
bread = fread (rgb, sizeof (unsigned char), size * 3, s);
|
||||||
|
@ -276,9 +277,9 @@ unsigned char* getRGB (FILE *s, int size){
|
||||||
// getGray
|
// getGray
|
||||||
// Gets the grayscale image data. Used as an alpha channel.
|
// Gets the grayscale image data. Used as an alpha channel.
|
||||||
// =============
|
// =============
|
||||||
unsigned char* getGray (FILE *s, int size){
|
unsigned char* getGray (FILE *s, size_t size){
|
||||||
unsigned char *grayData;
|
unsigned char *grayData;
|
||||||
int bread;
|
size_t bread;
|
||||||
grayData=(unsigned char*)malloc (size);
|
grayData=(unsigned char*)malloc (size);
|
||||||
if (grayData == NULL) return 0;
|
if (grayData == NULL) return 0;
|
||||||
bread = fread (grayData, sizeof (unsigned char), size, s);
|
bread = fread (grayData, sizeof (unsigned char), size, s);
|
||||||
|
|
|
@ -46,6 +46,7 @@ static HDESK hInteractiveDesktop = NULL;
|
||||||
static bool visible = true;
|
static bool visible = true;
|
||||||
static bool window_ready=false;
|
static bool window_ready=false;
|
||||||
static UINT_PTR gfx_timer_id = 0;
|
static UINT_PTR gfx_timer_id = 0;
|
||||||
|
HANDLE graphics_threadh;
|
||||||
|
|
||||||
#define GLUT_CTRL_KEY 17
|
#define GLUT_CTRL_KEY 17
|
||||||
|
|
||||||
|
@ -80,6 +81,7 @@ void KillWindow() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void SetupPixelFormat(HDC hDC) {
|
void SetupPixelFormat(HDC hDC) {
|
||||||
int nPixelFormat;
|
int nPixelFormat;
|
||||||
|
|
||||||
|
@ -255,7 +257,7 @@ static void set_mode(int mode) {
|
||||||
BOINCTRACE("Retrieved the required window station\n");
|
BOINCTRACE("Retrieved the required window station\n");
|
||||||
SetProcessWindowStation(hInteractiveWindowStation);
|
SetProcessWindowStation(hInteractiveWindowStation);
|
||||||
hInteractiveDesktop = OpenDesktop(
|
hInteractiveDesktop = OpenDesktop(
|
||||||
graphics_msg.desktop, NULL, FALSE,
|
graphics_msg.desktop, (DWORD)NULL, FALSE,
|
||||||
GENERIC_READ | DESKTOP_CREATEWINDOW | DESKTOP_CREATEMENU
|
GENERIC_READ | DESKTOP_CREATEWINDOW | DESKTOP_CREATEMENU
|
||||||
);
|
);
|
||||||
if (NULL == hInteractiveDesktop) {
|
if (NULL == hInteractiveDesktop) {
|
||||||
|
@ -377,6 +379,7 @@ LRESULT CALLBACK WndProc(
|
||||||
PAINTSTRUCT ps;
|
PAINTSTRUCT ps;
|
||||||
RECT winRect;
|
RECT winRect;
|
||||||
HDC pdc;
|
HDC pdc;
|
||||||
|
if (!graphics_threadh) graphics_threadh=(HANDLE)GetCurrentThreadId();
|
||||||
pdc = BeginPaint(hWnd, &ps);
|
pdc = BeginPaint(hWnd, &ps);
|
||||||
GetClientRect(hWnd, &winRect);
|
GetClientRect(hWnd, &winRect);
|
||||||
FillRect(pdc, &winRect, (HBRUSH)GetStockObject(BLACK_BRUSH));
|
FillRect(pdc, &winRect, (HBRUSH)GetStockObject(BLACK_BRUSH));
|
||||||
|
|
Loading…
Reference in New Issue