/// <summary> /// Clones this instance. /// </summary> /// <returns>A new copy-instance of this GraphicsDeviceInformation.</returns> public GraphicsDeviceInformation Clone() { var newValue = (GraphicsDeviceInformation)MemberwiseClone(); newValue.PresentationParameters = PresentationParameters.Clone(); return(newValue); }
public GraphicsDeviceInformation Clone() { var information = new GraphicsDeviceInformation { _presentationParameters = _presentationParameters.Clone(), _adapter = _adapter, _deviceType = _deviceType }; return(information); }
/// <summary> /// Initializes a new instance of the <see cref="GraphicsPresenter" /> class. /// </summary> /// <param name="device">The device.</param> /// <param name="presentationParameters"> </param> protected GraphicsPresenter(GraphicsDevice device, PresentationParameters presentationParameters) { GraphicsDevice = device.RootDevice; Description = presentationParameters.Clone(); ProcessPresentationParameters(); DefaultViewport = new Viewport(0, 0, Description.BackBufferWidth, Description.BackBufferHeight); // Creates a default DepthStencilBuffer. CreateDepthStencilBuffer(); }
/// <summary> /// Initializes a new instance of the <see cref="GraphicsPresenter" /> class. /// </summary> /// <param name="device">The device.</param> /// <param name="presentationParameters"> </param> protected GraphicsPresenter(GraphicsDevice device, PresentationParameters presentationParameters) { GraphicsDevice = device.RootDevice; var description = presentationParameters.Clone(); // If we are creating a GraphicsPresenter with if (device.Features.HasSRgb && device.ColorSpace == ColorSpace.Linear) { // If the device support SRgb and ColorSpace is linear, we use automatically a SRgb backbuffer if (description.BackBufferFormat == PixelFormat.R8G8B8A8_UNorm) { description.BackBufferFormat = PixelFormat.R8G8B8A8_UNorm_SRgb; } else if (description.BackBufferFormat == PixelFormat.B8G8R8A8_UNorm) { description.BackBufferFormat = PixelFormat.B8G8R8A8_UNorm_SRgb; } } else if (!device.Features.HasSRgb) { // If the device does not support SRgb, but the backbuffer format asked is SRgb, convert it to non SRgb if (description.BackBufferFormat == PixelFormat.R8G8B8A8_UNorm_SRgb) { description.BackBufferFormat = PixelFormat.R8G8B8A8_UNorm; } else if (description.BackBufferFormat == PixelFormat.B8G8R8A8_UNorm_SRgb) { description.BackBufferFormat = PixelFormat.B8G8R8A8_UNorm; } } Description = description; ProcessPresentationParameters(); DefaultViewport = new Viewport(0, 0, Description.BackBufferWidth, Description.BackBufferHeight); // Creates a default DepthStencilBuffer. CreateDepthStencilBuffer(); }
/// <summary> /// Clones this instance. /// </summary> /// <returns>A new copy-instance of this GraphicsDeviceInformation.</returns> public GraphicsDeviceInformation Clone() { return(new GraphicsDeviceInformation { Adapter = Adapter, GraphicsProfile = GraphicsProfile, PresentationParameters = PresentationParameters.Clone() }); }
public void CloneTest() { Assert.IsTrue(a.Clone() == a, "#1"); }