Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix previous commit: Remove SDL_FreeSurface(HiddenSurface.get());. #642

Merged
merged 1 commit into from
Mar 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 16 additions & 18 deletions src/video/cursor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -340,24 +340,22 @@ void DrawCursor()

// Last, Normal cursor.
if (!Preference.HardwareCursor) {
const PixelPos pos = CursorScreenPos - GameCursor->HotPos;

if (!GameRunning && !Editor.Running) {
if (!HiddenSurface
|| HiddenSurface->w != GameCursor->G->getWidth()
|| HiddenSurface->h != GameCursor->G->getHeight()) {
if (HiddenSurface) {
VideoPaletteListRemove(HiddenSurface.get());
SDL_FreeSurface(HiddenSurface.get());
}
HiddenSurface.reset(SDL_CreateRGBSurface(SDL_SWSURFACE,
GameCursor->G->getWidth(),
GameCursor->G->getHeight(),
TheScreen->format->BitsPerPixel,
TheScreen->format->Rmask,
TheScreen->format->Gmask,
TheScreen->format->Bmask,
TheScreen->format->Amask));
const PixelPos pos = CursorScreenPos - GameCursor->HotPos;

if (!GameRunning && !Editor.Running) {
if (!HiddenSurface || HiddenSurface->w != GameCursor->G->getWidth()
|| HiddenSurface->h != GameCursor->G->getHeight()) {
if (HiddenSurface) {
VideoPaletteListRemove(HiddenSurface.get());
}
HiddenSurface.reset(SDL_CreateRGBSurface(SDL_SWSURFACE,
GameCursor->G->getWidth(),
GameCursor->G->getHeight(),
TheScreen->format->BitsPerPixel,
TheScreen->format->Rmask,
TheScreen->format->Gmask,
TheScreen->format->Bmask,
TheScreen->format->Amask));
}
SDL_Rect srcRect = { Sint16(pos.x), Sint16(pos.y), Uint16(GameCursor->G->getWidth()), Uint16(GameCursor->G->getHeight())};
SDL_BlitSurface(TheScreen, &srcRect, HiddenSurface.get(), nullptr);
Expand Down
Loading