guestrendering/guestopenvg/inc/vgstate.h
author Matt Plumtree <matt.plumtree@nokia.com>
Thu, 07 Oct 2010 13:58:22 +0100
branchbug235_bringup_0
changeset 55 09263774e342
parent 24 a3f46bb01be2
child 59 d9b81aebba7b
permissions -rwxr-xr-x
Move GLES20 source into standard locations Move Khronos headers into their respective components, to be exported by each. Remove hostthreadadapter as nothing outside of the vghwapiwrapper, which now contains the code, needs it
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
24
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
     1
// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
     2
// All rights reserved.
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
     3
// This component and the accompanying materials are made available
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
     4
// under the terms of "Eclipse Public License v1.0"
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
     5
// which accompanies this distribution, and is available
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
     7
//
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
     8
// Initial Contributors:
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
     9
// Nokia Corporation - initial contribution.
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
    10
//
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
    11
// Contributors:
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
    12
//
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
    13
// Description:
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
    14
// Header file defining Open VG client-side state classes.
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
    15
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
    16
#ifndef VGSTATE_H
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
    17
#define VGSTATE_H
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
    18
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
    19
#include <EGL/egl.h>
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
    20
#include <VG/openvg.h>
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
    21
#include <e32hashtab.h>
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
    22
#include "vghwutils.h"
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
    23
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
    24
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
    25
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
    26
// tracing
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
    27
#include <e32debug.h>
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
    28
#ifdef _DEBUG
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
    29
	#define OPENVG_TRACE(fmt, args...) RDebug::Printf(fmt, ##args)
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
    30
	#define VGPANIC_ASSERT(condition, panic) if (!(condition)) { VgPanic(panic, #panic, #condition, __FILE__, __LINE__); }
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
    31
	#define VGPANIC_ASSERT_DEBUG(condition, panic) if (!(condition)) { VgPanic(panic, #panic, #condition, __FILE__, __LINE__); }
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
    32
	#define VGPANIC_ALWAYS(panic) { VgPanic(panic, #panic, NULL, __FILE__, __LINE__); }
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
    33
#else
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
    34
	#define OPENVG_TRACE(fmt, args...)
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
    35
	#define VGPANIC_ASSERT(condition, panic) if (!(condition)) { VgPanic(panic, NULL, NULL, NULL, __LINE__); }
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
    36
	#define VGPANIC_ASSERT_DEBUG(condition, panic)
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
    37
	#define VGPANIC_ALWAYS(panic) { VgPanic(panic, NULL, NULL, NULL, __LINE__); }
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
    38
#endif
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
    39
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
    40
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
    41
// Guest Open VG panic codes
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
    42
typedef enum
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
    43
	{
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
    44
	EVgPanicTemp = 1, // note: for development, references should be replaced with a more specific panic
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
    45
	EVgPanicNullPixmapPointer,
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
    46
	EVgPanicPixmapSizeError,
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
    47
	EVgPanicSingletonAlreadyInitialised,
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
    48
	EVgPanicSingletonNotInitialised,
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
    49
	EVgPanicNullPointer,
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
    50
	EVgPanicBadLastBitsParam,
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
    51
	EVgPanicBadRowLengthParam,
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
    52
	EVgPanicBadRowCountParam,
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
    53
	EVgPanicStrideSmallerThanRowLength, // 10
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
    54
	EVgPanicNotReplyOpcode,
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
    55
	EVgPanicDeleteInUseVgImageInfo,
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
    56
	EVgPanicUidGeneratorZeroSeed,
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
    57
	EVgPanicMissingEglInterface,
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
    58
	EVgPanicNullCVgHandlePointer,
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
    59
	EVgPanicWrongVgHandleType,
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
    60
	EVgPanicHandleAlreadyMarkedDestroyed,
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
    61
	EVgPanicUnknownVgHandleType,
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
    62
	EVgPanicHostHandleIsInvalid,
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
    63
	EVgPanicImageParentIsInvalid, // 20
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
    64
	EVgPanicFunctionParameterIsNull,
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
    65
	EVgPanicValueFromHostVgIsInvalid,
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
    66
	EVgPanicHostHandleAlreadySet,
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
    67
	EVgPanicParentImageAlreadyDestroyed,
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
    68
	EVgPanicStateLockMutexNotHeld,
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
    69
	} TVgPanic;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
    70
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
    71
void VgPanic(TVgPanic aPanicCode, char* aPanicName, char* aCondition, char* aFile, TInt aLine);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
    72
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
    73
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
    74
// state singleton, in Writeable Static Data memory
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
    75
class XOpenVgState;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
    76
extern XOpenVgState OpenVgState;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
    77
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
    78
// classes declared in this header
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
    79
class CVgHandleBase;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
    80
class CVgImageBase;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
    81
class CVgMaskLayerInfo;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
    82
class CVgFontInfo;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
    83
class CVgImageInfo;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
    84
class CVgPaintInfo;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
    85
class CVgPathInfo;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
    86
class THandleGen;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
    87
class TVgLockHolder;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
    88
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
    89
extern const float KFloatMinusOne;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
    90
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
    91
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
    92
