コード例 #1
0
        /// <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);
        }
コード例 #2
0
        public GraphicsDeviceInformation Clone()
        {
            var information = new GraphicsDeviceInformation
            {
                _presentationParameters = _presentationParameters.Clone(),
                _adapter    = _adapter,
                _deviceType = _deviceType
            };

            return(information);
        }
コード例 #3
0
        /// <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();
        }
コード例 #4
0
        /// <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();
        }
コード例 #5
0
 /// <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()
     });
 }
コード例 #6
0
 public void CloneTest()
 {
     Assert.IsTrue(a.Clone() == a, "#1");
 }