os/graphics/graphicsresourceservices/graphicsresourceadaptation/inc/sgdriverimpl.inl
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/graphics/graphicsresourceservices/graphicsresourceadaptation/inc/sgdriverimpl.inl	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,157 @@
     1.4 +// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.5 +// All rights reserved.
     1.6 +// This component and the accompanying materials are made available
     1.7 +// under the terms of "Eclipse Public License v1.0"
     1.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.10 +//
    1.11 +// Initial Contributors:
    1.12 +// Nokia Corporation - initial contribution.
    1.13 +//
    1.14 +// Contributors:
    1.15 +//
    1.16 +// Description:
    1.17 +//
    1.18 +
    1.19 +/**
    1.20 + @file
    1.21 + @internalComponent
    1.22 +*/
    1.23 +
    1.24 +#ifndef SGDRIVERIMPL_INL
    1.25 +#define SGDRIVERIMPL_INL
    1.26 +
    1.27 +
    1.28 +inline void Panic(TSgResourceAdapterPanicReason aReason)
    1.29 +	{
    1.30 +	User::Panic(KSgResourceAdapterPanicCategory, aReason);
    1.31 +	}
    1.32 +
    1.33 +
    1.34 +// XSgBase
    1.35 +
    1.36 +inline XSgBase::XSgBase(XSgDriverImpl& aDriverImpl)
    1.37 +	: iDriverImpl(aDriverImpl)
    1.38 +	{}
    1.39 +
    1.40 +
    1.41 +inline void XSgBase::IncRefCount()
    1.42 +	{
    1.43 +	__ASSERT_DEBUG(iDriverImpl.IsMutexHeld(), Panic(ESgPanicMutexNotHeld));
    1.44 +	__ASSERT_DEBUG(iRefCount >= 0, Panic(ESgPanicBadReferenceCount));
    1.45 +	++iRefCount;
    1.46 +	}
    1.47 +
    1.48 +
    1.49 +inline TInt XSgBase::DecRefCount()
    1.50 +	{
    1.51 +	__ASSERT_DEBUG(iDriverImpl.IsMutexHeld(), Panic(ESgPanicMutexNotHeld));
    1.52 +	__ASSERT_DEBUG(iRefCount > 0, Panic(ESgPanicBadReferenceCount));
    1.53 +	return --iRefCount;
    1.54 +	}
    1.55 +
    1.56 +
    1.57 +/**
    1.58 +@internalComponent
    1.59 +@test
    1.60 +*/
    1.61 +inline TInt XSgBase::RefCount() const
    1.62 +	{
    1.63 +	return iRefCount;
    1.64 +	}
    1.65 +
    1.66 +
    1.67 +inline TAny* XSgBase::operator new(TUint aSize, TAny* aBase)
    1.68 +	{
    1.69 +	Mem::FillZ(aBase, aSize);
    1.70 +	return aBase;
    1.71 +	}
    1.72 +
    1.73 +
    1.74 +// XSgDriverImpl
    1.75 +
    1.76 +inline XSgDriverImpl::XSgDriverImpl(RHeap* aHeap)
    1.77 +	: iHeap(aHeap)
    1.78 +	{}
    1.79 +
    1.80 +
    1.81 +inline TAny* XSgDriverImpl::operator new(TUint aSize, TAny* aBase)
    1.82 +	{
    1.83 +	Mem::FillZ(aBase, aSize);
    1.84 +	return aBase;
    1.85 +	}
    1.86 +
    1.87 +
    1.88 +inline void XSgDriverImpl::Wait()
    1.89 +	{
    1.90 +	iMutex.Wait();
    1.91 +	}
    1.92 +
    1.93 +
    1.94 +inline void XSgDriverImpl::Signal()
    1.95 +	{
    1.96 +	iMutex.Signal();
    1.97 +	}
    1.98 +
    1.99 +
   1.100 +inline TBool XSgDriverImpl::IsMutexHeld() const
   1.101 +	{
   1.102 +	return iMutex.IsHeld();
   1.103 +	}
   1.104 +
   1.105 +
   1.106 +inline TAny* XSgDriverImpl::Alloc(TInt aSize)
   1.107 +	{
   1.108 +	return iHeap->Alloc(aSize);
   1.109 +	}
   1.110 +
   1.111 +
   1.112 +inline void XSgDriverImpl::Free(TAny* aCell)
   1.113 +	{
   1.114 +	iHeap->Free(aCell);
   1.115 +	}
   1.116 +
   1.117 +
   1.118 +inline TInt XSgDriverImpl::CreateSurface(const RSurfaceManager::TSurfaceCreationAttributesBuf& aReqs, TSurfaceId& aSurfaceId)
   1.119 +	{
   1.120 +	return iSurfaceManager.CreateSurface(aReqs, aSurfaceId);
   1.121 +	}
   1.122 +
   1.123 +
   1.124 +inline TInt XSgDriverImpl::CreateSurface(const RSurfaceManager::TSurfaceCreationAttributesBuf& aReqs, TSurfaceId& aSurfaceId, const RChunk& aChunk)
   1.125 +	{
   1.126 +	return iSurfaceManager.CreateSurface(aReqs, aSurfaceId, aChunk);
   1.127 +	}
   1.128 +
   1.129 +
   1.130 +inline TInt XSgDriverImpl::OpenSurface(const TSurfaceId& aSurfaceId)
   1.131 +	{
   1.132 +	return iSurfaceManager.OpenSurface(aSurfaceId);
   1.133 +	}
   1.134 +
   1.135 +
   1.136 +inline TInt XSgDriverImpl::CloseSurface(const TSurfaceId& aSurfaceId)
   1.137 +	{
   1.138 +	return iSurfaceManager.CloseSurface(aSurfaceId);
   1.139 +	}
   1.140 +
   1.141 +
   1.142 +inline TInt XSgDriverImpl::SurfaceInfo(const TSurfaceId& aSurfaceId, RSurfaceManager::TInfoBuf& aInfo)
   1.143 +	{
   1.144 +	return iSurfaceManager.SurfaceInfo(aSurfaceId, aInfo);
   1.145 +	}
   1.146 +
   1.147 +
   1.148 +inline TInt XSgDriverImpl::SynchronizeCache(const TSurfaceId& aSurfaceId, TInt aBuffer, RSurfaceManager::TSyncOperation aOperation)
   1.149 +	{
   1.150 +	return iSurfaceManager.SynchronizeCache(aSurfaceId, aBuffer, aOperation);
   1.151 +	}
   1.152 +
   1.153 +
   1.154 +inline TInt XSgDriverImpl::GetSurfaceHint(const TSurfaceId& aSurfaceId, RSurfaceManager::THintPair& aHint)
   1.155 +	{
   1.156 +	return iSurfaceManager.GetSurfaceHint(aSurfaceId, aHint);
   1.157 +	}
   1.158 +
   1.159 +
   1.160 +#endif // SGDRIVERIMPL_INL