|
1 // Copyright (c) 2008-2009 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 // |
|
15 |
|
16 /** |
|
17 @file |
|
18 @internalComponent |
|
19 */ |
|
20 |
|
21 #ifndef SGDRIVERIMPL_INL |
|
22 #define SGDRIVERIMPL_INL |
|
23 |
|
24 |
|
25 inline void Panic(TSgResourceAdapterPanicReason aReason) |
|
26 { |
|
27 User::Panic(KSgResourceAdapterPanicCategory, aReason); |
|
28 } |
|
29 |
|
30 |
|
31 // XSgBase |
|
32 |
|
33 inline XSgBase::XSgBase(XSgDriverImpl& aDriverImpl) |
|
34 : iDriverImpl(aDriverImpl) |
|
35 {} |
|
36 |
|
37 |
|
38 inline void XSgBase::IncRefCount() |
|
39 { |
|
40 __ASSERT_DEBUG(iDriverImpl.IsMutexHeld(), Panic(ESgPanicMutexNotHeld)); |
|
41 __ASSERT_DEBUG(iRefCount >= 0, Panic(ESgPanicBadReferenceCount)); |
|
42 ++iRefCount; |
|
43 } |
|
44 |
|
45 |
|
46 inline TInt XSgBase::DecRefCount() |
|
47 { |
|
48 __ASSERT_DEBUG(iDriverImpl.IsMutexHeld(), Panic(ESgPanicMutexNotHeld)); |
|
49 __ASSERT_DEBUG(iRefCount > 0, Panic(ESgPanicBadReferenceCount)); |
|
50 return --iRefCount; |
|
51 } |
|
52 |
|
53 |
|
54 /** |
|
55 @internalComponent |
|
56 @test |
|
57 */ |
|
58 inline TInt XSgBase::RefCount() const |
|
59 { |
|
60 return iRefCount; |
|
61 } |
|
62 |
|
63 |
|
64 inline TAny* XSgBase::operator new(TUint aSize, TAny* aBase) |
|
65 { |
|
66 Mem::FillZ(aBase, aSize); |
|
67 return aBase; |
|
68 } |
|
69 |
|
70 |
|
71 // XSgDriverImpl |
|
72 |
|
73 inline XSgDriverImpl::XSgDriverImpl(RHeap* aHeap) |
|
74 : iHeap(aHeap) |
|
75 {} |
|
76 |
|
77 |
|
78 inline TAny* XSgDriverImpl::operator new(TUint aSize, TAny* aBase) |
|
79 { |
|
80 Mem::FillZ(aBase, aSize); |
|
81 return aBase; |
|
82 } |
|
83 |
|
84 |
|
85 inline void XSgDriverImpl::Wait() |
|
86 { |
|
87 iMutex.Wait(); |
|
88 } |
|
89 |
|
90 |
|
91 inline void XSgDriverImpl::Signal() |
|
92 { |
|
93 iMutex.Signal(); |
|
94 } |
|
95 |
|
96 |
|
97 inline TBool XSgDriverImpl::IsMutexHeld() const |
|
98 { |
|
99 return iMutex.IsHeld(); |
|
100 } |
|
101 |
|
102 |
|
103 inline TAny* XSgDriverImpl::Alloc(TInt aSize) |
|
104 { |
|
105 return iHeap->Alloc(aSize); |
|
106 } |
|
107 |
|
108 |
|
109 inline void XSgDriverImpl::Free(TAny* aCell) |
|
110 { |
|
111 iHeap->Free(aCell); |
|
112 } |
|
113 |
|
114 |
|
115 inline TInt XSgDriverImpl::CreateSurface(const RSurfaceManager::TSurfaceCreationAttributesBuf& aReqs, TSurfaceId& aSurfaceId) |
|
116 { |
|
117 return iSurfaceManager.CreateSurface(aReqs, aSurfaceId); |
|
118 } |
|
119 |
|
120 |
|
121 inline TInt XSgDriverImpl::CreateSurface(const RSurfaceManager::TSurfaceCreationAttributesBuf& aReqs, TSurfaceId& aSurfaceId, const RChunk& aChunk) |
|
122 { |
|
123 return iSurfaceManager.CreateSurface(aReqs, aSurfaceId, aChunk); |
|
124 } |
|
125 |
|
126 |
|
127 inline TInt XSgDriverImpl::OpenSurface(const TSurfaceId& aSurfaceId) |
|
128 { |
|
129 return iSurfaceManager.OpenSurface(aSurfaceId); |
|
130 } |
|
131 |
|
132 |
|
133 inline TInt XSgDriverImpl::CloseSurface(const TSurfaceId& aSurfaceId) |
|
134 { |
|
135 return iSurfaceManager.CloseSurface(aSurfaceId); |
|
136 } |
|
137 |
|
138 |
|
139 inline TInt XSgDriverImpl::SurfaceInfo(const TSurfaceId& aSurfaceId, RSurfaceManager::TInfoBuf& aInfo) |
|
140 { |
|
141 return iSurfaceManager.SurfaceInfo(aSurfaceId, aInfo); |
|
142 } |
|
143 |
|
144 |
|
145 inline TInt XSgDriverImpl::SynchronizeCache(const TSurfaceId& aSurfaceId, TInt aBuffer, RSurfaceManager::TSyncOperation aOperation) |
|
146 { |
|
147 return iSurfaceManager.SynchronizeCache(aSurfaceId, aBuffer, aOperation); |
|
148 } |
|
149 |
|
150 |
|
151 inline TInt XSgDriverImpl::GetSurfaceHint(const TSurfaceId& aSurfaceId, RSurfaceManager::THintPair& aHint) |
|
152 { |
|
153 return iSurfaceManager.GetSurfaceHint(aSurfaceId, aHint); |
|
154 } |
|
155 |
|
156 |
|
157 #endif // SGDRIVERIMPL_INL |