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.
|
|
|
|
*/
|
|
|
|
|
2013-01-19 23:27:34 +04:00
|
|
|
#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 23:27:34 +04:00
|
|
|
|
2013-01-19 02:32:58 +04:00
|
|
|
#include <freerdp/primitives.h>
|
2013-01-20 00:16:28 +04:00
|
|
|
|
2013-01-19 02:32:58 +04:00
|
|
|
#include "prim_internal.h"
|
2013-01-20 00:16:28 +04:00
|
|
|
|
2013-01-19 02:32:58 +04:00
|
|
|
/* Singleton pointer used throughout the program when requested. */
|
2016-04-05 18:07:45 +03:00
|
|
|
static primitives_t pPrimitives = { 0 };
|
|
|
|
static primitives_t pPrimitivesGeneric = { 0 };
|
|
|
|
static BOOL pPrimitivesInitialized = FALSE;
|
|
|
|
static BOOL pPrimitivesGenericInitialized = FALSE;
|
2013-01-19 02:32:58 +04:00
|
|
|
|
|
|
|
/* ------------------------------------------------------------------------- */
|
2016-04-05 18:07:45 +03:00
|
|
|
static void primitives_init_generic(void)
|
2013-01-19 02:32:58 +04:00
|
|
|
{
|
2016-04-05 18:07:45 +03:00
|
|
|
primitives_init_add(&pPrimitivesGeneric);
|
|
|
|
primitives_init_andor(&pPrimitivesGeneric);
|
|
|
|
primitives_init_alphaComp(&pPrimitivesGeneric);
|
|
|
|
primitives_init_copy(&pPrimitivesGeneric);
|
|
|
|
primitives_init_set(&pPrimitivesGeneric);
|
|
|
|
primitives_init_shift(&pPrimitivesGeneric);
|
|
|
|
primitives_init_sign(&pPrimitivesGeneric);
|
|
|
|
primitives_init_colors(&pPrimitivesGeneric);
|
|
|
|
primitives_init_YCoCg(&pPrimitivesGeneric);
|
|
|
|
primitives_init_YUV(&pPrimitivesGeneric);
|
|
|
|
pPrimitivesGenericInitialized = TRUE;
|
|
|
|
}
|
2013-01-19 02:32:58 +04:00
|
|
|
|
2016-04-05 18:07:45 +03:00
|
|
|
static void primitives_init(void)
|
|
|
|
{
|
2013-01-19 02:32:58 +04:00
|
|
|
/* Now call each section's initialization routine. */
|
2016-04-05 18:07:45 +03:00
|
|
|
primitives_init_add_opt(&pPrimitives);
|
|
|
|
primitives_init_andor_opt(&pPrimitives);
|
|
|
|
primitives_init_alphaComp_opt(&pPrimitives);
|
|
|
|
primitives_init_copy_opt(&pPrimitives);
|
|
|
|
primitives_init_set_opt(&pPrimitives);
|
|
|
|
primitives_init_shift_opt(&pPrimitives);
|
|
|
|
primitives_init_sign_opt(&pPrimitives);
|
|
|
|
primitives_init_colors_opt(&pPrimitives);
|
|
|
|
primitives_init_YCoCg_opt(&pPrimitives);
|
|
|
|
primitives_init_YUV_opt(&pPrimitives);
|
|
|
|
pPrimitivesInitialized = TRUE;
|
2013-01-19 02:32:58 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* ------------------------------------------------------------------------- */
|
2013-01-20 00:16:28 +04:00
|
|
|
primitives_t* primitives_get(void)
|
2013-01-19 02:32:58 +04:00
|
|
|
{
|
2016-04-05 18:07:45 +03:00
|
|
|
if (!pPrimitivesGenericInitialized)
|
|
|
|
primitives_init_generic();
|
|
|
|
|
|
|
|
if (!pPrimitivesInitialized)
|
2013-01-20 00:16:28 +04:00
|
|
|
primitives_init();
|
|
|
|
|
2016-04-05 18:07:45 +03:00
|
|
|
return &pPrimitives;
|
2013-01-19 02:32:58 +04:00
|
|
|
}
|
|
|
|
|
2016-04-05 18:07:45 +03:00
|
|
|
primitives_t* primitives_get_generic(void)
|
2013-01-19 02:32:58 +04:00
|
|
|
{
|
2016-04-05 18:07:45 +03:00
|
|
|
if (!pPrimitivesGenericInitialized)
|
|
|
|
primitives_init_generic();
|
2013-01-19 02:32:58 +04:00
|
|
|
|
2016-07-13 15:04:48 +03:00
|
|
|
return &pPrimitivesGeneric;
|
2013-01-19 02:32:58 +04:00
|
|
|
}
|
2016-04-05 18:07:45 +03:00
|
|
|
|