Date:2012-04-10 22:33:43 (11 years 11 months ago)
Author:Maarten ter Huurne
Commit:b248aaf8089fdd4ac41136f1eef3b8668e24fcc3
Message:Surface cleanup.

Use unsigned ints for width and height, like SDL does.
We're using the SDL typedefs there after all.

Include argument names in header when type name does tell everything.

Use whitespace in argument lists.
Files: src/surface.cpp (2 diffs)
src/surface.h (1 diff)

Change Details

src/surface.cpp
146146    return blitRight(destination->raw,x,y,w,h,a);
147147}
148148
149int Surface::box(Sint16 x, Sint16 y, Sint16 w, Sint16 h, Uint8 r, Uint8 g, Uint8 b, Uint8 a) {
150    return boxRGBA(raw,x,y,x+w-1,y+h-1,r,g,b,a);
149int Surface::box(Sint16 x, Sint16 y, Uint16 w, Uint16 h, Uint8 r, Uint8 g, Uint8 b, Uint8 a) {
150    return boxRGBA(raw, x, y, x + w - 1, y + h - 1, r, g, b, a);
151151}
152int Surface::box(Sint16 x, Sint16 y, Sint16 w, Sint16 h, Uint8 r, Uint8 g, Uint8 b) {
153    SDL_Rect re = {x,y,w,h};
154    return SDL_FillRect(raw, &re, SDL_MapRGBA(raw->format,r,g,b,255));
152int Surface::box(Sint16 x, Sint16 y, Uint16 w, Uint16 h, Uint8 r, Uint8 g, Uint8 b) {
153    SDL_Rect re = { x, y, w, h };
154    return SDL_FillRect(raw, &re, SDL_MapRGBA(raw->format, r, g, b, 255));
155155}
156int Surface::box(Sint16 x, Sint16 y, Sint16 w, Sint16 h, RGBAColor c) {
157    return box(x,y,w,h,c.r,c.g,c.b,c.a);
156int Surface::box(Sint16 x, Sint16 y, Uint16 w, Uint16 h, RGBAColor c) {
157    return box(x, y, w, h, c.r, c.g, c.b, c.a);
158158}
159159int Surface::box(SDL_Rect re, RGBAColor c) {
160160    return boxRGBA(
...... 
162162        );
163163}
164164
165int Surface::rectangle(Sint16 x, Sint16 y, Sint16 w, Sint16 h, Uint8 r, Uint8 g, Uint8 b, Uint8 a) {
166    return rectangleRGBA(raw,x,y,x+w-1,y+h-1,r,g,b,a);
165int Surface::rectangle(Sint16 x, Sint16 y, Uint16 w, Uint16 h, Uint8 r, Uint8 g, Uint8 b, Uint8 a) {
166    return rectangleRGBA(raw, x, y, x + w - 1, y + h - 1, r, g, b, a);
167167}
168int Surface::rectangle(Sint16 x, Sint16 y, Sint16 w, Sint16 h, RGBAColor c) {
169    return rectangle(x,y,w,h,c.r,c.g,c.b,c.a);
168int Surface::rectangle(Sint16 x, Sint16 y, Uint16 w, Uint16 h, RGBAColor c) {
169    return rectangle(x, y, w, h, c.r, c.g, c.b, c.a);
170170}
171171int Surface::rectangle(SDL_Rect re, RGBAColor c) {
172    return rectangle(re.x,re.y,re.w,re.h,c.r,c.g,c.b,c.a);
172    return rectangle(re.x, re.y, re.w, re.h, c.r, c.g, c.b, c.a);
173173}
174174
175int Surface::hline(Sint16 x, Sint16 y, Sint16 w, Uint8 r, Uint8 g, Uint8 b, Uint8 a) {
176    return hlineRGBA(raw,x,x+w-1,y,r,g,b,a);
175int Surface::hline(Sint16 x, Sint16 y, Uint16 w, Uint8 r, Uint8 g, Uint8 b, Uint8 a) {
176    return hlineRGBA(raw, x, x + w - 1, y, r, g, b, a);
177177}
178178
179179void Surface::clearClipRect() {
src/surface.h
7272        font->write(this, text, x, y, halign, valign);
7373    }
7474
75    int box(Sint16, Sint16, Sint16, Sint16, Uint8, Uint8, Uint8, Uint8);
76    int box(Sint16, Sint16, Sint16, Sint16, Uint8, Uint8, Uint8);
77    int box(Sint16, Sint16, Sint16, Sint16, RGBAColor);
75    int box(Sint16 x, Sint16 y, Uint16 w, Uint16 h, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
76    int box(Sint16 x, Sint16 y, Uint16 w, Uint16 h, Uint8 r, Uint8 g, Uint8 b);
77    int box(Sint16 x, Sint16 y, Uint16 w, Uint16 h, RGBAColor);
7878    int box(SDL_Rect, RGBAColor);
79    int rectangle(Sint16, Sint16, Sint16, Sint16, Uint8, Uint8, Uint8, Uint8);
80    int rectangle(Sint16, Sint16, Sint16, Sint16, RGBAColor);
79    int rectangle(Sint16, Sint16, Uint16, Uint16, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
80    int rectangle(Sint16, Sint16, Uint16, Uint16, RGBAColor);
8181    int rectangle(SDL_Rect, RGBAColor);
82    int hline(Sint16, Sint16, Sint16, Uint8, Uint8, Uint8, Uint8);
82    int hline(Sint16 x, Sint16 y, Uint16 h, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
8383
8484private:
8585    Surface(SDL_Surface *raw, bool freeWhenDone);

Archive Download the corresponding diff file



interactive