Permalink
Browse files

SDLSurfaceSprite2D: apparently constructors can have default arguments

lets use that instead of having 2
  • Loading branch information...
1 parent 18f705c commit da0e66eae723e676250f4cba5526f16b85585b4e @bradallred bradallred committed Jun 17, 2013
Showing with 8 additions and 11 deletions.
  1. +7 −9 gemrb/plugins/SDLVideo/SDLSurfaceSprite2D.cpp
  2. +1 −2 gemrb/plugins/SDLVideo/SDLSurfaceSprite2D.h
View
16 gemrb/plugins/SDLVideo/SDLSurfaceSprite2D.cpp
@@ -26,15 +26,6 @@
namespace GemRB {
-SDLSurfaceSprite2D::SDLSurfaceSprite2D(int Width, int Height, int Bpp, void* pixels)
- : Sprite2D(Width, Height, Bpp, pixels)
-{
- surface = SDL_CreateRGBSurfaceFrom( pixels, Width, Height, Bpp < 8 ? 8 : Bpp, Width * ( Bpp / 8 ),
- 0, 0, 0, 0 );
- freePixels = true;
- SetSurfaceRLE(true);
-}
-
SDLSurfaceSprite2D::SDLSurfaceSprite2D (int Width, int Height, int Bpp, void* pixels,
Uint32 rmask, Uint32 gmask, Uint32 bmask, Uint32 amask)
: Sprite2D(Width, Height, Bpp, pixels)
@@ -144,6 +135,13 @@ Color SDLSurfaceSprite2D::GetPixel(unsigned short x, unsigned short y) const
SDL_UnlockSurface( surface );
SDL_GetRGBA( val, surface->format, (Uint8 *) &c.r, (Uint8 *) &c.g, (Uint8 *) &c.b, (Uint8 *) &c.a );
+ if (c.a == 0 && (c.r || c.g || c.b)) {
+ c.a = 0xff;
+ }
+ ieDword ck = GetColorKey();
+ if (ck) {
+ ck;
+ }
return c;
}
View
3 gemrb/plugins/SDLVideo/SDLSurfaceSprite2D.h
@@ -35,9 +35,8 @@ class SDLSurfaceSprite2D : public Sprite2D {
private:
void SetSurfaceRLE(bool);
public:
- SDLSurfaceSprite2D(int Width, int Height, int Bpp, void* pixels);
SDLSurfaceSprite2D(int Width, int Height, int Bpp, void* pixels,
- ieDword rmask, ieDword gmask, ieDword bmask, ieDword amask);
+ ieDword rmask = 0, ieDword gmask = 0, ieDword bmask = 0, ieDword amask = 0);
SDLSurfaceSprite2D(const SDLSurfaceSprite2D &obj);
SDLSurfaceSprite2D* copy() const;
~SDLSurfaceSprite2D();

0 comments on commit da0e66e

Please sign in to comment.