VirtualBox

source: vbox/trunk/src/VBox/Main/include/DisplayImpl.h@ 52934

最後變更 在這個檔案從52934是 52901,由 vboxsync 提交於 10 年 前

Main: trailing spaces + warning

  • 屬性 svn:eol-style 設為 native
  • 屬性 svn:keywords 設為 Author Date Id Revision
檔案大小: 22.0 KB
 
1/* $Id: DisplayImpl.h 52901 2014-09-30 15:32:03Z vboxsync $ */
2/** @file
3 * VirtualBox COM class implementation
4 */
5
6/*
7 * Copyright (C) 2006-2014 Oracle Corporation
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.alldomusa.eu.org. This file is free software;
11 * you can redistribute it and/or modify it under the terms of the GNU
12 * General Public License (GPL) as published by the Free Software
13 * Foundation, in version 2 as it comes in the "COPYING" file of the
14 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16 */
17
18#ifndef ____H_DISPLAYIMPL
19#define ____H_DISPLAYIMPL
20
21#include "SchemaDefs.h"
22
23#include <iprt/semaphore.h>
24#include <VBox/vmm/pdmdrv.h>
25#include <VBox/VMMDev.h>
26#include <VBox/VBoxVideo.h>
27#include <VBox/vmm/pdmifs.h>
28#include "DisplayWrap.h"
29
30#ifdef VBOX_WITH_CROGL
31# include <VBox/HostServices/VBoxCrOpenGLSvc.h>
32#endif
33
34#include "DisplaySourceBitmapWrap.h"
35
36class Console;
37struct VIDEORECCONTEXT;
38
39typedef struct _DISPLAYFBINFO
40{
41 /* The following 3 fields (u32Offset, u32MaxFramebufferSize and u32InformationSize)
42 * are not used by the current HGSMI. They are needed for backward compatibility with
43 * pre-HGSMI additions.
44 */
45 uint32_t u32Offset;
46 uint32_t u32MaxFramebufferSize;
47 uint32_t u32InformationSize;
48
49 ComPtr<IFramebuffer> pFramebuffer;
50 ComPtr<IDisplaySourceBitmap> pSourceBitmap;
51 bool fDisabled;
52
53 uint32_t u32Caps;
54
55 struct
56 {
57 ComPtr<IDisplaySourceBitmap> pSourceBitmap;
58 uint8_t *pu8Address;
59 uint32_t cbLine;
60 } updateImage;
61
62 LONG xOrigin;
63 LONG yOrigin;
64
65 ULONG w;
66 ULONG h;
67
68 uint16_t u16BitsPerPixel;
69 uint8_t *pu8FramebufferVRAM;
70 uint32_t u32LineSize;
71
72 uint16_t flags;
73
74 VBOXVIDEOINFOHOSTEVENTS *pHostEvents;
75
76 /** The framebuffer has default format and must be updates immediately. */
77 bool fDefaultFormat;
78
79#ifdef VBOX_WITH_HGSMI
80 bool fVBVAEnabled;
81 bool fVBVAForceResize;
82 bool fRenderThreadMode;
83 PVBVAHOSTFLAGS pVBVAHostFlags;
84#endif /* VBOX_WITH_HGSMI */
85
86#ifdef VBOX_WITH_CROGL
87 struct
88 {
89 bool fPending;
90 ULONG x;
91 ULONG y;
92 ULONG width;
93 ULONG height;
94 } pendingViewportInfo;
95#endif /* VBOX_WITH_CROGL */
96} DISPLAYFBINFO;
97
98/* The legacy VBVA (VideoAccel) data.
99 *
100 * Backward compatibility with the guest additions 3.x or older.
101 */
102typedef struct VIDEOACCEL
103{
104 VBVAMEMORY *pVbvaMemory;
105 bool fVideoAccelEnabled;
106
107 uint8_t *pu8VbvaPartial;
108 uint32_t cbVbvaPartial;
109
110 /* Old guest additions (3.x and older) use both VMMDev and DevVGA refresh timer
111 * to process the VBVABUFFER memory. Therefore the legacy VBVA (VideoAccel) host
112 * code can be executed concurrently by VGA refresh timer and the guest VMMDev
113 * request in SMP VMs. The semaphore serialized this.
114 */
115 RTSEMXROADS hXRoadsVideoAccel;
116
117} VIDEOACCEL;
118
119class DisplayMouseInterface
120{
121public:
122 virtual HRESULT i_getScreenResolution(ULONG cScreen, ULONG *pcx,
123 ULONG *pcy, ULONG *pcBPP, LONG *pXOrigin, LONG *pYOrigin) = 0;
124 virtual void i_getFramebufferDimensions(int32_t *px1, int32_t *py1,
125 int32_t *px2, int32_t *py2) = 0;
126};
127
128class VMMDev;
129
130class ATL_NO_VTABLE Display :
131 public DisplayWrap,
132 public DisplayMouseInterface
133{
134public:
135
136 DECLARE_EMPTY_CTOR_DTOR(Display)
137
138 HRESULT FinalConstruct();
139 void FinalRelease();
140
141 // public initializer/uninitializer for internal purposes only
142 HRESULT init(Console *aParent);
143 void uninit();
144 int i_registerSSM(PUVM pUVM);
145
146 // public methods only for internal purposes
147 int i_handleDisplayResize(unsigned uScreenId, uint32_t bpp, void *pvVRAM, uint32_t cbLine,
148 uint32_t w, uint32_t h, uint16_t flags);
149 void i_handleDisplayUpdate(unsigned uScreenId, int x, int y, int w, int h);
150#ifdef VBOX_WITH_VIDEOHWACCEL
151 int i_handleVHWACommandProcess(PVBOXVHWACMD pCommand);
152#endif
153#ifdef VBOX_WITH_CRHGSMI
154 void i_handleCrHgsmiCommandCompletion(int32_t result, uint32_t u32Function, PVBOXHGCMSVCPARM pParam);
155 void i_handleCrHgsmiControlCompletion(int32_t result, uint32_t u32Function, PVBOXHGCMSVCPARM pParam);
156 void i_handleCrHgsmiCommandProcess(PVBOXVDMACMD_CHROMIUM_CMD pCmd, uint32_t cbCmd);
157 void i_handleCrHgsmiControlProcess(PVBOXVDMACMD_CHROMIUM_CTL pCtl, uint32_t cbCtl);
158#endif
159#if defined(VBOX_WITH_HGCM) && defined(VBOX_WITH_CROGL)
160 int i_handleCrHgcmCtlSubmit(struct VBOXCRCMDCTL* pCmd, uint32_t cbCmd,
161 PFNCRCTLCOMPLETION pfnCompletion,
162 void *pvCompletion);
163 void i_handleCrVRecScreenshotPerform(uint32_t uScreen,
164 uint32_t x, uint32_t y, uint32_t uPixelFormat, uint32_t uBitsPerPixel,
165 uint32_t uBytesPerLine, uint32_t uGuestWidth, uint32_t uGuestHeight,
166 uint8_t *pu8BufferAddress, uint64_t u64TimeStamp);
167 bool i_handleCrVRecScreenshotBegin(uint32_t uScreen, uint64_t u64TimeStamp);
168 void i_handleCrVRecScreenshotEnd(uint32_t uScreen, uint64_t u64TimeStamp);
169 void i_handleVRecCompletion();
170#endif
171
172 int i_notifyCroglResize(const PVBVAINFOVIEW pView, const PVBVAINFOSCREEN pScreen, void *pvVRAM);
173
174 int i_handleSetVisibleRegion(uint32_t cRect, PRTRECT pRect);
175 int i_handleQueryVisibleRegion(uint32_t *pcRect, PRTRECT pRect);
176
177 void i_VideoAccelVRDP(bool fEnable);
178
179 /* Legacy video acceleration requests coming from the VGA refresh timer. */
180 int VideoAccelEnableVGA(bool fEnable, VBVAMEMORY *pVbvaMemory);
181
182 /* Legacy video acceleration requests coming from VMMDev. */
183 int VideoAccelEnableVMMDev(bool fEnable, VBVAMEMORY *pVbvaMemory);
184 void VideoAccelFlushVMMDev(void);
185
186 int i_VideoCaptureStart();
187 void i_VideoCaptureStop();
188 int i_VideoCaptureEnableScreens(ComSafeArrayIn(BOOL, aScreens));
189
190 void i_notifyPowerDown(void);
191
192 // DisplayMouseInterface methods
193 virtual HRESULT i_getScreenResolution(ULONG cScreen, ULONG *pcx,
194 ULONG *pcy, ULONG *pcBPP, LONG *pXOrigin, LONG *pYOrigin)
195 {
196 return getScreenResolution(cScreen, pcx, pcy, pcBPP, pXOrigin, pYOrigin);
197 }
198 virtual void i_getFramebufferDimensions(int32_t *px1, int32_t *py1,
199 int32_t *px2, int32_t *py2);
200
201 static const PDMDRVREG DrvReg;
202
203private:
204 // Wrapped IDisplay properties
205
206 // Wrapped IDisplay methods
207 virtual HRESULT getScreenResolution(ULONG aScreenId,
208 ULONG *aWidth,
209 ULONG *aHeight,
210 ULONG *aBitsPerPixel,
211 LONG *aXOrigin,
212 LONG *aYOrigin);
213 virtual HRESULT attachFramebuffer(ULONG aScreenId,
214 const ComPtr<IFramebuffer> &aFramebuffer);
215 virtual HRESULT detachFramebuffer(ULONG aScreenId);
216 virtual HRESULT queryFramebuffer(ULONG aScreenId,
217 ComPtr<IFramebuffer> &aFramebuffer);
218 virtual HRESULT setVideoModeHint(ULONG aDisplay,
219 BOOL aEnabled,
220 BOOL aChangeOrigin,
221 LONG aOriginX,
222 LONG aOriginY,
223 ULONG aWidth,
224 ULONG aHeight,
225 ULONG aBitsPerPixel);
226 virtual HRESULT setSeamlessMode(BOOL aEnabled);
227 virtual HRESULT takeScreenShot(ULONG aScreenId,
228 BYTE *aAddress,
229 ULONG aWidth,
230 ULONG aHeight,
231 BitmapFormat_T aBitmapFormat);
232 virtual HRESULT takeScreenShotToArray(ULONG aScreenId,
233 ULONG aWidth,
234 ULONG aHeight,
235 BitmapFormat_T aBitmapFormat,
236 std::vector<BYTE> &aScreenData);
237 virtual HRESULT drawToScreen(ULONG aScreenId,
238 BYTE *aAddress,
239 ULONG aX,
240 ULONG aY,
241 ULONG aWidth,
242 ULONG aHeight);
243 virtual HRESULT invalidateAndUpdate();
244 virtual HRESULT invalidateAndUpdateScreen(ULONG aScreenId);
245 virtual HRESULT completeVHWACommand(BYTE *aCommand);
246 virtual HRESULT viewportChanged(ULONG aScreenId,
247 ULONG aX,
248 ULONG aY,
249 ULONG aWidth,
250 ULONG aHeight);
251 virtual HRESULT querySourceBitmap(ULONG aScreenId,
252 ComPtr<IDisplaySourceBitmap> &aDisplaySourceBitmap);
253
254 // Wrapped IEventListener properties
255
256 // Wrapped IEventListener methods
257 virtual HRESULT handleEvent(const ComPtr<IEvent> &aEvent);
258
259 // other internal methods
260 HRESULT takeScreenShotWorker(ULONG aScreenId,
261 BYTE *aAddress,
262 ULONG aWidth,
263 ULONG aHeight,
264 BitmapFormat_T aBitmapFormat,
265 ULONG *pcbOut);
266
267#ifdef VBOX_WITH_CRHGSMI
268 void i_setupCrHgsmiData(void);
269 void i_destructCrHgsmiData(void);
270#endif
271
272#if defined(VBOX_WITH_HGCM) && defined(VBOX_WITH_CROGL)
273 int i_crViewportNotify(ULONG aScreenId, ULONG x, ULONG y, ULONG width, ULONG height);
274#endif
275
276 static DECLCALLBACK(void*) i_drvQueryInterface(PPDMIBASE pInterface, const char *pszIID);
277 static DECLCALLBACK(int) i_drvConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfg, uint32_t fFlags);
278 static DECLCALLBACK(void) i_drvDestruct(PPDMDRVINS pDrvIns);
279 static DECLCALLBACK(int) i_displayResizeCallback(PPDMIDISPLAYCONNECTOR pInterface, uint32_t bpp, void *pvVRAM,
280 uint32_t cbLine, uint32_t cx, uint32_t cy);
281 static DECLCALLBACK(void) i_displayUpdateCallback(PPDMIDISPLAYCONNECTOR pInterface,
282 uint32_t x, uint32_t y, uint32_t cx, uint32_t cy);
283 static DECLCALLBACK(void) i_displayRefreshCallback(PPDMIDISPLAYCONNECTOR pInterface);
284 static DECLCALLBACK(void) i_displayResetCallback(PPDMIDISPLAYCONNECTOR pInterface);
285 static DECLCALLBACK(void) i_displayLFBModeChangeCallback(PPDMIDISPLAYCONNECTOR pInterface, bool fEnabled);
286 static DECLCALLBACK(void) i_displayProcessAdapterDataCallback(PPDMIDISPLAYCONNECTOR pInterface,
287 void *pvVRAM, uint32_t u32VRAMSize);
288 static DECLCALLBACK(void) i_displayProcessDisplayDataCallback(PPDMIDISPLAYCONNECTOR pInterface,
289 void *pvVRAM, unsigned uScreenId);
290
291#ifdef VBOX_WITH_VIDEOHWACCEL
292 static DECLCALLBACK(int) i_displayVHWACommandProcess(PPDMIDISPLAYCONNECTOR pInterface, PVBOXVHWACMD pCommand);
293#endif
294
295#ifdef VBOX_WITH_CRHGSMI
296 static DECLCALLBACK(void) i_displayCrHgsmiCommandProcess(PPDMIDISPLAYCONNECTOR pInterface,
297 PVBOXVDMACMD_CHROMIUM_CMD pCmd, uint32_t cbCmd);
298 static DECLCALLBACK(void) i_displayCrHgsmiControlProcess(PPDMIDISPLAYCONNECTOR pInterface, PVBOXVDMACMD_CHROMIUM_CTL pCtl,
299 uint32_t cbCtl);
300
301 static DECLCALLBACK(void) i_displayCrHgsmiCommandCompletion(int32_t result, uint32_t u32Function, PVBOXHGCMSVCPARM pParam,
302 void *pvContext);
303 static DECLCALLBACK(void) i_displayCrHgsmiControlCompletion(int32_t result, uint32_t u32Function, PVBOXHGCMSVCPARM pParam,
304 void *pvContext);
305#endif
306#if defined(VBOX_WITH_HGCM) && defined(VBOX_WITH_CROGL)
307 static DECLCALLBACK(int) i_displayCrHgcmCtlSubmit(PPDMIDISPLAYCONNECTOR pInterface,
308 struct VBOXCRCMDCTL* pCmd, uint32_t cbCmd,
309 PFNCRCTLCOMPLETION pfnCompletion,
310 void *pvCompletion);
311 static DECLCALLBACK(void) i_displayCrHgcmCtlSubmitCompletion(int32_t result, uint32_t u32Function, PVBOXHGCMSVCPARM pParam,
312 void *pvContext);
313#endif
314#ifdef VBOX_WITH_HGSMI
315 static DECLCALLBACK(int) i_displayVBVAEnable(PPDMIDISPLAYCONNECTOR pInterface, unsigned uScreenId,
316 PVBVAHOSTFLAGS pHostFlags, bool fRenderThreadMode);
317 static DECLCALLBACK(void) i_displayVBVADisable(PPDMIDISPLAYCONNECTOR pInterface, unsigned uScreenId);
318 static DECLCALLBACK(void) i_displayVBVAUpdateBegin(PPDMIDISPLAYCONNECTOR pInterface, unsigned uScreenId);
319 static DECLCALLBACK(void) i_displayVBVAUpdateProcess(PPDMIDISPLAYCONNECTOR pInterface, unsigned uScreenId,
320 const PVBVACMDHDR pCmd, size_t cbCmd);
321 static DECLCALLBACK(void) i_displayVBVAUpdateEnd(PPDMIDISPLAYCONNECTOR pInterface, unsigned uScreenId, int32_t x, int32_t y,
322 uint32_t cx, uint32_t cy);
323 static DECLCALLBACK(int) i_displayVBVAResize(PPDMIDISPLAYCONNECTOR pInterface, const PVBVAINFOVIEW pView,
324 const PVBVAINFOSCREEN pScreen, void *pvVRAM);
325 static DECLCALLBACK(int) i_displayVBVAMousePointerShape(PPDMIDISPLAYCONNECTOR pInterface, bool fVisible, bool fAlpha,
326 uint32_t xHot, uint32_t yHot, uint32_t cx, uint32_t cy,
327 const void *pvShape);
328#endif
329
330#if defined(VBOX_WITH_HGCM) && defined(VBOX_WITH_CROGL)
331 static DECLCALLBACK(void) i_displayCrVRecScreenshotPerform(void *pvCtx, uint32_t uScreen,
332 uint32_t x, uint32_t y,
333 uint32_t uBitsPerPixel, uint32_t uBytesPerLine,
334 uint32_t uGuestWidth, uint32_t uGuestHeight,
335 uint8_t *pu8BufferAddress, uint64_t u64TimeStamp);
336 static DECLCALLBACK(bool) i_displayCrVRecScreenshotBegin(void *pvCtx, uint32_t uScreen, uint64_t u64TimeStamp);
337 static DECLCALLBACK(void) i_displayCrVRecScreenshotEnd(void *pvCtx, uint32_t uScreen, uint64_t u64TimeStamp);
338
339 static DECLCALLBACK(void) i_displayVRecCompletion(struct VBOXCRCMDCTL* pCmd, uint32_t cbCmd, int rc, void *pvCompletion);
340#endif
341 static DECLCALLBACK(void) i_displayCrCmdFree(struct VBOXCRCMDCTL* pCmd, uint32_t cbCmd, int rc, void *pvCompletion);
342
343 static DECLCALLBACK(void) i_displaySSMSaveScreenshot(PSSMHANDLE pSSM, void *pvUser);
344 static DECLCALLBACK(int) i_displaySSMLoadScreenshot(PSSMHANDLE pSSM, void *pvUser, uint32_t uVersion, uint32_t uPass);
345 static DECLCALLBACK(void) i_displaySSMSave(PSSMHANDLE pSSM, void *pvUser);
346 static DECLCALLBACK(int) i_displaySSMLoad(PSSMHANDLE pSSM, void *pvUser, uint32_t uVersion, uint32_t uPass);
347
348 Console * const mParent;
349 /** Pointer to the associated display driver. */
350 struct DRVMAINDISPLAY *mpDrv;
351 /** Pointer to the device instance for the VMM Device. */
352 PPDMDEVINS mpVMMDev;
353 /** Set after the first attempt to find the VMM Device. */
354 bool mfVMMDevInited;
355
356 unsigned mcMonitors;
357 DISPLAYFBINFO maFramebuffers[SchemaDefs::MaxGuestMonitors];
358
359 bool mfSourceBitmapEnabled;
360 bool volatile fVGAResizing;
361
362 bool mfVideoAccelVRDP;
363 uint32_t mfu32SupportedOrders;
364 int32_t volatile mcVideoAccelVRDPRefs;
365
366#ifdef VBOX_WITH_CROGL
367 bool mfCrOglDataHidden;
368#endif
369
370#ifdef VBOX_WITH_CRHGSMI
371 /* for fast host hgcm calls */
372 HGCMCVSHANDLE mhCrOglSvc;
373 RTCRITSECTRW mCrOglLock;
374#endif
375#ifdef VBOX_WITH_CROGL
376 CR_MAIN_INTERFACE mCrOglCallbacks;
377 volatile uint32_t mfCrOglVideoRecState;
378 CRVBOXHGCMTAKESCREENSHOT mCrOglScreenshotData;
379 VBOXCRCMDCTL_HGCM mCrOglScreenshotCtl;
380#endif
381
382 void i_handleResizeCompletedEMT(unsigned uScreenId, BOOL fResizeContext);
383
384 /* The legacy VBVA data and methods. */
385 VIDEOACCEL mVideoAccelLegacy;
386
387 int i_VideoAccelEnable(bool fEnable, VBVAMEMORY *pVbvaMemory, PPDMIDISPLAYPORT pUpPort);
388 void i_VideoAccelFlush(PPDMIDISPLAYPORT pUpPort);
389 bool i_VideoAccelAllowed(void);
390
391 int i_videoAccelRefreshProcess(PPDMIDISPLAYPORT pUpPort);
392 int i_videoAccelEnable(bool fEnable, VBVAMEMORY *pVbvaMemory, PPDMIDISPLAYPORT pUpPort);
393 int i_videoAccelFlush(PPDMIDISPLAYPORT pUpPort);
394
395 /* Legacy pre-HGSMI handlers. */
396 void processAdapterData(void *pvVRAM, uint32_t u32VRAMSize);
397 void processDisplayData(void *pvVRAM, unsigned uScreenId);
398
399 /* Serializes access to mVideoAccelLegacy and mfVideoAccelVRDP, etc between VRDP and Display. */
400 RTCRITSECT mVideoAccelLock;
401
402public:
403
404 static int i_displayTakeScreenshotEMT(Display *pDisplay, ULONG aScreenId, uint8_t **ppu8Data, size_t *pcbData,
405 uint32_t *pu32Width, uint32_t *pu32Height);
406
407#if defined(VBOX_WITH_HGCM) && defined(VBOX_WITH_CROGL)
408 static BOOL i_displayCheckTakeScreenshotCrOgl(Display *pDisplay, ULONG aScreenId, uint8_t *pu8Data,
409 uint32_t u32Width, uint32_t u32Height);
410 int i_crCtlSubmit(struct VBOXCRCMDCTL* pCmd, uint32_t cbCmd, PFNCRCTLCOMPLETION pfnCompletion, void *pvCompletion);
411 int i_crCtlSubmitSync(struct VBOXCRCMDCTL* pCmd, uint32_t cbCmd);
412 /* copies the given command and submits it asynchronously,
413 * i.e. the pCmd data may be discarded right after the call returns */
414 int i_crCtlSubmitAsyncCmdCopy(struct VBOXCRCMDCTL* pCmd, uint32_t cbCmd);
415 /* performs synchronous request processing if 3D backend has something to display
416 * this is primarily to work-around 3d<->main thread deadlocks on OSX
417 * in case of async completion, the command is coppied to the allocated buffer,
418 * freeded on command completion
419 * can be used for "notification" commands, when client is not interested in command result,
420 * that must synchronize with 3D backend only when some 3D data is displayed.
421 * The routine does NOT provide any info on whether command is processed asynchronously or not */
422 int i_crCtlSubmitSyncIfHasDataForScreen(uint32_t u32ScreenID, struct VBOXCRCMDCTL* pCmd, uint32_t cbCmd);
423#endif
424
425private:
426 static int i_InvalidateAndUpdateEMT(Display *pDisplay, unsigned uId, bool fUpdateAll);
427 static int i_drawToScreenEMT(Display *pDisplay, ULONG aScreenId, BYTE *address, ULONG x, ULONG y, ULONG width, ULONG height);
428
429#if defined(VBOX_WITH_HGCM) && defined(VBOX_WITH_CROGL)
430 int i_crOglWindowsShow(bool fShow);
431#endif
432
433#ifdef VBOX_WITH_HGSMI
434 volatile uint32_t mu32UpdateVBVAFlags;
435#endif
436
437#ifdef VBOX_WITH_VPX
438 VIDEORECCONTEXT *mpVideoRecCtx;
439 bool maVideoRecEnabled[SchemaDefs::MaxGuestMonitors];
440#endif
441};
442
443/* The legacy VBVA helpers. */
444int videoAccelConstruct(VIDEOACCEL *pVideoAccel);
445void videoAccelDestroy(VIDEOACCEL *pVideoAccel);
446void i_vbvaSetMemoryFlags(VBVAMEMORY *pVbvaMemory,
447 bool fVideoAccelEnabled,
448 bool fVideoAccelVRDP,
449 uint32_t fu32SupportedOrders,
450 DISPLAYFBINFO *paFBInfos,
451 unsigned cFBInfos);
452int videoAccelEnterVGA(VIDEOACCEL *pVideoAccel);
453void videoAccelLeaveVGA(VIDEOACCEL *pVideoAccel);
454int videoAccelEnterVMMDev(VIDEOACCEL *pVideoAccel);
455void videoAccelLeaveVMMDev(VIDEOACCEL *pVideoAccel);
456
457
458/* helper function, code in DisplayResampleImage.cpp */
459void gdImageCopyResampled(uint8_t *dst, uint8_t *src,
460 int dstX, int dstY, int srcX, int srcY,
461 int dstW, int dstH, int srcW, int srcH);
462
463void BitmapScale32(uint8_t *dst, int dstW, int dstH,
464 const uint8_t *src, int iDeltaLine, int srcW, int srcH);
465
466/* helper function, code in DisplayPNGUtul.cpp */
467int DisplayMakePNG(uint8_t *pu8Data, uint32_t cx, uint32_t cy,
468 uint8_t **ppu8PNG, uint32_t *pcbPNG, uint32_t *pcxPNG, uint32_t *pcyPNG,
469 uint8_t fLimitSize);
470
471class ATL_NO_VTABLE DisplaySourceBitmap:
472 public DisplaySourceBitmapWrap
473{
474public:
475
476 DECLARE_EMPTY_CTOR_DTOR(DisplaySourceBitmap)
477
478 HRESULT FinalConstruct();
479 void FinalRelease();
480
481 /* Public initializer/uninitializer for internal purposes only. */
482 HRESULT init(ComObjPtr<Display> pDisplay, unsigned uScreenId, DISPLAYFBINFO *pFBInfo);
483 void uninit();
484
485 bool i_usesVRAM(void) { return m.pu8Allocated == NULL; }
486
487private:
488 // wrapped IDisplaySourceBitmap properties
489 virtual HRESULT getScreenId(ULONG *aScreenId);
490
491 // wrapped IDisplaySourceBitmap methods
492 virtual HRESULT queryBitmapInfo(BYTE **aAddress,
493 ULONG *aWidth,
494 ULONG *aHeight,
495 ULONG *aBitsPerPixel,
496 ULONG *aBytesPerLine,
497 ULONG *aPixelFormat);
498
499 int initSourceBitmap(unsigned aScreenId, DISPLAYFBINFO *pFBInfo);
500
501 struct Data
502 {
503 ComObjPtr<Display> pDisplay;
504 unsigned uScreenId;
505 DISPLAYFBINFO *pFBInfo;
506
507 uint8_t *pu8Allocated;
508
509 uint8_t *pu8Address;
510 ULONG ulWidth;
511 ULONG ulHeight;
512 ULONG ulBitsPerPixel;
513 ULONG ulBytesPerLine;
514 ULONG ulPixelFormat;
515 };
516
517 Data m;
518};
519
520#endif // ____H_DISPLAYIMPL
521/* vi: set tabstop=4 shiftwidth=4 expandtab: */
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette