os/graphics/graphicscomposition/openwfcompositionengine/adaptation/src/Platform/OS/symbian/owfextensions.cpp
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/graphics/graphicscomposition/openwfcompositionengine/adaptation/src/Platform/OS/symbian/owfextensions.cpp	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,110 @@
     1.4 +// Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
     1.5 +//
     1.6 +// Permission is hereby granted, free of charge, to any person obtaining a
     1.7 +// copy of this software and/or associated documentation files (the
     1.8 +// "Materials"), to deal in the Materials without restriction, including
     1.9 +// without limitation the rights to use, copy, modify, merge, publish,
    1.10 +// distribute, sublicense, and/or sell copies of the Materials, and to
    1.11 +// permit persons to whom the Materials are furnished to do so, subject to
    1.12 +// the following conditions:
    1.13 +//
    1.14 +// The above copyright notice and this permission notice shall be included
    1.15 +// in all copies or substantial portions of the Materials.
    1.16 +//
    1.17 +// THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
    1.18 +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
    1.19 +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
    1.20 +// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
    1.21 +// CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
    1.22 +// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
    1.23 +// MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
    1.24 +//
    1.25 +// Description:
    1.26 +// Tables of OpenWF-C strings and extensions, plus access for EGL.
    1.27 +//
    1.28 +//
    1.29 +
    1.30 +#include <string.h>
    1.31 +#include <e32def.h>
    1.32 +#include <WF/wfc.h>
    1.33 +#include <KHR/khrplatform.h>
    1.34 +#include "owfextensions.h"
    1.35 +#include "owftypes.h"
    1.36 +
    1.37 +/*!
    1.38 + * Vendor, renderer and version strings
    1.39 + */
    1.40 +const char* wfc_strings[] =
    1.41 +{
    1.42 +    "Nokia",
    1.43 +    "Sample Implementation",
    1.44 +    "1.0",
    1.45 +};
    1.46 +
    1.47 +/*
    1.48 + * Table of extensions supported, terminated by a NULL.
    1.49 + */
    1.50 +const char *wfc_extensions[] =
    1.51 +{
    1.52 +    NULL
    1.53 +};
    1.54 +
    1.55 +#ifdef __cplusplus
    1.56 +typedef void (*OWFExtensionFunction)(...);
    1.57 +#else
    1.58 +typedef void (*OWFExtensionFunction)();
    1.59 +#endif
    1.60 +
    1.61 +typedef struct OWFExtension_tag
    1.62 +{
    1.63 +    const char *name;
    1.64 +    OWFExtensionFunction function;
    1.65 +} OWFExtension;
    1.66 +
    1.67 +/*
    1.68 + * Table of extension function name/pointer pairs, terminated with a NULL name
    1.69 + * pair (pointer not used for terminating entry).
    1.70 + */
    1.71 +static OWFExtension OWF_ExtensionFunctionTable[] =
    1.72 +{
    1.73 +    { NULL, NULL }
    1.74 +};
    1.75 +
    1.76 +OWF_API_CALL OWFExtensionFunction
    1.77 +owfGetProcAddress(const char *procName)
    1.78 +{
    1.79 +    WFCint ii;
    1.80 +    
    1.81 +    if (!procName)
    1.82 +        {
    1.83 +        return NULL;
    1.84 +        }
    1.85 +    
    1.86 +    for (ii=0; OWF_ExtensionFunctionTable[ii].name != NULL; ii++)
    1.87 +    {
    1.88 +       if (strcmp(procName, OWF_ExtensionFunctionTable[ii].name)==0)
    1.89 +       {
    1.90 +           return OWF_ExtensionFunctionTable[ii].function;
    1.91 +       }
    1.92 +    }
    1.93 +    
    1.94 +    return NULL;
    1.95 +}
    1.96 +
    1.97 +/*
    1.98 + * eglGetProcAddress uses export 1 (implemented as GetExtensionFunctionTable) to
    1.99 + * fill in a function pointer table. The first entry is the function that looks up
   1.100 + * a function pointer for a given name. Other entries could be added in the
   1.101 + * future if coordinated with the EGL implementation.
   1.102 + */
   1.103 +
   1.104 +typedef struct
   1.105 +{
   1.106 +    OWFExtensionFunction (*owfGetProcAddressFn) (const char* procname);
   1.107 +} owfCFunctions;
   1.108 +
   1.109 +extern "C" WFC_API_CALL void WFC_APIENTRY
   1.110 +GetExtensionFunctionTable(owfCFunctions* fnTable) WFC_APIEXIT
   1.111 +{
   1.112 +    fnTable->owfGetProcAddressFn = owfGetProcAddress;
   1.113 +}