sl@0
|
1 |
// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
2 |
// All rights reserved.
|
sl@0
|
3 |
// This component and the accompanying materials are made available
|
sl@0
|
4 |
// under the terms of "Eclipse Public License v1.0"
|
sl@0
|
5 |
// which accompanies this distribution, and is available
|
sl@0
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
7 |
//
|
sl@0
|
8 |
// Initial Contributors:
|
sl@0
|
9 |
// Nokia Corporation - initial contribution.
|
sl@0
|
10 |
//
|
sl@0
|
11 |
// Contributors:
|
sl@0
|
12 |
//
|
sl@0
|
13 |
// Description:
|
sl@0
|
14 |
//
|
sl@0
|
15 |
|
sl@0
|
16 |
/**
|
sl@0
|
17 |
@file
|
sl@0
|
18 |
@internalComponent
|
sl@0
|
19 |
*/
|
sl@0
|
20 |
|
sl@0
|
21 |
#ifndef SGDRIVERIMPL_INL
|
sl@0
|
22 |
#define SGDRIVERIMPL_INL
|
sl@0
|
23 |
|
sl@0
|
24 |
|
sl@0
|
25 |
inline void Panic(TSgResourceAdapterPanicReason aReason)
|
sl@0
|
26 |
{
|
sl@0
|
27 |
User::Panic(KSgResourceAdapterPanicCategory, aReason);
|
sl@0
|
28 |
}
|
sl@0
|
29 |
|
sl@0
|
30 |
|
sl@0
|
31 |
// XSgBase
|
sl@0
|
32 |
|
sl@0
|
33 |
inline XSgBase::XSgBase(XSgDriverImpl& aDriverImpl)
|
sl@0
|
34 |
: iDriverImpl(aDriverImpl)
|
sl@0
|
35 |
{}
|
sl@0
|
36 |
|
sl@0
|
37 |
|
sl@0
|
38 |
inline void XSgBase::IncRefCount()
|
sl@0
|
39 |
{
|
sl@0
|
40 |
__ASSERT_DEBUG(iDriverImpl.IsMutexHeld(), Panic(ESgPanicMutexNotHeld));
|
sl@0
|
41 |
__ASSERT_DEBUG(iRefCount >= 0, Panic(ESgPanicBadReferenceCount));
|
sl@0
|
42 |
++iRefCount;
|
sl@0
|
43 |
}
|
sl@0
|
44 |
|
sl@0
|
45 |
|
sl@0
|
46 |
inline TInt XSgBase::DecRefCount()
|
sl@0
|
47 |
{
|
sl@0
|
48 |
__ASSERT_DEBUG(iDriverImpl.IsMutexHeld(), Panic(ESgPanicMutexNotHeld));
|
sl@0
|
49 |
__ASSERT_DEBUG(iRefCount > 0, Panic(ESgPanicBadReferenceCount));
|
sl@0
|
50 |
return --iRefCount;
|
sl@0
|
51 |
}
|
sl@0
|
52 |
|
sl@0
|
53 |
|
sl@0
|
54 |
/**
|
sl@0
|
55 |
@internalComponent
|
sl@0
|
56 |
@test
|
sl@0
|
57 |
*/
|
sl@0
|
58 |
inline TInt XSgBase::RefCount() const
|
sl@0
|
59 |
{
|
sl@0
|
60 |
return iRefCount;
|
sl@0
|
61 |
}
|
sl@0
|
62 |
|
sl@0
|
63 |
|
sl@0
|
64 |
inline TAny* XSgBase::operator new(TUint aSize, TAny* aBase)
|
sl@0
|
65 |
{
|
sl@0
|
66 |
Mem::FillZ(aBase, aSize);
|
sl@0
|
67 |
return aBase;
|
sl@0
|
68 |
}
|
sl@0
|
69 |
|
sl@0
|
70 |
|
sl@0
|
71 |
// XSgDriverImpl
|
sl@0
|
72 |
|
sl@0
|
73 |
inline XSgDriverImpl::XSgDriverImpl(RHeap* aHeap)
|
sl@0
|
74 |
: iHeap(aHeap)
|
sl@0
|
75 |
{}
|
sl@0
|
76 |
|
sl@0
|
77 |
|
sl@0
|
78 |
inline TAny* XSgDriverImpl::operator new(TUint aSize, TAny* aBase)
|
sl@0
|
79 |
{
|
sl@0
|
80 |
Mem::FillZ(aBase, aSize);
|
sl@0
|
81 |
return aBase;
|
sl@0
|
82 |
}
|
sl@0
|
83 |
|
sl@0
|
84 |
|
sl@0
|
85 |
inline void XSgDriverImpl::Wait()
|
sl@0
|
86 |
{
|
sl@0
|
87 |
iMutex.Wait();
|
sl@0
|
88 |
}
|
sl@0
|
89 |
|
sl@0
|
90 |
|
sl@0
|
91 |
inline void XSgDriverImpl::Signal()
|
sl@0
|
92 |
{
|
sl@0
|
93 |
iMutex.Signal();
|
sl@0
|
94 |
}
|
sl@0
|
95 |
|
sl@0
|
96 |
|
sl@0
|
97 |
inline TBool XSgDriverImpl::IsMutexHeld() const
|
sl@0
|
98 |
{
|
sl@0
|
99 |
return iMutex.IsHeld();
|
sl@0
|
100 |
}
|
sl@0
|
101 |
|
sl@0
|
102 |
|
sl@0
|
103 |
inline TAny* XSgDriverImpl::Alloc(TInt aSize)
|
sl@0
|
104 |
{
|
sl@0
|
105 |
return iHeap->Alloc(aSize);
|
sl@0
|
106 |
}
|
sl@0
|
107 |
|
sl@0
|
108 |
|
sl@0
|
109 |
inline void XSgDriverImpl::Free(TAny* aCell)
|
sl@0
|
110 |
{
|
sl@0
|
111 |
iHeap->Free(aCell);
|
sl@0
|
112 |
}
|
sl@0
|
113 |
|
sl@0
|
114 |
|
sl@0
|
115 |
inline TInt XSgDriverImpl::CreateSurface(const RSurfaceManager::TSurfaceCreationAttributesBuf& aReqs, TSurfaceId& aSurfaceId)
|
sl@0
|
116 |
{
|
sl@0
|
117 |
return iSurfaceManager.CreateSurface(aReqs, aSurfaceId);
|
sl@0
|
118 |
}
|
sl@0
|
119 |
|
sl@0
|
120 |
|
sl@0
|
121 |
inline TInt XSgDriverImpl::CreateSurface(const RSurfaceManager::TSurfaceCreationAttributesBuf& aReqs, TSurfaceId& aSurfaceId, const RChunk& aChunk)
|
sl@0
|
122 |
{
|
sl@0
|
123 |
return iSurfaceManager.CreateSurface(aReqs, aSurfaceId, aChunk);
|
sl@0
|
124 |
}
|
sl@0
|
125 |
|
sl@0
|
126 |
|
sl@0
|
127 |
inline TInt XSgDriverImpl::OpenSurface(const TSurfaceId& aSurfaceId)
|
sl@0
|
128 |
{
|
sl@0
|
129 |
return iSurfaceManager.OpenSurface(aSurfaceId);
|
sl@0
|
130 |
}
|
sl@0
|
131 |
|
sl@0
|
132 |
|
sl@0
|
133 |
inline TInt XSgDriverImpl::CloseSurface(const TSurfaceId& aSurfaceId)
|
sl@0
|
134 |
{
|
sl@0
|
135 |
return iSurfaceManager.CloseSurface(aSurfaceId);
|
sl@0
|
136 |
}
|
sl@0
|
137 |
|
sl@0
|
138 |
|
sl@0
|
139 |
inline TInt XSgDriverImpl::SurfaceInfo(const TSurfaceId& aSurfaceId, RSurfaceManager::TInfoBuf& aInfo)
|
sl@0
|
140 |
{
|
sl@0
|
141 |
return iSurfaceManager.SurfaceInfo(aSurfaceId, aInfo);
|
sl@0
|
142 |
}
|
sl@0
|
143 |
|
sl@0
|
144 |
|
sl@0
|
145 |
inline TInt XSgDriverImpl::SynchronizeCache(const TSurfaceId& aSurfaceId, TInt aBuffer, RSurfaceManager::TSyncOperation aOperation)
|
sl@0
|
146 |
{
|
sl@0
|
147 |
return iSurfaceManager.SynchronizeCache(aSurfaceId, aBuffer, aOperation);
|
sl@0
|
148 |
}
|
sl@0
|
149 |
|
sl@0
|
150 |
|
sl@0
|
151 |
inline TInt XSgDriverImpl::GetSurfaceHint(const TSurfaceId& aSurfaceId, RSurfaceManager::THintPair& aHint)
|
sl@0
|
152 |
{
|
sl@0
|
153 |
return iSurfaceManager.GetSurfaceHint(aSurfaceId, aHint);
|
sl@0
|
154 |
}
|
sl@0
|
155 |
|
sl@0
|
156 |
|
sl@0
|
157 |
#endif // SGDRIVERIMPL_INL
|