Skip to content
This repository has been archived by the owner on Mar 30, 2019. It is now read-only.

Commit

Permalink
[DXGI] FormatHelper public static method's convert to extensons
Browse files Browse the repository at this point in the history
  • Loading branch information
AndrewSt committed Jun 6, 2016
1 parent 6b09ebb commit a1ad26a
Showing 1 changed file with 21 additions and 21 deletions.
42 changes: 21 additions & 21 deletions Source/SharpDX.DXGI/FormatHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public static class FormatHelper
/// </summary>
/// <param name="format">The DXGI format.</param>
/// <returns>size of in bytes</returns>
public static int SizeOfInBytes(Format format)
public static int SizeOfInBytes(this Format format)
{
var sizeInBits = SizeOfInBits(format);
return sizeInBits >> 3;
Expand All @@ -48,7 +48,7 @@ public static int SizeOfInBytes(Format format)
/// </summary>
/// <param name="format">The DXGI format.</param>
/// <returns>size of in bits</returns>
public static int SizeOfInBits(Format format)
public static int SizeOfInBits(this Format format)
{
return sizeOfInBits[(int) format];
}
Expand All @@ -58,39 +58,39 @@ public static int SizeOfInBits(Format format)
/// </summary>
/// <param name="format">A format to validate</param>
/// <returns>True if the <see cref="Format"/> is valid.</returns>
public static bool IsValid( Format format )
public static bool IsValid(this Format format)
{
return ( (int)(format) >= 1 && (int)(format) <= 115 );
}

/// <summary>
/// Returns true if the <see cref="Format"/> is a compressed format.
/// </summary>
/// <param name="fmt">The format to check for compressed.</param>
/// <param name="format">The format to check for compressed.</param>
/// <returns>True if the <see cref="Format"/> is a compressed format</returns>
public static bool IsCompressed(Format fmt)
public static bool IsCompressed(this Format format)
{
return compressedFormats[(int) fmt];
return compressedFormats[(int) format];
}

/// <summary>
/// Determines whether the specified <see cref="Format"/> is packed.
/// </summary>
/// <param name="fmt">The DXGI Format.</param>
/// <param name="format">The DXGI Format.</param>
/// <returns><c>true</c> if the specified <see cref="Format"/> is packed; otherwise, <c>false</c>.</returns>
public static bool IsPacked( Format fmt )
public static bool IsPacked(this Format format )
{
return ((fmt == Format.R8G8_B8G8_UNorm) || (fmt == Format.G8R8_G8B8_UNorm));
return ((format == Format.R8G8_B8G8_UNorm) || (format == Format.G8R8_G8B8_UNorm));
}

/// <summary>
/// Determines whether the specified <see cref="Format"/> is video.
/// </summary>
/// <param name="fmt">The <see cref="Format"/>.</param>
/// <param name="format">The <see cref="Format"/>.</param>
/// <returns><c>true</c> if the specified <see cref="Format"/> is video; otherwise, <c>false</c>.</returns>
public static bool IsVideo( Format fmt )
public static bool IsVideo(this Format format )
{
switch ( fmt )
switch ( format )
{
case Format.AYUV:
case Format.Y410:
Expand Down Expand Up @@ -121,32 +121,32 @@ public static bool IsVideo( Format fmt )
/// <summary>
/// Determines whether the specified <see cref="Format"/> is a SRGB format.
/// </summary>
/// <param name="fmt">The <see cref="Format"/>.</param>
/// <param name="format">The <see cref="Format"/>.</param>
/// <returns><c>true</c> if the specified <see cref="Format"/> is a SRGB format; otherwise, <c>false</c>.</returns>
public static bool IsSRgb( Format fmt )
public static bool IsSRgb(this Format format )
{
return srgbFormats[(int) fmt];
return srgbFormats[(int) format];
}

/// <summary>
/// Determines whether the specified <see cref="Format"/> is typeless.
/// </summary>
/// <param name="fmt">The <see cref="Format"/>.</param>
/// <param name="format">The <see cref="Format"/>.</param>
/// <returns><c>true</c> if the specified <see cref="Format"/> is typeless; otherwise, <c>false</c>.</returns>
public static bool IsTypeless( Format fmt )
public static bool IsTypeless(this Format format )
{
return typelessFormats[(int) fmt];
return typelessFormats[(int) format];
}

/// <summary>
/// Computes the scanline count (number of scanlines).
/// </summary>
/// <param name="fmt">The <see cref="Format"/>.</param>
/// <param name="format">The <see cref="Format"/>.</param>
/// <param name="height">The height.</param>
/// <returns>The scanline count.</returns>
public static int ComputeScanlineCount(Format fmt, int height)
public static int ComputeScanlineCount(this Format format, int height)
{
switch (fmt)
switch (format)
{
case Format.BC1_Typeless:
case Format.BC1_UNorm:
Expand Down

0 comments on commit a1ad26a

Please sign in to comment.