|
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 /** |
|
17 @file |
|
18 @publishedPartner |
|
19 @prototype |
|
20 */ |
|
21 |
|
22 #ifndef SGRESOURCE_H |
|
23 #define SGRESOURCE_H |
|
24 |
|
25 #include <e32cmn.h> |
|
26 #include <graphics/sgconst.h> |
|
27 |
|
28 |
|
29 /** |
|
30 @publishedPartner |
|
31 @prototype |
|
32 @deprecated |
|
33 |
|
34 Set of static functions in the Graphics Resource API. |
|
35 */ |
|
36 class SgDriver |
|
37 { |
|
38 public: |
|
39 IMPORT_C static TInt Open(); |
|
40 IMPORT_C static void Close(); |
|
41 IMPORT_C static TInt ResourceCount(); |
|
42 IMPORT_C static void AllocMarkStart(); |
|
43 IMPORT_C static void AllocMarkEnd(TInt aCount); |
|
44 IMPORT_C static void SetAllocFail(RAllocator::TAllocFail aType, TInt aRate); |
|
45 }; |
|
46 |
|
47 |
|
48 /** |
|
49 @publishedPartner |
|
50 @prototype |
|
51 @deprecated |
|
52 |
|
53 A user-defined graphics resource attribute. The Graphics Resource driver can attach |
|
54 attributes defined by the user to a resource at creation time but does not interpret |
|
55 them. The attributes cannot be changed after the resource has been created. |
|
56 */ |
|
57 struct TSgUserAttribute |
|
58 { |
|
59 /** |
|
60 The globally unique identifier of the attribute. |
|
61 */ |
|
62 TUid iUid; |
|
63 /** |
|
64 The value of the attribute. |
|
65 */ |
|
66 TInt iValue; |
|
67 }; |
|
68 |
|
69 |
|
70 /** |
|
71 @publishedPartner |
|
72 @prototype |
|
73 @deprecated |
|
74 |
|
75 This class is used to uniquely identify drawable resources. It represents an opaque |
|
76 192-bit identifier that is unique across the system but not persistent. |
|
77 */ |
|
78 NONSHARABLE_CLASS(TSgDrawableId) |
|
79 { |
|
80 public: |
|
81 inline TBool operator ==(const TSgDrawableId& aId) const; |
|
82 inline TBool operator !=(const TSgDrawableId& aId) const; |
|
83 public: |
|
84 /** |
|
85 The identifier stored as an array of six 32-bit integers. The contents have |
|
86 no meaning to the user, except that all zeros represents a null identifier. |
|
87 */ |
|
88 TUint32 iId[6]; |
|
89 }; |
|
90 |
|
91 |
|
92 /** |
|
93 @publishedPartner |
|
94 @prototype |
|
95 @deprecated |
|
96 |
|
97 This constant represents the null drawable resource identifier, defined as 192 zero bits. |
|
98 */ |
|
99 const TSgDrawableId KSgNullDrawableId = {0, 0, 0, 0, 0, 0}; |
|
100 |
|
101 |
|
102 /** |
|
103 @publishedPartner |
|
104 @prototype |
|
105 @deprecated |
|
106 |
|
107 This globally unique identifier represents the handle type for instances of RSgDrawable. |
|
108 */ |
|
109 const TUid KSgDrawableTypeUid = {0x102858EB}; |
|
110 |
|
111 |
|
112 class MSgDrawableAdapter; |
|
113 |
|
114 /** |
|
115 @publishedPartner |
|
116 @prototype |
|
117 @deprecated |
|
118 |
|
119 A handle to a reference-counted graphics resource that can be drawn in different |
|
120 rendering pipelines, for example DirectGDI, OpenVG etc. Instances of RSgDrawable |
|
121 allow access to drawable resources created using other APIs without knowing the |
|
122 concrete type of the resource. Since drawable resources are reference-counted they |
|
123 are guaranteed to exist while there are open handles referencing them. |
|
124 |
|
125 A new RSgDrawable handle does not refer to a drawable resource until a successful |
|
126 call to Open(). Before that point, the handle is said to be a null handle. Instances |
|
127 of RSgDrawable can be shared among threads in the same process. |
|
128 |
|
129 An RSgDrawable handle is said to be invalid if it is not null but it does not |
|
130 reference an existing drawable resource. Copying an instance of RSgDrawable must |
|
131 be done with extreme care, since it does not increment the reference count of the |
|
132 referenced drawable resource and may therefore allow some RSgDrawable handle to |
|
133 become invalid when the drawable resource is destroyed. |
|
134 */ |
|
135 NONSHARABLE_CLASS(RSgDrawable) |
|
136 { |
|
137 public: |
|
138 IMPORT_C RSgDrawable(); |
|
139 IMPORT_C TInt Open(const TSgDrawableId& aId); |
|
140 IMPORT_C TInt Open(const TSgDrawableId& aId, TUint32 aMode); |
|
141 IMPORT_C void Close(); |
|
142 IMPORT_C const TSgDrawableId& Id() const; |
|
143 IMPORT_C TBool IsNull() const; |
|
144 IMPORT_C TUid DrawableType() const; |
|
145 inline TUid HandleType() const; |
|
146 template<class M> inline TInt GetInterface(M*& aInterfacePtr); |
|
147 template<class M> inline TInt GetInterface(const M*& aInterfacePtr) const; |
|
148 private: |
|
149 IMPORT_C TInt GetInterface(TUid aInterfaceUid, TAny*& aInterfacePtr) const; |
|
150 protected: |
|
151 TUid iHandleType; |
|
152 MSgDrawableAdapter* iImpl; |
|
153 }; |
|
154 |
|
155 |
|
156 #include <graphics/sgresource.inl> |
|
157 |
|
158 #endif // SGRESOURCE_H |