mirror of
git://projects.qi-hardware.com/gmenu2x.git
synced 2024-11-29 04:10:16 +02:00
Removed return code from surface drawing methods
Not a single caller actually checked the return codes.
This commit is contained in:
parent
86ee9955d6
commit
2a4b519282
@ -112,8 +112,8 @@ void Surface::flip() {
|
|||||||
SDL_Flip(raw);
|
SDL_Flip(raw);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Surface::blit(SDL_Surface *destination, int x, int y, int w, int h, int a) const {
|
void Surface::blit(SDL_Surface *destination, int x, int y, int w, int h, int a) const {
|
||||||
if (destination == NULL || a==0) return false;
|
if (destination == NULL || a==0) return;
|
||||||
|
|
||||||
SDL_Rect src = { 0, 0, static_cast<Uint16>(w), static_cast<Uint16>(h) };
|
SDL_Rect src = { 0, 0, static_cast<Uint16>(w), static_cast<Uint16>(h) };
|
||||||
SDL_Rect dest;
|
SDL_Rect dest;
|
||||||
@ -121,55 +121,53 @@ bool Surface::blit(SDL_Surface *destination, int x, int y, int w, int h, int a)
|
|||||||
dest.y = y;
|
dest.y = y;
|
||||||
if (a>0 && a!=raw->format->alpha)
|
if (a>0 && a!=raw->format->alpha)
|
||||||
SDL_SetAlpha(raw, SDL_SRCALPHA|SDL_RLEACCEL, a);
|
SDL_SetAlpha(raw, SDL_SRCALPHA|SDL_RLEACCEL, a);
|
||||||
return SDL_BlitSurface(raw, (w==0 || h==0) ? NULL : &src, destination, &dest);
|
SDL_BlitSurface(raw, (w==0 || h==0) ? NULL : &src, destination, &dest);
|
||||||
}
|
}
|
||||||
bool Surface::blit(Surface *destination, int x, int y, int w, int h, int a) const {
|
void Surface::blit(Surface *destination, int x, int y, int w, int h, int a) const {
|
||||||
return blit(destination->raw,x,y,w,h,a);
|
blit(destination->raw,x,y,w,h,a);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Surface::blitCenter(SDL_Surface *destination, int x, int y, int w, int h, int a) const {
|
void Surface::blitCenter(SDL_Surface *destination, int x, int y, int w, int h, int a) const {
|
||||||
int oh, ow;
|
int oh, ow;
|
||||||
if (w==0) ow = halfW; else ow = min(halfW,w/2);
|
if (w==0) ow = halfW; else ow = min(halfW,w/2);
|
||||||
if (h==0) oh = halfH; else oh = min(halfH,h/2);
|
if (h==0) oh = halfH; else oh = min(halfH,h/2);
|
||||||
return blit(destination,x-ow,y-oh,w,h,a);
|
blit(destination,x-ow,y-oh,w,h,a);
|
||||||
}
|
}
|
||||||
bool Surface::blitCenter(Surface *destination, int x, int y, int w, int h, int a) const {
|
void Surface::blitCenter(Surface *destination, int x, int y, int w, int h, int a) const {
|
||||||
return blitCenter(destination->raw,x,y,w,h,a);
|
blitCenter(destination->raw,x,y,w,h,a);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Surface::blitRight(SDL_Surface *destination, int x, int y, int w, int h, int a) const {
|
void Surface::blitRight(SDL_Surface *destination, int x, int y, int w, int h, int a) const {
|
||||||
if (!w) w = raw->w;
|
if (!w) w = raw->w;
|
||||||
return blit(destination,x-min(raw->w,w),y,w,h,a);
|
blit(destination,x-min(raw->w,w),y,w,h,a);
|
||||||
}
|
}
|
||||||
bool Surface::blitRight(Surface *destination, int x, int y, int w, int h, int a) const {
|
void Surface::blitRight(Surface *destination, int x, int y, int w, int h, int a) const {
|
||||||
if (!w) w = raw->w;
|
if (!w) w = raw->w;
|
||||||
return blitRight(destination->raw,x,y,w,h,a);
|
blitRight(destination->raw,x,y,w,h,a);
|
||||||
}
|
}
|
||||||
|
|
||||||
int Surface::box(Sint16 x, Sint16 y, Uint16 w, Uint16 h, Uint8 r, Uint8 g, Uint8 b, Uint8 a) {
|
void Surface::box(Sint16 x, Sint16 y, Uint16 w, Uint16 h, Uint8 r, Uint8 g, Uint8 b, Uint8 a) {
|
||||||
return boxRGBA(raw, x, y, x + w - 1, y + h - 1, r, g, b, a);
|
boxRGBA(raw, x, y, x + w - 1, y + h - 1, r, g, b, a);
|
||||||
}
|
}
|
||||||
int Surface::box(Sint16 x, Sint16 y, Uint16 w, Uint16 h, Uint8 r, Uint8 g, Uint8 b) {
|
void Surface::box(Sint16 x, Sint16 y, Uint16 w, Uint16 h, Uint8 r, Uint8 g, Uint8 b) {
|
||||||
SDL_Rect re = { x, y, w, h };
|
SDL_Rect re = { x, y, w, h };
|
||||||
return SDL_FillRect(raw, &re, SDL_MapRGBA(raw->format, r, g, b, 255));
|
SDL_FillRect(raw, &re, SDL_MapRGBA(raw->format, r, g, b, 255));
|
||||||
}
|
}
|
||||||
int Surface::box(Sint16 x, Sint16 y, Uint16 w, Uint16 h, RGBAColor c) {
|
void Surface::box(Sint16 x, Sint16 y, Uint16 w, Uint16 h, RGBAColor c) {
|
||||||
return box(x, y, w, h, c.r, c.g, c.b, c.a);
|
box(x, y, w, h, c.r, c.g, c.b, c.a);
|
||||||
}
|
}
|
||||||
int Surface::box(SDL_Rect re, RGBAColor c) {
|
void Surface::box(SDL_Rect re, RGBAColor c) {
|
||||||
return boxRGBA(
|
boxRGBA(raw, re.x, re.y, re.x + re.w - 1, re.y + re.h - 1, c.r, c.g, c.b, c.a);
|
||||||
raw, re.x, re.y, re.x + re.w - 1, re.y + re.h - 1, c.r, c.g, c.b, c.a
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int Surface::rectangle(Sint16 x, Sint16 y, Uint16 w, Uint16 h, Uint8 r, Uint8 g, Uint8 b, Uint8 a) {
|
void Surface::rectangle(Sint16 x, Sint16 y, Uint16 w, Uint16 h, Uint8 r, Uint8 g, Uint8 b, Uint8 a) {
|
||||||
return rectangleRGBA(raw, x, y, x + w - 1, y + h - 1, r, g, b, a);
|
rectangleRGBA(raw, x, y, x + w - 1, y + h - 1, r, g, b, a);
|
||||||
}
|
}
|
||||||
int Surface::rectangle(Sint16 x, Sint16 y, Uint16 w, Uint16 h, RGBAColor c) {
|
void Surface::rectangle(Sint16 x, Sint16 y, Uint16 w, Uint16 h, RGBAColor c) {
|
||||||
return rectangle(x, y, w, h, c.r, c.g, c.b, c.a);
|
rectangle(x, y, w, h, c.r, c.g, c.b, c.a);
|
||||||
}
|
}
|
||||||
int Surface::rectangle(SDL_Rect re, RGBAColor c) {
|
void Surface::rectangle(SDL_Rect re, RGBAColor c) {
|
||||||
return rectangle(re.x, re.y, re.w, re.h, c.r, c.g, c.b, c.a);
|
rectangle(re.x, re.y, re.w, re.h, c.r, c.g, c.b, c.a);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Surface::clearClipRect() {
|
void Surface::clearClipRect() {
|
||||||
@ -188,7 +186,7 @@ void Surface::setClipRect(SDL_Rect rect) {
|
|||||||
SDL_SetClipRect(raw,&rect);
|
SDL_SetClipRect(raw,&rect);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Surface::blit(Surface *destination, SDL_Rect container, Font::HAlign halign, Font::VAlign valign) const {
|
void Surface::blit(Surface *destination, SDL_Rect container, Font::HAlign halign, Font::VAlign valign) const {
|
||||||
switch (halign) {
|
switch (halign) {
|
||||||
case Font::HAlignLeft:
|
case Font::HAlignLeft:
|
||||||
break;
|
break;
|
||||||
@ -211,5 +209,5 @@ bool Surface::blit(Surface *destination, SDL_Rect container, Font::HAlign halign
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return blit(destination,container.x,container.y);
|
blit(destination,container.x,container.y);
|
||||||
}
|
}
|
||||||
|
@ -61,10 +61,10 @@ public:
|
|||||||
void setClipRect(int x, int y, int w, int h);
|
void setClipRect(int x, int y, int w, int h);
|
||||||
void setClipRect(SDL_Rect rect);
|
void setClipRect(SDL_Rect rect);
|
||||||
|
|
||||||
bool blit(Surface *destination, int x, int y, int w=0, int h=0, int a=-1) const;
|
void blit(Surface *destination, int x, int y, int w=0, int h=0, int a=-1) const;
|
||||||
bool blit(Surface *destination, SDL_Rect container, Font::HAlign halign = Font::HAlignLeft, Font::VAlign valign = Font::VAlignTop) const;
|
void blit(Surface *destination, SDL_Rect container, Font::HAlign halign = Font::HAlignLeft, Font::VAlign valign = Font::VAlignTop) const;
|
||||||
bool blitCenter(Surface *destination, int x, int y, int w=0, int h=0, int a=-1) const;
|
void blitCenter(Surface *destination, int x, int y, int w=0, int h=0, int a=-1) const;
|
||||||
bool blitRight(Surface *destination, int x, int y, int w=0, int h=0, int a=-1) const;
|
void blitRight(Surface *destination, int x, int y, int w=0, int h=0, int a=-1) const;
|
||||||
|
|
||||||
void write(Font *font, const std::string &text, int x, int y,
|
void write(Font *font, const std::string &text, int x, int y,
|
||||||
Font::HAlign halign = Font::HAlignLeft,
|
Font::HAlign halign = Font::HAlignLeft,
|
||||||
@ -72,19 +72,19 @@ public:
|
|||||||
font->write(this, text, x, y, halign, valign);
|
font->write(this, text, x, y, halign, valign);
|
||||||
}
|
}
|
||||||
|
|
||||||
int box(Sint16 x, Sint16 y, Uint16 w, Uint16 h, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
|
void box(Sint16 x, Sint16 y, Uint16 w, Uint16 h, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
|
||||||
int box(Sint16 x, Sint16 y, Uint16 w, Uint16 h, Uint8 r, Uint8 g, Uint8 b);
|
void box(Sint16 x, Sint16 y, Uint16 w, Uint16 h, Uint8 r, Uint8 g, Uint8 b);
|
||||||
int box(Sint16 x, Sint16 y, Uint16 w, Uint16 h, RGBAColor);
|
void box(Sint16 x, Sint16 y, Uint16 w, Uint16 h, RGBAColor);
|
||||||
int box(SDL_Rect, RGBAColor);
|
void box(SDL_Rect, RGBAColor);
|
||||||
int rectangle(Sint16, Sint16, Uint16, Uint16, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
|
void rectangle(Sint16, Sint16, Uint16, Uint16, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
|
||||||
int rectangle(Sint16, Sint16, Uint16, Uint16, RGBAColor);
|
void rectangle(Sint16, Sint16, Uint16, Uint16, RGBAColor);
|
||||||
int rectangle(SDL_Rect, RGBAColor);
|
void rectangle(SDL_Rect, RGBAColor);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Surface(SDL_Surface *raw, bool freeWhenDone);
|
Surface(SDL_Surface *raw, bool freeWhenDone);
|
||||||
bool blit(SDL_Surface *destination, int x, int y, int w=0, int h=0, int a=-1) const;
|
void blit(SDL_Surface *destination, int x, int y, int w=0, int h=0, int a=-1) const;
|
||||||
bool blitCenter(SDL_Surface *destination, int x, int y, int w=0, int h=0, int a=-1) const;
|
void blitCenter(SDL_Surface *destination, int x, int y, int w=0, int h=0, int a=-1) const;
|
||||||
bool blitRight(SDL_Surface *destination, int x, int y, int w=0, int h=0, int a=-1) const;
|
void blitRight(SDL_Surface *destination, int x, int y, int w=0, int h=0, int a=-1) const;
|
||||||
|
|
||||||
SDL_Surface *raw;
|
SDL_Surface *raw;
|
||||||
bool freeWhenDone;
|
bool freeWhenDone;
|
||||||
|
Loading…
Reference in New Issue
Block a user