working on images, adding unit tests for image and buffers

This commit is contained in:
2024-12-08 03:16:10 +01:00
parent f020d8bf2c
commit 52850323fd
21 changed files with 697 additions and 25 deletions

35
Sources/PulseImage.c git.filemode.normal_file
View File

@@ -0,0 +1,35 @@
// Copyright (C) 2024 kanel
// This file is part of "Pulse"
// For conditions of distribution and use, see copyright notice in LICENSE
#include "Pulse.h"
#include "PulseDefs.h"
#include "PulseInternal.h"
PULSE_API PulseImage PulseCreateImage(PulseDevice device, const PulseImageCreateInfo* create_infos)
{
PULSE_CHECK_HANDLE_RETVAL(device, PULSE_NULL_HANDLE);
if(PULSE_IS_BACKEND_LOW_LEVEL_DEBUG(device->backend))
{
if(create_infos == PULSE_NULLPTR)
{
PulseLogError(device->backend, "create_infos is NULL");
PulseSetInternalError(PULSE_ERROR_INITIALIZATION_FAILED);
return PULSE_NULL_HANDLE;
}
}
return device->PFN_CreateImage(device, create_infos);
}
PULSE_API void PulseDestroyImage(PulseDevice device, PulseImage image)
{
PULSE_CHECK_HANDLE(device);
if(image == PULSE_NULL_HANDLE)
{
if(PULSE_IS_BACKEND_LOW_LEVEL_DEBUG(device->backend))
PulseLogWarning(device->backend, "image is NULL, this may be a bug in your application");
return;
}
return device->PFN_DestroyImage(device, image);
}