From 22dbc0f32f9ea3a73c67c07cb7766dd1348f76dd Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Wed, 31 Jan 2024 15:32:03 -0500 Subject: [PATCH] camera: Patched to compile after rebasing to latest in main. --- include/SDL3/SDL_events.h | 1 + src/camera/SDL_camera.c | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/include/SDL3/SDL_events.h b/include/SDL3/SDL_events.h index cbd1f2a8a..c60b351e6 100644 --- a/include/SDL3/SDL_events.h +++ b/include/SDL3/SDL_events.h @@ -39,6 +39,7 @@ #include #include #include +#include #include /* Set up for C function definitions, even when using C++ */ diff --git a/src/camera/SDL_camera.c b/src/camera/SDL_camera.c index 486b50013..b4823f806 100644 --- a/src/camera/SDL_camera.c +++ b/src/camera/SDL_camera.c @@ -393,7 +393,7 @@ void SDL_CameraDeviceDisconnected(SDL_CameraDevice *device) ObtainPhysicalCameraDeviceObj(device); - const SDL_bool first_disconnect = SDL_AtomicCAS(&device->zombie, 0, 1); + const SDL_bool first_disconnect = SDL_AtomicCompareAndSwap(&device->zombie, 0, 1); if (first_disconnect) { // if already disconnected this device, don't do it twice. // Swap in "Zombie" versions of the usual platform interfaces, so the device will keep // making progress until the app closes it. @@ -706,7 +706,7 @@ SDL_bool SDL_CameraThreadIterate(SDL_CameraDevice *device) SDL_Surface *srcsurf = acquired; if (device->needs_scaling == -1) { // downscaling? Do it first. -1: downscale, 0: no scaling, 1: upscale SDL_Surface *dstsurf = device->needs_conversion ? device->conversion_surface : output_surface; - SDL_SoftStretch(srcsurf, NULL, dstsurf, NULL); // !!! FIXME: linear scale? letterboxing? + SDL_SoftStretch(srcsurf, NULL, dstsurf, NULL, SDL_SCALEMODE_NEAREST); // !!! FIXME: linear scale? letterboxing? srcsurf = dstsurf; } if (device->needs_conversion) { @@ -717,7 +717,7 @@ SDL_bool SDL_CameraThreadIterate(SDL_CameraDevice *device) srcsurf = dstsurf; } if (device->needs_scaling == 1) { // upscaling? Do it last. -1: downscale, 0: no scaling, 1: upscale - SDL_SoftStretch(srcsurf, NULL, output_surface, NULL); // !!! FIXME: linear scale? letterboxing? + SDL_SoftStretch(srcsurf, NULL, output_surface, NULL, SDL_SCALEMODE_NEAREST); // !!! FIXME: linear scale? letterboxing? } // we made a copy, so we can give the driver back its resources.