TColorPutterAlpha CSDL_Ext::getPutterAlphaFor(SDL_Surface * const &dest, int incrementing) { switch(dest->format->BytesPerPixel) { CASE_BPP(2) CASE_BPP(3) CASE_BPP(4) default: tlog1 << (int)dest->format->BitsPerPixel << "bpp is not supported!\n"; return NULL; } #undef CASE_BPP }
TColorPutterAlpha CSDL_Ext::getPutterAlphaFor(SDL_Surface * const &dest, int incrementing) { switch(dest->format->BytesPerPixel) { CASE_BPP(2) CASE_BPP(3) CASE_BPP(4) default: logGlobal->errorStream() << (int)dest->format->BitsPerPixel << "bpp is not supported!"; return nullptr; } #undef CASE_BPP }
TColorPutter CSDL_Ext::getPutterFor(SDL_Surface * const &dest, int incrementing) { #define CASE_BPP(BytesPerPixel) \ case BytesPerPixel: \ if(incrementing > 0) \ return ColorPutter<BytesPerPixel, 1>::PutColor; \ else if(incrementing == 0) \ return ColorPutter<BytesPerPixel, 0>::PutColor; \ else \ return ColorPutter<BytesPerPixel, -1>::PutColor;\ break; switch(dest->format->BytesPerPixel) { CASE_BPP(2) CASE_BPP(3) CASE_BPP(4) default: tlog1 << (int)dest->format->BitsPerPixel << "bpp is not supported!\n"; return NULL; } }