From a3a471694692fb990dbf154fa2b22a53d71bad00 Mon Sep 17 00:00:00 2001 From: Oliver Wang Date: Fri, 3 Oct 2003 22:51:28 +0000 Subject: [PATCH] started moving graphics configurability to S@H svn path=/trunk/boinc/; revision=2409 --- api/graphics_api.C | 4 ++-- api/graphics_data.h | 5 +++++ api/gutil.C | 33 ++------------------------------- api/gutil.h | 3 +++ api/reduce.h | 4 ++++ lib/xml_util.C | 2 +- 6 files changed, 17 insertions(+), 34 deletions(-) diff --git a/api/graphics_api.C b/api/graphics_api.C index 5858ec946e..07f1fe9727 100755 --- a/api/graphics_api.C +++ b/api/graphics_api.C @@ -169,8 +169,8 @@ void throttled_app_render(int x, int y, double t) { bool ok_to_render; // the following should be passed in via prefs - double max_fps = 1; - double max_gfx_cpu_frac = 0.2; + double max_fps = 1000; + double max_gfx_cpu_frac = 1.00; ok_to_render = true; now = dtime(); diff --git a/api/graphics_data.h b/api/graphics_data.h index c66f8a0a25..1bf1f65ac4 100644 --- a/api/graphics_data.h +++ b/api/graphics_data.h @@ -47,6 +47,9 @@ // There are two buffers, each with a "state" (see below). // In a given state, only one thread can access the data or change the state. // +#ifndef GRAPHICS_DATA_H +#define GRAPHICS_DATA_H + #define GB_STATE_IDLE 0 #define GB_STATE_GENERATING 1 #define GB_STATE_GENERATED 2 @@ -77,3 +80,5 @@ public: GRAPHICS_BUFFER* get_generate_buffer(bool first); void generate_done(GRAPHICS_BUFFER*); }; + +#endif diff --git a/api/gutil.C b/api/gutil.C index ee4916eb49..44550c0d28 100755 --- a/api/gutil.C +++ b/api/gutil.C @@ -22,14 +22,9 @@ #include #include #include + #ifdef _WIN32 #include -/* the old way... Use the defines below which should be set in - * config.h - * #include "gl/gl.h" - * #include "gl/glu.h" - * #include "gl/glut.h" -*/ #endif #ifdef HAVE_GL_H @@ -59,17 +54,6 @@ #include #endif -// the old way -// #ifdef __APPLE_CC__ -// #include -// #include -// #endif -// #ifdef unix -// #include -// #include -// #include -// #endif - #include "gutil.h" GLfloat mat_diffuse[] = {0.7, 0.5, 1.0, 0.4}; @@ -258,16 +242,6 @@ bool get_matrix_invert(float src[16]) src[i*4+3] = dst[i*4+3]; } -/* - char buf[512]; - sprintf(buf,"%f,%f,%f,%f\n%f,%f,%f,%f\n%f,%f,%f,%f\n%f,%f,%f,%f\n", - dst[0],dst[1],dst[2],dst[3], - dst[4],dst[5],dst[6],dst[7], - dst[8],dst[9],dst[10],dst[11], - dst[12],dst[13],dst[14],dst[15]); - fprintf(stderr, "%s: modelview\n", buf); - MessageBox(NULL,buf,"F",0); -*/ return true; } @@ -751,7 +725,6 @@ void draw_texture(float* p, float* size) { glDisable(GL_TEXTURE_2D); } - //star drawing functions -- #define PI 3.14159265358979323846264 @@ -782,9 +755,7 @@ void build_stars(int size, float speed) tmpStar->next = new Star; tmpStar=tmpStar->next; - i++; - - + i++; } tmpStar->next=NULL; tmpStar=NULL; diff --git a/api/gutil.h b/api/gutil.h index 978a6bbea7..65bad24b96 100755 --- a/api/gutil.h +++ b/api/gutil.h @@ -18,6 +18,8 @@ // //using indepenent jpeg group library - jpeglib.lib +#ifndef GUTIL_H +#define GUTIL_H #include @@ -152,3 +154,4 @@ extern bool CreateTexturePPM(UINT textureArray[], char* strFileName, int texture extern bool CreateTextureTGA(UINT textureArray[], char* strFileName, int textureID); extern tImageJPG *LoadJPG(const char *filename); extern void print_text(unsigned int base, char *string); +#endif \ No newline at end of file diff --git a/api/reduce.h b/api/reduce.h index 6f73bf3502..8df0accf4c 100644 --- a/api/reduce.h +++ b/api/reduce.h @@ -19,6 +19,8 @@ // If reduced in one dimension, draw vertical rectangles. // Otherwise draw quadrilaterals. +#ifndef REDUCE_H +#define REDUCE_H #define REDUCE_METHOD_AVG 0 // Take the average of reduced elements #define REDUCE_METHOD_SUM 1 // Take the sum of reduced elements @@ -82,3 +84,5 @@ public: void draw_labels(); void draw_3dlabels(); }; + +#endif \ No newline at end of file diff --git a/lib/xml_util.C b/lib/xml_util.C index 101d051a32..7b4252f24b 100644 --- a/lib/xml_util.C +++ b/lib/xml_util.C @@ -206,7 +206,7 @@ static int xml_indent_level=0; std::string xml_indent(int i) { if (i) xml_indent_level+=i; - xml_indent_level=std::max(xml_indent_level,0); + xml_indent_level = (xml_indent_level>0) ? xml_indent_level : 0; return std::string(xml_indent_level,' '); }