diff options
| author | Simon Robertshaw <simon@hardwired.org.uk> | 2012-07-27 19:06:17 (GMT) |
|---|---|---|
| committer | Simon Robertshaw <simon@hardwired.org.uk> | 2012-07-27 19:06:17 (GMT) |
| commit | 5befe5c25f8f188e7588de44ab2c8bead22ae999 (patch) | |
| tree | 643b02af217770c1a3156be03e01442557795760 /src/graphics | |
| parent | f8ca8af387b8611c18ca7c5357efd19c8bc28941 (diff) | |
| download | powder-5befe5c25f8f188e7588de44ab2c8bead22ae999.zip powder-5befe5c25f8f188e7588de44ab2c8bead22ae999.tar.gz | |
Local file browser + some more interesting things like Progress bar UI component
Diffstat (limited to 'src/graphics')
| -rw-r--r-- | src/graphics/Graphics.cpp | 1 | ||||
| -rw-r--r-- | src/graphics/Graphics.h | 3 | ||||
| -rw-r--r-- | src/graphics/OpenGLGraphics.cpp | 16 | ||||
| -rw-r--r-- | src/graphics/RasterDrawMethods.inl | 2 | ||||
| -rw-r--r-- | src/graphics/RasterGraphics.cpp | 10 |
5 files changed, 30 insertions, 2 deletions
diff --git a/src/graphics/Graphics.cpp b/src/graphics/Graphics.cpp index 2bed5ee..2b12b1d 100644 --- a/src/graphics/Graphics.cpp +++ b/src/graphics/Graphics.cpp @@ -31,7 +31,6 @@ VideoBuffer::VideoBuffer(VideoBuffer * old): std::copy(old->Buffer, old->Buffer+(old->Width*old->Height), Buffer); }; - VideoBuffer::~VideoBuffer() { delete[] Buffer; diff --git a/src/graphics/Graphics.h b/src/graphics/Graphics.h index 3b25bb1..e74239e 100644 --- a/src/graphics/Graphics.h +++ b/src/graphics/Graphics.h @@ -135,6 +135,9 @@ public: static int textwidth(const char *s); static void textsize(const char * s, int & width, int & height); + void Acquire(); + void Release(); + void blendpixel(int x, int y, int r, int g, int b, int a); void addpixel(int x, int y, int r, int g, int b, int a); diff --git a/src/graphics/OpenGLGraphics.cpp b/src/graphics/OpenGLGraphics.cpp index 66a1753..43bff6b 100644 --- a/src/graphics/OpenGLGraphics.cpp +++ b/src/graphics/OpenGLGraphics.cpp @@ -1,11 +1,17 @@ #include "Graphics.h" #include "font.h" +#include <pthread.h> #ifdef OGLI +static pthread_mutex_t gMutex = PTHREAD_MUTEX_INITIALIZER; + Graphics::Graphics(): sdl_scale(1) { + if(gMutex == PTHREAD_MUTEX_INITIALIZER) + pthread_mutex_init (&gMutex, NULL); + Reset(); glEnable(GL_BLEND); @@ -35,6 +41,16 @@ sdl_scale(1) glDisable(GL_TEXTURE_2D); } +void Graphics::Acquire() +{ + pthread_mutex_lock(&gMutex); +} + +void Graphics::Release() +{ + pthread_mutex_unlock(&gMutex); +} + Graphics::~Graphics() { } diff --git a/src/graphics/RasterDrawMethods.inl b/src/graphics/RasterDrawMethods.inl index 76b9dde..cce81d2 100644 --- a/src/graphics/RasterDrawMethods.inl +++ b/src/graphics/RasterDrawMethods.inl @@ -329,7 +329,7 @@ void PIXELMETHODS_CLASS::clearrect(int x, int y, int w, int h) void PIXELMETHODS_CLASS::draw_image(pixel *img, int x, int y, int w, int h, int a) { int i, j, r, g, b; - if (!img) return; + if (!img || y >= VIDYRES) return; if(y + h > VIDYRES) h = (VIDYRES)-y; //Adjust height to prevent drawing off the bottom if(a >= 255) for (j=0; j<h; j++) diff --git a/src/graphics/RasterGraphics.cpp b/src/graphics/RasterGraphics.cpp index 312f44e..2a485e5 100644 --- a/src/graphics/RasterGraphics.cpp +++ b/src/graphics/RasterGraphics.cpp @@ -9,6 +9,16 @@ sdl_scale(1) } +void Graphics::Acquire() +{ + +} + +void Graphics::Release() +{ + +} + Graphics::~Graphics() { free(vid); |
