VirtualBox

source: vbox/trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIFrameBuffer.h@ 82781

Last change on this file since 82781 was 76581, checked in by vboxsync, 5 years ago

Fe/QT: scm header guard alignment.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 5.7 KB
Line 
1/* $Id: UIFrameBuffer.h 76581 2019-01-01 06:24:57Z vboxsync $ */
2/** @file
3 * VBox Qt GUI - UIFrameBuffer class declaration.
4 */
5
6/*
7 * Copyright (C) 2010-2019 Oracle Corporation
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.virtualbox.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 FEQT_INCLUDED_SRC_runtime_UIFrameBuffer_h
19#define FEQT_INCLUDED_SRC_runtime_UIFrameBuffer_h
20#ifndef RT_WITHOUT_PRAGMA_ONCE
21# pragma once
22#endif
23
24/* Qt includes: */
25#include <QSize>
26
27/* GUI includes: */
28#include "UIExtraDataDefs.h"
29
30/* Other VBox includes: */
31#include <VBox/com/ptr.h>
32
33/* Forward declarations: */
34class UIFrameBufferPrivate;
35class UIMachineView;
36class QResizeEvent;
37class QPaintEvent;
38class QRegion;
39
40/** IFramebuffer implementation used to maintain VM display video memory. */
41class UIFrameBuffer : public QObject
42{
43 Q_OBJECT;
44
45public:
46
47#ifdef VBOX_WITH_VIDEOHWACCEL
48 /** Frame-buffer constructor.
49 * @param m_fAccelerate2DVideo defines whether we should use VBoxOverlayFrameBuffer
50 * instead of the default one. */
51 UIFrameBuffer(bool m_fAccelerate2DVideo);
52#else /* !VBOX_WITH_VIDEOHWACCEL */
53 /** Frame-buffer constructor. */
54 UIFrameBuffer();
55#endif /* !VBOX_WITH_VIDEOHWACCEL */
56
57 /** Frame-buffer destructor. */
58 ~UIFrameBuffer();
59
60 /** Frame-buffer initialization.
61 * @param pMachineView defines machine-view this frame-buffer is bounded to. */
62 HRESULT init(UIMachineView *pMachineView);
63
64 /** Assigns machine-view frame-buffer will be bounded to.
65 * @param pMachineView defines machine-view this frame-buffer is bounded to. */
66 void setView(UIMachineView *pMachineView);
67
68 /** Attach frame-buffer to the Display. */
69 void attach();
70 /** Detach frame-buffer from the Display. */
71 void detach();
72
73 /** Returns frame-buffer data address. */
74 uchar* address();
75 /** Returns frame-buffer width. */
76 ulong width() const;
77 /** Returns frame-buffer height. */
78 ulong height() const;
79 /** Returns frame-buffer bits-per-pixel value. */
80 ulong bitsPerPixel() const;
81 /** Returns frame-buffer bytes-per-line value. */
82 ulong bytesPerLine() const;
83 /** Returns the visual-state this frame-buffer is used for. */
84 UIVisualStateType visualState() const;
85
86 /** Defines whether frame-buffer is <b>unused</b>.
87 * @note Calls to this and any other EMT callback are synchronized (from GUI side). */
88 void setMarkAsUnused(bool fUnused);
89
90 /** Returns whether frame-buffer is <b>auto-enabled</b>.
91 * @note Refer to m_fAutoEnabled for more information. */
92 bool isAutoEnabled() const;
93 /** Defines whether frame-buffer is <b>auto-enabled</b>.
94 * @note Refer to m_fAutoEnabled for more information. */
95 void setAutoEnabled(bool fAutoEnabled);
96
97 /** Returns the frame-buffer's scaled-size. */
98 QSize scaledSize() const;
99 /** Defines host-to-guest scale ratio as @a size. */
100 void setScaledSize(const QSize &size = QSize());
101 /** Returns x-origin of the guest (actual) content corresponding to x-origin of host (scaled) content. */
102 int convertHostXTo(int iX) const;
103 /** Returns y-origin of the guest (actual) content corresponding to y-origin of host (scaled) content. */
104 int convertHostYTo(int iY) const;
105
106 /** Returns the scale-factor used by the frame-buffer. */
107 double scaleFactor() const;
108 /** Define the scale-factor used by the frame-buffer. */
109 void setScaleFactor(double dScaleFactor);
110
111 /** Returns device-pixel-ratio set for HiDPI frame-buffer. */
112 double devicePixelRatio() const;
113 /** Defines device-pixel-ratio set for HiDPI frame-buffer. */
114 void setDevicePixelRatio(double dDevicePixelRatio);
115 /** Returns actual device-pixel-ratio set for HiDPI frame-buffer. */
116 double devicePixelRatioActual() const;
117 /** Defines actual device-pixel-ratio set for HiDPI frame-buffer. */
118 void setDevicePixelRatioActual(double dDevicePixelRatioActual);
119
120 /** Returns whether frame-buffer should use unscaled HiDPI output. */
121 bool useUnscaledHiDPIOutput() const;
122 /** Defines whether frame-buffer should use unscaled HiDPI output. */
123 void setUseUnscaledHiDPIOutput(bool fUseUnscaledHiDPIOutput);
124
125 /** Returns the frame-buffer scaling optimization type. */
126 ScalingOptimizationType scalingOptimizationType() const;
127 /** Defines the frame-buffer scaling optimization type. */
128 void setScalingOptimizationType(ScalingOptimizationType type);
129
130 /** Handles frame-buffer notify-change-event. */
131 void handleNotifyChange(int iWidth, int iHeight);
132 /** Handles frame-buffer paint-event. */
133 void handlePaintEvent(QPaintEvent *pEvent);
134 /** Handles frame-buffer set-visible-region-event. */
135 void handleSetVisibleRegion(const QRegion &region);
136
137 /** Performs frame-buffer resizing. */
138 void performResize(int iWidth, int iHeight);
139 /** Performs frame-buffer rescaling. */
140 void performRescale();
141
142#ifdef VBOX_WITH_VIDEOHWACCEL
143 /** Performs Video HW Acceleration command. */
144 void doProcessVHWACommand(QEvent *pEvent);
145 /** Handles viewport resize-event. */
146 void viewportResized(QResizeEvent *pEvent);
147 /** Handles viewport scroll-event. */
148 void viewportScrolled(int iX, int iY);
149#endif /* VBOX_WITH_VIDEOHWACCEL */
150
151private:
152
153 /** Holds the frame-buffer private instance. */
154 ComObjPtr<UIFrameBufferPrivate> m_pFrameBuffer;
155};
156
157#endif /* !FEQT_INCLUDED_SRC_runtime_UIFrameBuffer_h */
Note: See TracBrowser for help on using the repository browser.

© 2023 Oracle
ContactPrivacy policyTerms of Use