Changeset View
Changeset View
Standalone View
Standalone View
source/lib/res/graphics/cursor.cpp
Show First 20 Lines • Show All 69 Lines • ▼ Show 20 Lines | Status create(const PIVFS& vfs, const VfsPath& pathname, int hotspotx_, int hotspoty_, double scale) | ||||
surface = SDL_CreateRGBSurfaceFrom(bgra_img, (int)t.m_Width, (int)t.m_Height, 32, (int)t.m_Width*4, 0x00FF0000, 0x0000FF00, 0x000000FF, 0xFF000000); | surface = SDL_CreateRGBSurfaceFrom(bgra_img, (int)t.m_Width, (int)t.m_Height, 32, (int)t.m_Width*4, 0x00FF0000, 0x0000FF00, 0x000000FF, 0xFF000000); | ||||
if(!surface) | if(!surface) | ||||
return ERR::FAIL; | return ERR::FAIL; | ||||
if(scale != 1.0) | if(scale != 1.0) | ||||
{ | { | ||||
SDL_Surface* scaled_surface = SDL_CreateRGBSurface(0, surface->w * scale, surface->h * scale, 32, 0x00FF0000, 0x0000FF00, 0x000000FF, 0xFF000000); | SDL_Surface* scaled_surface = SDL_CreateRGBSurface(0, surface->w * scale, surface->h * scale, 32, 0x00FF0000, 0x0000FF00, 0x000000FF, 0xFF000000); | ||||
if(!scaled_surface) | if(!scaled_surface) | ||||
return ERR::FAIL; | return ERR::FAIL; | ||||
if(SDL_BlitScaled(surface, NULL, scaled_surface, NULL)) | if(SDL_BlitScaled(surface, nullptr, scaled_surface, nullptr)) | ||||
return ERR::FAIL; | return ERR::FAIL; | ||||
SDL_FreeSurface(surface); | SDL_FreeSurface(surface); | ||||
surface = scaled_surface; | surface = scaled_surface; | ||||
} | } | ||||
cursor = SDL_CreateColorCursor(surface, hotspotx_, hotspoty_); | cursor = SDL_CreateColorCursor(surface, hotspotx_, hotspoty_); | ||||
if(!cursor) | if(!cursor) | ||||
return ERR::FAIL; | return ERR::FAIL; | ||||
▲ Show 20 Lines • Show All 280 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator