Terraria
v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
GraphicsHelpers.cs
Go to the documentation of this file.
1
using
System
;
2
using
System.Diagnostics.CodeAnalysis
;
3
4
namespace
Microsoft.Xna.Framework.Graphics
;
5
6
internal
static
class
GraphicsHelpers
7
{
8
public
static
void
ThrowExceptionFromResult
(uint result)
9
{
10
if
(result == 0)
11
{
12
return
;
13
}
14
throw
GetExceptionFromResult
(result);
15
}
16
17
[SuppressMessage(
"Microsoft.Maintainability"
,
"CA1502:AvoidExcessiveComplexity"
)]
18
[SuppressMessage(
"Microsoft.Usage"
,
"CA2208:InstantiateArgumentExceptionsCorrectly"
)]
19
[SuppressMessage(
"Microsoft.Usage"
,
"CA2201:DoNotRaiseReservedExceptionTypes"
)]
20
public
static
Exception
GetExceptionFromResult
(uint result)
21
{
22
if
(result == 0)
23
{
24
return
null
;
25
}
26
return
result
switch
27
{
28
2289436711u =>
new
InvalidOperationException
(
FrameworkResources
.
DriverError
),
29
2289436776u =>
new
DeviceLostException
(),
30
2289436777u =>
new
DeviceNotResetException
(),
31
2289436784u =>
new
NotSupportedException
(),
32
2289435004u =>
new
OutOfMemoryException
(),
33
2150814720u =>
new
InvalidOperationException
(
FrameworkResources
.
DirectRenderingWrongMode
),
34
_ =>
Helpers
.
GetExceptionFromResult
(result),
35
};
36
}
37
38
internal
static
Blend
AdjustAlphaBlend
(
Blend
blend)
39
{
40
return
blend
switch
41
{
42
Blend.SourceColor =>
Blend
.SourceAlpha,
43
Blend.InverseSourceColor =>
Blend
.InverseSourceAlpha,
44
Blend.DestinationColor =>
Blend
.DestinationAlpha,
45
Blend.InverseDestinationColor =>
Blend
.InverseDestinationAlpha,
46
_ => blend,
47
};
48
}
49
50
internal
static
bool
IsSeparateBlend
(
Blend
colorBlend,
Blend
alphaBlend)
51
{
52
return
AdjustAlphaBlend
(colorBlend) !=
AdjustAlphaBlend
(alphaBlend);
53
}
54
}
Microsoft.Xna.Framework.FrameworkResources.DirectRenderingWrongMode
static string DirectRenderingWrongMode
Definition
FrameworkResources.cs:141
Microsoft.Xna.Framework.FrameworkResources.DriverError
static string DriverError
Definition
FrameworkResources.cs:143
Microsoft.Xna.Framework.FrameworkResources
Definition
FrameworkResources.cs:15
Microsoft.Xna.Framework.Graphics.DeviceLostException
Definition
DeviceLostException.cs:8
Microsoft.Xna.Framework.Graphics.DeviceNotResetException
Definition
DeviceNotResetException.cs:8
Microsoft.Xna.Framework.Graphics.GraphicsHelpers.IsSeparateBlend
static bool IsSeparateBlend(Blend colorBlend, Blend alphaBlend)
Definition
GraphicsHelpers.cs:50
Microsoft.Xna.Framework.Graphics.GraphicsHelpers.GetExceptionFromResult
static Exception GetExceptionFromResult(uint result)
Definition
GraphicsHelpers.cs:20
Microsoft.Xna.Framework.Graphics.GraphicsHelpers.AdjustAlphaBlend
static Blend AdjustAlphaBlend(Blend blend)
Definition
GraphicsHelpers.cs:38
Microsoft.Xna.Framework.Graphics.GraphicsHelpers.ThrowExceptionFromResult
static void ThrowExceptionFromResult(uint result)
Definition
GraphicsHelpers.cs:8
Microsoft.Xna.Framework.Graphics.GraphicsHelpers
Definition
GraphicsHelpers.cs:7
Microsoft.Xna.Framework.Helpers.GetExceptionFromResult
static Exception GetExceptionFromResult(uint result)
Definition
Helpers.cs:115
Microsoft.Xna.Framework.Helpers
Definition
Helpers.cs:10
System.Exception
Definition
Exception.cs:15
System.InvalidOperationException
Definition
InvalidOperationException.cs:9
System.NotSupportedException
Definition
NotSupportedException.cs:9
System.OutOfMemoryException
Definition
OutOfMemoryException.cs:9
Microsoft.Xna.Framework.Graphics.Blend
Blend
Definition
Blend.cs:7
Microsoft.Xna.Framework.Graphics
Definition
AlphaTestEffect.cs:1
System.Diagnostics.CodeAnalysis
Definition
AllowNullAttribute.cs:1
System
Definition
BlockingCollection.cs:8
source
Microsoft.Xna.Framework.Graphics
GraphicsHelpers.cs
Generated by
1.10.0