24
|
1 |
// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
|
2 |
// All rights reserved.
|
|
3 |
// This component and the accompanying materials are made available
|
|
4 |
// under the terms of "Eclipse Public License v1.0"
|
|
5 |
// which accompanies this distribution, and is available
|
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
7 |
//
|
|
8 |
// Initial Contributors:
|
|
9 |
// Nokia Corporation - initial contribution.
|
|
10 |
//
|
|
11 |
// Contributors:
|
|
12 |
//
|
|
13 |
// Description:
|
|
14 |
// Client-side state information for Open VG handle based objects
|
|
15 |
|
|
16 |
#include "vgstate.h"
|
|
17 |
#include "remotefunctioncall.h"
|
|
18 |
#include "openvgrfc.h"
|
|
19 |
|
|
20 |
|
|
21 |
/////////////////////////////////////////////////////////////////////////////////////////////
|
|
22 |
// CVgMaskLayerInfo
|
|
23 |
/////////////////////////////////////////////////////////////////////////////////////////////
|
|
24 |
|
|
25 |
CVgMaskLayerInfo* CVgMaskLayerInfo::New(VGint aWidth, VGint aHeight)
|
|
26 |
{
|
|
27 |
RHeap* clientHeap = CVghwUtils::SwitchToVghwHeap();
|
|
28 |
CVgMaskLayerInfo* self = new CVgMaskLayerInfo(aWidth, aHeight);
|
|
29 |
CVghwUtils::SwitchFromVghwHeap(clientHeap);
|
|
30 |
return self;
|
|
31 |
}
|
|
32 |
|
|
33 |
|
|
34 |
CVgMaskLayerInfo::~CVgMaskLayerInfo()
|
|
35 |
{}
|
|
36 |
|
|
37 |
|
|
38 |
CVgMaskLayerInfo::CVgMaskLayerInfo(VGint aWidth, VGint aHeight) :
|
|
39 |
CVgImageBase(EVgHandleForMaskLayer, aWidth, aHeight)
|
|
40 |
{}
|
|
41 |
|
|
42 |
|
|
43 |
TBool CVgMaskLayerInfo::DestroyObject(MVgContext& aVgContext)
|
|
44 |
{
|
|
45 |
VGPANIC_ASSERT_DEBUG(iIsDestroyed, EVgPanicTemp);
|
|
46 |
OPENVG_TRACE(" CVgMaskLayerInfo::DestroyObject HostHandle=0x%x", iHostHandle);
|
|
47 |
|
|
48 |
if (iHostHandle)
|
|
49 |
{
|
|
50 |
RemoteFunctionCallData data; OpenVgRFC vgApiData(data);
|
|
51 |
vgApiData.Init(OpenVgRFC::EvgDestroyMaskLayer, RemoteFunctionCallData::EOpRequest);
|
|
52 |
vgApiData.AppendParam(iHostHandle);
|
|
53 |
aVgContext.ExecuteVgCommand(vgApiData);
|
|
54 |
}
|
|
55 |
|
|
56 |
return ETrue;
|
|
57 |
}
|
|
58 |
|
|
59 |
|
|
60 |
VGint CVgMaskLayerInfo::GetParameterVectorSize(MVgContext& aVgContext, VGint)
|
|
61 |
{
|
|
62 |
aVgContext.SetVgError(VG_ILLEGAL_ARGUMENT_ERROR); // VGMasks do not have any parameters
|
|
63 |
return 0;
|
|
64 |
}
|
|
65 |
|
|
66 |
|
|
67 |
void CVgMaskLayerInfo::FillMaskLayer(MVgContext& aVgContext, VGint aX, VGint aY, VGint aWidth, VGint aHeight, VGfloat aValue)
|
|
68 |
{
|
|
69 |
if ( (aValue < 0.0f) || (aValue > 1.0f) )
|
|
70 |
{
|
|
71 |
aVgContext.SetVgError(VG_ILLEGAL_ARGUMENT_ERROR);
|
|
72 |
}
|
|
73 |
else
|
|
74 |
{
|
|
75 |
RemoteFunctionCallData data; OpenVgRFC vgApiData(data);
|
|
76 |
vgApiData.Init(OpenVgRFC::EvgFillMaskLayer, RemoteFunctionCallData::EOpRequest);
|
|
77 |
vgApiData.AppendParam(iHostHandle);
|
|
78 |
vgApiData.AppendParam(aX);
|
|
79 |
vgApiData.AppendParam(aY);
|
|
80 |
vgApiData.AppendParam(aWidth);
|
|
81 |
vgApiData.AppendParam(aHeight);
|
|
82 |
vgApiData.AppendParam(aValue);
|
|
83 |
aVgContext.ExecuteVgCommand(vgApiData);
|
|
84 |
}
|
|
85 |
}
|
|
86 |
|
|
87 |
|
|
88 |
void CVgMaskLayerInfo::CopyMask(MVgContext& aVgContext, VGint aSx, VGint aSy, VGint aDx, VGint aDy, VGint aWidth, VGint aHeight)
|
|
89 |
{
|
|
90 |
// **** Desirable: check maskLayer is compatible with the current surface mask
|
|
91 |
RemoteFunctionCallData data; OpenVgRFC vgApiData(data);
|
|
92 |
vgApiData.Init(OpenVgRFC::EvgCopyMask, RemoteFunctionCallData::EOpRequest);
|
|
93 |
vgApiData.AppendParam(iHostHandle);
|
|
94 |
vgApiData.AppendParam(aSx);
|
|
95 |
vgApiData.AppendParam(aSy);
|
|
96 |
vgApiData.AppendParam(aDx);
|
|
97 |
vgApiData.AppendParam(aDy);
|
|
98 |
vgApiData.AppendParam(aWidth);
|
|
99 |
vgApiData.AppendParam(aHeight);
|
|
100 |
aVgContext.ExecuteVgCommand(vgApiData);
|
|
101 |
}
|
|
102 |
|
|
103 |
|
|
104 |
// end of file vgmask.cpp
|