mirror of
https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git
synced 2025-07-19 03:39:08 +00:00
Fixes for plGImage HS_BUILD_FOR_WIN32.
This commit is contained in:
@ -51,13 +51,14 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
|||||||
// //
|
// //
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#if HS_BUILD_FOR_WIN32
|
|
||||||
|
|
||||||
#include "hsConfig.h"
|
#include "hsConfig.h"
|
||||||
#include "hsWindows.h"
|
#include "hsWindows.h"
|
||||||
|
|
||||||
|
#if HS_BUILD_FOR_WIN32
|
||||||
#include <ddraw.h>
|
#include <ddraw.h>
|
||||||
#include <d3d9.h>
|
#include <d3d9.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "hsTypes.h"
|
#include "hsTypes.h"
|
||||||
#include "hsDXTDirectXCodec.h"
|
#include "hsDXTDirectXCodec.h"
|
||||||
@ -65,6 +66,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
|||||||
#include "hsCodecManager.h"
|
#include "hsCodecManager.h"
|
||||||
#include "plPipeline/hsGDDrawDllLoad.h"
|
#include "plPipeline/hsGDDrawDllLoad.h"
|
||||||
|
|
||||||
|
#if HS_BUILD_FOR_WIN32
|
||||||
namespace {
|
namespace {
|
||||||
typedef HRESULT(WINAPI * DIRECTDRAWCREATEEX)( GUID*, VOID**, REFIID, IUnknown* );
|
typedef HRESULT(WINAPI * DIRECTDRAWCREATEEX)( GUID*, VOID**, REFIID, IUnknown* );
|
||||||
}
|
}
|
||||||
@ -75,6 +77,7 @@ enum
|
|||||||
D3DTEXTURE_FMT_FOURCC_DXT1 = 0x00002000, // No.14: DXTn FourCC (DXT1), format.
|
D3DTEXTURE_FMT_FOURCC_DXT1 = 0x00002000, // No.14: DXTn FourCC (DXT1), format.
|
||||||
D3DTEXTURE_FMT_FOURCC_DXT5 = 0x00020000, // No.18: DXTn FourCC (DXT5), format.
|
D3DTEXTURE_FMT_FOURCC_DXT5 = 0x00020000, // No.18: DXTn FourCC (DXT5), format.
|
||||||
};
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
hsBool hsDXTDirectXCodec::fRegistered = false;
|
hsBool hsDXTDirectXCodec::fRegistered = false;
|
||||||
|
|
||||||
@ -93,6 +96,7 @@ hsDXTDirectXCodec::hsDXTDirectXCodec() : fDirectDraw( nil ), fDDLibraryInstance(
|
|||||||
|
|
||||||
hsDXTDirectXCodec::~hsDXTDirectXCodec()
|
hsDXTDirectXCodec::~hsDXTDirectXCodec()
|
||||||
{
|
{
|
||||||
|
#if HS_BUILD_FOR_WIN32
|
||||||
if ((fFlags & kExternalInit) == 0)
|
if ((fFlags & kExternalInit) == 0)
|
||||||
{
|
{
|
||||||
if (fDirectDraw)
|
if (fDirectDraw)
|
||||||
@ -108,6 +112,7 @@ hsDXTDirectXCodec::~hsDXTDirectXCodec()
|
|||||||
|
|
||||||
fDirectDraw = nil;
|
fDirectDraw = nil;
|
||||||
fDDLibraryInstance = nil;
|
fDDLibraryInstance = nil;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
hsBool hsDXTDirectXCodec::Register()
|
hsBool hsDXTDirectXCodec::Register()
|
||||||
@ -115,6 +120,7 @@ hsBool hsDXTDirectXCodec::Register()
|
|||||||
return hsCodecManager::Instance().Register( &(Instance()), plMipmap::kDirectXCompression, 500 );
|
return hsCodecManager::Instance().Register( &(Instance()), plMipmap::kDirectXCompression, 500 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if HS_BUILD_FOR_WIN32
|
||||||
//// Initialize ///////////////////////////////////////////////////////////////
|
//// Initialize ///////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
void hsDXTDirectXCodec::Initialize( IDirect3DDevice8 *directDraw )
|
void hsDXTDirectXCodec::Initialize( IDirect3DDevice8 *directDraw )
|
||||||
@ -161,6 +167,7 @@ hsBool hsDXTDirectXCodec::IInitialize()
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
//// CreateCompressedMipmap ///////////////////////////////////////////////////
|
//// CreateCompressedMipmap ///////////////////////////////////////////////////
|
||||||
// Updated 8.15.2000 mcn to generate uncompressed mipmaps down to 1x1 (the
|
// Updated 8.15.2000 mcn to generate uncompressed mipmaps down to 1x1 (the
|
||||||
@ -169,6 +176,7 @@ hsBool hsDXTDirectXCodec::IInitialize()
|
|||||||
|
|
||||||
plMipmap *hsDXTDirectXCodec::CreateCompressedMipmap( plMipmap *uncompressed )
|
plMipmap *hsDXTDirectXCodec::CreateCompressedMipmap( plMipmap *uncompressed )
|
||||||
{
|
{
|
||||||
|
#if HS_BUILD_FOR_WIN32
|
||||||
const plMipmap *b = uncompressed;
|
const plMipmap *b = uncompressed;
|
||||||
plMipmap *compressed = nil;
|
plMipmap *compressed = nil;
|
||||||
|
|
||||||
@ -273,6 +281,9 @@ plMipmap *hsDXTDirectXCodec::CreateCompressedMipmap( plMipmap *uncompressed )
|
|||||||
|
|
||||||
/// All done!
|
/// All done!
|
||||||
return compressed;
|
return compressed;
|
||||||
|
#else
|
||||||
|
return nil;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
//// CreateUncompressedMipmap /////////////////////////////////////////////////
|
//// CreateUncompressedMipmap /////////////////////////////////////////////////
|
||||||
@ -418,6 +429,7 @@ plMipmap *hsDXTDirectXCodec::CreateUncompressedMipmap( plMipmap *compressed,
|
|||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if HS_BUILD_FOR_WIN32
|
||||||
UInt32 hsDXTDirectXCodec::ICompressedFormat(const plMipmap *uncompressed)
|
UInt32 hsDXTDirectXCodec::ICompressedFormat(const plMipmap *uncompressed)
|
||||||
{
|
{
|
||||||
if( uncompressed->GetFlags() & plMipmap::kAlphaChannelFlag )
|
if( uncompressed->GetFlags() & plMipmap::kAlphaChannelFlag )
|
||||||
@ -1236,10 +1248,9 @@ void hsDXTDirectXCodec::CheckErrorCode(HRESULT res)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
hsBool hsDXTDirectXCodec::ColorizeCompMipmap( plMipmap *bMap, const UInt8 *colorMask )
|
hsBool hsDXTDirectXCodec::ColorizeCompMipmap( plMipmap *bMap, const UInt8 *colorMask )
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
|
@ -54,15 +54,16 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
|||||||
#ifndef hsDXTDirectXCodec_inc
|
#ifndef hsDXTDirectXCodec_inc
|
||||||
#define hsDXTDirectXCodec_inc
|
#define hsDXTDirectXCodec_inc
|
||||||
|
|
||||||
#if HS_BUILD_FOR_WIN32
|
|
||||||
|
|
||||||
#include "hsWindows.h"
|
#include "hsWindows.h"
|
||||||
#include "hsCodec.h"
|
#include "hsCodec.h"
|
||||||
|
|
||||||
class plMipmap;
|
class plMipmap;
|
||||||
|
#if HS_BUILD_FOR_WIN32
|
||||||
struct IDirect3DDevice8;
|
struct IDirect3DDevice8;
|
||||||
struct IDirectDrawSurface7;
|
struct IDirectDrawSurface7;
|
||||||
struct IDirectDraw7;
|
struct IDirectDraw7;
|
||||||
|
#endif
|
||||||
|
|
||||||
class hsDXTDirectXCodec : public hsCodec
|
class hsDXTDirectXCodec : public hsCodec
|
||||||
{
|
{
|
||||||
@ -80,9 +81,12 @@ public:
|
|||||||
// Colorize a compressed mipmap
|
// Colorize a compressed mipmap
|
||||||
hsBool ColorizeCompMipmap( plMipmap *bMap, const UInt8 *colorMask );
|
hsBool ColorizeCompMipmap( plMipmap *bMap, const UInt8 *colorMask );
|
||||||
|
|
||||||
|
#if HS_BUILD_FOR_WIN32
|
||||||
void Initialize( IDirect3DDevice8 *directDraw );
|
void Initialize( IDirect3DDevice8 *directDraw );
|
||||||
|
#endif
|
||||||
hsBool Initialized() { return (fFlags & kInitialized) != 0; }
|
hsBool Initialized() { return (fFlags & kInitialized) != 0; }
|
||||||
|
|
||||||
|
#if HS_BUILD_FOR_WIN32
|
||||||
private:
|
private:
|
||||||
UInt32 ICompressedFormat(const plMipmap *uncompressed);
|
UInt32 ICompressedFormat(const plMipmap *uncompressed);
|
||||||
IDirectDrawSurface7 *IMakeDirect3DSurface( UInt32 formatType, UInt32 mipMapLevels, UInt32 width, UInt32 height );
|
IDirectDrawSurface7 *IMakeDirect3DSurface( UInt32 formatType, UInt32 mipMapLevels, UInt32 width, UInt32 height );
|
||||||
@ -91,9 +95,15 @@ private:
|
|||||||
void ICopySurface( IDirectDrawSurface7 *dest, IDirectDrawSurface7 *src, Int32 mipMapLevels );
|
void ICopySurface( IDirectDrawSurface7 *dest, IDirectDrawSurface7 *src, Int32 mipMapLevels );
|
||||||
void CheckErrorCode(HRESULT res);
|
void CheckErrorCode(HRESULT res);
|
||||||
hsBool IInitialize();
|
hsBool IInitialize();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if HS_BUILD_FOR_WIN32
|
||||||
IDirectDraw7 *fDirectDraw;
|
IDirectDraw7 *fDirectDraw;
|
||||||
HINSTANCE fDDLibraryInstance;
|
HINSTANCE fDDLibraryInstance;
|
||||||
|
#else
|
||||||
|
void* fDirectDraw;
|
||||||
|
void* fDDLibraryInstance;
|
||||||
|
#endif
|
||||||
UInt32 fFlags;
|
UInt32 fFlags;
|
||||||
|
|
||||||
enum
|
enum
|
||||||
@ -105,6 +115,5 @@ private:
|
|||||||
static hsBool Register();
|
static hsBool Register();
|
||||||
static hsBool fRegistered;
|
static hsBool fRegistered;
|
||||||
};
|
};
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif // hsDXTDirectXCodec_inc
|
#endif // hsDXTDirectXCodec_inc
|
||||||
|
@ -39,14 +39,15 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
|||||||
Mead, WA 99021
|
Mead, WA 99021
|
||||||
|
|
||||||
*==LICENSE==*/
|
*==LICENSE==*/
|
||||||
#if HS_BUILD_FOR_WIN32
|
|
||||||
|
|
||||||
#include "plAVIWriter.h"
|
#include "plAVIWriter.h"
|
||||||
|
|
||||||
#include "hsTypes.h"
|
#include "hsTypes.h"
|
||||||
|
|
||||||
#include "hsWindows.h"
|
#include "hsWindows.h"
|
||||||
|
#if HS_BUILD_FOR_WIN32
|
||||||
#include <vfw.h>
|
#include <vfw.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "hsTimer.h"
|
#include "hsTimer.h"
|
||||||
#include "plMipmap.h"
|
#include "plMipmap.h"
|
||||||
@ -57,6 +58,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
|||||||
|
|
||||||
bool plAVIWriter::fInitialized = false;
|
bool plAVIWriter::fInitialized = false;
|
||||||
|
|
||||||
|
#if HS_BUILD_FOR_WIN32
|
||||||
class plAVIWriterImp : public plAVIWriter
|
class plAVIWriterImp : public plAVIWriter
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
@ -86,6 +88,21 @@ public:
|
|||||||
virtual bool Open(const char* fileName, plPipeline* pipeline);
|
virtual bool Open(const char* fileName, plPipeline* pipeline);
|
||||||
virtual void Close();
|
virtual void Close();
|
||||||
};
|
};
|
||||||
|
#else
|
||||||
|
class plAVIWriterImp : public plAVIWriter
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
plAVIWriterImp();
|
||||||
|
virtual ~plAVIWriterImp();
|
||||||
|
|
||||||
|
virtual hsBool MsgReceive(plMessage* msg);
|
||||||
|
|
||||||
|
virtual void Shutdown();
|
||||||
|
|
||||||
|
virtual bool Open(const char* fileName, plPipeline* pipeline);
|
||||||
|
virtual void Close();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
plAVIWriter::~plAVIWriter()
|
plAVIWriter::~plAVIWriter()
|
||||||
{
|
{
|
||||||
@ -106,6 +123,7 @@ plAVIWriter& plAVIWriter::Instance()
|
|||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#if HS_BUILD_FOR_WIN32
|
||||||
plAVIWriterImp::plAVIWriterImp() :
|
plAVIWriterImp::plAVIWriterImp() :
|
||||||
fStartTime(0),
|
fStartTime(0),
|
||||||
fOldRealTime(false),
|
fOldRealTime(false),
|
||||||
@ -115,6 +133,9 @@ plAVIWriterImp::plAVIWriterImp() :
|
|||||||
{
|
{
|
||||||
AVIFileInit();
|
AVIFileInit();
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
plAVIWriterImp::plAVIWriterImp() { }
|
||||||
|
#endif
|
||||||
|
|
||||||
plAVIWriterImp::~plAVIWriterImp()
|
plAVIWriterImp::~plAVIWriterImp()
|
||||||
{
|
{
|
||||||
@ -134,7 +155,7 @@ plProfile_CreateTimer("AviCapture", "RenderSetup", AviCapture);
|
|||||||
|
|
||||||
hsBool plAVIWriterImp::MsgReceive(plMessage* msg)
|
hsBool plAVIWriterImp::MsgReceive(plMessage* msg)
|
||||||
{
|
{
|
||||||
|
#if HS_BUILD_FOR_WIN32
|
||||||
plRenderMsg* renderMsg = plRenderMsg::ConvertNoRef(msg);
|
plRenderMsg* renderMsg = plRenderMsg::ConvertNoRef(msg);
|
||||||
if (renderMsg)
|
if (renderMsg)
|
||||||
{
|
{
|
||||||
@ -144,12 +165,14 @@ hsBool plAVIWriterImp::MsgReceive(plMessage* msg)
|
|||||||
plProfile_EndTiming(AviCapture);
|
plProfile_EndTiming(AviCapture);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
return hsKeyedObject::MsgReceive(msg);
|
return hsKeyedObject::MsgReceive(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const int kFramesPerSec = 30;
|
static const int kFramesPerSec = 30;
|
||||||
|
|
||||||
|
#if HS_BUILD_FOR_WIN32
|
||||||
bool plAVIWriterImp::Open(const char* fileName, plPipeline* pipeline)
|
bool plAVIWriterImp::Open(const char* fileName, plPipeline* pipeline)
|
||||||
{
|
{
|
||||||
// Already writing, fail
|
// Already writing, fail
|
||||||
@ -232,11 +255,13 @@ bool plAVIWriterImp::Open(const char* fileName, plPipeline* pipeline)
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void plAVIWriterImp::Close()
|
void plAVIWriterImp::Close()
|
||||||
{
|
{
|
||||||
plgDispatch::Dispatch()->UnRegisterForExactType(plRenderMsg::Index(), GetKey());
|
plgDispatch::Dispatch()->UnRegisterForExactType(plRenderMsg::Index(), GetKey());
|
||||||
|
|
||||||
|
#if HS_BUILD_FOR_WIN32
|
||||||
hsTimer::SetRealTime(fOldRealTime);
|
hsTimer::SetRealTime(fOldRealTime);
|
||||||
|
|
||||||
if (fStreamHandle)
|
if (fStreamHandle)
|
||||||
@ -258,8 +283,10 @@ void plAVIWriterImp::Close()
|
|||||||
}
|
}
|
||||||
|
|
||||||
AVIFileExit();
|
AVIFileExit();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if HS_BUILD_FOR_WIN32
|
||||||
void plAVIWriterImp::IFillStreamInfo(AVISTREAMINFO* inf, plPipeline* pipeline)
|
void plAVIWriterImp::IFillStreamInfo(AVISTREAMINFO* inf, plPipeline* pipeline)
|
||||||
{
|
{
|
||||||
memset(inf, 0, sizeof(AVISTREAMINFO));
|
memset(inf, 0, sizeof(AVISTREAMINFO));
|
||||||
|
@ -42,8 +42,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
|||||||
#ifndef plAVIWriter_h_inc
|
#ifndef plAVIWriter_h_inc
|
||||||
#define plAVIWriter_h_inc
|
#define plAVIWriter_h_inc
|
||||||
|
|
||||||
#if HS_BUILD_FOR_WIN32
|
|
||||||
|
|
||||||
#include "pnKeyedObject/hsKeyedObject.h"
|
#include "pnKeyedObject/hsKeyedObject.h"
|
||||||
|
|
||||||
class plPipeline;
|
class plPipeline;
|
||||||
@ -69,6 +67,5 @@ public:
|
|||||||
virtual bool Open(const char* fileName, plPipeline* pipeline)=0;
|
virtual bool Open(const char* fileName, plPipeline* pipeline)=0;
|
||||||
virtual void Close()=0;
|
virtual void Close()=0;
|
||||||
};
|
};
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif // plAVIWriter_h_inc
|
#endif // plAVIWriter_h_inc
|
||||||
|
Reference in New Issue
Block a user