GRIM: Make PrimitiveObject use const where appropriate

This commit is contained in:
Joel Teichroeb 2012-05-05 18:03:04 -07:00
parent a28057c6b5
commit b223ca4880
7 changed files with 29 additions and 29 deletions

View File

@ -213,9 +213,9 @@ public:
virtual void drawEmergString(int x, int y, const char *text, const Color &fgColor) = 0;
virtual void loadEmergFont() = 0;
virtual void drawRectangle(PrimitiveObject *primitive) = 0;
virtual void drawLine(PrimitiveObject *primitive) = 0;
virtual void drawPolygon(PrimitiveObject *primitive) = 0;
virtual void drawRectangle(const PrimitiveObject *primitive) = 0;
virtual void drawLine(const PrimitiveObject *primitive) = 0;
virtual void drawPolygon(const PrimitiveObject *primitive) = 0;
/**
* Prepare a movie-frame for drawing

View File

@ -1506,7 +1506,7 @@ void GfxOpenGL::irisAroundRegion(int x1, int y1, int x2, int y2) {
glDepthMask(GL_TRUE);
}
void GfxOpenGL::drawRectangle(PrimitiveObject *primitive) {
void GfxOpenGL::drawRectangle(const PrimitiveObject *primitive) {
float x1 = primitive->getP1().x * _scaleW;
float y1 = primitive->getP1().y * _scaleH;
float x2 = primitive->getP2().x * _scaleW;
@ -1570,7 +1570,7 @@ void GfxOpenGL::drawRectangle(PrimitiveObject *primitive) {
glEnable(GL_LIGHTING);
}
void GfxOpenGL::drawLine(PrimitiveObject *primitive) {
void GfxOpenGL::drawLine(const PrimitiveObject *primitive) {
float x1 = primitive->getP1().x * _scaleW;
float y1 = primitive->getP1().y * _scaleH;
float x2 = primitive->getP2().x * _scaleW;
@ -1604,7 +1604,7 @@ void GfxOpenGL::drawLine(PrimitiveObject *primitive) {
glEnable(GL_LIGHTING);
}
void GfxOpenGL::drawPolygon(PrimitiveObject *primitive) {
void GfxOpenGL::drawPolygon(const PrimitiveObject *primitive) {
float x1 = primitive->getP1().x * _scaleW;
float y1 = primitive->getP1().y * _scaleH;
float x2 = primitive->getP2().x * _scaleW;

View File

@ -113,9 +113,9 @@ public:
void drawEmergString(int x, int y, const char *text, const Color &fgColor);
void loadEmergFont();
void drawRectangle(PrimitiveObject *primitive);
void drawLine(PrimitiveObject *primitive);
void drawPolygon(PrimitiveObject *primitive);
void drawRectangle(const PrimitiveObject *primitive);
void drawLine(const PrimitiveObject *primitive);
void drawPolygon(const PrimitiveObject *primitive);
void prepareMovieFrame(Graphics::Surface* frame);
void drawMovieFrame(int offsetX, int offsetY);

View File

@ -1174,7 +1174,7 @@ void GfxTinyGL::irisAroundRegion(int x1, int y1, int x2, int y2) {
}
}
void GfxTinyGL::drawRectangle(PrimitiveObject *primitive) {
void GfxTinyGL::drawRectangle(const PrimitiveObject *primitive) {
int x1 = primitive->getP1().x;
int y1 = primitive->getP1().y;
int x2 = primitive->getP2().x;
@ -1209,7 +1209,7 @@ void GfxTinyGL::drawRectangle(PrimitiveObject *primitive) {
}
}
void GfxTinyGL::drawLine(PrimitiveObject *primitive) {
void GfxTinyGL::drawLine(const PrimitiveObject *primitive) {
int x1 = primitive->getP1().x;
int y1 = primitive->getP1().y;
int x2 = primitive->getP2().x;
@ -1233,7 +1233,7 @@ void GfxTinyGL::drawLine(PrimitiveObject *primitive) {
}
}
void GfxTinyGL::drawPolygon(PrimitiveObject *primitive) {
void GfxTinyGL::drawPolygon(const PrimitiveObject *primitive) {
int x1 = primitive->getP1().x;
int y1 = primitive->getP1().y;
int x2 = primitive->getP2().x;

View File

@ -106,9 +106,9 @@ public:
void drawEmergString(int x, int y, const char *text, const Color &fgColor);
void loadEmergFont();
void drawRectangle(PrimitiveObject *primitive);
void drawLine(PrimitiveObject *primitive);
void drawPolygon(PrimitiveObject *primitive);
void drawRectangle(const PrimitiveObject *primitive);
void drawLine(const PrimitiveObject *primitive);
void drawPolygon(const PrimitiveObject *primitive);
void prepareMovieFrame(Graphics::Surface* frame);
void drawMovieFrame(int offsetX, int offsetY);

View File

@ -72,7 +72,7 @@ bool PrimitiveObject::restoreState(SaveGame *savedState) {
return true;
}
void PrimitiveObject::createRectangle(Common::Point p1, Common::Point p2, const Color &color, bool filled) {
void PrimitiveObject::createRectangle(const Common::Point &p1, const Common::Point &p2, const Color &color, bool filled) {
_type = RECTANGLE;
_p1 = p1;
_p2 = p2;
@ -80,14 +80,14 @@ void PrimitiveObject::createRectangle(Common::Point p1, Common::Point p2, const
_filled = filled;
}
void PrimitiveObject::createLine(Common::Point p1, Common::Point p2, const Color &color) {
void PrimitiveObject::createLine(const Common::Point &p1, const Common::Point &p2, const Color &color) {
_type = LINE;
_p1 = p1;
_p2 = p2;
_color = color;
}
void PrimitiveObject::createPolygon(Common::Point p1, Common::Point p2, Common::Point p3, Common::Point p4, const Color &color) {
void PrimitiveObject::createPolygon(const Common::Point &p1, const Common::Point &p2, const Common::Point &p3, const Common::Point &p4, const Color &color) {
_type = POLYGON;
_p1 = p1;
_p2 = p2;
@ -96,7 +96,7 @@ void PrimitiveObject::createPolygon(Common::Point p1, Common::Point p2, Common::
_color = color;
}
void PrimitiveObject::draw() {
void PrimitiveObject::draw() const {
assert(_type);
if (_type == RECTANGLE)

View File

@ -45,18 +45,18 @@ public:
POLYGON
} PrimType;
void createRectangle(Common::Point p1, Common::Point p2, const Color &color, bool filled);
void createLine(Common::Point p1, Common::Point p2, const Color &color);
void createPolygon(Common::Point p1, Common::Point p2, Common::Point p3, Common::Point p4, const Color &color);
Common::Point getP1() { return _p1; }
Common::Point getP2() { return _p2; }
Common::Point getP3() { return _p3; }
Common::Point getP4() { return _p4; }
void createRectangle(const Common::Point &p1, const Common::Point &p2, const Color &color, bool filled);
void createLine(const Common::Point &p1, const Common::Point &p2, const Color &color);
void createPolygon(const Common::Point &p1, const Common::Point &p2, const Common::Point &p3, const Common::Point &p4, const Color &color);
Common::Point getP1() const { return _p1; }
Common::Point getP2() const { return _p2; }
Common::Point getP3() const { return _p3; }
Common::Point getP4() const { return _p4; }
void setPos(int x, int y);
void setColor(const Color &color) { _color = color; }
Color getColor() { return _color; }
bool isFilled() { return _filled; }
void draw();
Color getColor() const { return _color; }
bool isFilled() const { return _filled; }
void draw() const;
void saveState(SaveGame *state) const;
bool restoreState(SaveGame *state);