From 526bed2f43aa584e1ffdb8549468e73630325b16 Mon Sep 17 00:00:00 2001 From: Darryl Pogue Date: Sun, 30 Oct 2011 13:18:54 -0700 Subject: [PATCH] Fixes for plGImage HS_BUILD_FOR_WIN32. --- .../PubUtilLib/plGImage/hsDXTDirectXCodec.cpp | 19 +++++++++--- .../PubUtilLib/plGImage/hsDXTDirectXCodec.h | 13 ++++++-- .../PubUtilLib/plGImage/plAVIWriter.cpp | 31 +++++++++++++++++-- .../Plasma/PubUtilLib/plGImage/plAVIWriter.h | 3 -- 4 files changed, 55 insertions(+), 11 deletions(-) diff --git a/Sources/Plasma/PubUtilLib/plGImage/hsDXTDirectXCodec.cpp b/Sources/Plasma/PubUtilLib/plGImage/hsDXTDirectXCodec.cpp index 35742818..3f68ba44 100644 --- a/Sources/Plasma/PubUtilLib/plGImage/hsDXTDirectXCodec.cpp +++ b/Sources/Plasma/PubUtilLib/plGImage/hsDXTDirectXCodec.cpp @@ -51,13 +51,14 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // // /////////////////////////////////////////////////////////////////////////////// -#if HS_BUILD_FOR_WIN32 #include "hsConfig.h" #include "hsWindows.h" +#if HS_BUILD_FOR_WIN32 #include #include +#endif #include "hsTypes.h" #include "hsDXTDirectXCodec.h" @@ -65,6 +66,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "hsCodecManager.h" #include "plPipeline/hsGDDrawDllLoad.h" +#if HS_BUILD_FOR_WIN32 namespace { 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_DXT5 = 0x00020000, // No.18: DXTn FourCC (DXT5), format. }; +#endif hsBool hsDXTDirectXCodec::fRegistered = false; @@ -93,6 +96,7 @@ hsDXTDirectXCodec::hsDXTDirectXCodec() : fDirectDraw( nil ), fDDLibraryInstance( hsDXTDirectXCodec::~hsDXTDirectXCodec() { +#if HS_BUILD_FOR_WIN32 if ((fFlags & kExternalInit) == 0) { if (fDirectDraw) @@ -108,6 +112,7 @@ hsDXTDirectXCodec::~hsDXTDirectXCodec() fDirectDraw = nil; fDDLibraryInstance = nil; +#endif } hsBool hsDXTDirectXCodec::Register() @@ -115,6 +120,7 @@ hsBool hsDXTDirectXCodec::Register() return hsCodecManager::Instance().Register( &(Instance()), plMipmap::kDirectXCompression, 500 ); } +#if HS_BUILD_FOR_WIN32 //// Initialize /////////////////////////////////////////////////////////////// void hsDXTDirectXCodec::Initialize( IDirect3DDevice8 *directDraw ) @@ -161,6 +167,7 @@ hsBool hsDXTDirectXCodec::IInitialize() return true; } +#endif //// CreateCompressedMipmap /////////////////////////////////////////////////// // 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 ) { +#if HS_BUILD_FOR_WIN32 const plMipmap *b = uncompressed; plMipmap *compressed = nil; @@ -273,6 +281,9 @@ plMipmap *hsDXTDirectXCodec::CreateCompressedMipmap( plMipmap *uncompressed ) /// All done! return compressed; +#else + return nil; +#endif } //// CreateUncompressedMipmap ///////////////////////////////////////////////// @@ -418,6 +429,7 @@ plMipmap *hsDXTDirectXCodec::CreateUncompressedMipmap( plMipmap *compressed, */ } +#if HS_BUILD_FOR_WIN32 UInt32 hsDXTDirectXCodec::ICompressedFormat(const plMipmap *uncompressed) { if( uncompressed->GetFlags() & plMipmap::kAlphaChannelFlag ) @@ -1236,10 +1248,9 @@ void hsDXTDirectXCodec::CheckErrorCode(HRESULT res) break; } } +#endif hsBool hsDXTDirectXCodec::ColorizeCompMipmap( plMipmap *bMap, const UInt8 *colorMask ) { return false; -} - -#endif +} \ No newline at end of file diff --git a/Sources/Plasma/PubUtilLib/plGImage/hsDXTDirectXCodec.h b/Sources/Plasma/PubUtilLib/plGImage/hsDXTDirectXCodec.h index 1094bc7b..5157e8fc 100644 --- a/Sources/Plasma/PubUtilLib/plGImage/hsDXTDirectXCodec.h +++ b/Sources/Plasma/PubUtilLib/plGImage/hsDXTDirectXCodec.h @@ -54,15 +54,16 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef hsDXTDirectXCodec_inc #define hsDXTDirectXCodec_inc -#if HS_BUILD_FOR_WIN32 #include "hsWindows.h" #include "hsCodec.h" class plMipmap; +#if HS_BUILD_FOR_WIN32 struct IDirect3DDevice8; struct IDirectDrawSurface7; struct IDirectDraw7; +#endif class hsDXTDirectXCodec : public hsCodec { @@ -80,9 +81,12 @@ public: // Colorize a compressed mipmap hsBool ColorizeCompMipmap( plMipmap *bMap, const UInt8 *colorMask ); +#if HS_BUILD_FOR_WIN32 void Initialize( IDirect3DDevice8 *directDraw ); +#endif hsBool Initialized() { return (fFlags & kInitialized) != 0; } +#if HS_BUILD_FOR_WIN32 private: UInt32 ICompressedFormat(const plMipmap *uncompressed); IDirectDrawSurface7 *IMakeDirect3DSurface( UInt32 formatType, UInt32 mipMapLevels, UInt32 width, UInt32 height ); @@ -91,9 +95,15 @@ private: void ICopySurface( IDirectDrawSurface7 *dest, IDirectDrawSurface7 *src, Int32 mipMapLevels ); void CheckErrorCode(HRESULT res); hsBool IInitialize(); +#endif +#if HS_BUILD_FOR_WIN32 IDirectDraw7 *fDirectDraw; HINSTANCE fDDLibraryInstance; +#else + void* fDirectDraw; + void* fDDLibraryInstance; +#endif UInt32 fFlags; enum @@ -105,6 +115,5 @@ private: static hsBool Register(); static hsBool fRegistered; }; -#endif #endif // hsDXTDirectXCodec_inc diff --git a/Sources/Plasma/PubUtilLib/plGImage/plAVIWriter.cpp b/Sources/Plasma/PubUtilLib/plGImage/plAVIWriter.cpp index 110ac5b4..7452642e 100644 --- a/Sources/Plasma/PubUtilLib/plGImage/plAVIWriter.cpp +++ b/Sources/Plasma/PubUtilLib/plGImage/plAVIWriter.cpp @@ -39,14 +39,15 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com Mead, WA 99021 *==LICENSE==*/ -#if HS_BUILD_FOR_WIN32 #include "plAVIWriter.h" #include "hsTypes.h" #include "hsWindows.h" +#if HS_BUILD_FOR_WIN32 #include +#endif #include "hsTimer.h" #include "plMipmap.h" @@ -57,6 +58,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com bool plAVIWriter::fInitialized = false; +#if HS_BUILD_FOR_WIN32 class plAVIWriterImp : public plAVIWriter { protected: @@ -86,6 +88,21 @@ public: virtual bool Open(const char* fileName, plPipeline* pipeline); 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() { @@ -106,6 +123,7 @@ plAVIWriter& plAVIWriter::Instance() //////////////////////////////////////////////////////////////////////////////// +#if HS_BUILD_FOR_WIN32 plAVIWriterImp::plAVIWriterImp() : fStartTime(0), fOldRealTime(false), @@ -115,6 +133,9 @@ plAVIWriterImp::plAVIWriterImp() : { AVIFileInit(); } +#else +plAVIWriterImp::plAVIWriterImp() { } +#endif plAVIWriterImp::~plAVIWriterImp() { @@ -134,7 +155,7 @@ plProfile_CreateTimer("AviCapture", "RenderSetup", AviCapture); hsBool plAVIWriterImp::MsgReceive(plMessage* msg) { - +#if HS_BUILD_FOR_WIN32 plRenderMsg* renderMsg = plRenderMsg::ConvertNoRef(msg); if (renderMsg) { @@ -144,12 +165,14 @@ hsBool plAVIWriterImp::MsgReceive(plMessage* msg) plProfile_EndTiming(AviCapture); } +#endif return hsKeyedObject::MsgReceive(msg); } static const int kFramesPerSec = 30; +#if HS_BUILD_FOR_WIN32 bool plAVIWriterImp::Open(const char* fileName, plPipeline* pipeline) { // Already writing, fail @@ -232,11 +255,13 @@ bool plAVIWriterImp::Open(const char* fileName, plPipeline* pipeline) return true; } +#endif void plAVIWriterImp::Close() { plgDispatch::Dispatch()->UnRegisterForExactType(plRenderMsg::Index(), GetKey()); +#if HS_BUILD_FOR_WIN32 hsTimer::SetRealTime(fOldRealTime); if (fStreamHandle) @@ -258,8 +283,10 @@ void plAVIWriterImp::Close() } AVIFileExit(); +#endif } +#if HS_BUILD_FOR_WIN32 void plAVIWriterImp::IFillStreamInfo(AVISTREAMINFO* inf, plPipeline* pipeline) { memset(inf, 0, sizeof(AVISTREAMINFO)); diff --git a/Sources/Plasma/PubUtilLib/plGImage/plAVIWriter.h b/Sources/Plasma/PubUtilLib/plGImage/plAVIWriter.h index c11c740b..1b050359 100644 --- a/Sources/Plasma/PubUtilLib/plGImage/plAVIWriter.h +++ b/Sources/Plasma/PubUtilLib/plGImage/plAVIWriter.h @@ -42,8 +42,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef plAVIWriter_h_inc #define plAVIWriter_h_inc -#if HS_BUILD_FOR_WIN32 - #include "pnKeyedObject/hsKeyedObject.h" class plPipeline; @@ -69,6 +67,5 @@ public: virtual bool Open(const char* fileName, plPipeline* pipeline)=0; virtual void Close()=0; }; -#endif #endif // plAVIWriter_h_inc