|
1 // Copyright (c) 2007-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 #include "directgdidrawableref.h" |
|
17 |
|
18 |
|
19 /** |
|
20 Destructor. Checks that the reference count is zero to make sure all references to this object have |
|
21 been closed properly before it is destroyed. |
|
22 |
|
23 @panic DGDIAdapter 44, if the reference count is not zero. The |
|
24 driver that created this object is responsible for decrementing the reference count. |
|
25 */ |
|
26 CDirectGdiDrawableRef::~CDirectGdiDrawableRef() |
|
27 { |
|
28 GRAPHICS_ASSERT_DEBUG(iRefCount == 0, EDirectGdiPanicDrawableRefDestructorError); |
|
29 } |
|
30 |
|
31 /** |
|
32 Increments the reference count for this object. |
|
33 */ |
|
34 void CDirectGdiDrawableRef::Open() |
|
35 { |
|
36 ++iRefCount; |
|
37 } |
|
38 |
|
39 /** |
|
40 Decrements the reference count for this object. When the count reaches zero, it deletes itself. |
|
41 Therefore no operations should be called on an object of this type after calling DecRefCount(). |
|
42 |
|
43 @return The decremented open count. |
|
44 |
|
45 @panic DGDIAdapter 30, when attempting to decrement a reference count that is zero or less. |
|
46 */ |
|
47 void CDirectGdiDrawableRef::Close() |
|
48 { |
|
49 GRAPHICS_ASSERT_DEBUG(iRefCount > 0, EDirectGdiPanicDrawableRefCountError); |
|
50 if (--iRefCount == 0) |
|
51 { |
|
52 delete this; |
|
53 } |
|
54 } |