FreeRDP/libfreerdp/primitives/primitives.c

86 lines
2.5 KiB
C
Raw Normal View History

2013-01-19 02:32:58 +04:00
/* primitives.c
* This code queries processor features and calls the init/deinit routines.
* vi:ts=4 sw=4
*
2013-12-04 14:37:57 +04:00
* Copyright 2011 Martin Fleisz <martin.fleisz@thincast.com>
2013-01-19 02:32:58 +04:00
* (c) Copyright 2012 Hewlett-Packard Development Company, L.P.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License. You may obtain
* a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
* or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
2013-01-19 02:32:58 +04:00
#include <string.h>
#include <stdlib.h>
2013-01-19 02:32:58 +04:00
#include <freerdp/primitives.h>
2013-01-19 02:32:58 +04:00
#include "prim_internal.h"
2013-01-19 02:32:58 +04:00
/* Singleton pointer used throughout the program when requested. */
static primitives_t* pPrimitives = NULL;
2013-01-19 02:32:58 +04:00
/* ------------------------------------------------------------------------- */
void primitives_init(void)
{
if (pPrimitives == NULL)
{
pPrimitives = calloc(1, sizeof(primitives_t));
if (pPrimitives == NULL)
return;
2013-01-19 02:32:58 +04:00
}
/* Now call each section's initialization routine. */
primitives_init_add(pPrimitives);
primitives_init_andor(pPrimitives);
primitives_init_alphaComp(pPrimitives);
primitives_init_copy(pPrimitives);
primitives_init_set(pPrimitives);
primitives_init_shift(pPrimitives);
primitives_init_sign(pPrimitives);
primitives_init_colors(pPrimitives);
2014-07-03 00:30:04 +04:00
primitives_init_YCoCg(pPrimitives);
primitives_init_16to32bpp(pPrimitives);
2013-01-19 02:32:58 +04:00
}
/* ------------------------------------------------------------------------- */
primitives_t* primitives_get(void)
2013-01-19 02:32:58 +04:00
{
if (pPrimitives == NULL)
primitives_init();
2013-01-19 02:32:58 +04:00
return pPrimitives;
}
/* ------------------------------------------------------------------------- */
void primitives_deinit(void)
{
if (pPrimitives == NULL)
return;
2013-01-19 02:32:58 +04:00
/* Call each section's de-initialization routine. */
primitives_deinit_add(pPrimitives);
primitives_deinit_andor(pPrimitives);
primitives_deinit_alphaComp(pPrimitives);
primitives_deinit_copy(pPrimitives);
primitives_deinit_set(pPrimitives);
primitives_deinit_shift(pPrimitives);
primitives_deinit_sign(pPrimitives);
primitives_deinit_colors(pPrimitives);
2014-07-03 00:30:04 +04:00
primitives_deinit_YCoCg(pPrimitives);
primitives_deinit_16to32bpp(pPrimitives);
2013-01-19 02:32:58 +04:00
free((void*) pPrimitives);
2013-01-19 02:32:58 +04:00
pPrimitives = NULL;
}