|
1 /* Copyright (c) 2009 The Khronos Group Inc. |
|
2 * |
|
3 * Permission is hereby granted, free of charge, to any person obtaining a |
|
4 * copy of this software and/or associated documentation files (the |
|
5 * "Materials"), to deal in the Materials without restriction, including |
|
6 * without limitation the rights to use, copy, modify, merge, publish, |
|
7 * distribute, sublicense, and/or sell copies of the Materials, and to |
|
8 * permit persons to whom the Materials are furnished to do so, subject to |
|
9 * the following conditions: |
|
10 * |
|
11 * The above copyright notice and this permission notice shall be included |
|
12 * in all copies or substantial portions of the Materials. |
|
13 * |
|
14 * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
|
15 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
|
16 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. |
|
17 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY |
|
18 * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, |
|
19 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE |
|
20 * MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. |
|
21 */ |
|
22 |
|
23 #ifndef OWFDISPLAYCONTEXT_H |
|
24 #define OWFDISPLAYCONTEXT_H |
|
25 |
|
26 #include <e32base.h> |
|
27 |
|
28 #include <dispchannel.h> |
|
29 #include "owfmemory.h" |
|
30 #include "owfscreen.h" |
|
31 #include "owfdisplaycontextgeneral.h" |
|
32 |
|
33 #define _OWF_DISPLAYCONTEXT(x) (static_cast<OWFDisplayContext *>(x)) |
|
34 |
|
35 struct TBufferAddress |
|
36 { |
|
37 RChunk iChunk; |
|
38 TInt iOffset; |
|
39 TUint8* iAddress; |
|
40 }; |
|
41 |
|
42 /** |
|
43 Container that allocates and destroys the chunks used by the scratch buffers. |
|
44 */ |
|
45 class COwfScratchBuffers : public CBase |
|
46 { |
|
47 public: |
|
48 void* Allocate(TInt aMinSize); |
|
49 void Destroy(void* aAddress); |
|
50 ~COwfScratchBuffers(); |
|
51 private: |
|
52 RArray <TBufferAddress> iBuffers; |
|
53 }; |
|
54 |
|
55 class COWFScreenDisplayInfo : public CBase |
|
56 { |
|
57 public: |
|
58 ~COWFScreenDisplayInfo(); |
|
59 static COWFScreenDisplayInfo* NewL(TInt aScreen); |
|
60 TInt ScreenNumber() const; |
|
61 void GetScreenInfo(OWF_SCREEN *header) const; |
|
62 OWFboolean Blit(void* buffer, OWF_ROTATION rotation); |
|
63 |
|
64 private: |
|
65 COWFScreenDisplayInfo(TInt aScreen); |
|
66 void ConstructL(); |
|
67 private: |
|
68 OWF_SCREEN iScreenInfo; |
|
69 mutable RDisplayChannel iDispChan; |
|
70 TInt iScreenNumber; |
|
71 RArray <TBufferAddress*> iCompositionBuffer; |
|
72 RDisplayChannel::TDisplayRotation iDefaultRotation; |
|
73 TInt iRotationOffset; |
|
74 }; |
|
75 |
|
76 class COwfcDisplayDevice : public CBase |
|
77 { |
|
78 private: |
|
79 static COwfcDisplayDevice* gDisplayDeviceInstancePtr; |
|
80 public: |
|
81 static COwfcDisplayDevice* SingletonInstance(); |
|
82 TInt OpenScreen(TInt aScreen); |
|
83 TInt CloseScreen(TInt aScreen, OWFboolean *aCanDelete); |
|
84 ~COwfcDisplayDevice(); |
|
85 public: |
|
86 static TBool ScreenCompare(const TInt* k, COWFScreenDisplayInfo* const & t) |
|
87 {return (*k == t->ScreenNumber());} |
|
88 RArray <COWFScreenDisplayInfo*> iScreenDisplayInfo; |
|
89 }; |
|
90 |
|
91 typedef struct OWFDisplayContext_ |
|
92 { |
|
93 public: |
|
94 COwfcDisplayDevice *iDisplayContext; |
|
95 COwfScratchBuffers iBuffers; |
|
96 WFCint iEventServerUpdate; |
|
97 WFCboolean iCompositionOngoing; |
|
98 WFCint iPreviousCommit; |
|
99 WFCint iSerialNumber; |
|
100 public: |
|
101 virtual ~OWFDisplayContext_(); |
|
102 } OWFDisplayContext; |
|
103 |
|
104 #endif //OWFDISPLAYCONTEXT_H |