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: // sl@0: sl@0: #include "directgdidrawableref.h" sl@0: sl@0: sl@0: /** sl@0: Destructor. Checks that the reference count is zero to make sure all references to this object have sl@0: been closed properly before it is destroyed. sl@0: sl@0: @panic DGDIAdapter 44, if the reference count is not zero. The sl@0: driver that created this object is responsible for decrementing the reference count. sl@0: */ sl@0: CDirectGdiDrawableRef::~CDirectGdiDrawableRef() sl@0: { sl@0: GRAPHICS_ASSERT_DEBUG(iRefCount == 0, EDirectGdiPanicDrawableRefDestructorError); sl@0: } sl@0: sl@0: /** sl@0: Increments the reference count for this object. sl@0: */ sl@0: void CDirectGdiDrawableRef::Open() sl@0: { sl@0: ++iRefCount; sl@0: } sl@0: sl@0: /** sl@0: Decrements the reference count for this object. When the count reaches zero, it deletes itself. sl@0: Therefore no operations should be called on an object of this type after calling DecRefCount(). sl@0: sl@0: @return The decremented open count. sl@0: sl@0: @panic DGDIAdapter 30, when attempting to decrement a reference count that is zero or less. sl@0: */ sl@0: void CDirectGdiDrawableRef::Close() sl@0: { sl@0: GRAPHICS_ASSERT_DEBUG(iRefCount > 0, EDirectGdiPanicDrawableRefCountError); sl@0: if (--iRefCount == 0) sl@0: { sl@0: delete this; sl@0: } sl@0: }