guestrendering/guestopenvg/src/vgimage.cpp
author Faisal Memon <faisal.memon@nokia.com>
Wed, 08 Sep 2010 17:02:34 +0100
branchbug235_bringup_0
changeset 14 acbd4400e82b
child 24 a3f46bb01be2
permissions -rwxr-xr-x
Add Guest OpenVG
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
14
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
     1
// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
     2
// All rights reserved.
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
     3
// This component and the accompanying materials are made available
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
     4
// under the terms of "Eclipse Public License v1.0"
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
     5
// which accompanies this distribution, and is available
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
     7
//
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
     8
// Initial Contributors:
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
     9
// Nokia Corporation - initial contribution.
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    10
//
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    11
// Contributors:
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    12
//
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    13
// Description:
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    14
// Client-side state information for Open VG handle based objects
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    15
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    16
#include "vgstate.h"
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    17
#include "remotefunctioncall.h"
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    18
#include "openvgrfc.h"
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    19
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    20
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    21
const TInt KColorMatrixSize = 20;
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    22
const TInt KLUTLength = 256;
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    23
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    24
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    25
/////////////////////////////////////////////////////////////////////////////////////////////
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    26
// CVgImageInfo
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    27
/////////////////////////////////////////////////////////////////////////////////////////////
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    28
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    29
CVgImageInfo::CVgImageInfo(VGImageFormat aFormat, VGint aWidth, VGint aHeight, CVgImageInfo* aParent, VGbitfield aAllowedQuality,
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    30
			EGLImageKHR aEglImage, TUint64 aSgImageId) :
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    31
		CVgImageBase(EVgHandleForImage, aWidth, aHeight), iFormat(aFormat), iParent(aParent),
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    32
		iAllowedQuality(aAllowedQuality), iIsEglSibling( aSgImageId ? ETrue : EFalse),
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    33
		iEglImage(aEglImage), iSgImageId(aSgImageId),
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    34
		iChildCount(0)
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    35
	{
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    36
	if (aParent)
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    37
		{
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    38
		aParent->IncChildCount();
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    39
		}
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    40
	}
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    41
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    42
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    43
// eglChildImage
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    44
CVgImageInfo* CVgImageInfo::New(VGint aWidth, VGint aHeight, CVgImageInfo* aParent)
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    45
	{
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    46
	VGPANIC_ASSERT_DEBUG(aParent, EVgPanicImageParentIsInvalid);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    47
	RHeap* clientHeap = CVghwUtils::SwitchToVghwHeap();
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    48
	CVgImageInfo* self = new CVgImageInfo(aParent->iFormat, aWidth, aHeight, aParent, aParent->AllowedQuality(),
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    49
			aParent->EglImage(), aParent->SgImageId());
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    50
	CVghwUtils::SwitchFromVghwHeap(clientHeap);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    51
	return self;
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    52
	}
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    53
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    54
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    55
// vgCreateEGLImageTargetKHR
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    56
CVgImageInfo* CVgImageInfo::New(VGImageFormat aFormat, VGint aWidth, VGint aHeight, EGLImageKHR aEglImage, TUint64& aSgImageId)
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    57
	{
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    58
	RHeap* clientHeap = CVghwUtils::SwitchToVghwHeap();
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    59
	CVgImageInfo* self = new CVgImageInfo(aFormat, aWidth, aHeight, VG_INVALID_HANDLE, 0, aEglImage, aSgImageId);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    60
	CVghwUtils::SwitchFromVghwHeap(clientHeap);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    61
	return self;
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    62
	}
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    63
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    64
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    65
// eglCreateImage
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    66
CVgImageInfo* CVgImageInfo::New(VGImageFormat aFormat, VGint aWidth, VGint aHeight, VGbitfield aAllowedQuality)
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    67
	{
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    68
	RHeap* clientHeap = CVghwUtils::SwitchToVghwHeap();
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    69
	CVgImageInfo* self = new CVgImageInfo(aFormat, aWidth, aHeight, VG_INVALID_HANDLE, aAllowedQuality, NULL, 0l);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    70
	CVghwUtils::SwitchFromVghwHeap(clientHeap);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    71
	return self;
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    72
	}
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    73
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    74
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    75
CVgImageInfo::~CVgImageInfo()
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    76
	{
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    77
	VGPANIC_ASSERT(iChildCount == 0, EVgPanicDeleteInUseVgImageInfo);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    78
	if (iParent)
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    79
		{
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    80
		iParent->DecChildCount();
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    81
		}
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    82
	}
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    83
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    84
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    85
CVgImageInfo* CVgImageInfo::Parent() const
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    86
	{
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    87
	return iParent;
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    88
	}
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    89
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    90
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    91
TInt CVgImageInfo::ChildCount() const
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    92
	{
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    93
	return iChildCount;
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    94
	}
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    95
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    96
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    97
void CVgImageInfo::IncChildCount()
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    98
	{
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    99
	VGPANIC_ASSERT(!iIsDestroyed, EVgPanicParentImageAlreadyDestroyed);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   100
	User::LockedInc(iChildCount);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   101
	}
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   102
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   103
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   104
void CVgImageInfo::DecChildCount()
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   105
	{
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   106
	User::LockedDec(iChildCount);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   107
	if ((iChildCount == 0) && iIsDestroyed)
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   108
		{
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   109
		if (iParent == NULL)
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   110
			{
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   111
			if (IsEglSibling())
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   112
				{ // close the root EglImage
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   113
				OpenVgState.EglImageClose(iEglImage);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   114
				}
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   115
			}
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   116
		else
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   117
			{
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   118
			iParent->DecChildCount();
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   119
			}
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   120
		// delete this image & remove it from HandleMap
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   121
		RHeap* clientHeap = CVghwUtils::SwitchToVghwHeap();
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   122
		OpenVgState.UnMapHandle(iClientHandle);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   123
		delete this;
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   124
		CVghwUtils::SwitchFromVghwHeap(clientHeap);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   125
		}
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   126
	}
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   127
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   128
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   129
VGbitfield CVgImageInfo::AllowedQuality() const
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   130
	{
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   131
	return iAllowedQuality;
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   132
	}
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   133
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   134
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   135
TBool CVgImageInfo::IsEglSibling() const
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   136
	{
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   137
	return iIsEglSibling;
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   138
	}
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   139
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   140
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   141
EGLImageKHR CVgImageInfo::EglImage() const
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   142
	{
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   143
	return iEglImage;
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   144
	}
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   145
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   146
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   147
TUint64 CVgImageInfo::SgImageId() const
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   148
	{
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   149
	return iSgImageId;
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   150
	}
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   151
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   152
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   153
TBool CVgImageInfo::DestroyObject(MVgContext& aVgContext)
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   154
	{
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   155
	VGPANIC_ASSERT_DEBUG(iIsDestroyed, EVgPanicTemp);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   156
	OPENVG_TRACE("  CVgImageInfo::DestroyObject HostHandle=0x%x; ChildCount=%d, Parent=0x%x, IsEglSibling=%d, EglImage=0x%x",
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   157
			iHostHandle, ChildCount(), Parent(), IsEglSibling(), EglImage());
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   158
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   159
	if (iHostHandle)
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   160
		{
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   161
		// Destroy image, but not for eglImages/SgImages
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   162
		if (!IsEglSibling())
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   163
			{
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   164
			RemoteFunctionCallData data; OpenVgRFC vgApiData(data);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   165
			vgApiData.Init(OpenVgRFC::EvgDestroyImage, RemoteFunctionCallData::EOpRequest);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   166
			vgApiData.AppendParam(iHostHandle);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   167
			aVgContext.ExecuteVgCommand(vgApiData);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   168
			}
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   169
		iHostHandle = VG_INVALID_HANDLE;
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   170
		}
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   171
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   172
	if (iChildCount == 0)
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   173
		{
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   174
		if (iParent == NULL)
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   175
			{
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   176
			if (IsEglSibling())
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   177
				{ // close the root EglImage
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   178
				OpenVgState.EglImageClose(iEglImage);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   179
				}
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   180
			}
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   181
		else
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   182
			{
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   183
			iParent->DecChildCount();
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   184
			}
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   185
		return ETrue;
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   186
		}
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   187
	// don't delete this image until all children have been destroyed
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   188
	return EFalse;
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   189
	}
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   190
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   191
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   192
TInt CVgImageInfo::BitsPerPixelForVgImageFormat(VGImageFormat aFormat)
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   193
	{
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   194
	TInt result = -1;
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   195
	if ((aFormat == VG_BW_1) || (aFormat == VG_A_1))
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   196
		{
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   197
		result = 1;
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   198
		}
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   199
	else if (aFormat == VG_A_4)
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   200
		{
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   201
		result = 4;
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   202
		}
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   203
	else if ((aFormat == VG_sL_8) || (aFormat == VG_lL_8) || (aFormat == VG_A_8))
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   204
		{
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   205
		result = 8;
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   206
		}
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   207
	else if ((aFormat >= 0) && (aFormat < 256))
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   208
		{ // low bits of format number repeat in a pattern for 16/32 bit per pel
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   209
		TInt format = aFormat & 0x3f;
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   210
		if ((format >= VG_sRGB_565) && (format <= VG_sRGBA_4444))
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   211
			{
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   212
			result = 16;
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   213
			}
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   214
		else if (format <= VG_lRGBA_8888_PRE)
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   215
			{
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   216
			result = 32;
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   217
			}
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   218
		}
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   219
	return result;
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   220
	}
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   221
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   222
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   223
void CVgImageInfo::PixmapBlit(TUint8* aDest, const TUint8* aSource, TInt aDestStride, TInt aSourceStride, TInt aRowCount,
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   224
		size_t aRowLength, TInt aLastBits)
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   225
	{
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   226
	VGPANIC_ASSERT_DEBUG(aDest, EVgPanicNullPointer);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   227
	VGPANIC_ASSERT_DEBUG(aSource, EVgPanicNullPointer);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   228
	VGPANIC_ASSERT_DEBUG(aDestStride >= aRowLength, EVgPanicStrideSmallerThanRowLength);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   229
	VGPANIC_ASSERT_DEBUG(aSourceStride >= aRowLength, EVgPanicStrideSmallerThanRowLength);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   230
	VGPANIC_ASSERT_DEBUG(aRowCount > 0, EVgPanicBadRowCountParam);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   231
	VGPANIC_ASSERT_DEBUG(aRowLength > 0, EVgPanicBadRowLengthParam);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   232
	VGPANIC_ASSERT_DEBUG( (aLastBits >= 0) && (aLastBits <= 7), EVgPanicBadLastBitsParam);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   233
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   234
	if (aLastBits)
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   235
		{ // bits per pixel < 8, only copy lowest <aLastBits> from source to dest
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   236
		TUint8 destMask = 0xFF << aLastBits; // high bits
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   237
		TUint8 srcMask = 0xFF ^ destMask; // low bits
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   238
		aRowLength -= 1;
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   239
		for (VGint row = 0; row < aRowCount; ++row)
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   240
			{
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   241
			memcpy(aDest, aSource, aRowLength);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   242
			TUint8 byte = (aDest[aRowLength] & destMask) | (aSource[aRowLength] & srcMask);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   243
			aDest[aRowLength] = byte;
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   244
			aSource += aSourceStride;
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   245
			aDest += aDestStride;
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   246
			}
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   247
		}
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   248
	else
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   249
		{
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   250
		for (VGint row = 0; row < aRowCount; ++row)
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   251
			{
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   252
			memcpy(aDest, aSource, aRowLength);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   253
			aSource += aSourceStride;
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   254
			aDest += aDestStride;
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   255
			}
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   256
		}
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   257
	}
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   258
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   259
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   260
VGint CVgImageInfo::GetParameterVectorSize(MVgContext& aVgContext, VGint aParamType)
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   261
	{
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   262
	switch (aParamType)
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   263
		{
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   264
		case VG_IMAGE_FORMAT:
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   265
		case VG_IMAGE_WIDTH:
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   266
		case VG_IMAGE_HEIGHT:
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   267
			return 1;
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   268
		}
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   269
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   270
	// invalid ParamType
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   271
	aVgContext.SetVgError(VG_ILLEGAL_ARGUMENT_ERROR);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   272
	return 0;
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   273
	}
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   274
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   275
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   276
VGfloat CVgImageInfo::GetParameterf(MVgContext& aVgContext, VGint aParamType)
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   277
	{
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   278
	switch (aParamType)
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   279
		{
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   280
		case VG_IMAGE_FORMAT:
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   281
			if (iFormat != VG_IMAGE_FORMAT_INVALID)
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   282
				{
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   283
				return (VGfloat)iFormat;
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   284
				}
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   285
			// for EglImage need to get format of underlying VgImage
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   286
			return HostVgGetParameterf(aVgContext, aParamType);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   287
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   288
		case VG_IMAGE_WIDTH:
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   289
			return (VGfloat)iWidth;
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   290
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   291
		case VG_IMAGE_HEIGHT:
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   292
			return (VGfloat)iHeight;
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   293
		}
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   294
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   295
	// invalid ParamType
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   296
	aVgContext.SetVgError(VG_ILLEGAL_ARGUMENT_ERROR);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   297
	return 0;
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   298
	}
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   299
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   300
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   301
VGint CVgImageInfo::GetParameteri(MVgContext& aVgContext, VGint aParamType)
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   302
	{
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   303
	switch (aParamType)
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   304
		{
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   305
		case VG_IMAGE_FORMAT:
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   306
			if (iFormat != VG_IMAGE_FORMAT_INVALID)
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   307
				{
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   308
				return iFormat;
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   309
				}
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   310
			// for EglImage need to get format of underlying VgImage
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   311
			iFormat = (VGImageFormat) HostVgGetParameteri(aVgContext, aParamType);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   312
			return iFormat;
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   313
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   314
		case VG_IMAGE_WIDTH:
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   315
			return iWidth;
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   316
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   317
		case VG_IMAGE_HEIGHT:
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   318
			return iHeight;
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   319
		}
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   320
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   321
	// invalid ParamType
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   322
	aVgContext.SetVgError(VG_ILLEGAL_ARGUMENT_ERROR);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   323
	return 0;
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   324
	}
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   325
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   326
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   327
void CVgImageInfo::ClearImage(MVgContext& aVgContext, VGint aX, VGint aY, VGint aWidth, VGint aHeight)
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   328
	{
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   329
	// **** Desirable: check aImage is not rendering target
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   330
	RemoteFunctionCallData data; OpenVgRFC vgApiData(data);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   331
	vgApiData.Init(OpenVgRFC::EvgClearImage, RemoteFunctionCallData::EOpRequest);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   332
	vgApiData.AppendParam(iHostHandle);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   333
	vgApiData.AppendParam(aX);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   334
	vgApiData.AppendParam(aY);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   335
	vgApiData.AppendParam(aWidth);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   336
	vgApiData.AppendParam(aHeight);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   337
	TUint64 sgId(0L);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   338
	if (iIsEglSibling)
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   339
		{
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   340
		sgId = iSgImageId;
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   341
		}
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   342
	vgApiData.AppendTUint64(sgId);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   343
	aVgContext.ExecuteVgCommand(vgApiData);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   344
	}
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   345
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   346
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   347
void CVgImageInfo::ImageSubData(MVgContext& aVgContext, const void * aData, VGint aDataStride, VGImageFormat aDataFormat, VGint aX, VGint aY,
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   348
		VGint aWidth, VGint aHeight)
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   349
	{
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   350
	// **** Desirable: check image is not a rendering target
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   351
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   352
	// Limit aWidth & aHeight to the dimensions of aImage
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   353
	if (iWidth < aWidth)
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   354
		{
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   355
		aWidth = iWidth;
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   356
		}
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   357
	if (iHeight < aHeight)
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   358
		{
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   359
		aHeight = iHeight;
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   360
		}
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   361
	OPENVG_TRACE("CVgImageInfo::ImageSubData.1a dest Image: width=%d, height=%d; clipped width=%d, clipped height=%d",
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   362
			iWidth, iHeight, aWidth, aHeight);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   363
	TInt bitsPerPixel = BitsPerPixelForVgImageFormat(aDataFormat);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   364
	TUint32 lineLength = ((static_cast<TUint32>(aWidth) * static_cast<TUint32>(bitsPerPixel)) + 7) / 8;
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   365
	OPENVG_TRACE("CVgImageInfo::ImageSubData.1b bitsPerPixel=%d, lineLength=%d", bitsPerPixel, lineLength);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   366
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   367
	if (bitsPerPixel <= 0)
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   368
		{
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   369
		aVgContext.SetVgError(VG_UNSUPPORTED_IMAGE_FORMAT_ERROR);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   370
		}
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   371
	else
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   372
		{
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   373
		if (lineLength  == aDataStride)
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   374
			{ // use original parameters
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   375
			OPENVG_TRACE("CVgImageInfo::ImageSubData.2a: lineLength == dataStride");
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   376
			HostVgImageSubData(aVgContext, aData, aDataStride * aHeight, aDataStride,
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   377
					aDataFormat, aX, aY, aWidth, aHeight);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   378
			}
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   379
		else if (0 == aDataStride)
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   380
			{ // Fill operation, pixmap size = lineLength
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   381
			OPENVG_TRACE("CVgImageInfo::ImageSubData.2b: 0 == dataStride");
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   382
			HostVgImageSubData(aVgContext, aData, lineLength, aDataStride,
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   383
					aDataFormat, aX, aY, aWidth, aHeight);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   384
			}
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   385
		else
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   386
			{ // try to alloc a translation buffer - datastride maybe negative or simply > lineLength
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   387
			size_t pixmapSize = lineLength * aHeight;
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   388
			TUint8* localBuffer = (TUint8*) CVghwUtils::Alloc(pixmapSize);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   389
			OPENVG_TRACE("CVgImageInfo::ImageSubData.2c: dataStride not 0 or lineLength, localBuffer=0x%x", localBuffer);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   390
			if (localBuffer != NULL)
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   391
				{ // reformat data into temporary buffer
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   392
				PixmapBlit(localBuffer, static_cast<const TUint8*>(aData), lineLength, aDataStride, aHeight, lineLength);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   393
				HostVgImageSubData(aVgContext, localBuffer, pixmapSize, lineLength, aDataFormat, aX, aY, aWidth, aHeight);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   394
				CVghwUtils::Free(localBuffer);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   395
				}
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   396
			else
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   397
				{ // alloc failed, so do VG operation row by row
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   398
				const TUint8* source = static_cast<const TUint8*>(aData);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   399
				for (VGint row = 0; row < aHeight; ++row)
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   400
					{
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   401
					HostVgImageSubData(aVgContext, source, lineLength, lineLength, aDataFormat, aX + row, aY, aWidth, 1);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   402
					source += aDataStride;
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   403
					}
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   404
				}
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   405
			}
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   406
		}
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   407
	}
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   408
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   409
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   410
void CVgImageInfo::HostVgImageSubData(MVgContext& aVgContext, const void* aPixmap, size_t aPixmapSize, VGint aHostDataStride,
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   411
		VGImageFormat aDataFormat, VGint aX, VGint aY, VGint aWidth, VGint aHeight)
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   412
	{
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   413
	VGPANIC_ASSERT(aPixmap != NULL, EVgPanicNullPixmapPointer);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   414
	VGPANIC_ASSERT(aPixmapSize >= (aHostDataStride * aHeight), EVgPanicPixmapSizeError);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   415
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   416
	RemoteFunctionCallData rfcdata; OpenVgRFC vgApiData(rfcdata);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   417
	vgApiData.Init(OpenVgRFC::EvgImageSubData, RemoteFunctionCallData::EOpRequest);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   418
	vgApiData.AppendParam(iHostHandle);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   419
	vgApiData.AppendVector(aPixmap, aPixmapSize);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   420
	vgApiData.AppendParam(aHostDataStride);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   421
	vgApiData.AppendParam(aDataFormat);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   422
	vgApiData.AppendParam(aX);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   423
	vgApiData.AppendParam(aY);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   424
	vgApiData.AppendParam(aWidth);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   425
	vgApiData.AppendParam(aHeight);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   426
	TUint64 sgId(0L);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   427
	if (iIsEglSibling)
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   428
		{
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   429
		sgId = iSgImageId;
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   430
		}
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   431
	OPENVG_TRACE("CVgImageInfo::HostVgImageSubData sgId 0x%lx", sgId);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   432
	vgApiData.AppendTUint64(sgId);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   433
	aVgContext.ExecuteVgCommand(vgApiData);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   434
	}
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   435
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   436
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   437
void CVgImageInfo::GetImageSubData(MVgContext& aVgContext, void * aData, VGint aDataStride, VGImageFormat aDataFormat, VGint aX, VGint aY, VGint aWidth, VGint aHeight)
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   438
	{
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   439
	// **** Desirable: check VGImage is not currently a rendering target
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   440
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   441
	// Limit aWidth & aHeight to the dimensions of aImage
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   442
	if (iWidth < aWidth)
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   443
		{
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   444
		aWidth = iWidth;
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   445
		}
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   446
	if (iHeight < aHeight)
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   447
		{
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   448
		aHeight = iHeight;
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   449
		}
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   450
	OPENVG_TRACE("CVgImageInfo::GetImageSubData.1a source Image: width=%d, height=%d; clipped width=%d, clipped height=%d",
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   451
			iWidth, iHeight, aWidth, aHeight);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   452
	TInt bitsPerPixel = BitsPerPixelForVgImageFormat(aDataFormat);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   453
	TUint32 lineLength = static_cast<TUint32>(aWidth) * static_cast<TUint32>(bitsPerPixel);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   454
	TUint32 tailBits = lineLength & 7;
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   455
	lineLength = (lineLength + 7) / 8;
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   456
	OPENVG_TRACE("CVgImageInfo::GetImageSubData.1b bitsPerPixel=%d, lineLength=%d, tailBits=%d", bitsPerPixel, lineLength, tailBits);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   457
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   458
	if (bitsPerPixel <= 0)
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   459
		{
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   460
		aVgContext.SetVgError(VG_UNSUPPORTED_IMAGE_FORMAT_ERROR);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   461
		}
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   462
	else
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   463
		{
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   464
		if (lineLength  == aDataStride)
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   465
			{ // use original params
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   466
			OPENVG_TRACE("CVgImageInfo::GetImageSubData.2a: lineLength == dataStride");
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   467
			HostVgGetImageSubData(aVgContext, aData, aDataStride * aHeight, aDataStride, aDataFormat, aX, aY, aWidth, aHeight);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   468
			}
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   469
		else if (0 == aDataStride)
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   470
			{ // unlikely unless aHeight = 1, symmetric to fill function for vgGetImageSubData
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   471
			OPENVG_TRACE("CVgImageInfo::GetImageSubData.2b: 0 == dataStride");
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   472
			HostVgGetImageSubData(aVgContext, aData, lineLength, aDataStride, aDataFormat, aX, aY, aWidth, aHeight);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   473
			}
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   474
		else
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   475
			{ // datastride maybe negative or simply > lineLength
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   476
			TInt pixmapSize = lineLength * aHeight;
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   477
			TUint8* localBuffer = (TUint8*) CVghwUtils::Alloc(pixmapSize);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   478
			OPENVG_TRACE("CVgImageInfo::GetImageSubData.2c: dataStride not 0 or lineLength, localBuffer=0x%x", localBuffer);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   479
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   480
			if (localBuffer != NULL)
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   481
				{ // read pixels into temporary buffer
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   482
				HostVgGetImageSubData(aVgContext, localBuffer, pixmapSize, lineLength, aDataFormat, aX, aY, aWidth, aHeight);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   483
				// reformat into client memory
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   484
				PixmapBlit(static_cast<TUint8*>(aData), localBuffer, aDataStride, lineLength, aHeight, lineLength, tailBits);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   485
				CVghwUtils::Free(localBuffer);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   486
				}
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   487
			else
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   488
				{ // alloc failed, so do VG operation row by row
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   489
				TUint8* dest = static_cast<TUint8*>(aData);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   490
				for (VGint row = 0; row < aHeight; ++row)
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   491
					{
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   492
					HostVgGetImageSubData(aVgContext, dest, lineLength, lineLength, aDataFormat, aX + row, aY, aWidth, 1);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   493
					dest += aDataStride;
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   494
					}
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   495
				}
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   496
			}
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   497
		}
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   498
	}
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   499
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   500
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   501
void CVgImageInfo::HostVgGetImageSubData(MVgContext& aVgContext, void* aPixmap, size_t aPixmapSize, VGint aHostDataStride,
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   502
		VGImageFormat aDataFormat, VGint aX, VGint aY, VGint aWidth, VGint aHeight)
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   503
	{
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   504
	VGPANIC_ASSERT_DEBUG(aPixmap != NULL, EVgPanicNullPixmapPointer);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   505
	VGPANIC_ASSERT_DEBUG(aPixmapSize >= (aHostDataStride * aHeight), EVgPanicPixmapSizeError);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   506
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   507
	RemoteFunctionCallData rfcdata; OpenVgRFC vgApiData(rfcdata);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   508
	vgApiData.Init(OpenVgRFC::EvgGetImageSubData);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   509
	vgApiData.AppendParam(iHostHandle);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   510
	vgApiData.AppendVector(aPixmap, aPixmapSize, RemoteFunctionCallData::EOut);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   511
	vgApiData.AppendParam(aHostDataStride);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   512
	vgApiData.AppendParam(aDataFormat);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   513
	vgApiData.AppendParam(aX);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   514
	vgApiData.AppendParam(aY);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   515
	vgApiData.AppendParam(aWidth);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   516
	vgApiData.AppendParam(aHeight);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   517
	vgApiData.AppendParam((VGint)aPixmapSize); // ToDo overload AppendParam for TUint32
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   518
	TUint64 sgId(0L);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   519
	if (iIsEglSibling)
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   520
		{
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   521
		sgId = iSgImageId;
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   522
		}
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   523
	vgApiData.AppendTUint64(sgId);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   524
	aVgContext.ExecuteVgCommand(vgApiData);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   525
	}
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   526
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   527
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   528
void CVgImageInfo::CopyImage(MVgContext& aVgContext, VGint aDx, VGint aDy, CVgImageInfo& aSrcImageInfo, VGint aSx, VGint aSy, VGint aWidth,
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   529
		VGint aHeight, VGboolean aDither)
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   530
	{
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   531
	// **** Desirable: verify src & dst are not a rendering target, ...
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   532
	RemoteFunctionCallData data; OpenVgRFC vgApiData(data);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   533
	vgApiData.Init(OpenVgRFC::EvgCopyImage, RemoteFunctionCallData::EOpRequest);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   534
	vgApiData.AppendParam(iHostHandle);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   535
	vgApiData.AppendParam(aDx);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   536
	vgApiData.AppendParam(aDy);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   537
	vgApiData.AppendParam(aSrcImageInfo.HostHandle());
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   538
	vgApiData.AppendParam(aSx);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   539
	vgApiData.AppendParam(aSy);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   540
	vgApiData.AppendParam(aWidth);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   541
	vgApiData.AppendParam(aHeight);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   542
	vgApiData.AppendParam(aDither);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   543
	TUint64 dstSgId(0L);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   544
	TUint64 srcSgId(0L);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   545
	if (iIsEglSibling)
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   546
		{
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   547
		dstSgId = iSgImageId;
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   548
		}
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   549
	if (aSrcImageInfo.IsEglSibling())
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   550
		{
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   551
		srcSgId = aSrcImageInfo.SgImageId();
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   552
		}
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   553
	vgApiData.AppendTUint64(dstSgId);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   554
	vgApiData.AppendTUint64(srcSgId);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   555
	aVgContext.ExecuteVgCommand(vgApiData);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   556
	}
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   557
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   558
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   559
void CVgImageInfo::DrawImage(MVgContext& aVgContext)
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   560
	{
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   561
	RemoteFunctionCallData data; OpenVgRFC vgApiData(data);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   562
	vgApiData.Init(OpenVgRFC::EvgDrawImage, RemoteFunctionCallData::EOpRequest);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   563
	vgApiData.AppendParam(iHostHandle);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   564
	TUint64 sgId(0L);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   565
	if (iIsEglSibling)
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   566
		{
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   567
		sgId = iSgImageId;
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   568
		}
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   569
	vgApiData.AppendTUint64(sgId);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   570
	aVgContext.ExecuteVgCommand(vgApiData);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   571
	}
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   572
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   573
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   574
void CVgImageInfo::SetPixels(MVgContext& aVgContext, VGint aDx, VGint aDy, VGint aSx, VGint aSy, VGint aWidth, VGint aHeight)
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   575
	{
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   576
	// **** Desirable: verify aSrc image is not a rendering target
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   577
	RemoteFunctionCallData data; OpenVgRFC vgApiData(data);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   578
	vgApiData.Init(OpenVgRFC::EvgSetPixels, RemoteFunctionCallData::EOpRequest);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   579
	vgApiData.AppendParam(aDx);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   580
	vgApiData.AppendParam(aDy);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   581
	vgApiData.AppendParam(iHostHandle);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   582
	vgApiData.AppendParam(aSx);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   583
	vgApiData.AppendParam(aSy);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   584
	vgApiData.AppendParam(aWidth);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   585
	vgApiData.AppendParam(aHeight);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   586
	aVgContext.ExecuteVgCommand(vgApiData);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   587
	}
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   588
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   589
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   590
void CVgImageInfo::GetPixels(MVgContext& aVgContext, VGint aDx, VGint aDy, VGint aSx, VGint aSy, VGint aWidth, VGint aHeight)
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   591
	{
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   592
	// **** Desirable: verify aDst is not currently a rendering target
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   593
	RemoteFunctionCallData data; OpenVgRFC vgApiData(data);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   594
	vgApiData.Init(OpenVgRFC::EvgGetPixels, RemoteFunctionCallData::EOpRequest);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   595
	vgApiData.AppendParam(iHostHandle);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   596
	vgApiData.AppendParam(aDx);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   597
	vgApiData.AppendParam(aDy);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   598
	vgApiData.AppendParam(aSx);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   599
	vgApiData.AppendParam(aSy);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   600
	vgApiData.AppendParam(aWidth);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   601
	vgApiData.AppendParam(aHeight);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   602
	TUint64 sgId(0L);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   603
	if (iIsEglSibling)
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   604
		{
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   605
		sgId = iSgImageId;
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   606
		}
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   607
	vgApiData.AppendTUint64(sgId);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   608
	aVgContext.ExecuteVgCommand(vgApiData);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   609
	}
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   610
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   611
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   612
void CVgImageInfo::ColorMatrix(MVgContext& aVgContext, CVgImageInfo& aSrcImageInfo, const VGfloat * aMatrix)
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   613
	{
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   614
	RemoteFunctionCallData data; OpenVgRFC vgApiData(data);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   615
	vgApiData.Init(OpenVgRFC::EvgColorMatrix, RemoteFunctionCallData::EOpRequest);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   616
	vgApiData.AppendParam(iHostHandle);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   617
	vgApiData.AppendParam(aSrcImageInfo.HostHandle());
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   618
	vgApiData.AppendVector(aMatrix, KColorMatrixSize);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   619
	TUint64 dstSgId(0L);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   620
	TUint64 srcSgId(0L);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   621
	if (IsEglSibling())
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   622
		{
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   623
		dstSgId = SgImageId();
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   624
		}
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   625
	if (aSrcImageInfo.IsEglSibling())
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   626
		{
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   627
		srcSgId = aSrcImageInfo.SgImageId();
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   628
		}
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   629
	vgApiData.AppendTUint64(dstSgId);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   630
	vgApiData.AppendTUint64(srcSgId);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   631
	aVgContext.ExecuteVgCommand(vgApiData);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   632
	}
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   633
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   634
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   635
void CVgImageInfo::Convolve(MVgContext& aVgContext, CVgImageInfo& aSrcImageInfo, VGint aKernelWidth, VGint aKernelHeight,
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   636
		VGint aShiftX, VGint aShiftY, const VGshort * aKernel, VGfloat aScale, VGfloat aBias, VGTilingMode aTilingMode)
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   637
	{
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   638
	// **** Desirable: verify aDst & aSrc are valid and do not overlap
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   639
	RemoteFunctionCallData data; OpenVgRFC vgApiData(data);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   640
	vgApiData.Init(OpenVgRFC::EvgConvolve, RemoteFunctionCallData::EOpRequest);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   641
	vgApiData.AppendParam(iHostHandle);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   642
	vgApiData.AppendParam(aSrcImageInfo.HostHandle());
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   643
	vgApiData.AppendParam(aKernelWidth);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   644
	vgApiData.AppendParam(aKernelHeight);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   645
	vgApiData.AppendParam(aShiftX);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   646
	vgApiData.AppendParam(aShiftY);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   647
	vgApiData.AppendVector(aKernel, aKernelWidth*aKernelHeight);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   648
	vgApiData.AppendParam(aScale);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   649
	vgApiData.AppendParam(aBias);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   650
	vgApiData.AppendParam(aTilingMode);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   651
	aVgContext.ExecuteVgCommand(vgApiData);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   652
	}
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   653
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   654
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   655
void CVgImageInfo::SeparableConvolve(MVgContext& aVgContext, CVgImageInfo& aSrcImageInfo, VGint aKernelWidth, VGint aKernelHeight,
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   656
		VGint aShiftX, VGint aShiftY, const VGshort * aKernelX, const VGshort * aKernelY, 
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   657
		VGfloat aScale, VGfloat aBias, VGTilingMode aTilingMode)
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   658
	{
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   659
	// **** Desirable: verify aDst & aSrc are valid and do not overlap
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   660
	RemoteFunctionCallData data; OpenVgRFC vgApiData(data);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   661
	vgApiData.Init(OpenVgRFC::EvgSeparableConvolve, RemoteFunctionCallData::EOpRequest);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   662
	vgApiData.AppendParam(iHostHandle);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   663
	vgApiData.AppendParam(aSrcImageInfo.HostHandle());
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   664
	vgApiData.AppendParam(aKernelWidth);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   665
	vgApiData.AppendParam(aKernelHeight);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   666
	vgApiData.AppendParam(aShiftX);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   667
	vgApiData.AppendParam(aShiftY);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   668
	vgApiData.AppendVector(aKernelX, aKernelWidth);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   669
	vgApiData.AppendVector(aKernelY, aKernelHeight);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   670
	vgApiData.AppendParam(aScale);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   671
	vgApiData.AppendParam(aBias);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   672
	vgApiData.AppendParam(aTilingMode);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   673
	TUint64 dstSgId(0L);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   674
	TUint64 srcSgId(0L);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   675
	if (IsEglSibling())
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   676
		{
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   677
		dstSgId = SgImageId();
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   678
		}
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   679
	if (aSrcImageInfo.IsEglSibling())
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   680
		{
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   681
		srcSgId = aSrcImageInfo.SgImageId();
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   682
		}
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   683
	vgApiData.AppendTUint64(dstSgId);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   684
	vgApiData.AppendTUint64(srcSgId);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   685
	aVgContext.ExecuteVgCommand(vgApiData);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   686
	}
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   687
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   688
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   689
void CVgImageInfo::GaussianBlur(MVgContext& aVgContext, CVgImageInfo& aSrcImageInfo, VGfloat aStdDeviationX, VGfloat aStdDeviationY, VGTilingMode aTilingMode)
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   690
	{
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   691
	// **** Desirable: verify aDst & src are not currently a rendering target or overlap
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   692
	RemoteFunctionCallData data; OpenVgRFC vgApiData(data);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   693
	vgApiData.Init(OpenVgRFC::EvgGaussianBlur, RemoteFunctionCallData::EOpRequest);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   694
	vgApiData.AppendParam(iHostHandle);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   695
	vgApiData.AppendParam(aSrcImageInfo.HostHandle());
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   696
	vgApiData.AppendParam(aStdDeviationX);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   697
	vgApiData.AppendParam(aStdDeviationY);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   698
	vgApiData.AppendParam(aTilingMode);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   699
	TUint64 dstSgId(0L);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   700
	TUint64 srcSgId(0L);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   701
	if (IsEglSibling())
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   702
		{
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   703
		dstSgId = SgImageId();
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   704
		}
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   705
	if (aSrcImageInfo.IsEglSibling())
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   706
		{
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   707
		srcSgId = aSrcImageInfo.SgImageId();
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   708
		}
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   709
	vgApiData.AppendTUint64(dstSgId);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   710
	vgApiData.AppendTUint64(srcSgId);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   711
	aVgContext.ExecuteVgCommand(vgApiData);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   712
	}
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   713
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   714
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   715
void CVgImageInfo::Lookup(MVgContext& aVgContext, CVgImageInfo& aSrcImageInfo, const VGubyte * aRedLUT, const VGubyte * aGreenLUT, const VGubyte * aBlueLUT,
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   716
		const VGubyte * aAlphaLUT, VGboolean aOutputLinear, VGboolean aOutputPremultiplied)
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   717
	{
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   718
	// **** Desirable: verify aDst & aSrc are not currently a rendering target or overlap
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   719
	RemoteFunctionCallData data; OpenVgRFC vgApiData(data);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   720
	vgApiData.Init(OpenVgRFC::EvgLookup, RemoteFunctionCallData::EOpRequest);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   721
	vgApiData.AppendParam(iHostHandle);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   722
	vgApiData.AppendParam(aSrcImageInfo.HostHandle());
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   723
	vgApiData.AppendVector(aRedLUT, KLUTLength);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   724
	vgApiData.AppendVector(aGreenLUT, KLUTLength);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   725
	vgApiData.AppendVector(aBlueLUT, KLUTLength);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   726
	vgApiData.AppendVector(aAlphaLUT, KLUTLength);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   727
	vgApiData.AppendParam(aOutputLinear);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   728
	vgApiData.AppendParam(aOutputPremultiplied);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   729
	TUint64 dstSgId(0L);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   730
	TUint64 srcSgId(0L);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   731
	if (IsEglSibling())
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   732
		{
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   733
		dstSgId = SgImageId();
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   734
		}
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   735
	if (aSrcImageInfo.IsEglSibling())
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   736
		{
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   737
		srcSgId = aSrcImageInfo.SgImageId();
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   738
		}
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   739
	vgApiData.AppendTUint64(dstSgId);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   740
	vgApiData.AppendTUint64(srcSgId);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   741
	aVgContext.ExecuteVgCommand(vgApiData);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   742
	}
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   743
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   744
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   745
void CVgImageInfo::LookupSingle(MVgContext& aVgContext, CVgImageInfo& aSrcImageInfo, const VGuint * aLookupTable, VGImageChannel aSourceChannel,
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   746
		VGboolean aOutputLinear, VGboolean aOutputPremultiplied)
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   747
	{
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   748
	// **** Desirable: check aSrc is in an RGB pixel format, and that aSourceChannel is okay
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   749
	RemoteFunctionCallData data; OpenVgRFC vgApiData(data);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   750
	vgApiData.Init(OpenVgRFC::EvgLookupSingle, RemoteFunctionCallData::EOpRequest);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   751
	vgApiData.AppendParam(iHostHandle);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   752
	vgApiData.AppendParam(aSrcImageInfo.HostHandle());
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   753
	vgApiData.AppendVector(aLookupTable, KLUTLength);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   754
	vgApiData.AppendParam(aSourceChannel);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   755
	vgApiData.AppendParam(aOutputLinear);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   756
	vgApiData.AppendParam(aOutputPremultiplied);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   757
	TUint64 dstSgId(0L);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   758
	TUint64 srcSgId(0L);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   759
	if (IsEglSibling())
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   760
		{
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   761
		dstSgId = SgImageId();
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   762
		}
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   763
	if (aSrcImageInfo.IsEglSibling())
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   764
		{
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   765
		srcSgId = aSrcImageInfo.SgImageId();
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   766
		}
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   767
	vgApiData.AppendTUint64(dstSgId);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   768
	vgApiData.AppendTUint64(srcSgId);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   769
	aVgContext.ExecuteVgCommand(vgApiData);
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   770
	}
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   771
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   772
acbd4400e82b Add Guest OpenVG
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   773
// end of file vgimage.cpp