VirtualBox

Changeset 98300 in vbox


Ignore:
Timestamp:
Jan 25, 2023 8:18:57 AM (2 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
155505
Message:

FE/SDL. bugref:9449. Removing unused VBoxSDLFBOverlay from FrameBuffer.cpp.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VBoxSDL/Framebuffer.cpp

    r98290 r98300  
    11811181
    11821182#endif /* VBOX_SECURELABEL */
    1183 
    1184 
    1185 // IFramebufferOverlay
    1186 ///////////////////////////////////////////////////////////////////////////////////
    1187 
    1188 /**
    1189  * Constructor for the VBoxSDLFBOverlay class (IFramebufferOverlay implementation)
    1190  *
    1191  * @param x       Initial X offset for the overlay
    1192  * @param y       Initial Y offset for the overlay
    1193  * @param width   Initial width for the overlay
    1194  * @param height  Initial height for the overlay
    1195  * @param visible Whether the overlay is initially visible
    1196  * @param alpha   Initial alpha channel value for the overlay
    1197  */
    1198 VBoxSDLFBOverlay::VBoxSDLFBOverlay(ULONG x, ULONG y, ULONG width, ULONG height,
    1199                                    BOOL visible, VBoxSDLFB *aParent) :
    1200                                    mOverlayX(x), mOverlayY(y), mOverlayWidth(width),
    1201                                    mOverlayHeight(height), mOverlayVisible(visible),
    1202                                    mParent(aParent)
    1203 {}
    1204 
    1205 /**
    1206  * Destructor for the VBoxSDLFBOverlay class.
    1207  */
    1208 VBoxSDLFBOverlay::~VBoxSDLFBOverlay()
    1209 {
    1210     SDL_FreeSurface(mBlendedBits);
    1211     SDL_FreeSurface(mOverlayBits);
    1212 }
    1213 
    1214 /**
    1215  * Perform any initialisation of the overlay that can potentially fail
    1216  *
    1217  * @returns S_OK on success or the reason for the failure
    1218  */
    1219 HRESULT VBoxSDLFBOverlay::init()
    1220 {
    1221 #ifndef VBOX_WITH_SDL2
    1222     Uint32 fFlags = SDL_ANYFORMAT;
    1223 #else
    1224     Uint32 fFlags = 0;
    1225 #endif
    1226 
    1227     mBlendedBits = SDL_CreateRGBSurface(fFlags, mOverlayWidth, mOverlayHeight, 32,
    1228                                         0x00ff0000, 0x0000ff00, 0x000000ff, 0);
    1229     AssertMsgReturn(mBlendedBits != NULL, ("Failed to create an SDL surface\n"),
    1230                     E_OUTOFMEMORY);
    1231 
    1232 #ifndef VBOX_WITH_SDL2
    1233     fFlags = SDL_SWSURFACE | SDL_SRCALPHA, mOverlayWidth;
    1234 #else
    1235     fFlags = 0;
    1236 #endif
    1237 
    1238     mOverlayBits = SDL_CreateRGBSurface(fFlags,
    1239                                         mOverlayHeight, 32, 0x00ff0000, 0x0000ff00,
    1240                                         0x000000ff, 0xff000000, 0);
    1241     AssertMsgReturn(mOverlayBits != NULL, ("Failed to create an SDL surface\n"),
    1242                     E_OUTOFMEMORY);
    1243     return S_OK;
    1244 }
    1245 
    1246 /**
    1247  * Returns the current overlay X offset in pixels.
    1248  *
    1249  * @returns COM status code
    1250  * @param   x Address of result buffer.
    1251  */
    1252 STDMETHODIMP VBoxSDLFBOverlay::COMGETTER(X)(ULONG *x)
    1253 {
    1254     LogFlow(("VBoxSDLFBOverlay::GetX\n"));
    1255     if (!x)
    1256         return E_INVALIDARG;
    1257     *x = mOverlayX;
    1258     return S_OK;
    1259 }
    1260 
    1261 /**
    1262  * Returns the current overlay height in pixels.
    1263  *
    1264  * @returns COM status code
    1265  * @param   height Address of result buffer.
    1266  */
    1267 STDMETHODIMP VBoxSDLFBOverlay::COMGETTER(Y)(ULONG *y)
    1268 {
    1269     LogFlow(("VBoxSDLFBOverlay::GetY\n"));
    1270     if (!y)
    1271         return E_INVALIDARG;
    1272     *y = mOverlayY;
    1273     return S_OK;
    1274 }
    1275 
    1276 /**
    1277  * Returns the current overlay width in pixels.  In fact, this returns the line size.
    1278  *
    1279  * @returns COM status code
    1280  * @param   width Address of result buffer.
    1281  */
    1282 STDMETHODIMP VBoxSDLFBOverlay::COMGETTER(Width)(ULONG *width)
    1283 {
    1284     LogFlow(("VBoxSDLFBOverlay::GetWidth\n"));
    1285     if (!width)
    1286         return E_INVALIDARG;
    1287     *width = mOverlayBits->pitch;
    1288     return S_OK;
    1289 }
    1290 
    1291 /**
    1292  * Returns the current overlay line size in pixels.
    1293  *
    1294  * @returns COM status code
    1295  * @param   lineSize Address of result buffer.
    1296  */
    1297 STDMETHODIMP VBoxSDLFBOverlay::COMGETTER(BytesPerLine)(ULONG *bytesPerLine)
    1298 {
    1299     LogFlow(("VBoxSDLFBOverlay::GetBytesPerLine\n"));
    1300     if (!bytesPerLine)
    1301         return E_INVALIDARG;
    1302     *bytesPerLine = mOverlayBits->pitch;
    1303     return S_OK;
    1304 }
    1305 
    1306 /**
    1307  * Returns the current overlay height in pixels.
    1308  *
    1309  * @returns COM status code
    1310  * @param   height Address of result buffer.
    1311  */
    1312 STDMETHODIMP VBoxSDLFBOverlay::COMGETTER(Height)(ULONG *height)
    1313 {
    1314     LogFlow(("VBoxSDLFBOverlay::GetHeight\n"));
    1315     if (!height)
    1316         return E_INVALIDARG;
    1317     *height = mOverlayHeight;
    1318     return S_OK;
    1319 }
    1320 
    1321 /**
    1322  * Returns whether the overlay is currently visible.
    1323  *
    1324  * @returns COM status code
    1325  * @param   visible Address of result buffer.
    1326  */
    1327 STDMETHODIMP VBoxSDLFBOverlay::COMGETTER(Visible)(BOOL *visible)
    1328 {
    1329     LogFlow(("VBoxSDLFBOverlay::GetVisible\n"));
    1330     if (!visible)
    1331         return E_INVALIDARG;
    1332     *visible = mOverlayVisible;
    1333     return S_OK;
    1334 }
    1335 
    1336 /**
    1337  * Sets whether the overlay is currently visible.
    1338  *
    1339  * @returns COM status code
    1340  * @param   visible New value.
    1341  */
    1342 STDMETHODIMP VBoxSDLFBOverlay::COMSETTER(Visible)(BOOL visible)
    1343 {
    1344     LogFlow(("VBoxSDLFBOverlay::SetVisible\n"));
    1345     mOverlayVisible = visible;
    1346     return S_OK;
    1347 }
    1348 
    1349 /**
    1350  * Returns the value of the global alpha channel.
    1351  *
    1352  * @returns COM status code
    1353  * @param   alpha Address of result buffer.
    1354  */
    1355 STDMETHODIMP VBoxSDLFBOverlay::COMGETTER(Alpha)(ULONG *alpha)
    1356 {
    1357     RT_NOREF(alpha);
    1358     LogFlow(("VBoxSDLFBOverlay::GetAlpha\n"));
    1359     return E_NOTIMPL;
    1360 }
    1361 
    1362 /**
    1363  * Sets whether the overlay is currently visible.
    1364  *
    1365  * @returns COM status code
    1366  * @param   alpha new value.
    1367  */
    1368 STDMETHODIMP VBoxSDLFBOverlay::COMSETTER(Alpha)(ULONG alpha)
    1369 {
    1370     RT_NOREF(alpha);
    1371     LogFlow(("VBoxSDLFBOverlay::SetAlpha\n"));
    1372     return E_NOTIMPL;
    1373 }
    1374 
    1375 /**
    1376  * Returns the current colour depth.  In fact, this is always 32bpp.
    1377  *
    1378  * @returns COM status code
    1379  * @param   bitsPerPixel Address of result buffer.
    1380  */
    1381 STDMETHODIMP VBoxSDLFBOverlay::COMGETTER(BitsPerPixel)(ULONG *bitsPerPixel)
    1382 {
    1383     LogFlow(("VBoxSDLFBOverlay::GetBitsPerPixel\n"));
    1384     if (!bitsPerPixel)
    1385         return E_INVALIDARG;
    1386     *bitsPerPixel = 32;
    1387     return S_OK;
    1388 }
    1389 
    1390 /**
    1391  * Returns the current pixel format.  In fact, this is always RGB.
    1392  *
    1393  * @returns COM status code
    1394  * @param   pixelFormat Address of result buffer.
    1395  */
    1396 STDMETHODIMP VBoxSDLFBOverlay::COMGETTER(PixelFormat)(ULONG *pixelFormat)
    1397 {
    1398     LogFlow(("VBoxSDLFBOverlay::GetPixelFormat\n"));
    1399     if (!pixelFormat)
    1400         return E_INVALIDARG;
    1401     *pixelFormat = BitmapFormat_BGR;
    1402     return S_OK;
    1403 }
    1404 
    1405 /**
    1406  * Returns whether the guest VRAM is used directly.  In fact, this is always FALSE.
    1407  *
    1408  * @returns COM status code
    1409  * @param   usesGuestVRAM Address of result buffer.
    1410  */
    1411 STDMETHODIMP VBoxSDLFBOverlay::COMGETTER(UsesGuestVRAM)(BOOL *usesGuestVRAM)
    1412 {
    1413     LogFlow(("VBoxSDLFBOverlay::GetUsesGuestVRAM\n"));
    1414     if (!usesGuestVRAM)
    1415         return E_INVALIDARG;
    1416     *usesGuestVRAM = FALSE;
    1417     return S_OK;
    1418 }
    1419 
    1420 /**
    1421  * Returns the height reduction.  In fact, this is always 0.
    1422  *
    1423  * @returns COM status code
    1424  * @param   heightReduction Address of result buffer.
    1425  */
    1426 STDMETHODIMP VBoxSDLFBOverlay::COMGETTER(HeightReduction)(ULONG *heightReduction)
    1427 {
    1428     LogFlow(("VBoxSDLFBOverlay::GetHeightReduction\n"));
    1429     if (!heightReduction)
    1430         return E_INVALIDARG;
    1431     *heightReduction = 0;
    1432     return S_OK;
    1433 }
    1434 
    1435 /**
    1436  * Returns the overlay for this framebuffer.  Obviously, we return NULL here.
    1437  *
    1438  * @returns COM status code
    1439  * @param   overlay Address of result buffer.
    1440  */
    1441 STDMETHODIMP VBoxSDLFBOverlay::COMGETTER(Overlay)(IFramebufferOverlay **aOverlay)
    1442 {
    1443     LogFlow(("VBoxSDLFBOverlay::GetOverlay\n"));
    1444     if (!aOverlay)
    1445         return E_INVALIDARG;
    1446     *aOverlay = 0;
    1447     return S_OK;
    1448 }
    1449 
    1450 /**
    1451  * Returns associated window handle. We return NULL here.
    1452  *
    1453  * @returns COM status code
    1454  * @param   winId Address of result buffer.
    1455  */
    1456 STDMETHODIMP VBoxSDLFBOverlay::COMGETTER(WinId)(LONG64 *winId)
    1457 {
    1458     LogFlow(("VBoxSDLFBOverlay::GetWinId\n"));
    1459     if (!winId)
    1460         return E_INVALIDARG;
    1461     *winId = 0;
    1462     return S_OK;
    1463 }
    1464 
    1465 
    1466 /**
    1467  * Lock the overlay.  This should not be used - lock the parent IFramebuffer instead.
    1468  *
    1469  * @returns COM status code
    1470  */
    1471 STDMETHODIMP VBoxSDLFBOverlay::Lock()
    1472 {
    1473     LogFlow(("VBoxSDLFBOverlay::Lock\n"));
    1474     AssertMsgFailed(("You should not attempt to lock an IFramebufferOverlay object -\n"
    1475                      "lock the parent IFramebuffer object instead.\n"));
    1476     return E_NOTIMPL;
    1477 }
    1478 
    1479 /**
    1480  * Unlock the overlay.
    1481  *
    1482  * @returns COM status code
    1483  */
    1484 STDMETHODIMP VBoxSDLFBOverlay::Unlock()
    1485 {
    1486     LogFlow(("VBoxSDLFBOverlay::Unlock\n"));
    1487     AssertMsgFailed(("You should not attempt to lock an IFramebufferOverlay object -\n"
    1488                      "lock the parent IFramebuffer object instead.\n"));
    1489     return E_NOTIMPL;
    1490 }
    1491 
    1492 /**
    1493  * Change the X and Y co-ordinates of the overlay area.
    1494  *
    1495  * @returns COM status code
    1496  * @param   x New X co-ordinate.
    1497  * @param   y New Y co-ordinate.
    1498  */
    1499 STDMETHODIMP VBoxSDLFBOverlay::Move(ULONG x, ULONG y)
    1500 {
    1501     mOverlayX = x;
    1502     mOverlayY = y;
    1503     return S_OK;
    1504 }
    1505 
    1506 /**
    1507  * Notify the overlay that a section of the framebuffer has been redrawn.
    1508  *
    1509  * @returns COM status code
    1510  * @param   x        X co-ordinate of upper left corner of modified area.
    1511  * @param   y        Y co-ordinate of upper left corner of modified area.
    1512  * @param   w        Width of modified area.
    1513  * @param   h        Height of modified area.
    1514  * @retval  finished Set if the operation has completed.
    1515  *
    1516  * All we do here is to send a request to the parent to update the affected area,
    1517  * translating between our co-ordinate system and the parent's.  It would be have
    1518  * been better to call the parent directly, but such is life.  We leave bounds
    1519  * checking to the parent.
    1520  */
    1521 STDMETHODIMP VBoxSDLFBOverlay::NotifyUpdate(ULONG x, ULONG y,
    1522                             ULONG w, ULONG h)
    1523 {
    1524     return mParent->NotifyUpdate(x + mOverlayX, y + mOverlayY, w, h);
    1525 }
    1526 
    1527 /**
    1528  * Change the dimensions of the overlay.
    1529  *
    1530  * @returns COM status code
    1531  * @param   pixelFormat Must be BitmapFormat_BGR.
    1532  * @param   vram        Must be NULL.
    1533  * @param   lineSize    Ignored.
    1534  * @param   w           New overlay width.
    1535  * @param   h           New overlay height.
    1536  * @retval  finished    Set if the operation has completed.
    1537  */
    1538 STDMETHODIMP VBoxSDLFBOverlay::RequestResize(ULONG aScreenId, ULONG pixelFormat, ULONG vram,
    1539                                              ULONG bitsPerPixel, ULONG bytesPerLine,
    1540                                              ULONG w, ULONG h, BOOL *finished)
    1541 {
    1542     RT_NOREF(aScreenId, bytesPerLine, finished);
    1543     AssertReturn(pixelFormat == BitmapFormat_BGR, E_INVALIDARG);
    1544     AssertReturn(vram == 0, E_INVALIDARG);
    1545     AssertReturn(bitsPerPixel == 32, E_INVALIDARG);
    1546     mOverlayWidth = w;
    1547     mOverlayHeight = h;
    1548     SDL_FreeSurface(mOverlayBits);
    1549 
    1550 #ifndef VBOX_WITH_SDL2
    1551     Uint32 fFlags = SDL_ANYFORMAT;
    1552 #else
    1553     Uint32 fFlags = 0;
    1554 #endif
    1555 
    1556     mBlendedBits = SDL_CreateRGBSurface(fFlags, mOverlayWidth, mOverlayHeight, 32,
    1557                                         0x00ff0000, 0x0000ff00, 0x000000ff, 0);
    1558     AssertMsgReturn(mBlendedBits != NULL, ("Failed to create an SDL surface\n"),
    1559                     E_OUTOFMEMORY);
    1560 
    1561 #ifndef VBOX_WITH_SDL2
    1562     fFlags = SDL_SWSURFACE | SDL_SRCALPHA;
    1563 #else
    1564     fFlags = 0;
    1565 #endif
    1566 
    1567     mOverlayBits = SDL_CreateRGBSurface(fFlags, mOverlayWidth,
    1568                                         mOverlayHeight, 32, 0x00ff0000, 0x0000ff00,
    1569                                         0x000000ff, 0xff000000);
    1570     AssertMsgReturn(mOverlayBits != NULL, ("Failed to create an SDL surface\n"),
    1571                     E_OUTOFMEMORY);
    1572     return S_OK;
    1573 }
    1574 
    1575 /**
    1576  * Returns whether we like the given video mode.
    1577  *
    1578  * @returns COM status code
    1579  * @param   width     video mode width in pixels
    1580  * @param   height    video mode height in pixels
    1581  * @param   bpp       video mode bit depth in bits per pixel
    1582  * @retval  supported pointer to result variable
    1583  *
    1584  * Basically, we support anything with 32bpp.
    1585  */
    1586 STDMETHODIMP VBoxSDLFBOverlay::VideoModeSupported(ULONG width, ULONG height, ULONG bpp, BOOL *supported)
    1587 {
    1588     RT_NOREF(width, height);
    1589     if (!supported)
    1590         return E_POINTER;
    1591     if (bpp == 32)
    1592         *supported = true;
    1593     else
    1594         *supported = false;
    1595     return S_OK;
    1596 }
Note: See TracChangeset for help on using the changeset viewer.

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