From 1e406eeaf4d9e88f3638d3d145a48e58efc07f93 Mon Sep 17 00:00:00 2001 From: Simon Robertshaw Date: Wed, 15 Aug 2012 13:02:15 +0100 Subject: [PATCH] Revert some changes by Triclops200 in 42d707f8a432afa001d58611fc960d6ce6021676, Broke prototypes for drawrect with pixel functions, seems to have modified drawrect to make filled rects (forgot about fillrect?). Also use correct macros for getting colour components out of pixel data --- src/graphics/Graphics.h | 2 +- src/graphics/OpenGLDrawMethods.inl | 7 ++----- src/graphics/Renderer.cpp | 8 ++++---- src/graphics/Renderer.h | 2 +- 4 files changed, 8 insertions(+), 11 deletions(-) diff --git a/src/graphics/Graphics.h b/src/graphics/Graphics.h index 01318c89a..46d28b4d7 100644 --- a/src/graphics/Graphics.h +++ b/src/graphics/Graphics.h @@ -160,7 +160,7 @@ public: void xor_bitmap(unsigned char * bitmap, int x, int y, int w, int h); void draw_line(int x, int y, int x2, int y2, int r, int g, int b, int a); - void drawrect(int x, int y, int width, int height, int r, int g, int b, int a,bool hollow=true); + void drawrect(int x, int y, int width, int height, int r, int g, int b, int a); void fillrect(int x, int y, int width, int height, int r, int g, int b, int a); void clearrect(int x, int y, int width, int height); void gradientrect(int x, int y, int width, int height, int r, int g, int b, int a, int r2, int g2, int b2, int a2); diff --git a/src/graphics/OpenGLDrawMethods.inl b/src/graphics/OpenGLDrawMethods.inl index cbf311366..173cb4bd9 100644 --- a/src/graphics/OpenGLDrawMethods.inl +++ b/src/graphics/OpenGLDrawMethods.inl @@ -282,7 +282,7 @@ void PIXELMETHODS_CLASS::draw_line(int x, int y, int x2, int y2, int r, int g, i glEnd(); } -void PIXELMETHODS_CLASS::drawrect(int x, int y, int width, int height, int r, int g, int b, int a,bool hollow) +void PIXELMETHODS_CLASS::drawrect(int x, int y, int width, int height, int r, int g, int b, int a) { float fx = float(x)+0.5f; float fy = float(y)+0.5f; @@ -293,10 +293,7 @@ void PIXELMETHODS_CLASS::drawrect(int x, int y, int width, int height, int r, in //height-=2; //width-=2; glColor4ub(r, g, b, a); - if(hollow) - glBegin(GL_LINE_STRIP); - else - glBegin(GL_QUADS); + glBegin(GL_LINE_STRIP); glVertex2f(fx, fy); glVertex2f(fx+fwidth, fy); glVertex2f(fx+fwidth, fy+fheight); diff --git a/src/graphics/Renderer.cpp b/src/graphics/Renderer.cpp index f39e47614..380aabd5d 100644 --- a/src/graphics/Renderer.cpp +++ b/src/graphics/Renderer.cpp @@ -593,9 +593,9 @@ void Renderer::DrawWalls() pc = wtypes[wt].colour; gc = wtypes[wt].eglow; #ifdef OGLR - int r = (pc&0x00FF0000)>>8; - int g = (pc&0x0000FF00)>>4; - int b = (pc&0x000000FF)>>0; + int r = PIXR(pc); + int g = PIXG(pc); + int b = PIXB(pc); int a = 255; #endif #ifndef OGLR @@ -715,7 +715,7 @@ void Renderer::DrawWalls() } #else - this->drawrect(x*CELL,y*CELL,CELL,CELL,r,g,b,a,false); + this->fillrect(x*CELL, y*CELL, CELL, CELL, r, g, b, a); #endif } } diff --git a/src/graphics/Renderer.h b/src/graphics/Renderer.h index b4f730f41..6e814cccb 100644 --- a/src/graphics/Renderer.h +++ b/src/graphics/Renderer.h @@ -105,7 +105,7 @@ public: void xor_bitmap(unsigned char * bitmap, int x, int y, int w, int h); void draw_line(int x, int y, int x2, int y2, int r, int g, int b, int a); - void drawrect(int x, int y, int width, int height, int r, int g, int b, int a,bool hollow = true); + void drawrect(int x, int y, int width, int height, int r, int g, int b, int a); void fillrect(int x, int y, int width, int height, int r, int g, int b, int a); void clearrect(int x, int y, int width, int height); void gradientrect(int x, int y, int width, int height, int r, int g, int b, int a, int r2, int g2, int b2, int a2);