guestrendering/guestopenvg/inc/vgstate.h
author Faisal Memon <faisal.memon@nokia.com>
Fri, 22 Oct 2010 10:16:29 +0100
branchbug235_bringup_0
changeset 59 d9b81aebba7b
parent 24 a3f46bb01be2
permissions -rwxr-xr-x
Add mapping fix to guestegl and debugging (temporary)
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
59
d9b81aebba7b Add mapping fix to guestegl and debugging (temporary)
Faisal Memon <faisal.memon@nokia.com>
parents: 24
diff changeset
    24
#define _DEBUG // FAISALMEMON temporary
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
59
d9b81aebba7b Add mapping fix to guestegl and debugging (temporary)
Faisal Memon <faisal.memon@nokia.com>
parents: 24
diff changeset
    27
24
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
    28
#include <e32debug.h>
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
    29
#ifdef _DEBUG
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
    30
	#define OPENVG_TRACE(fmt, args...) RDebug::Printf(fmt, ##args)
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
    31
	#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
    32
	#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
    33
	#define VGPANIC_ALWAYS(panic) { VgPanic(panic, #panic, NULL, __FILE__, __LINE__); }
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
    34
#else
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
    35
	#define OPENVG_TRACE(fmt, args...)
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
    36
	#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
    37
	#define VGPANIC_ASSERT_DEBUG(condition, panic)
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
    38
	#define VGPANIC_ALWAYS(panic) { VgPanic(panic, NULL, NULL, NULL, __LINE__); }
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
    39
#endif
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
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
    42
// Guest Open VG panic codes
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
    43
typedef enum
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
    44
	{
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
    45
	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
    46
	EVgPanicNullPixmapPointer,
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
    47
	EVgPanicPixmapSizeError,
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
    48
	EVgPanicSingletonAlreadyInitialised,
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
    49
	EVgPanicSingletonNotInitialised,
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
    50
	EVgPanicNullPointer,
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
    51
	EVgPanicBadLastBitsParam,
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
    52
	EVgPanicBadRowLengthParam,
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
    53
	EVgPanicBadRowCountParam,
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
    54
	EVgPanicStrideSmallerThanRowLength, // 10
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
    55
	EVgPanicNotReplyOpcode,
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
    56
	EVgPanicDeleteInUseVgImageInfo,
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
    57
	EVgPanicUidGeneratorZeroSeed,
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
    58
	EVgPanicMissingEglInterface,
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
    59
	EVgPanicNullCVgHandlePointer,
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
    60
	EVgPanicWrongVgHandleType,
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
    61
	EVgPanicHandleAlreadyMarkedDestroyed,
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
    62
	EVgPanicUnknownVgHandleType,
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
    63
	EVgPanicHostHandleIsInvalid,
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
    64
	EVgPanicImageParentIsInvalid, // 20
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
    65
	EVgPanicFunctionParameterIsNull,
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
    66
	EVgPanicValueFromHostVgIsInvalid,
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
    67
	EVgPanicHostHandleAlreadySet,
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
    68
	EVgPanicParentImageAlreadyDestroyed,
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
    69
	EVgPanicStateLockMutexNotHeld,
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
    70
	} TVgPanic;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
    71
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
    72
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
    73
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
    74
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
    75
// state singleton, in Writeable Static Data memory
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
    76
class XOpenVgState;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
    77
extern XOpenVgState OpenVgState;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
    78
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
    79
// classes declared in this header
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
    80
class CVgHandleBase;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
    81
class CVgImageBase;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
    82
class CVgMaskLayerInfo;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
    83
class CVgFontInfo;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
    84
class CVgImageInfo;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
    85
class CVgPaintInfo;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
    86
class CVgPathInfo;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
    87
class THandleGen;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
    88
class TVgLockHolder;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
    89
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
    90
extern const float KFloatMinusOne;
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
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
    93
