mirror of
https://github.com/microsoft/DirectXTex.git
synced 2026-02-06 05:06:14 +01:00
CMake support added for building with MinGW (#275)
This commit is contained in:
@@ -1583,7 +1583,7 @@ HRESULT DirectX::GetMetadataFromDDSFile(
|
||||
if (!szFile)
|
||||
return E_INVALIDARG;
|
||||
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
#if (_WIN32_WINNT >= _WIN32_WINNT_WIN8)
|
||||
ScopedHandle hFile(safe_handle(CreateFile2(szFile, GENERIC_READ, FILE_SHARE_READ, OPEN_EXISTING, nullptr)));
|
||||
#else
|
||||
@@ -1637,7 +1637,7 @@ HRESULT DirectX::GetMetadataFromDDSFile(
|
||||
// Read the header in (including extended header if present)
|
||||
uint8_t header[MAX_HEADER_SIZE] = {};
|
||||
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
DWORD bytesRead = 0;
|
||||
if (!ReadFile(hFile.get(), header, MAX_HEADER_SIZE, &bytesRead, nullptr))
|
||||
{
|
||||
@@ -1746,7 +1746,7 @@ HRESULT DirectX::LoadFromDDSFile(
|
||||
|
||||
image.Release();
|
||||
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
#if (_WIN32_WINNT >= _WIN32_WINNT_WIN8)
|
||||
ScopedHandle hFile(safe_handle(CreateFile2(szFile, GENERIC_READ, FILE_SHARE_READ, OPEN_EXISTING, nullptr)));
|
||||
#else
|
||||
@@ -1798,7 +1798,7 @@ HRESULT DirectX::LoadFromDDSFile(
|
||||
// Read the header in (including extended header if present)
|
||||
uint8_t header[MAX_HEADER_SIZE] = {};
|
||||
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
DWORD bytesRead = 0;
|
||||
if (!ReadFile(hFile.get(), header, MAX_HEADER_SIZE, &bytesRead, nullptr))
|
||||
{
|
||||
@@ -1824,7 +1824,7 @@ HRESULT DirectX::LoadFromDDSFile(
|
||||
|
||||
if (!(convFlags & CONV_FLAGS_DX10))
|
||||
{
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
// Must reset file position since we read more than the standard header above
|
||||
const LARGE_INTEGER filePos = { { sizeof(uint32_t) + sizeof(DDS_HEADER), 0 } };
|
||||
if (!SetFilePointerEx(hFile.get(), filePos, nullptr, FILE_BEGIN))
|
||||
@@ -1849,7 +1849,7 @@ HRESULT DirectX::LoadFromDDSFile(
|
||||
return E_OUTOFMEMORY;
|
||||
}
|
||||
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
if (!ReadFile(hFile.get(), pal8.get(), 256 * sizeof(uint32_t), &bytesRead, nullptr))
|
||||
{
|
||||
return HRESULT_FROM_WIN32(GetLastError());
|
||||
@@ -1885,7 +1885,7 @@ HRESULT DirectX::LoadFromDDSFile(
|
||||
return E_OUTOFMEMORY;
|
||||
}
|
||||
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
if (!ReadFile(hFile.get(), temp.get(), static_cast<DWORD>(remaining), &bytesRead, nullptr))
|
||||
{
|
||||
image.Release();
|
||||
@@ -1943,7 +1943,7 @@ HRESULT DirectX::LoadFromDDSFile(
|
||||
return HRESULT_E_ARITHMETIC_OVERFLOW;
|
||||
}
|
||||
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
auto pixelBytes = static_cast<DWORD>(image.GetPixelsSize());
|
||||
if (!ReadFile(hFile.get(), image.GetPixels(), pixelBytes, &bytesRead, nullptr))
|
||||
{
|
||||
@@ -2230,7 +2230,7 @@ HRESULT DirectX::SaveToDDSFile(
|
||||
return hr;
|
||||
|
||||
// Create file and write header
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
#if (_WIN32_WINNT >= _WIN32_WINNT_WIN8)
|
||||
ScopedHandle hFile(safe_handle(CreateFile2(szFile,
|
||||
GENERIC_WRITE | DELETE, 0, CREATE_ALWAYS, nullptr)));
|
||||
@@ -2292,7 +2292,7 @@ HRESULT DirectX::SaveToDDSFile(
|
||||
|
||||
if ((images[index].slicePitch == ddsSlicePitch) && (ddsSlicePitch <= UINT32_MAX))
|
||||
{
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
if (!WriteFile(hFile.get(), images[index].pixels, static_cast<DWORD>(ddsSlicePitch), &bytesWritten, nullptr))
|
||||
{
|
||||
return HRESULT_FROM_WIN32(GetLastError());
|
||||
@@ -2325,7 +2325,7 @@ HRESULT DirectX::SaveToDDSFile(
|
||||
const size_t lines = ComputeScanlines(metadata.format, images[index].height);
|
||||
for (size_t j = 0; j < lines; ++j)
|
||||
{
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
if (!WriteFile(hFile.get(), sPtr, static_cast<DWORD>(ddsRowPitch), &bytesWritten, nullptr))
|
||||
{
|
||||
return HRESULT_FROM_WIN32(GetLastError());
|
||||
@@ -2377,7 +2377,7 @@ HRESULT DirectX::SaveToDDSFile(
|
||||
|
||||
if ((images[index].slicePitch == ddsSlicePitch) && (ddsSlicePitch <= UINT32_MAX))
|
||||
{
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
if (!WriteFile(hFile.get(), images[index].pixels, static_cast<DWORD>(ddsSlicePitch), &bytesWritten, nullptr))
|
||||
{
|
||||
return HRESULT_FROM_WIN32(GetLastError());
|
||||
@@ -2410,7 +2410,7 @@ HRESULT DirectX::SaveToDDSFile(
|
||||
const size_t lines = ComputeScanlines(metadata.format, images[index].height);
|
||||
for (size_t j = 0; j < lines; ++j)
|
||||
{
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
if (!WriteFile(hFile.get(), sPtr, static_cast<DWORD>(ddsRowPitch), &bytesWritten, nullptr))
|
||||
{
|
||||
return HRESULT_FROM_WIN32(GetLastError());
|
||||
@@ -2440,7 +2440,7 @@ HRESULT DirectX::SaveToDDSFile(
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
delonfail.clear();
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user