Cosmos/source/Cosmos.System2/Graphics/FullScreenCanvas.cs
fanoI 376c0d2db6 Changed some classes of CGS to be struct as they should have been from the beginnning.
- Mode and Point are now structures
- The copy of System.Drawing.Color is not needed anymore the real System.DrawingColor is used instead
- Updated CGS Test Kernel
- Made SVGAII a little more faster (but this not the complete solution)
2018-05-13 20:17:20 +02:00

75 lines
1.8 KiB
C#

//#define COSMOSDEBUG
using Cosmos.System.Graphics;
using Cosmos.HAL;
namespace Cosmos.System.Graphics
{
public static class FullScreenCanvas
{
private static PCIDevice SVGAIIDevice = PCI.GetDevice(VendorID.VMWare, DeviceID.SVGAIIAdapter);
public static bool SVGAIIExist()
{
if (SVGAIIDevice == null)
{
return false;
}
return SVGAIIDevice.DeviceExists;
}
private static Canvas MyVideoDriver = null;
private static Canvas GetVideoDriver()
{
if (SVGAIIExist())
{
return new SVGAIIScreen();
}
else
{
return new VBEScreen();
}
}
private static Canvas GetVideoDriver(Mode mode)
{
if (SVGAIIExist())
{
return new SVGAIIScreen(mode);
}
else
{
return new VBEScreen(mode);
}
}
public static Canvas GetFullScreenCanvas()
{
if (MyVideoDriver == null)
{
return MyVideoDriver = GetVideoDriver();
}
else
{
MyVideoDriver.Mode = MyVideoDriver.DefaultGraphicMode;
return MyVideoDriver;
}
}
public static Canvas GetFullScreenCanvas(Mode mode)
{
Global.mDebugger.SendInternal($"GetFullScreenCanvas() with mode" + mode);
if (MyVideoDriver == null)
{
return MyVideoDriver = GetVideoDriver(mode);
}
else
{
MyVideoDriver.Mode = mode;
return MyVideoDriver;
}
}
}
}