class THandleGen
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
    94
	{
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
    95
public:
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
    96
	inline void Init(TUint aInit);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
    97
	TUint NextUid();
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
    98
private:
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
    99
	TUint iValue;
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
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   102
typedef enum
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   103
	{
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   104
	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
   105
	EVgHandleForFont = 0, // specific types ...
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   106
	EVgHandleForImage,
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   107
	EVgHandleForPaint,
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   108
	EVgHandleForPath,
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   109
	EVgHandleForMaskLayer,
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   110
	} TVgHandleType;
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
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   113
// 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
   114
// 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
   115
NONSHARABLE_CLASS(CVgHandleBase) : public CBase // Base Class
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   116
	{
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   117
public:
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   118
	static void InitStatics();
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   119
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   120
	// public inline methods 
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   121
	inline VGHandle HostHandle() const;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   122
	inline TVgHandleType HandleType() const;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   123
	inline TBool IsDestroyed() const;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   124
	inline void SetHostHandle(VGHandle aHostHandle);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   125
	inline TUint ClientHandle() const;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   126
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   127
	// general & specific portions of derived object destruction
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   128
	void Destroy(MVgContext& aVgContext);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   129
	virtual TBool DestroyObject(MVgContext& aVgContext) = 0;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   130
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   131
	// Each VGHandle object type must implement GetParameterVectorSize
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   132
	virtual VGint GetParameterVectorSize(MVgContext& aVgContext, VGint aParamType) = 0;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   133
	// 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
   134
	virtual VGfloat GetParameterf(MVgContext& aVgContext, VGint aParamType);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   135
	virtual VGint GetParameteri(MVgContext& aVgContext, VGint aParamType);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   136
	// 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
   137
	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
   138
	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
   139
	// 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
   140
	virtual void SetParameterf(MVgContext& aVgContext, VGint aParamType, VGfloat aValue);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   141
	virtual void SetParameteri(MVgContext& aVgContext, VGint aParamType, VGint aValue);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   142
	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
   143
	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
   144
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   145
protected:
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   146
	inline CVgHandleBase(TVgHandleType aHandleType);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   147
	inline ~CVgHandleBase();
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   148
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   149
	VGint HostVgGetParameterVectorSize(MVgContext& aVgContext, VGint aParamType);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   150
	VGint HostVgGetParameteri(MVgContext& aVgContext, VGint aParamType);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   151
	VGfloat HostVgGetParameterf(MVgContext& aVgContext, VGint aParamType);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   152
	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
   153
	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
   154
	void HostVgSetParameterf(MVgContext& aVgContext, VGint aParamType, VGfloat aValue);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   155
	void HostVgSetParameteri(MVgContext& aVgContext, VGint aParamType, VGint aValue);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   156
	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
   157
	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
   158
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   159
protected:
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   160
	TUint iClientHandle;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   161
	TVgHandleType iHandleType;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   162
	VGHandle iHostHandle;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   163
	TBool iIsDestroyed;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   164
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   165
private:
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   166
	static THandleGen iHandleGen; // generator for unique client side handles
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
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   170
NONSHARABLE_CLASS(CVgImageBase) : public CVgHandleBase
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   171
	{
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   172
public:
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   173
	inline VGint Width() const;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   174
	inline VGint Height() const;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   175
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   176
	TBool DestroyObject(MVgContext& aVgContext) = 0;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   177
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   178
	virtual VGint GetParameterVectorSize(MVgContext& aVgContext, VGint aParamType) = 0;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   179
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   180
protected:
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   181
	inline CVgImageBase(TVgHandleType aHandleType, VGint aWidth, VGint aHeight);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   182
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   183
protected:
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   184
	VGint const   iWidth;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   185
	VGint const   iHeight;
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
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   189
NONSHARABLE_CLASS(CVgMaskLayerInfo) : public CVgImageBase
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   190
	{
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   191
public:
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   192
	static CVgMaskLayerInfo* New(VGint aWidth, VGint aHeight);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   193
	virtual TBool DestroyObject(MVgContext& aVgContext);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   194
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   195
	virtual VGint GetParameterVectorSize(MVgContext& aVgContext, VGint aParamType);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   196
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   197
	// Mask specific operations
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   198
	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
   199
	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
   200
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   201
private:
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   202
	inline CVgMaskLayerInfo(VGint aWidth, VGint aHeight);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   203
	inline ~CVgMaskLayerInfo();
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
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   207
NONSHARABLE_CLASS(CVgImageInfo) : public CVgImageBase
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   208
	{
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   209
public:
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   210
	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
   211
	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
   212
	static CVgImageInfo* New(VGint aWidth, VGint aHeight, CVgImageInfo* aParent);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   213
	virtual TBool DestroyObject(MVgContext& aVgContext);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   214
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   215
	TInt ChildCount() const;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   216
	CVgImageInfo* Parent() const;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   217
	VGbitfield AllowedQuality() const;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   218
	TBool IsEglSibling() const;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   219
	TUint64 SgImageId() const;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   220
	EGLImageKHR EglImage() const;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   221
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   222
	static TInt BitsPerPixelForVgImageFormat(VGImageFormat aFormat);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   223
	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
   224
			size_t aRowLength, TInt aLastBits=0);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   225
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   226
	virtual VGint GetParameterVectorSize(MVgContext& aVgContext, VGint aParamType);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   227
	virtual VGfloat GetParameterf(MVgContext& aVgContext, VGint aParamType);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   228
	virtual VGint GetParameteri(MVgContext& aVgContext, VGint aParamType);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   229
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   230
	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
   231
	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
   232
			VGint aWidth, VGint aHeight);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   233
	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
   234
			VGint aWidth, VGint aHeight);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   235
	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
   236
			VGint aHeight, VGboolean aDither);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   237
	void DrawImage(MVgContext& aVgContext);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   238
	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
   239
	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
   240
	void ColorMatrix(MVgContext& aVgContext, CVgImageInfo& aSrcImageInfo, const VGfloat * aMatrix);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   241
	void Convolve(MVgContext& aVgContext, CVgImageInfo& aSrcImageInfo, VGint aKernelWidth, VGint aKernelHeight,
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   242
			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
   243
	void SeparableConvolve(MVgContext& aVgContext, CVgImageInfo& aSrcImageInfo, VGint aKernelWidth, VGint aKernelHeight,
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   244
			VGint aShiftX, VGint aShiftY, const VGshort * aKernelX, const VGshort * aKernelY, 
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   245
			VGfloat aScale, VGfloat aBias, VGTilingMode aTilingMode);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   246
	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
   247
	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
   248
			const VGubyte * aAlphaLUT, VGboolean aOutputLinear, VGboolean aOutputPremultiplied);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   249
	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
   250
			VGboolean aOutputLinear, VGboolean aOutputPremultiplied);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   251
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   252
private:
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   253
	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
   254
			EGLImageKHR aEglImage, TUint64 aSgImageId);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   255
	inline ~CVgImageInfo();
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   256
	inline void IncChildCount();
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   257
	inline void DecChildCount();
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   258
	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
   259
			VGImageFormat aDataFormat, VGint aX, VGint aY, VGint aWidth, VGint aHeight);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   260
	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
   261
			VGImageFormat aDataFormat, VGint aX, VGint aY, VGint aWidth, VGint aHeight);
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
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   264
	/* **** 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
   265
		(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
   266
		(TUint iUsedAsPaintPattern; - non-zero stops use as a render target)
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   267
		(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
   268
	   */
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   269
private:
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   270
	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
   271
	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
   272
	VGbitfield    const iAllowedQuality;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   273
	// EglImage / SgImage info ...
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   274
	TBool         const iIsEglSibling;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   275
	EGLImageKHR   const iEglImage;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   276
	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
   277
	// non-const state
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   278
	TInt          iChildCount;     // count of direct child images
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
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   282
NONSHARABLE_CLASS(CVgFontInfo) : public CVgHandleBase
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   283
	{
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   284
public:
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   285
	static CVgFontInfo* New();
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   286
	virtual TBool DestroyObject(MVgContext& aVgContext);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   287
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   288
	virtual VGint GetParameterVectorSize(MVgContext& aVgContext, VGint aParamType);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   289
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   290
	void SetGlyphToPath(MVgContext& aVgContext, VGuint aGlyphIndex, CVgPathInfo* aPathInfo, VGboolean aIsHinted,
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   291
			const VGfloat aGlyphOrigin [2], const VGfloat aEscapement[2]);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   292
	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
   293
			const VGfloat aEscapement[2]);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   294
	void ClearGlyph(MVgContext& aVgContext, VGuint aGlyphIndex);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   295
	void DrawGlyph(MVgContext& aVgContext, VGuint aGlyphIndex, VGbitfield aPaintModes, VGboolean aAllowAutoHinting);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   296
	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
   297
			const VGfloat * aAdjustmentsY, VGbitfield aPaintModes, VGboolean aAllowAutoHinting);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   298
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   299
private:
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
	inline ~CVgFontInfo();
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
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   305
NONSHARABLE_CLASS(CVgPaintInfo) : public CVgHandleBase
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   306
	{
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   307
public:
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   308
	static CVgPaintInfo* New();
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   309
	virtual TBool DestroyObject(MVgContext& aVgContext);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   310
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   311
	virtual VGint GetParameterVectorSize(MVgContext& aVgContext, VGint aParamType);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   312
	virtual VGfloat GetParameterf(MVgContext& aVgContext, VGint aParamType);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   313
	virtual VGint GetParameteri(MVgContext& aVgContext, VGint aParamType);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   314
	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
   315
	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
   316
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   317
	virtual void SetParameterf(MVgContext& aVgContext, VGint aParamType, VGfloat aValue);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   318
	virtual void SetParameteri(MVgContext& aVgContext, VGint aParamType, VGint aValue);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   319
	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
   320
	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
   321
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   322
	static void ResetPaint(MVgContext& aVgContext);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   323
	void SetPaint(MVgContext& aVgContext, VGbitfield aPaintModes);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   324
	void SetColor(MVgContext& aVgContext, VGuint aRgba);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   325
	VGuint GetColor(MVgContext& aVgContext);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   326
	void PaintPattern(MVgContext& aVgContext, CVgImageInfo* aPatternInfo);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   327
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   328
private:
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
	inline ~CVgPaintInfo();
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   331
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   332
private:
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   333
	// cached parameters
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   334
	VGPaintType           iPaintType;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   335
	VGColorRampSpreadMode iColorRampSpreadMode;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   336
	VGboolean             iColorRampPremultiplied;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   337
	VGTilingMode          iPatternTilingMode;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   338
	// VGfloat vector parameters are not currently cached in client
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
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   342
NONSHARABLE_CLASS(CVgPathInfo) : public CVgHandleBase
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   343
	{
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   344
public:
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   345
	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
   346
	virtual TBool DestroyObject(MVgContext& aVgContext);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   347
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   348
	void ClearPath(MVgContext& aVgContext, VGbitfield aCapabilities);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   349
	void RemovePathCapabilities(MVgContext& aVgContext, VGbitfield aCapabilities);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   350
	VGbitfield GetPathCapabilities(MVgContext& aVgContext);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   351
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   352
	void AppendPath(MVgContext& aVgContext, CVgPathInfo& aSrcPathInfo);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   353
	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
   354
	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
   355
	void TransformPath(MVgContext& aVgContext, CVgPathInfo& aSrcPathInfo);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   356
	VGboolean InterpolatePath(MVgContext& aVgContext, CVgPathInfo& aStartPathInfo, CVgPathInfo& aEndPathInfo, VGfloat aAmount);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   357
	VGfloat PathLength(MVgContext& aVgContext, VGint aStartSegment, VGint aNumSegments);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   358
	void PointAlongPath(MVgContext& aVgContext, VGint aStartSegment, VGint aNumSegments, VGfloat aDistance,
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   359
			VGfloat* aX, VGfloat* aY, VGfloat* aTangentX, VGfloat* aTangentY);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   360
	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
   361
	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
   362
	void DrawPath(MVgContext& aVgContext, VGbitfield aPaintModes);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   363
	void RenderToMask(MVgContext& aVgContext, VGbitfield aPaintModes, VGMaskOperation aOperation);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   364
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   365
	inline VGPathDatatype PathDatatype() const;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   366
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   367
	TBool CheckHasPathCapabilities(MVgContext& aVgContext, VGbitfield aCapabilities);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   368
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   369
	virtual VGint GetParameterVectorSize(MVgContext& aVgContext, VGint aParamType);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   370
	virtual VGfloat GetParameterf(MVgContext& aVgContext, VGint aParamType);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   371
	virtual VGint GetParameteri(MVgContext& aVgContext, VGint aParamType);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   372
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   373
private:
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   374
	inline CVgPathInfo(VGPathDatatype aPathDatatype, VGfloat aScale, VGfloat aBias, VGbitfield aCapabilities);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   375
	inline ~CVgPathInfo();
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   376
	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
   377
			VGint* aPathDataSize);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   378
	TBool CheckPathDataAlignment(MVgContext& aVgContext, const void* aPathData);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   379
	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
   380
	VGint HostVgeGetPathCoordsSizeInBytes(MVgContext& aVgContext, VGint aStartIndex, VGint aNumSegments);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   381
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   382
private:
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   383
	VGPathDatatype const iDatatype;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   384
	VGfloat const        iScale;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   385
	VGfloat const        iBias; 
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   386
	VGbitfield           iCapabilities;
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
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   390
// 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
   391
class TCheck
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   392
	{
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   393
public:
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   394
	inline static TBool Chk16bitPtr(MVgContext& aVgContext, const void* aDataPtr);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   395
	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
   396
	inline static TBool Chk32bitPtr(MVgContext& aVgContext, const void* aDataPtr);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   397
	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
   398
	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
   399
	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
   400
	inline static TBool ChkVGMaskOperation(MVgContext& aVgContext, VGMaskOperation aOperation);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   401
	inline static TBool ChkVGPaintMode(MVgContext& aVgContext, VGPaintMode aPaintMode);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   402
	inline static TBool ChkVGPathDataType(MVgContext& aVgContext, VGPathDatatype aDatatype);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   403
	inline static TBool ChkVGTilingMode(MVgContext& aVgContext, VGTilingMode aTilingMode);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   404
	inline static TBool ChkVgImageFormat(MVgContext& aVgContext, VGImageFormat aFormat);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   405
	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
   406
	inline static TBool ChkPositiveImageSize(MVgContext& aVgContext, VGint aWidth, VGint aHeight);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   407
	inline static TBool ChkNewImageSize(MVgContext& aVgContext, VGint aWidth, VGint aHeight);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   408
	inline static TBool ChkVGPaintModesCombination(MVgContext& aVgContext, VGbitfield aPaintModes);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   409
	inline static TBool ChkVGPathFormat(MVgContext& aVgContext, VGint aPathFormat);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   410
	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
   411
	static TBool ChkParamCountAndValuesPtr(MVgContext& aVgContext, VGint aCount, const void* aValues);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   412
	static VGint ImageFormatByteDepth(VGImageFormat aImageFormat);
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
/*
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   417
 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
   418
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   419
 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
   420
 */ 
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   421
class TCleanupVgLocks
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   422
	{
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   423
public:
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   424
	// 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
   425
	TCleanupVgLocks(MVgContext& aVgContext);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   426
	~TCleanupVgLocks();
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   427
	void WaitForMutex(RMutex& aMutex);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   428
	void SignalMutex();
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   429
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   430
	inline TBool CheckVGFont(VGFont aFont, CVgFontInfo** aFontInfo);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   431
	inline TBool CheckVGImage(VGImage aImage, CVgImageInfo** aImageInfo);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   432
	inline TBool CheckOptionalVGImage(VGImage aImage, CVgImageInfo** aImageInfo);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   433
	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
   434
	inline TBool CheckVGMaskLayer(VGMaskLayer aMaskLayer, CVgMaskLayerInfo** aHandleInfo);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   435
	inline TBool CheckVGPaint(VGPaint aPaint, CVgPaintInfo** aPaintInfo);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   436
	inline TBool CheckOptionalVGPaint(VGPaint aPaint, CVgPaintInfo** aPaintInfo);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   437
	// 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
   438
	inline TBool CheckVGPath(VGPath aPath, CVgPathInfo** aPathInfo, VGbitfield aReqdCapabilities=0);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   439
	inline TBool CheckOptionalVGPath(VGPath aPath, CVgPathInfo** aPathInfo);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   440
	inline TBool CheckVGAnyHandle(VGHandle aHandle, CVgHandleBase** aHandleInfo);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   441
	TBool CheckVGMaskOperationAndHandle(VGMaskOperation aOperation, VGHandle aMask, CVgImageBase** aImageInfo);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   442
	inline TBool CheckKernelWidthAndHeight(VGint aKernelWidth, VGint aKernelHeight, VGParamType aLimitType);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   443
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   444
	VGFont CreateFont(VGint aGlyphCapacityHint);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   445
	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
   446
	VGImage CreateImage(VGImageFormat aFormat, VGint aWidth, VGint aHeight, VGbitfield aAllowedQuality);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   447
	VGMaskLayer CreateMaskLayer(VGint aWidth, VGint aHeight);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   448
	VGPaint CreatePaint();
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   449
	VGPaint GetPaint(VGPaintMode aPaintMode);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   450
	VGPath CreatePath(VGint aPathFormat, VGPathDatatype aDatatype, VGfloat aScale, VGfloat aBias,
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   451
			VGint aSegmentCapacityHint, VGint aCoordCapacityHint, VGbitfield aCapabilities);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   452
	VGImage CreateEGLImageTargetKHR(VGeglImageKHR aImage);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   453
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   454
private:
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   455
	MVgContext& const iVgContext;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   456
	RMutex&           iMutex;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   457
	TBool             iIsHeld;
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
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   462
// per VG client state
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   463
NONSHARABLE_CLASS(XOpenVgState) : public MEglManagementApi, public MVgApiForEgl
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   464
	{
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   465
	friend class TCleanupVgLocks;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   466
public:
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
	~XOpenVgState();
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   469
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   470
	// functions using/maintaining Open Vg Handle Map
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   471
	TBool AddToHashMap(MVgContext& aVgContext, CVgHandleBase* aHandleInfo, VGHandle aHostHandle);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   472
	void UnMapHandle(TUint32 aClientHandle);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   473
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   474
	// MEglManagementApi - redirects via CVghwUtils to the EGL implementation
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   475
	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
   476
	virtual void EglImageClose(EGLImageKHR aImage);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   477
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   478
	// MVgApiForEgl - exported via CvghwUtils to the Guest EGL implementation
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   479
	virtual ExtensionProcPointer guestGetVgProcAddress (const char *aProcName);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   480
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   481
protected: // fns only visible to TVgLockHolder class
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   482
	inline RMutex& MutexWait();
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   483
	TBool CheckVGHandle(MVgContext& aVgContext, VGHandle aHandle, CVgHandleBase** aHandleInfo, TVgHandleType aMatchType);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   484
	// functions using cached values from Host Open VG implementation
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   485
	TBool CheckKernelWidthAndHeight(MVgContext& aVgContext, VGint aKernelWidth, VGint aKernelHeight, VGParamType aLimitType);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   486
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   487
private:
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   488
	RMutex                          iStateLock;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   489
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   490
	// Map holds info about VG Handle based objects
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   491
	RMutex                          iMapLock;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   492
	RHashMap<TUint, CVgHandleBase*> iHandleHashMap;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   493
	MEglManagementApi*              iEglManagementApi;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   494
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   495
	// '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
   496
	VGint iKVgMaxKernelSize;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   497
	VGint iKVgMaxSeparableKernelSize;
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   498
	// 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
   499
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   500
	// 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
   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
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   506
// class of static methods to implement Open VG APIs
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   507
class TGuestOpenVg
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   508
	{
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   509
public:
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   510
	// VG APIs
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   511
	static VGPaint vgGetPaint(VGPaintMode aPaintMode);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   512
	static VGPaint vgCreatePaint();
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   513
	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
   514
	static VGfloat vgPathLength(VGPath aPath, VGint aStartSegment, VGint aNumSegments);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   515
	static VGbitfield vgGetPathCapabilities(VGPath aPath);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   516
	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
   517
		VGint aSegmentCapacityHint, VGint aCoordCapacityHint, VGbitfield aCapabilities);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   518
	static VGfloat vgGetf(VGParamType aType);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   519
	static VGint vgGeti(VGParamType aType);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   520
	static VGfloat vgGetParameterf(VGHandle aObject,  VGint aParamType);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   521
	static VGint vgGetParameteri(VGHandle aObject,  VGint aParamType);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   522
	static VGint vgGetParameterVectorSize(VGHandle aObject, VGint aParamType);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   523
	static VGMaskLayer vgCreateMaskLayer(VGint aWidth, VGint aHeight);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   524
	static VGuint vgGetColor(VGPaint aPaint);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   525
	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
   526
	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
   527
	static VGImage vgGetParent(VGImage aImage);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   528
	static VGImage vgCreateEGLImageTargetKHR(VGeglImageKHR aImage);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   529
	static VGFont vgCreateFont(VGint aGlyphCapacityHint);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   530
	static VGHardwareQueryResult vgHardwareQuery(VGHardwareQueryType key, VGint setting);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   531
	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
   532
	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
   533
	static VGint vgGetVectorSize(VGParamType type);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   534
	static void vgGetfv(VGParamType aType, VGint aCount, const VGfloat * aValues);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   535
	static void vgGetiv(VGParamType aType, VGint aCount, const VGint * aValues);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   536
	static void vgGetMatrix(VGfloat* aM);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   537
	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
   538
		VGint aX, VGint aY, VGint aWidth, VGint aHeight);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   539
	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
   540
		VGint aWidth, VGint aHeight);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   541
	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
   542
	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
   543
	static void vgSetf(VGParamType aType, VGfloat aValue);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   544
	static void vgSeti(VGParamType aType, VGint aVvalue);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   545
	static void vgSetfv(VGParamType aType, VGint aCount, const VGfloat * aValues);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   546
	static void vgSetiv(VGParamType aType, VGint aCount, const VGint * aValues);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   547
	static void vgSetParameterf(VGHandle aObject, VGint aParamType, VGfloat aValue);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   548
	static void vgSetParameteri(VGHandle aObject, VGint aParamType, VGint aValue);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   549
	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
   550
	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
   551
	static void vgLoadIdentity();
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   552
	static void vgLoadMatrix(const VGfloat* aM);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   553
	static void vgMultMatrix(const VGfloat* aM);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   554
	static void vgTranslate(VGfloat aTx, VGfloat aTy);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   555
	static void vgScale(VGfloat aSx, VGfloat aSy);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   556
	static void vgShear(VGfloat aShx, VGfloat aShy);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   557
	static void vgRotate(VGfloat aAngle);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   558
	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
   559
	static void vgRenderToMask(VGPath aPath, VGbitfield aPaintModes, VGMaskOperation aOperation);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   560
	static void vgDestroyMaskLayer(VGMaskLayer maskLayer);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   561
	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
   562
	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
   563
	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
   564
	static void vgClearPath(VGPath aPath, VGbitfield aCapabilities);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   565
	static void vgDestroyPath(VGPath aPath);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   566
	static void vgRemovePathCapabilities(VGPath aPath, VGbitfield aCapabilities);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   567
	static void vgAppendPath(VGPath aDstPath, VGPath aSrcPath);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   568
	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
   569
	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
   570
	static void vgTransformPath(VGPath aDstPath, VGPath aSrcPath);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   571
	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
   572
		VGfloat* aX, VGfloat* aY, VGfloat* aTangentX, VGfloat* aTangentY);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   573
	static void vgDrawPath(VGPath aPath, VGbitfield aPaintModes);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   574
	static void vgDestroyPaint(VGPaint aPaint);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   575
	static void vgSetPaint(VGPaint aPaint, VGbitfield aPaintModes);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   576
	static void vgSetColor(VGPaint aPaint, VGuint aRgba);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   577
	static void vgPaintPattern(VGPaint aPaint, VGImage aPattern);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   578
	static void vgDestroyImage(VGImage aImage);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   579
	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
   580
	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
   581
		VGint aX, VGint aY, VGint aWidth, VGint aHeight);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   582
	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
   583
		VGboolean aDither);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   584
	static void vgDrawImage(VGImage aImage);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   585
	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
   586
	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
   587
		VGint aWidth, VGint aHeight);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   588
	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
   589
	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
   590
	static void vgDestroyFont(VGFont aFont);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   591
	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
   592
		const VGfloat aEscapement[2]);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   593
	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
   594
		const VGfloat aEscapement[2]);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   595
	static void vgClearGlyph(VGFont aFont, VGuint aGlyphIndex);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   596
	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
   597
	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
   598
		const VGfloat* aAdjustmentsY, VGbitfield aPaintModes, VGboolean aAllowAutoHinting);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   599
	static void vgColorMatrix(VGImage aDst, VGImage aSrc, const VGfloat* aMatrix);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   600
	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
   601
		const VGshort* aKernel, VGfloat aScale, VGfloat aBias, VGTilingMode aTilingMode);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   602
	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
   603
		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
   604
	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
   605
	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
   606
		const VGubyte* aAlphaLUT, VGboolean aOutputLinear, VGboolean aOutputPremultiplied);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   607
	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
   608
		VGboolean aOutputLinear, VGboolean aOutputPremultiplied);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   609
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   610
private:
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   611
	// 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
   612
	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
   613
			VGImageFormat aDataFormat, VGint aSx, VGint aSy, VGint aWidth, VGint aHeight);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   614
	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
   615
			VGImageFormat aDataFormat, VGint aDx, VGint aDy, VGint aWidth, VGint aHeight);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   616
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   617
	static VGint HostGetVectorSize(MVgContext& aVgContext, VGParamType aType);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   618
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   619
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
   620
	static VGint HostGeti(MVgContext& aVgContext, VGParamType type);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   621
private:
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   622
	static inline VGfloat HostGetf(MVgContext& aVgContext, VGParamType type);
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
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   626
// C api extensions
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   627
#ifdef __cplusplus
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   628
extern "C" {
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   629
#endif
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   630
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   631
VGImage vgCreateEGLImageTargetKHR(VGeglImageKHR image);
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   632
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   633
#ifdef __cplusplus
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   634
}
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   635
#endif
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
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   638
#include "openvg.inl"
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   639
a3f46bb01be2 Fix line endings
Faisal Memon <faisal.memon@nokia.com>
parents: 14
diff changeset
   640
#endif // VGSTATE_H