sl@0: // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // Graphics Resource - drawable implementation sl@0: // sl@0: sl@0: #include "sgdriver.h" sl@0: sl@0: EXPORT_C TInt RSgDrawable::Open(TSgDrawableId aId, const TSgAttributeArrayBase* aAttributes) sl@0: { sl@0: if (iImpl) sl@0: { sl@0: return KErrInUse; sl@0: } sl@0: __ASSERT_ALWAYS(gPls.iDriver, Panic(ESgPanicNoDriver)); sl@0: return gPls.iDriver->FindAndOpenImage(aId, aAttributes, iImpl); sl@0: } sl@0: sl@0: EXPORT_C void RSgDrawable::Close() sl@0: { sl@0: if (iImpl) sl@0: { sl@0: __ASSERT_ALWAYS(gPls.iDriver, Panic(ESgPanicNoDriver)); sl@0: __ASSERT_ALWAYS(gPls.iDriver->CheckImage(iImpl), Panic(ESgPanicBadDrawableHandle)); sl@0: static_cast(iImpl)->Close(); sl@0: iImpl = NULL; sl@0: } sl@0: } sl@0: sl@0: EXPORT_C TSgDrawableId RSgDrawable::Id() const sl@0: { sl@0: if (!iImpl) sl@0: { sl@0: return KSgNullDrawableId; sl@0: } sl@0: __ASSERT_ALWAYS(gPls.iDriver, Panic(ESgPanicNoDriver)); sl@0: __ASSERT_ALWAYS(gPls.iDriver->CheckImage(iImpl), Panic(ESgPanicBadDrawableHandle)); sl@0: return static_cast(iImpl)->Id(); sl@0: } sl@0: sl@0: EXPORT_C TUid RSgDrawable::DrawableType() const sl@0: { sl@0: if (!iImpl) sl@0: { sl@0: return KNullUid; sl@0: } sl@0: __ASSERT_ALWAYS(gPls.iDriver, Panic(ESgPanicNoDriver)); sl@0: __ASSERT_ALWAYS(gPls.iDriver->CheckImage(iImpl), Panic(ESgPanicBadDrawableHandle)); sl@0: return static_cast(iImpl)->DrawableType(); sl@0: } sl@0: sl@0: EXPORT_C TInt RSgDrawable::GetInterface(TUid aInterfaceUid, TAny*& aInterfacePtr) const sl@0: { sl@0: aInterfacePtr = NULL; sl@0: if (!iImpl) sl@0: { sl@0: return KErrBadHandle; sl@0: } sl@0: __ASSERT_ALWAYS(gPls.iDriver, Panic(ESgPanicNoDriver)); sl@0: __ASSERT_ALWAYS(gPls.iDriver->CheckImage(iImpl), Panic(ESgPanicBadDrawableHandle)); sl@0: return static_cast(iImpl)->GetInterface(aInterfaceUid, aInterfacePtr); sl@0: }