34
|
1 |
/*
|
|
2 |
* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
|
|
3 |
* All rights reserved.
|
|
4 |
* This component and the accompanying materials are made available
|
|
5 |
* under the terms of "Eclipse Public License v1.0"
|
|
6 |
* which accompanies this distribution, and is available
|
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
8 |
*
|
|
9 |
* Initial Contributors:
|
|
10 |
* Nokia Corporation - initial contribution.
|
|
11 |
*
|
|
12 |
* Contributors:
|
|
13 |
*
|
|
14 |
* Description: Preview provider ECOM plugin
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
#ifndef PREVIEWPROVIDERCRP_H
|
|
20 |
#define PREVIEWPROVIDERCRP_H
|
|
21 |
|
|
22 |
// INCLUDES
|
|
23 |
#include <w32std.h>
|
|
24 |
#include <graphics/wsgraphicdrawerinterface.h>
|
|
25 |
#include <graphics/wsgraphicdrawer.h>
|
|
26 |
|
|
27 |
// Number of screenshots used at the same time,
|
|
28 |
// each window group change will cause a screenshot
|
|
29 |
// to one of these, the index for the current one is
|
|
30 |
// switched after each screenshot capture. (this is needed
|
|
31 |
// to prevent overwriting screenshots before the client could
|
|
32 |
// make a copy of them)
|
|
33 |
const TInt KMaxShots = 4;
|
|
34 |
|
|
35 |
/**
|
|
36 |
* Preview provider window server ECOM plugin class.
|
|
37 |
*/
|
|
38 |
NONSHARABLE_CLASS( CPreviewProviderCRP ) : public CWsGraphicDrawer,
|
|
39 |
public MWsEventHandler
|
|
40 |
{
|
|
41 |
public:
|
|
42 |
|
|
43 |
/**
|
|
44 |
* Creates a new instance of the plguin.
|
|
45 |
*
|
|
46 |
* @return Created instance.
|
|
47 |
*/
|
|
48 |
static CWsGraphicDrawer* CreateL();
|
|
49 |
|
|
50 |
/**
|
|
51 |
* Destructor
|
|
52 |
*/
|
|
53 |
~CPreviewProviderCRP();
|
|
54 |
|
|
55 |
private:
|
|
56 |
|
|
57 |
/**
|
|
58 |
* From CWsGraphicDrawer.
|
|
59 |
*
|
|
60 |
* @param aGc
|
|
61 |
* @param aRect
|
|
62 |
* @param aData
|
|
63 |
*/
|
|
64 |
void DoDraw( MWsGc& aGc, const TRect& aRect, const TDesC8& aData ) const;
|
|
65 |
|
|
66 |
/**
|
|
67 |
* Handles message from PreviewProviderClient.
|
|
68 |
*
|
|
69 |
* @param aData Message data.
|
|
70 |
*/
|
|
71 |
void HandleMessage( const TDesC8& aData );
|
|
72 |
|
|
73 |
/**
|
|
74 |
* 2nd phase constructor.
|
|
75 |
*
|
|
76 |
* @param aEnv
|
|
77 |
* @param aId
|
|
78 |
* @param aOwner
|
|
79 |
* @param aData
|
|
80 |
*/
|
|
81 |
void ConstructL( MWsGraphicDrawerEnvironment& aEnv,
|
|
82 |
const TGraphicDrawerId& aId,
|
|
83 |
MWsClient& aOwner,
|
|
84 |
const TDesC8& aData );
|
|
85 |
|
|
86 |
/**
|
|
87 |
* From MWsEventHandler.
|
|
88 |
*
|
|
89 |
* Observer for TWservCrEvent::EWindowGroupChanged to take the screenshot
|
|
90 |
* when application changes.
|
|
91 |
*
|
|
92 |
* @param aEvent
|
|
93 |
*/
|
|
94 |
void DoHandleEvent( const TWservCrEvent& aEvent );
|
|
95 |
|
|
96 |
private:
|
|
97 |
|
|
98 |
/**
|
|
99 |
* 2nd phase constructor.
|
|
100 |
*/
|
|
101 |
void ConstructL();
|
|
102 |
|
|
103 |
/**
|
|
104 |
* Handles application registration.
|
|
105 |
*
|
|
106 |
* @param aWgId Window group id.
|
|
107 |
*/
|
|
108 |
void Register( TInt aWgId );
|
|
109 |
|
|
110 |
/**
|
|
111 |
* Handler application unregistration.
|
|
112 |
*
|
|
113 |
* @param aWgId Window group id.
|
|
114 |
*/
|
|
115 |
void Unregister( TInt aWgId );
|
|
116 |
|
|
117 |
/*
|
|
118 |
* Allocate resources and take screenshot
|
|
119 |
*/
|
|
120 |
void ScreenshotL();
|
|
121 |
|
|
122 |
/**
|
|
123 |
* Takes the screenshot.
|
|
124 |
*/
|
|
125 |
void ScreenshotL( CFbsBitmap& aBitmap );
|
|
126 |
|
|
127 |
/**
|
|
128 |
* Remove bitmap reference fom list
|
|
129 |
*/
|
|
130 |
void RemoveScreenshot( TInt aBitmapHandle );
|
|
131 |
|
|
132 |
/**
|
|
133 |
* Remove all bitmaps overflow
|
|
134 |
*/
|
|
135 |
void CheckOverflow();
|
|
136 |
|
|
137 |
/**
|
|
138 |
* Handles message from PreviewProviderClient.
|
|
139 |
*
|
|
140 |
* @param aData Message data.
|
|
141 |
*/
|
|
142 |
void DoHandleMessageL( const TDesC8& aData );
|
|
143 |
|
|
144 |
/**
|
|
145 |
* Notifies the PreviewProviderClient when screenshot is ready for copying.
|
|
146 |
*/
|
|
147 |
void ScaleCompleteL(const CFbsBitmap& aBitmap);
|
|
148 |
|
|
149 |
/**
|
|
150 |
* Notifies the PreviewProviderClient when an application has been exited.
|
|
151 |
*/
|
|
152 |
void UnregisterComplete( TInt aWgId );
|
|
153 |
|
|
154 |
/**
|
|
155 |
* Notifies the PreviewProviderClient that specific bitmap needs rotation.
|
|
156 |
*/
|
|
157 |
void BitmapRotationNeeded( TInt aWgId, TBool aClockwise );
|
|
158 |
|
|
159 |
/**
|
|
160 |
* Uses window server front buffer to create a screenshot.
|
|
161 |
* @param aFront preallocated destination bitmap
|
|
162 |
* @param aFront Front buffer.
|
|
163 |
* @param aSrcSize Size of the source front buffer in pixels.
|
|
164 |
* @param aSrcStride Source stride.
|
|
165 |
*/
|
|
166 |
void FrontBufferScreenShot(
|
|
167 |
CFbsBitmap& aBitmap,
|
|
168 |
MWsFrontBuffer& aFront, const TSize& aSrcSize, TInt aSrcStride );
|
|
169 |
|
|
170 |
private:
|
|
171 |
TInt iScreen;
|
|
172 |
TInt iPrevId;
|
|
173 |
TInt iPrevReg; // to work around the problem with wgid not set when app brought
|
|
174 |
// to foreground first time
|
|
175 |
RPointerArray<CFbsBitmap> iScreenshots;
|
|
176 |
TSize iScreenshotSize;
|
|
177 |
TDisplayMode iScreenshotMode;
|
|
178 |
RArray<TInt> iWgIds;
|
|
179 |
TTime iScreenChangedTime; // fix for orientation changed/wg group changed problem
|
|
180 |
TBool iClockwiseRot; // for marking rotation direction
|
|
181 |
TBool iLastWgIdRedraw;
|
|
182 |
};
|
|
183 |
|
|
184 |
#endif // PREVIEWPROVIDERCRP_H
|
|
185 |
|
|
186 |
// End of file
|