VirtualBox

source: vbox/trunk/src/VBox/Main/FramebufferImpl.cpp@ 19798

Last change on this file since 19798 was 19798, checked in by vboxsync, 16 years ago

removed long obsolete methods IFramebuffer::solidFill() and IFramebuffer::copyScreenBits()

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 5.5 KB
Line 
1/** @file
2 *
3 * VirtualBox COM class implementation
4 */
5
6/*
7 * Copyright (C) 2006-2007 Sun Microsystems, Inc.
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 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
18 * Clara, CA 95054 USA or visit http://www.sun.com if you need
19 * additional information or have any questions.
20 */
21
22#include "FramebufferImpl.h"
23#include <iprt/semaphore.h>
24
25// constructor / destructor
26/////////////////////////////////////////////////////////////////////////////
27
28InternalFramebuffer::InternalFramebuffer()
29{
30 mData = NULL;
31 RTSemMutexCreate(&mMutex);
32}
33
34InternalFramebuffer::~InternalFramebuffer()
35{
36 RTSemMutexDestroy(mMutex);
37 if (mData)
38 delete mData;
39}
40
41// public methods only for internal purposes
42/////////////////////////////////////////////////////////////////////////////
43
44HRESULT InternalFramebuffer::init(ULONG width, ULONG height, ULONG depth)
45{
46 mWidth = width;
47 mHeight = height;
48 mBitsPerPixel = depth;
49 mBytesPerLine = ((width * depth + 31) / 32) * 4;
50 mData = new uint8_t [mBytesPerLine * height];
51 memset (mData, 0, mBytesPerLine * height);
52
53 return S_OK;
54}
55
56// IFramebuffer properties
57/////////////////////////////////////////////////////////////////////////////
58
59STDMETHODIMP InternalFramebuffer::COMGETTER(Address) (BYTE **address)
60{
61 CheckComArgOutPointerValid(address);
62 *address = mData;
63 return S_OK;
64}
65
66STDMETHODIMP InternalFramebuffer::COMGETTER(Width) (ULONG *width)
67{
68 CheckComArgOutPointerValid(width);
69 *width = mWidth;
70 return S_OK;
71}
72
73STDMETHODIMP InternalFramebuffer::COMGETTER(Height) (ULONG *height)
74{
75 CheckComArgOutPointerValid(height);
76 *height = mHeight;
77 return S_OK;
78}
79
80STDMETHODIMP InternalFramebuffer::COMGETTER(BitsPerPixel) (ULONG *bitsPerPixel)
81{
82 CheckComArgOutPointerValid(bitsPerPixel);
83 *bitsPerPixel = mBitsPerPixel;
84 return S_OK;
85}
86
87STDMETHODIMP InternalFramebuffer::COMGETTER(BytesPerLine) (ULONG *bytesPerLine)
88{
89 CheckComArgOutPointerValid(bytesPerLine);
90 *bytesPerLine = mBytesPerLine;
91 return S_OK;
92}
93
94STDMETHODIMP InternalFramebuffer::COMGETTER(PixelFormat) (ULONG *pixelFormat)
95{
96 CheckComArgOutPointerValid(pixelFormat);
97 *pixelFormat = FramebufferPixelFormat_FOURCC_RGB;
98 return S_OK;
99}
100
101STDMETHODIMP InternalFramebuffer::COMGETTER(UsesGuestVRAM) (BOOL *usesGuestVRAM)
102{
103 CheckComArgOutPointerValid(usesGuestVRAM);
104 *usesGuestVRAM = FALSE;
105 return S_OK;
106}
107
108STDMETHODIMP InternalFramebuffer::COMGETTER(HeightReduction) (ULONG *heightReduction)
109{
110 CheckComArgOutPointerValid(heightReduction);
111 /* no reduction */
112 *heightReduction = 0;
113 return S_OK;
114}
115
116STDMETHODIMP InternalFramebuffer::COMGETTER(Overlay) (IFramebufferOverlay **aOverlay)
117{
118 CheckComArgOutPointerValid(aOverlay);
119 /* no overlay */
120 *aOverlay = 0;
121 return S_OK;
122}
123
124STDMETHODIMP InternalFramebuffer::COMGETTER(WinId) (ULONG64 *winId)
125{
126 CheckComArgOutPointerValid(winId);
127 *winId = 0;
128 return S_OK;
129}
130
131// IFramebuffer methods
132/////////////////////////////////////////////////////////////////////////////
133
134STDMETHODIMP InternalFramebuffer::Lock()
135{
136 RTSemMutexRequest(mMutex, RT_INDEFINITE_WAIT);
137 return S_OK;
138}
139
140STDMETHODIMP InternalFramebuffer::Unlock()
141{
142 RTSemMutexRelease(mMutex);
143 return S_OK;
144}
145
146STDMETHODIMP InternalFramebuffer::NotifyUpdate(ULONG x, ULONG y,
147 ULONG w, ULONG h,
148 BOOL *finished)
149{
150 CheckComArgOutPointerValid(finished);
151 // no need for the caller to wait
152 *finished = true;
153 return S_OK;
154}
155
156STDMETHODIMP
157InternalFramebuffer::RequestResize(ULONG iScreenId, ULONG pixelFormat, BYTE *vram,
158 ULONG bpp, ULONG bpl, ULONG w, ULONG h,
159 BOOL *finished)
160{
161 NOREF (bpp);
162 NOREF (bpl);
163
164 CheckComArgOutPointerValid(finished);
165 // no need for the caller to wait
166 *finished = true;
167
168 // allocate a new buffer
169 delete mData;
170 mWidth = w;
171 mHeight = h;
172 mBytesPerLine = ((w * mBitsPerPixel + 31) / 32) * 4;
173 mData = new uint8_t [mBytesPerLine * h];
174 memset (mData, 0, mBytesPerLine * h);
175
176 return S_OK;
177}
178
179STDMETHODIMP InternalFramebuffer::VideoModeSupported(ULONG width, ULONG height, ULONG bpp,
180 BOOL *supported)
181{
182 CheckComArgOutPointerValid(supported);
183 /* whatever you want! */
184 *supported = true;
185 return S_OK;
186}
187
188STDMETHODIMP InternalFramebuffer::GetVisibleRegion(BYTE *aRectangles, ULONG aCount,
189 ULONG *aCountCopied)
190{
191 CheckComArgOutPointerValid(aRectangles);
192
193 PRTRECT rects = (PRTRECT)aRectangles;
194
195 /// @todo
196
197 NOREF(rects);
198 NOREF(aCount);
199 NOREF(aCountCopied);
200
201 return S_OK;
202}
203
204STDMETHODIMP InternalFramebuffer::SetVisibleRegion(BYTE *aRectangles, ULONG aCount)
205{
206 CheckComArgOutPointerValid(aRectangles);
207
208 PRTRECT rects = (PRTRECT)aRectangles;
209
210 /// @todo
211
212 NOREF(rects);
213 NOREF(aCount);
214
215 return S_OK;
216}
217/* vi: set tabstop=4 shiftwidth=4 expandtab: */
Note: See TracBrowser for help on using the repository browser.

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