DirectXTex: Integrated some Code Review feedback (no code impact)

This commit is contained in:
walbourn_cp 2013-06-17 12:32:11 -07:00
Родитель e2e5a28c6d
Коммит fb6f5aac2e
3 изменённых файлов: 16 добавлений и 8 удалений

Просмотреть файл

@ -59,7 +59,7 @@ namespace DirectX
bool IsPacked( _In_ DXGI_FORMAT fmt ); bool IsPacked( _In_ DXGI_FORMAT fmt );
bool IsVideo( _In_ DXGI_FORMAT fmt ); bool IsVideo( _In_ DXGI_FORMAT fmt );
bool IsSRGB( _In_ DXGI_FORMAT fmt ); bool IsSRGB( _In_ DXGI_FORMAT fmt );
bool IsTypeless( _In_ DXGI_FORMAT fmt, _In_ bool partialTypeless=true ); bool IsTypeless( _In_ DXGI_FORMAT fmt, _In_ bool partialTypeless = true );
bool HasAlpha( _In_ DXGI_FORMAT fmt ); bool HasAlpha( _In_ DXGI_FORMAT fmt );

Просмотреть файл

@ -530,7 +530,7 @@ bool _LoadScanline( XMVECTOR* pDestination, size_t count,
{ {
assert( pDestination && count > 0 && (((uintptr_t)pDestination & 0xF) == 0) ); assert( pDestination && count > 0 && (((uintptr_t)pDestination & 0xF) == 0) );
assert( pSource && size > 0 ); assert( pSource && size > 0 );
assert( IsValid(format) && !IsVideo(format) && !IsTypeless(format,false) && !IsCompressed(format) ); assert( IsValid(format) && !IsVideo(format) && !IsTypeless(format, false) && !IsCompressed(format) );
XMVECTOR* __restrict dPtr = pDestination; XMVECTOR* __restrict dPtr = pDestination;
if ( !dPtr ) if ( !dPtr )
@ -1834,9 +1834,12 @@ HRESULT _ConvertFromR32G32B32A32( const Image* srcImages, size_t nimages, const
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
// Linear RGB -> sRGB // Convert from Linear RGB to sRGB
//
// if C_linear <= 0.0031308 -> C_srgb = 12.92 * C_linear
// if C_linear > 0.0031308 -> C_srgb = ( 1 + a ) * pow( C_Linear, 1 / 2.4 ) - a
// where a = 0.055
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
static inline XMVECTOR RGBToSRGB( FXMVECTOR rgb ) static inline XMVECTOR RGBToSRGB( FXMVECTOR rgb )
{ {
static const XMVECTORF32 Cutoff = { 0.0031308f, 0.0031308f, 0.0031308f, 1.f }; static const XMVECTORF32 Cutoff = { 0.0031308f, 0.0031308f, 0.0031308f, 1.f };
@ -1919,9 +1922,12 @@ bool _StoreScanlineLinear( LPVOID pDestination, size_t size, DXGI_FORMAT format,
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
// sRGB -> Linear RGB // Convert from sRGB to Linear RGB
//
// if C_srgb <= 0.04045 -> C_linear = C_srgb / 12.92
// if C_srgb > 0.04045 -> C_linear = pow( ( C_srgb + a ) / ( 1 + a ), 2.4 )
// where a = 0.055
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
static inline XMVECTOR SRGBToRGB( FXMVECTOR srgb ) static inline XMVECTOR SRGBToRGB( FXMVECTOR srgb )
{ {
static const XMVECTORF32 Cutoff = { 0.04045f, 0.04045f, 0.04045f, 1.f }; static const XMVECTORF32 Cutoff = { 0.04045f, 0.04045f, 0.04045f, 1.f };
@ -2502,6 +2508,7 @@ static const XMVECTORF32 g_ErrorWeight7 = { 7.f/16.f, 7.f/16.f, 7.f/16.f, 7.f/16
return false; return false;
#define STORE_SCANLINE2( type, scalev, clampzero, norm, itype, mask, row ) \ #define STORE_SCANLINE2( type, scalev, clampzero, norm, itype, mask, row ) \
/* The 2 component cases are always bgr=false */ \
if ( size >= sizeof(type) ) \ if ( size >= sizeof(type) ) \
{ \ { \
type * __restrict dest = reinterpret_cast<type*>(pDestination); \ type * __restrict dest = reinterpret_cast<type*>(pDestination); \
@ -2553,6 +2560,7 @@ static const XMVECTORF32 g_ErrorWeight7 = { 7.f/16.f, 7.f/16.f, 7.f/16.f, 7.f/16
return false; return false;
#define STORE_SCANLINE1( type, scalev, clampzero, norm, mask, row, selectw ) \ #define STORE_SCANLINE1( type, scalev, clampzero, norm, mask, row, selectw ) \
/* The 1 component cases are always bgr=false */ \
if ( size >= sizeof(type) ) \ if ( size >= sizeof(type) ) \
{ \ { \
type * __restrict dest = reinterpret_cast<type*>(pDestination); \ type * __restrict dest = reinterpret_cast<type*>(pDestination); \

Просмотреть файл

@ -449,8 +449,8 @@ size_t BitsPerPixel( DXGI_FORMAT fmt )
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
// Returns bits-per-color (i.e. bit-depth) for a given DXGI format, or 0 on failure // Returns bits-per-color-channel for a given DXGI format, or 0 on failure
// For mixed formats, it returns the largest bit-depth in the format // For mixed formats, it returns the largest color-depth in the format
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
_Use_decl_annotations_ _Use_decl_annotations_
size_t BitsPerColor( DXGI_FORMAT fmt ) size_t BitsPerColor( DXGI_FORMAT fmt )