bool CSprite::loadHQSprite( const std::string& filename ) { if(!IsFileAvailable(filename)) return false; if(!mpSurface.empty()) { const std::string fullpath = GetFullFileName(filename); SmartPointer<SDL_Surface> temp_surface = SDL_LoadBMP( fullpath.c_str() ); if(!temp_surface.empty()) { SmartPointer<SDL_Surface> displaysurface = SDL_ConvertSurface(temp_surface.get(), mpSurface->format, mpSurface->flags); readMask(displaysurface.get()); readBBox(displaysurface.get()); SDL_BlitSurface(displaysurface.get(), NULL, mpSurface.get(), NULL); return true; } } return false; }
bool CSprite::loadHQSprite( const std::string& filename ) { if(!IsFileAvailable(filename)) return false; if(mpSurface) { const std::string fullpath = GetFullFileName(filename); std::unique_ptr<SDL_Surface, SDL_Surface_Deleter> temp_surface(SDL_LoadBMP( fullpath.c_str() )); if(temp_surface) { std::unique_ptr<SDL_Surface, SDL_Surface_Deleter> displaysurface( SDL_ConvertSurface(temp_surface.get(), mpSurface->format, mpSurface->flags)); readMask(displaysurface.get()); readBBox(displaysurface.get()); SDL_BlitSurface(displaysurface.get(), NULL, mpSurface.get(), NULL); return true; } } return false; }