class THandleGen
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
    93
	{
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
    94
public:
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
    95
	inline void Init(TUint aInit);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
    96
	TUint NextUid();
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
    97
private:
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
    98
	TUint iValue;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
    99
	};
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   100
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   101
typedef enum
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   102
	{
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   103
	EVgHandleAny = -1, // match any valid handle type, e.g. for vgSetParameteri
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   104
	EVgHandleForFont = 0, // specific types ...
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   105
	EVgHandleForImage,
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   106
	EVgHandleForPaint,
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   107
	EVgHandleForPath,
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   108
	EVgHandleForMaskLayer,
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   109
	} TVgHandleType;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   110
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   111
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   112
// state structures for VG objects (i.e. anything that is a VGHandle): VGImage, VGPath, VGMaskLayer, VGPaint, VGFont
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   113
// ToDo review how to handle thread locking these objects whilst they are in use
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   114
NONSHARABLE_CLASS(CVgHandleBase) : public CBase // Base Class
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   115
	{
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   116
public:
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   117
	static void InitStatics();
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   118
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   119
	// public inline methods 
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   120
	inline VGHandle HostHandle() const;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   121
	inline TVgHandleType HandleType() const;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   122
	inline TBool IsDestroyed() const;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   123
	inline void SetHostHandle(VGHandle aHostHandle);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   124
	inline TUint ClientHandle() const;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   125
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   126
	// general & specific portions of derived object destruction
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   127
	void Destroy(MVgContext& aVgContext);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   128
	virtual TBool DestroyObject(MVgContext& aVgContext) = 0;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   129
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   130
	// Each VGHandle object type must implement GetParameterVectorSize
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   131
	virtual VGint GetParameterVectorSize(MVgContext& aVgContext, VGint aParamType) = 0;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   132
	// Base version of  GetParameter* uses GetParameterVectorSize to validate aParamType then calls Host VG
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   133
	virtual VGfloat GetParameterf(MVgContext& aVgContext, VGint aParamType);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   134
	virtual VGint GetParameteri(MVgContext& aVgContext, VGint aParamType);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   135
	// For details of Base versions of GetParameter*v see vghandle.cpp
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   136
	virtual void GetParameterfv(MVgContext& aVgContext, VGint aParamType, VGint aCount, VGfloat * aValues);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   137
	virtual void GetParameteriv(MVgContext& aVgContext, VGint aParamType, VGint aCount, VGint * aValues);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   138
	// Base versions of SetParameter* assume parameters are read-only, and give an error return
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   139
	virtual void SetParameterf(MVgContext& aVgContext, VGint aParamType, VGfloat aValue);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   140
	virtual void SetParameteri(MVgContext& aVgContext, VGint aParamType, VGint aValue);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   141
	virtual void SetParameterfv(MVgContext& aVgContext, VGint aParamType, VGint aCount, const VGfloat * aValues);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   142
	virtual void SetParameteriv(MVgContext& aVgContext, VGint aParamType, VGint aCount, const VGint * aValues);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   143
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   144
protected:
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   145
	inline CVgHandleBase(TVgHandleType aHandleType);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   146
	inline ~CVgHandleBase();
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   147
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   148
	VGint HostVgGetParameterVectorSize(MVgContext& aVgContext, VGint aParamType);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   149
	VGint HostVgGetParameteri(MVgContext& aVgContext, VGint aParamType);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   150
	VGfloat HostVgGetParameterf(MVgContext& aVgContext, VGint aParamType);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   151
	void HostVgGetParameterfv(MVgContext& aVgContext, VGint aParamType, VGint aCount, const VGfloat * aValues);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   152
	void HostVgGetParameteriv(MVgContext& aVgContext, VGint aParamType, VGint aCount, const VGint * aValues);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   153
	void HostVgSetParameterf(MVgContext& aVgContext, VGint aParamType, VGfloat aValue);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   154
	void HostVgSetParameteri(MVgContext& aVgContext, VGint aParamType, VGint aValue);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   155
	void HostVgSetParameterfv(MVgContext& aVgContext, VGint aParamType, VGint aCount, const VGfloat * aValues);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   156
	void HostVgSetParameteriv(MVgContext& aVgContext, VGint aParamType, VGint aCount, const VGint * aValues);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   157
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   158
protected:
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   159
	TUint iClientHandle;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   160
	TVgHandleType iHandleType;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   161
	VGHandle iHostHandle;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   162
	TBool iIsDestroyed;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   163
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   164
private:
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   165
	static THandleGen iHandleGen; // generator for unique client side handles
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   166
	};
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   167
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   168
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   169
NONSHARABLE_CLASS(CVgImageBase) : public CVgHandleBase
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   170
	{
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   171
public:
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   172
	inline VGint Width() const;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   173
	inline VGint Height() const;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   174
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   175
	TBool DestroyObject(MVgContext& aVgContext) = 0;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   176
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   177
	virtual VGint GetParameterVectorSize(MVgContext& aVgContext, VGint aParamType) = 0;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   178
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   179
protected:
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   180
	inline CVgImageBase(TVgHandleType aHandleType, VGint aWidth, VGint aHeight);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   181
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   182
protected:
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   183
	VGint const   iWidth;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   184
	VGint const   iHeight;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   185
	};
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   186
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   187
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   188
NONSHARABLE_CLASS(CVgMaskLayerInfo) : public CVgImageBase
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   189
	{
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   190
public:
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   191
	static CVgMaskLayerInfo* New(VGint aWidth, VGint aHeight);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   192
	virtual TBool DestroyObject(MVgContext& aVgContext);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   193
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   194
	virtual VGint GetParameterVectorSize(MVgContext& aVgContext, VGint aParamType);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   195
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   196
	// Mask specific operations
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   197
	void FillMaskLayer(MVgContext& aVgContext, VGint aX, VGint aY, VGint aWidth, VGint aHeight, VGfloat aValue);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   198
	void CopyMask(MVgContext& aVgContext, VGint aSx, VGint aSy, VGint aDx, VGint aDy, VGint aWidth, VGint aHeight);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   199
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   200
private:
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   201
	inline CVgMaskLayerInfo(VGint aWidth, VGint aHeight);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   202
	inline ~CVgMaskLayerInfo();
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   203
	};
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   204
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   205
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   206
NONSHARABLE_CLASS(CVgImageInfo) : public CVgImageBase
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   207
	{
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   208
public:
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   209
	static CVgImageInfo* New(VGImageFormat aFormat, VGint aWidth, VGint aHeight, VGbitfield aAllowedQuality);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   210
	static CVgImageInfo* New(VGImageFormat aFormat, VGint aWidth, VGint aHeight, EGLImageKHR aEglImage, TUint64& aSgImageId);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   211
	static CVgImageInfo* New(VGint aWidth, VGint aHeight, CVgImageInfo* aParent);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   212
	virtual TBool DestroyObject(MVgContext& aVgContext);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   213
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   214
	TInt ChildCount() const;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   215
	CVgImageInfo* Parent() const;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   216
	VGbitfield AllowedQuality() const;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   217
	TBool IsEglSibling() const;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   218
	TUint64 SgImageId() const;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   219
	EGLImageKHR EglImage() const;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   220
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   221
	static TInt BitsPerPixelForVgImageFormat(VGImageFormat aFormat);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   222
	static void PixmapBlit(TUint8* aDest, const TUint8* aSource, TInt aDestStride, TInt aSourceStride, TInt aRowCount,
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   223
			size_t aRowLength, TInt aLastBits=0);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   224
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   225
	virtual VGint GetParameterVectorSize(MVgContext& aVgContext, VGint aParamType);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   226
	virtual VGfloat GetParameterf(MVgContext& aVgContext, VGint aParamType);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   227
	virtual VGint GetParameteri(MVgContext& aVgContext, VGint aParamType);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   228
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   229
	void ClearImage(MVgContext& aVgContext, VGint aX, VGint aY, VGint aWidth, VGint aHeight);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   230
	void ImageSubData(MVgContext& aVgContext, const void * aData, VGint aDataStride, VGImageFormat aDataFormat, VGint aX, VGint aY,
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   231
			VGint aWidth, VGint aHeight);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   232
	void GetImageSubData(MVgContext& aVgContext, void * aData, VGint aDataStride, VGImageFormat aDataFormat, VGint aX, VGint aY,
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   233
			VGint aWidth, VGint aHeight);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   234
	void CopyImage(MVgContext& aVgContext, VGint aDx, VGint aDy, CVgImageInfo& aSrcImageInfo, VGint aSx, VGint aSy, VGint aWidth,
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   235
			VGint aHeight, VGboolean aDither);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   236
	void DrawImage(MVgContext& aVgContext);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   237
	void SetPixels(MVgContext& aVgContext, VGint aDx, VGint aDy, VGint aSx, VGint aSy, VGint aWidth, VGint aHeight);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   238
	void GetPixels(MVgContext& aVgContext, VGint aDx, VGint aDy, VGint aSx, VGint aSy, VGint aWidth, VGint aHeight);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   239
	void ColorMatrix(MVgContext& aVgContext, CVgImageInfo& aSrcImageInfo, const VGfloat * aMatrix);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   240
	void Convolve(MVgContext& aVgContext, CVgImageInfo& aSrcImageInfo, VGint aKernelWidth, VGint aKernelHeight,
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   241
			VGint aShiftX, VGint aShiftY, const VGshort * aKernel, VGfloat aScale, VGfloat aBias, VGTilingMode aTilingMode);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   242
	void SeparableConvolve(MVgContext& aVgContext, CVgImageInfo& aSrcImageInfo, VGint aKernelWidth, VGint aKernelHeight,
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   243
			VGint aShiftX, VGint aShiftY, const VGshort * aKernelX, const VGshort * aKernelY, 
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   244
			VGfloat aScale, VGfloat aBias, VGTilingMode aTilingMode);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   245
	void GaussianBlur(MVgContext& aVgContext, CVgImageInfo& aSrcImageInfo, VGfloat aStdDeviationX, VGfloat aStdDeviationY, VGTilingMode aTilingMode);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   246
	void Lookup(MVgContext& aVgContext, CVgImageInfo& aSrcImageInfo, const VGubyte * aRedLUT, const VGubyte * aGreenLUT, const VGubyte * aBlueLUT,
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   247
			const VGubyte * aAlphaLUT, VGboolean aOutputLinear, VGboolean aOutputPremultiplied);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   248
	void LookupSingle(MVgContext& aVgContext, CVgImageInfo& aSrcImageInfo, const VGuint * aLookupTable, VGImageChannel aSourceChannel,
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   249
			VGboolean aOutputLinear, VGboolean aOutputPremultiplied);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   250
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   251
private:
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   252
	inline CVgImageInfo(VGImageFormat aFormat, VGint aWidth, VGint aHeight, CVgImageInfo* aParent, VGbitfield aAllowedQuality,
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   253
			EGLImageKHR aEglImage, TUint64 aSgImageId);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   254
	inline ~CVgImageInfo();
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   255
	inline void IncChildCount();
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   256
	inline void DecChildCount();
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   257
	void HostVgGetImageSubData(MVgContext& aVgContext, void* aPixmap, size_t aPixmapSize, VGint aHostDataStride,
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   258
			VGImageFormat aDataFormat, VGint aX, VGint aY, VGint aWidth, VGint aHeight);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   259
	void HostVgImageSubData(MVgContext& aVgContext, const void* aPixmap, size_t aPixmapSize, VGint aHostDataStride,
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   260
			VGImageFormat aDataFormat, VGint aX, VGint aY, VGint aWidth, VGint aHeight);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   261
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   262
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   263
	/* **** desireable: expand CVgImageInfo to include and use for validating for various appropriate:
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   264
		(TBool iIsRenderTarget; - VgImage is a surface currently being rendered, blocks some operations)
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   265
		(TUint iUsedAsPaintPattern; - non-zero stops use as a render target)
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   266
		(TUint iUsedAsGlyph; - count of how many places the VgImage is being used as a font glyph)
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   267
	   */
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   268
private:
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   269
	VGImageFormat       iFormat; // not const because this is not currently initialised at creation for EglImages
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   270
	CVgImageInfo* const iParent; // immediate parent VgImage, NULL if not a child
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   271
	VGbitfield    const iAllowedQuality;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   272
	// EglImage / SgImage info ...
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   273
	TBool         const iIsEglSibling;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   274
	EGLImageKHR   const iEglImage;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   275
	TUint64       const iSgImageId;      // Set or copied from parent for Egl Sibling - used to prompt Cmd Scheduler to sync pbuffer & vgimage
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   276
	// non-const state
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   277
	TInt          iChildCount;     // count of direct child images
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   278
	};
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   279
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   280
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   281
NONSHARABLE_CLASS(CVgFontInfo) : public CVgHandleBase
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   282
	{
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   283
public:
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   284
	static CVgFontInfo* New();
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   285
	virtual TBool DestroyObject(MVgContext& aVgContext);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   286
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   287
	virtual VGint GetParameterVectorSize(MVgContext& aVgContext, VGint aParamType);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   288
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   289
	void SetGlyphToPath(MVgContext& aVgContext, VGuint aGlyphIndex, CVgPathInfo* aPathInfo, VGboolean aIsHinted,
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   290
			const VGfloat aGlyphOrigin [2], const VGfloat aEscapement[2]);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   291
	void SetGlyphToImage(MVgContext& aVgContext, VGuint aGlyphIndex, CVgImageInfo* aImageInfo, const VGfloat aGlyphOrigin [2],
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   292
			const VGfloat aEscapement[2]);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   293
	void ClearGlyph(MVgContext& aVgContext, VGuint aGlyphIndex);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   294
	void DrawGlyph(MVgContext& aVgContext, VGuint aGlyphIndex, VGbitfield aPaintModes, VGboolean aAllowAutoHinting);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   295
	void DrawGlyphs(MVgContext& aVgContext, VGint aGlyphCount, const VGuint * aGlyphIndices, const VGfloat * aAdjustmentsX,
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   296
			const VGfloat * aAdjustmentsY, VGbitfield aPaintModes, VGboolean aAllowAutoHinting);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   297
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   298
private:
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   299
	inline CVgFontInfo();
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   300
	inline ~CVgFontInfo();
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   301
	};
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   302
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   303
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   304
NONSHARABLE_CLASS(CVgPaintInfo) : public CVgHandleBase
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   305
	{
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   306
public:
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   307
	static CVgPaintInfo* New();
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   308
	virtual TBool DestroyObject(MVgContext& aVgContext);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   309
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   310
	virtual VGint GetParameterVectorSize(MVgContext& aVgContext, VGint aParamType);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   311
	virtual VGfloat GetParameterf(MVgContext& aVgContext, VGint aParamType);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   312
	virtual VGint GetParameteri(MVgContext& aVgContext, VGint aParamType);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   313
	virtual void GetParameterfv(MVgContext& aVgContext, VGint aParamType, VGint aCount, VGfloat * aValues);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   314
	virtual void GetParameteriv(MVgContext& aVgContext, VGint aParamType, VGint aCount, VGint * aValues);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   315
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   316
	virtual void SetParameterf(MVgContext& aVgContext, VGint aParamType, VGfloat aValue);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   317
	virtual void SetParameteri(MVgContext& aVgContext, VGint aParamType, VGint aValue);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   318
	virtual void SetParameterfv(MVgContext& aVgContext, VGint aParamType, VGint aCount, const VGfloat * aValues);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   319
	virtual void SetParameteriv(MVgContext& aVgContext, VGint aParamType, VGint aCount, const VGint * aValues);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   320
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   321
	static void ResetPaint(MVgContext& aVgContext);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   322
	void SetPaint(MVgContext& aVgContext, VGbitfield aPaintModes);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   323
	void SetColor(MVgContext& aVgContext, VGuint aRgba);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   324
	VGuint GetColor(MVgContext& aVgContext);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   325
	void PaintPattern(MVgContext& aVgContext, CVgImageInfo* aPatternInfo);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   326
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   327
private:
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   328
	inline CVgPaintInfo();
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   329
	inline ~CVgPaintInfo();
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   330
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   331
private:
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   332
	// cached parameters
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   333
	VGPaintType           iPaintType;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   334
	VGColorRampSpreadMode iColorRampSpreadMode;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   335
	VGboolean             iColorRampPremultiplied;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   336
	VGTilingMode          iPatternTilingMode;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   337
	// VGfloat vector parameters are not currently cached in client
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   338
	};
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   339
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   340
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   341
NONSHARABLE_CLASS(CVgPathInfo) : public CVgHandleBase
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   342
	{
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   343
public:
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   344
	static CVgPathInfo* CVgPathInfo::New(VGPathDatatype aDatatype, VGfloat aScale, VGfloat aBias, VGbitfield aCapabilities);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   345
	virtual TBool DestroyObject(MVgContext& aVgContext);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   346
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   347
	void ClearPath(MVgContext& aVgContext, VGbitfield aCapabilities);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   348
	void RemovePathCapabilities(MVgContext& aVgContext, VGbitfield aCapabilities);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   349
	VGbitfield GetPathCapabilities(MVgContext& aVgContext);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   350
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   351
	void AppendPath(MVgContext& aVgContext, CVgPathInfo& aSrcPathInfo);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   352
	void AppendPathData(MVgContext& aVgContext, VGint aNumSegments, const VGubyte * aPathSegments, const void* aPathData);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   353
	void ModifyPathCoords(MVgContext& aVgContext, VGint aStartIndex, VGint aNumSegments, const void* aPathData);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   354
	void TransformPath(MVgContext& aVgContext, CVgPathInfo& aSrcPathInfo);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   355
	VGboolean InterpolatePath(MVgContext& aVgContext, CVgPathInfo& aStartPathInfo, CVgPathInfo& aEndPathInfo, VGfloat aAmount);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   356
	VGfloat PathLength(MVgContext& aVgContext, VGint aStartSegment, VGint aNumSegments);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   357
	void PointAlongPath(MVgContext& aVgContext, VGint aStartSegment, VGint aNumSegments, VGfloat aDistance,
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   358
			VGfloat* aX, VGfloat* aY, VGfloat* aTangentX, VGfloat* aTangentY);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   359
	void PathBounds(MVgContext& aVgContext, VGfloat* aMinX, VGfloat* aMinY, VGfloat* aWidth, VGfloat* aHeight);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   360
	void PathTransformedBounds(MVgContext& aVgContext, VGfloat* aMinX, VGfloat* aMinY, VGfloat* aWidth, VGfloat* aHeight);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   361
	void DrawPath(MVgContext& aVgContext, VGbitfield aPaintModes);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   362
	void RenderToMask(MVgContext& aVgContext, VGbitfield aPaintModes, VGMaskOperation aOperation);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   363
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   364
	inline VGPathDatatype PathDatatype() const;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   365
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   366
	TBool CheckHasPathCapabilities(MVgContext& aVgContext, VGbitfield aCapabilities);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   367
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   368
	virtual VGint GetParameterVectorSize(MVgContext& aVgContext, VGint aParamType);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   369
	virtual VGfloat GetParameterf(MVgContext& aVgContext, VGint aParamType);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   370
	virtual VGint GetParameteri(MVgContext& aVgContext, VGint aParamType);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   371
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   372
private:
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   373
	inline CVgPathInfo(VGPathDatatype aPathDatatype, VGfloat aScale, VGfloat aBias, VGbitfield aCapabilities);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   374
	inline ~CVgPathInfo();
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   375
	TBool CheckAppendPathData(MVgContext& aVgContext, VGint aNumSegments, const VGubyte* aPathSegments, const void* aPathData,
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   376
			VGint* aPathDataSize);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   377
	TBool CheckPathDataAlignment(MVgContext& aVgContext, const void* aPathData);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   378
	TBool CheckPathDataSize(MVgContext& aVgContext, const VGubyte* aPathSegments, VGint aNumSegments, VGint* aPathDataSize);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   379
	VGint HostVgeGetPathCoordsSizeInBytes(MVgContext& aVgContext, VGint aStartIndex, VGint aNumSegments);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   380
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   381
private:
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   382
	VGPathDatatype const iDatatype;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   383
	VGfloat const        iScale;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   384
	VGfloat const        iBias; 
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   385
	VGbitfield           iCapabilities;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   386
	};
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   387
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   388
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   389
// Collection of static parameter checking functions - all "Chk" functions set the appropriate last VG Error on failure 
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   390
class TCheck
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   391
	{
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   392
public:
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   393
	inline static TBool Chk16bitPtr(MVgContext& aVgContext, const void* aDataPtr);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   394
	inline static TBool Chk2x16bitPtr(MVgContext& aVgContext, const void* aDataPtr1, const void* aDataPtr2);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   395
	inline static TBool Chk32bitPtr(MVgContext& aVgContext, const void* aDataPtr);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   396
	inline static TBool Chk2x32bitPtr(MVgContext& aVgContext, const void* aDataPtr1, const void* aDataPtr2);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   397
	inline static TBool Chk4x32bitPtr(MVgContext& aVgContext, const void* aDataPtr1, const void* aDataPtr2, const void* aDataPtr3, const void* aDataPtr4);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   398
	inline static TBool Chk2xOptional32bitPtr(MVgContext& aVgContext, const void* aDataPtr1, const void* aDataPtr2);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   399
	inline static TBool ChkVGMaskOperation(MVgContext& aVgContext, VGMaskOperation aOperation);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   400
	inline static TBool ChkVGPaintMode(MVgContext& aVgContext, VGPaintMode aPaintMode);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   401
	inline static TBool ChkVGPathDataType(MVgContext& aVgContext, VGPathDatatype aDatatype);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   402
	inline static TBool ChkVGTilingMode(MVgContext& aVgContext, VGTilingMode aTilingMode);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   403
	inline static TBool ChkVgImageFormat(MVgContext& aVgContext, VGImageFormat aFormat);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   404
	inline static TBool ChkImageAlignment(MVgContext& aVgContext, VGImageFormat aImageFormat, const void* aData);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   405
	inline static TBool ChkPositiveImageSize(MVgContext& aVgContext, VGint aWidth, VGint aHeight);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   406
	inline static TBool ChkNewImageSize(MVgContext& aVgContext, VGint aWidth, VGint aHeight);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   407
	inline static TBool ChkVGPaintModesCombination(MVgContext& aVgContext, VGbitfield aPaintModes);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   408
	inline static TBool ChkVGPathFormat(MVgContext& aVgContext, VGint aPathFormat);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   409
	static TBool ChkAreaIsWithinImage(MVgContext& aVgContext, CVgImageBase* aImageInfo, VGint aX, VGint aY, VGint aWidth, VGint aHeight);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   410
	static TBool ChkParamCountAndValuesPtr(MVgContext& aVgContext, VGint aCount, const void* aValues);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   411
	static VGint ImageFormatByteDepth(VGImageFormat aImageFormat);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   412
	};
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   413
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   414
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   415
/*
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   416
 Class holds mutex for Open VG client side state on construction, & releases it on destruction.
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   417
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   418
 Placing methods here ensures the procedural requirement that the Mutex is held before these methods are called.
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   419
 */ 
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   420
class TCleanupVgLocks
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   421
	{
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   422
public:
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   423
	// having functions here forces the caller to hold the Open VG Mutex before they are called (when the lock object is constructed)
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   424
	TCleanupVgLocks(MVgContext& aVgContext);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   425
	~TCleanupVgLocks();
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   426
	void WaitForMutex(RMutex& aMutex);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   427
	void SignalMutex();
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   428
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   429
	inline TBool CheckVGFont(VGFont aFont, CVgFontInfo** aFontInfo);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   430
	inline TBool CheckVGImage(VGImage aImage, CVgImageInfo** aImageInfo);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   431
	inline TBool CheckOptionalVGImage(VGImage aImage, CVgImageInfo** aImageInfo);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   432
	inline TBool Check2VGImages(VGImage aImage1, CVgImageInfo** aImageInfo1, VGImage aImage2, CVgImageInfo** aImageInfo2);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   433
	inline TBool CheckVGMaskLayer(VGMaskLayer aMaskLayer, CVgMaskLayerInfo** aHandleInfo);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   434
	inline TBool CheckVGPaint(VGPaint aPaint, CVgPaintInfo** aPaintInfo);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   435
	inline TBool CheckOptionalVGPaint(VGPaint aPaint, CVgPaintInfo** aPaintInfo);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   436
	// ToDo maybe add a version that checks Start Segment & Segment Count
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   437
	inline TBool CheckVGPath(VGPath aPath, CVgPathInfo** aPathInfo, VGbitfield aReqdCapabilities=0);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   438
	inline TBool CheckOptionalVGPath(VGPath aPath, CVgPathInfo** aPathInfo);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   439
	inline TBool CheckVGAnyHandle(VGHandle aHandle, CVgHandleBase** aHandleInfo);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   440
	TBool CheckVGMaskOperationAndHandle(VGMaskOperation aOperation, VGHandle aMask, CVgImageBase** aImageInfo);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   441
	inline TBool CheckKernelWidthAndHeight(VGint aKernelWidth, VGint aKernelHeight, VGParamType aLimitType);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   442
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   443
	VGFont CreateFont(VGint aGlyphCapacityHint);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   444
	VGImage ChildImage(CVgImageInfo& aParentInfo, VGint aX, VGint aY, VGint aWidth, VGint aHeight);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   445
	VGImage CreateImage(VGImageFormat aFormat, VGint aWidth, VGint aHeight, VGbitfield aAllowedQuality);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   446
	VGMaskLayer CreateMaskLayer(VGint aWidth, VGint aHeight);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   447
	VGPaint CreatePaint();
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   448
	VGPaint GetPaint(VGPaintMode aPaintMode);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   449
	VGPath CreatePath(VGint aPathFormat, VGPathDatatype aDatatype, VGfloat aScale, VGfloat aBias,
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   450
			VGint aSegmentCapacityHint, VGint aCoordCapacityHint, VGbitfield aCapabilities);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   451
	VGImage CreateEGLImageTargetKHR(VGeglImageKHR aImage);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   452
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   453
private:
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   454
	MVgContext& const iVgContext;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   455
	RMutex&           iMutex;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   456
	TBool             iIsHeld;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   457
	};
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   458
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   459
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   460
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   461
// per VG client state
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   462
NONSHARABLE_CLASS(XOpenVgState) : public MEglManagementApi, public MVgApiForEgl
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   463
	{
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   464
	friend class TCleanupVgLocks;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   465
public:
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   466
	XOpenVgState();
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   467
	~XOpenVgState();
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   468
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   469
	// functions using/maintaining Open Vg Handle Map
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   470
	TBool AddToHashMap(MVgContext& aVgContext, CVgHandleBase* aHandleInfo, VGHandle aHostHandle);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   471
	void UnMapHandle(TUint32 aClientHandle);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   472
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   473
	// MEglManagementApi - redirects via CVghwUtils to the EGL implementation
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   474
	virtual TBool EglImageOpenForVgImage(EGLImageKHR aImage, TSize& aSize, VGHandle& aVgHandle, TUint64& aSgImageId);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   475
	virtual void EglImageClose(EGLImageKHR aImage);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   476
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   477
	// MVgApiForEgl - exported via CvghwUtils to the Guest EGL implementation
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   478
	virtual ExtensionProcPointer guestGetVgProcAddress (const char *aProcName);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   479
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   480
protected: // fns only visible to TVgLockHolder class
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   481
	inline RMutex& MutexWait();
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   482
	TBool CheckVGHandle(MVgContext& aVgContext, VGHandle aHandle, CVgHandleBase** aHandleInfo, TVgHandleType aMatchType);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   483
	// functions using cached values from Host Open VG implementation
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   484
	TBool CheckKernelWidthAndHeight(MVgContext& aVgContext, VGint aKernelWidth, VGint aKernelHeight, VGParamType aLimitType);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   485
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   486
private:
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   487
	RMutex                          iStateLock;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   488
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   489
	// Map holds info about VG Handle based objects
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   490
	RMutex                          iMapLock;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   491
	RHashMap<TUint, CVgHandleBase*> iHandleHashMap;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   492
	MEglManagementApi*              iEglManagementApi;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   493
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   494
	// 'constants' initialised from x86 VG implementation the first time they are required
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   495
	VGint iKVgMaxKernelSize;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   496
	VGint iKVgMaxSeparableKernelSize;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   497
	// ToDo: more values to cache: VG_MAX_IMAGE_WIDTH, VG_MAX_IMAGE_HEIGHT, VG_MAX_IMAGE_PIXELS
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   498
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   499
	// ToDo Record when VG fonts use glyphs based on SgImages, required for Ref counting
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   500
	};
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   501
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   502
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   503
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   504
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   505
// class of static methods to implement Open VG APIs
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   506
class TGuestOpenVg
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   507
	{
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   508
public:
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   509
	// VG APIs
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   510
	static VGPaint vgGetPaint(VGPaintMode aPaintMode);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   511
	static VGPaint vgCreatePaint();
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   512
	static VGboolean vgInterpolatePath(VGPath aDstPath, VGPath aStartPath, VGPath aEndPath, VGfloat aAmount);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   513
	static VGfloat vgPathLength(VGPath aPath, VGint aStartSegment, VGint aNumSegments);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   514
	static VGbitfield vgGetPathCapabilities(VGPath aPath);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   515
	static VGPath vgCreatePath(VGint aPathFormat, VGPathDatatype aDatatype, VGfloat aScale, VGfloat aBias,
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   516
		VGint aSegmentCapacityHint, VGint aCoordCapacityHint, VGbitfield aCapabilities);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   517
	static VGfloat vgGetf(VGParamType aType);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   518
	static VGint vgGeti(VGParamType aType);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   519
	static VGfloat vgGetParameterf(VGHandle aObject,  VGint aParamType);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   520
	static VGint vgGetParameteri(VGHandle aObject,  VGint aParamType);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   521
	static VGint vgGetParameterVectorSize(VGHandle aObject, VGint aParamType);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   522
	static VGMaskLayer vgCreateMaskLayer(VGint aWidth, VGint aHeight);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   523
	static VGuint vgGetColor(VGPaint aPaint);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   524
	static VGImage vgCreateImage(VGImageFormat aFormat, VGint aWidth, VGint aHeight, VGbitfield aAllowedQuality);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   525
	static VGImage vgChildImage(VGImage aParent, VGint aX, VGint aY, VGint aWidth, VGint aHeight);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   526
	static VGImage vgGetParent(VGImage aImage);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   527
	static VGImage vgCreateEGLImageTargetKHR(VGeglImageKHR aImage);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   528
	static VGFont vgCreateFont(VGint aGlyphCapacityHint);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   529
	static VGHardwareQueryResult vgHardwareQuery(VGHardwareQueryType key, VGint setting);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   530
	static void vgGetParameterfv(VGHandle aObject, VGint aParamType, VGint aCount, VGfloat * aValues);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   531
	static void vgGetParameteriv(VGHandle aObject, VGint aParamType, VGint aCount, VGint * aValues);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   532
	static VGint vgGetVectorSize(VGParamType type);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   533
	static void vgGetfv(VGParamType aType, VGint aCount, const VGfloat * aValues);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   534
	static void vgGetiv(VGParamType aType, VGint aCount, const VGint * aValues);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   535
	static void vgGetMatrix(VGfloat* aM);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   536
	static void vgGetImageSubData(VGImage aImage, void* aData, VGint aDataStride, VGImageFormat aDataFormat,
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   537
		VGint aX, VGint aY, VGint aWidth, VGint aHeight);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   538
	static void vgReadPixels(void* aData, VGint aDataStride, VGImageFormat aDataFormat, VGint aSx, VGint aSy,
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   539
		VGint aWidth, VGint aHeight);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   540
	static void vgPathBounds(VGPath aPath, VGfloat* aMinX, VGfloat* aMinY, VGfloat* aWidth, VGfloat* aHeight);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   541
	static void vgPathTransformedBounds(VGPath aPath, VGfloat* aMinX, VGfloat* aMinY, VGfloat* aWidth, VGfloat* aHeight);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   542
	static void vgSetf(VGParamType aType, VGfloat aValue);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   543
	static void vgSeti(VGParamType aType, VGint aVvalue);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   544
	static void vgSetfv(VGParamType aType, VGint aCount, const VGfloat * aValues);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   545
	static void vgSetiv(VGParamType aType, VGint aCount, const VGint * aValues);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   546
	static void vgSetParameterf(VGHandle aObject, VGint aParamType, VGfloat aValue);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   547
	static void vgSetParameteri(VGHandle aObject, VGint aParamType, VGint aValue);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   548
	static void vgSetParameterfv(VGHandle aObject, VGint aParamType, VGint aCount, const VGfloat * aValues);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   549
	static void vgSetParameteriv(VGHandle aObject, VGint aParamType, VGint aCount, const VGint * aValues);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   550
	static void vgLoadIdentity();
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   551
	static void vgLoadMatrix(const VGfloat* aM);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   552
	static void vgMultMatrix(const VGfloat* aM);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   553
	static void vgTranslate(VGfloat aTx, VGfloat aTy);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   554
	static void vgScale(VGfloat aSx, VGfloat aSy);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   555
	static void vgShear(VGfloat aShx, VGfloat aShy);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   556
	static void vgRotate(VGfloat aAngle);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   557
	static void vgMask(VGHandle aMask, VGMaskOperation aOperation, VGint aX, VGint aY, VGint aWidth, VGint aHeight);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   558
	static void vgRenderToMask(VGPath aPath, VGbitfield aPaintModes, VGMaskOperation aOperation);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   559
	static void vgDestroyMaskLayer(VGMaskLayer maskLayer);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   560
	static void vgFillMaskLayer(VGMaskLayer aMaskLayer, VGint aX, VGint aY, VGint aWidth, VGint aHeight, VGfloat aValue);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   561
	static void vgCopyMask(VGMaskLayer aMaskLayer, VGint aSx, VGint aSy, VGint aDx, VGint aDy, VGint aWidth, VGint aHeight);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   562
	static void vgClear(VGint aX, VGint aY, VGint aWidth, VGint aHeight);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   563
	static void vgClearPath(VGPath aPath, VGbitfield aCapabilities);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   564
	static void vgDestroyPath(VGPath aPath);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   565
	static void vgRemovePathCapabilities(VGPath aPath, VGbitfield aCapabilities);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   566
	static void vgAppendPath(VGPath aDstPath, VGPath aSrcPath);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   567
	static void vgAppendPathData(VGPath aDstPath, VGint aNumSegments, const VGubyte* aPathSegments, const void* aPathData);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   568
	static void vgModifyPathCoords(VGPath aDstPath, VGint aStartIndex, VGint aNumSegments, const void* aPathData);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   569
	static void vgTransformPath(VGPath aDstPath, VGPath aSrcPath);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   570
	static void vgPointAlongPath(VGPath aPath, VGint aStartSegment, VGint aNumSegments, VGfloat aDistance,
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   571
		VGfloat* aX, VGfloat* aY, VGfloat* aTangentX, VGfloat* aTangentY);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   572
	static void vgDrawPath(VGPath aPath, VGbitfield aPaintModes);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   573
	static void vgDestroyPaint(VGPaint aPaint);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   574
	static void vgSetPaint(VGPaint aPaint, VGbitfield aPaintModes);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   575
	static void vgSetColor(VGPaint aPaint, VGuint aRgba);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   576
	static void vgPaintPattern(VGPaint aPaint, VGImage aPattern);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   577
	static void vgDestroyImage(VGImage aImage);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   578
	static void vgClearImage(VGImage aImage, VGint aX, VGint aY, VGint aWidth, VGint aHeight);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   579
	static void vgImageSubData(VGImage aImage, const void* aData, VGint aDataStride, VGImageFormat aDataFormat,
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   580
		VGint aX, VGint aY, VGint aWidth, VGint aHeight);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   581
	static void vgCopyImage(VGImage aDst, VGint aDx, VGint aDy, VGImage aSrc, VGint aSx, VGint aSy, VGint aWidth, VGint aHeight,
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   582
		VGboolean aDither);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   583
	static void vgDrawImage(VGImage aImage);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   584
	static void vgSetPixels(VGint aDx, VGint aDy, VGImage aSrc, VGint aSx, VGint aSy, VGint aWidth, VGint aHeight);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   585
	static void vgWritePixels(const void* data, VGint aDataStride, VGImageFormat aDataFormat, VGint aDx, VGint aDy,
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   586
		VGint aWidth, VGint aHeight);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   587
	static void vgGetPixels(VGImage aDst, VGint aDx, VGint aDy, VGint aSx, VGint aSy, VGint aWidth, VGint aHeight);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   588
	static void vgCopyPixels(VGint aDx, VGint aDy, VGint aSx, VGint aSy, VGint aWidth, VGint aHeight);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   589
	static void vgDestroyFont(VGFont aFont);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   590
	static void  vgSetGlyphToPath(VGFont aFont, VGuint aGlyphIndex, VGPath aPath, VGboolean aIsHinted, const VGfloat aGlyphOrigin [2],
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   591
		const VGfloat aEscapement[2]);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   592
	static void  vgSetGlyphToImage(VGFont aFont, VGuint aGlyphIndex, VGImage aImage, const VGfloat aGlyphOrigin [2],
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   593
		const VGfloat aEscapement[2]);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   594
	static void vgClearGlyph(VGFont aFont, VGuint aGlyphIndex);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   595
	static void vgDrawGlyph(VGFont aFont, VGuint aGlyphIndex, VGbitfield aPaintModes, VGboolean aAllowAutoHinting);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   596
	static void vgDrawGlyphs(VGFont aFont, VGint aGlyphCount, const VGuint* aGlyphIndices, const VGfloat* aAdjustmentsX,
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   597
		const VGfloat* aAdjustmentsY, VGbitfield aPaintModes, VGboolean aAllowAutoHinting);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   598
	static void vgColorMatrix(VGImage aDst, VGImage aSrc, const VGfloat* aMatrix);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   599
	static void vgConvolve(VGImage aDst, VGImage aSrc, VGint aKernelWidth, VGint aKernelHeight, VGint aShiftX, VGint aShiftY,
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   600
		const VGshort* aKernel, VGfloat aScale, VGfloat aBias, VGTilingMode aTilingMode);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   601
	static void vgSeparableConvolve(VGImage aDst, VGImage aSrc, VGint aKernelWidth, VGint aKernelHeight, VGint aShiftX, VGint aShiftY,
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   602
		const VGshort* aKernelX, const VGshort* aKernelY, VGfloat aScale, VGfloat aBias, VGTilingMode aTilingMode);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   603
	static void vgGaussianBlur(VGImage aDst, VGImage aSrc, VGfloat aStdDeviationX, VGfloat aStdDeviationY, VGTilingMode aTilingMode);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   604
	static void vgLookup(VGImage aDst, VGImage aSrc, const VGubyte* aRedLUT, const VGubyte* aGreenLUT, const VGubyte* aBlueLUT,
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   605
		const VGubyte* aAlphaLUT, VGboolean aOutputLinear, VGboolean aOutputPremultiplied);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   606
	static void vgLookupSingle(VGImage aDst, VGImage aSrc, const VGuint* aLookupTable, VGImageChannel aSourceChannel,
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   607
		VGboolean aOutputLinear, VGboolean aOutputPremultiplied);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   608
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   609
private:
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   610
	// fns that directly talk to Host Open VG (no parameter checking)
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   611
	static void HostVgReadPixels(MVgContext& aVgContext, void* aPixmap, size_t aPixmapSize, VGint aHostDataStride,
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   612
			VGImageFormat aDataFormat, VGint aSx, VGint aSy, VGint aWidth, VGint aHeight);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   613
	static void HostVgWritePixels(MVgContext& aVgContext, const void* aPixmap, size_t aPixmapSize, VGint aHostDataStride,
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   614
			VGImageFormat aDataFormat, VGint aDx, VGint aDy, VGint aWidth, VGint aHeight);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   615
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   616
	static VGint HostGetVectorSize(MVgContext& aVgContext, VGParamType aType);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   617
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   618
public: // ToDo find a more elegant way of calling this from XOpenVgState
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   619
	static VGint HostGeti(MVgContext& aVgContext, VGParamType type);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   620
private:
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   621
	static inline VGfloat HostGetf(MVgContext& aVgContext, VGParamType type);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   622
	};
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   623
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   624
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   625
// C api extensions
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   626
#ifdef __cplusplus
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   627
extern "C" {
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   628
#endif
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   629
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   630
VGImage vgCreateEGLImageTargetKHR(VGeglImageKHR image);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   631
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   632
#ifdef __cplusplus
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   633
}
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   634
#endif
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   635
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   636
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   637
#include "openvg.inl"
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   638
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   639
#endif // VGSTATE_H