34 #include "riImage.h" |
34 #include "riImage.h" |
35 #include "riDefs.h" |
35 #include "riDefs.h" |
36 |
36 |
37 #include <e32std.h> |
37 #include <e32std.h> |
38 #include <w32std.h> |
38 #include <w32std.h> |
39 #include <eglosnativewindowtype.h> |
39 #include "eglosnativewindowtype.h" |
|
40 |
|
41 |
|
42 REglWindowBase::REglWindowBase() |
|
43 { |
|
44 iIsRWindow = (TAny*)0xFFFFFFFF; |
|
45 } |
|
46 |
|
47 TBool REglWindowBase::IsRWindow() const |
|
48 { |
|
49 if((TAny*)0xFFFFFFFF == iIsRWindow) |
|
50 { |
|
51 return EFalse; |
|
52 } |
|
53 return ETrue; |
|
54 } |
|
55 |
|
56 EXPORT_C TNativeWindowType::TNativeWindowType(EGLNativeWindowType aNativeWindow) : iSize(0,0),iBitmap(NULL) |
|
57 { |
|
58 iEglWindow = (REglWindowBase*)aNativeWindow; |
|
59 iIsValid = ETrue; |
|
60 } |
|
61 |
|
62 EXPORT_C TNativeWindowType::TNativeWindowType() : iSize(0,0),iBitmap(NULL),iEglWindow(NULL),iIsValid(EFalse) |
|
63 { |
|
64 |
|
65 } |
|
66 |
|
67 EXPORT_C void TNativeWindowType::SetNativeWindow(EGLNativeWindowType aNativeWindow) |
|
68 { |
|
69 iEglWindow = (REglWindowBase*)aNativeWindow; |
|
70 iIsValid = ETrue; |
|
71 } |
|
72 |
|
73 EXPORT_C TBool TNativeWindowType::IsValid() const |
|
74 { |
|
75 return iIsValid; |
|
76 } |
|
77 |
|
78 EXPORT_C TSize TNativeWindowType::SizeInPixels() const |
|
79 { |
|
80 if(iEglWindow && iEglWindow->IsRWindow()) |
|
81 { |
|
82 return ((RWindow*)(iEglWindow))->Size(); |
|
83 } |
|
84 else |
|
85 { |
|
86 return iSize; |
|
87 } |
|
88 } |
|
89 |
|
90 EXPORT_C TInt TNativeWindowType::ScreenNumber() const |
|
91 { |
|
92 if(iEglWindow && iEglWindow->IsRWindow()) |
|
93 { |
|
94 return ((RWindow*)(iEglWindow))->ScreenNumber(); |
|
95 } |
|
96 else |
|
97 { |
|
98 return KDefaultScreenNumber; |
|
99 } |
|
100 } |
|
101 |
|
102 EXPORT_C TBool TNativeWindowType::IsWindow() const |
|
103 { |
|
104 if(iEglWindow) |
|
105 { |
|
106 return iEglWindow->IsRWindow(); |
|
107 } |
|
108 else |
|
109 return EFalse; |
|
110 } |
40 |
111 |
41 namespace OpenVGRI |
112 namespace OpenVGRI |
42 { |
113 { |
43 //internal fucntions |
114 //internal fucntions |
44 VGImageFormat MapSymbianDisplayModeToVG(TDisplayMode aMode); |
115 VGImageFormat MapSymbianDisplayModeToVG(TDisplayMode aMode); |
99 catch(std::bad_alloc) |
170 catch(std::bad_alloc) |
100 { |
171 { |
101 return NULL; |
172 return NULL; |
102 } |
173 } |
103 |
174 |
104 REglWindowBase* winbase = (REglWindowBase*)window; |
175 ctx->iNativeWindowType = new TNativeWindowType(window); |
105 if(winbase->IsWindow() == EFalse) |
176 |
106 { |
177 if(ctx->iNativeWindowType->IsWindow()) |
107 ctx->iNativeWindowType = (TNativeWindowType*)window; |
178 { |
108 } |
179 ctx->iNativeWindowType->iSize.iHeight = ctx->iNativeWindowType->SizeInPixels().iHeight; |
109 else |
180 ctx->iNativeWindowType->iSize.iWidth = ctx->iNativeWindowType->SizeInPixels().iWidth; |
110 { |
181 } |
111 RDrawableWindow* drawableWindow = (RDrawableWindow*)window; |
|
112 ctx->iNativeWindowType = new TNativeWindowType; |
|
113 ctx->iNativeWindowType->iSize.iHeight = drawableWindow->Size().iHeight; |
|
114 ctx->iNativeWindowType->iSize.iWidth = drawableWindow->Size().iWidth; |
|
115 } |
|
116 |
|
117 return ctx; |
182 return ctx; |
118 } |
183 } |
119 |
184 |
120 void OSDestroyWindowContext(void* context) |
185 void OSDestroyWindowContext(void* context) |
121 { |
186 { |
122 OSWindowContext* ctx = (OSWindowContext*)context; |
187 OSWindowContext* ctx = (OSWindowContext*)context; |
123 if(ctx) |
188 if(ctx) |
124 { |
189 { |
|
190 delete ctx->iNativeWindowType; |
125 RI_DELETE(ctx); |
191 RI_DELETE(ctx); |
126 } |
192 } |
127 } |
193 } |
128 |
194 |
129 bool OSIsWindow(const void* context) |
195 bool OSIsWindow(const void* context) |
130 { |
196 { |
131 OSWindowContext* ctx = (OSWindowContext*)context; |
197 OSWindowContext* ctx = (OSWindowContext*)context; |
132 if(ctx) |
198 if(ctx) |
133 { |
199 { |
|
200 /* stub! |
|
201 * ToDo at least attempt to check if IsWindow:o |
|
202 * or what was the idea here? |
|
203 */ |
134 return true; |
204 return true; |
135 } |
205 } |
136 return false; |
206 return false; |
137 } |
207 } |
138 |
208 |
173 { |
243 { |
174 CFbsBitmap* bitmap = ctx->iNativeWindowType->iBitmap; |
244 CFbsBitmap* bitmap = ctx->iNativeWindowType->iBitmap; |
175 ReadPixelsToCFbsBitmap(*bitmap, w, h); |
245 ReadPixelsToCFbsBitmap(*bitmap, w, h); |
176 } |
246 } |
177 } |
247 } |
|
248 // do we need to do anything for OpenVG/GL?? |
178 } |
249 } |
179 |
250 |
180 void ReadPixelsToCFbsBitmap(CFbsBitmap& aBitmap, TUint aW, TUint aH) |
251 void ReadPixelsToCFbsBitmap(CFbsBitmap& aBitmap, TUint aW, TUint aH) |
181 { |
252 { |
182 TSize sz = aBitmap.SizeInPixels(); |
253 TSize sz = aBitmap.SizeInPixels(); |