Browse Source

ifdef out all the Win32 specific code in plGImage.

Darryl Pogue 13 years ago
parent
commit
085b12e6eb
  1. 1
      Sources/Plasma/CoreLib/hsUtils.h
  2. 3
      Sources/Plasma/PubUtilLib/plGImage/hsDXTDirectXCodec.cpp
  3. 3
      Sources/Plasma/PubUtilLib/plGImage/hsDXTDirectXCodec.h
  4. 3
      Sources/Plasma/PubUtilLib/plGImage/plAVIWriter.cpp
  5. 5
      Sources/Plasma/PubUtilLib/plGImage/plAVIWriter.h
  6. 19
      Sources/Plasma/PubUtilLib/plGImage/plDynSurfaceWriter.cpp
  7. 2
      Sources/Plasma/PubUtilLib/plGImage/plFont.cpp

1
Sources/Plasma/CoreLib/hsUtils.h

@ -72,6 +72,7 @@ char * hsFormatStrV(const char * fmt, va_list args); // You are responsible f
# define strnicmp strncasecmp # define strnicmp strncasecmp
# define wcsicmp wcscasecmp # define wcsicmp wcscasecmp
# define wcsnicmp wcsncasecmp # define wcsnicmp wcsncasecmp
# define strlwr hsStrLower
#endif #endif

3
Sources/Plasma/PubUtilLib/plGImage/hsDXTDirectXCodec.cpp

@ -51,6 +51,8 @@ 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"
@ -1240,3 +1242,4 @@ hsBool hsDXTDirectXCodec::ColorizeCompMipmap( plMipmap *bMap, const UInt8 *color
return false; return false;
} }
#endif

3
Sources/Plasma/PubUtilLib/plGImage/hsDXTDirectXCodec.h

@ -54,6 +54,8 @@ 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"
@ -103,5 +105,6 @@ private:
static hsBool Register(); static hsBool Register();
static hsBool fRegistered; static hsBool fRegistered;
}; };
#endif
#endif // hsDXTDirectXCodec_inc #endif // hsDXTDirectXCodec_inc

3
Sources/Plasma/PubUtilLib/plGImage/plAVIWriter.cpp

@ -39,6 +39,8 @@ 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"
@ -308,3 +310,4 @@ bool plAVIWriterImp::ICaptureFrame(plPipeline* pipeline)
return (err == AVIERR_OK); return (err == AVIERR_OK);
} }
#endif

5
Sources/Plasma/PubUtilLib/plGImage/plAVIWriter.h

@ -42,6 +42,8 @@ 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;
@ -67,5 +69,6 @@ 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

19
Sources/Plasma/PubUtilLib/plGImage/plDynSurfaceWriter.cpp

@ -394,8 +394,10 @@ void plDynSurfaceWriter::IInit( void )
void plDynSurfaceWriter::Reset( void ) void plDynSurfaceWriter::Reset( void )
{ {
#if HS_BUILD_FOR_WIN32
fRGBSurface.Release(); fRGBSurface.Release();
fAlphaSurface.Release(); fAlphaSurface.Release();
#endif
fCurrTarget = nil; fCurrTarget = nil;
fFlushed = true; fFlushed = true;
@ -484,6 +486,7 @@ void plDynSurfaceWriter::SwitchTarget( plDynamicTextMap *target )
// Make sure our surfaces fit // Make sure our surfaces fit
bool hadToAllocate = false; bool hadToAllocate = false;
#if HS_BUILD_FOR_WIN32
if( target != nil ) if( target != nil )
{ {
if( !fRGBSurface.WillFit( (UInt16)(target->GetWidth()), (UInt16)(target->GetHeight()) ) ) if( !fRGBSurface.WillFit( (UInt16)(target->GetWidth()), (UInt16)(target->GetHeight()) ) )
@ -507,6 +510,7 @@ void plDynSurfaceWriter::SwitchTarget( plDynamicTextMap *target )
fAlphaSurface.Release(); fAlphaSurface.Release();
hadToAllocate = true; hadToAllocate = true;
} }
#endif
if( hadToAllocate ) if( hadToAllocate )
{ {
@ -533,6 +537,7 @@ void plDynSurfaceWriter::IEnsureSurfaceUpdated( void )
{ {
UInt32 *srcBits = (UInt32 *)fCurrTarget->GetImage(); UInt32 *srcBits = (UInt32 *)fCurrTarget->GetImage();
#if HS_BUILD_FOR_WIN32
// Are we merging in the alpha bits? // Are we merging in the alpha bits?
if( fFlags & kSupportAlpha ) if( fFlags & kSupportAlpha )
{ {
@ -568,12 +573,14 @@ void plDynSurfaceWriter::IEnsureSurfaceUpdated( void )
destBits += fRGBSurface.fWidth; destBits += fRGBSurface.fWidth;
} }
} }
#endif
// ALSO, we need to re-update our settings, since different targets // ALSO, we need to re-update our settings, since different targets
// can have different fonts or justifications // can have different fonts or justifications
ISetFont( fCurrTarget->GetFontFace(), fCurrTarget->GetFontSize(), 0/*fCurrTarget->GetWriterFontFlags()*/, fCurrTarget->GetFontAARGB() ); ISetFont( fCurrTarget->GetFontFace(), fCurrTarget->GetFontSize(), 0/*fCurrTarget->GetWriterFontFlags()*/, fCurrTarget->GetFontAARGB() );
SetJustify( (Justify)fCurrTarget->GetFontJustify() ); SetJustify( (Justify)fCurrTarget->GetFontJustify() );
ISetTextColor( fCurrTarget->GetFontColor(), fCurrTarget->GetFontBlockRGB() ); hsColorRGBA col = fCurrTarget->GetFontColor();
ISetTextColor( col, fCurrTarget->GetFontBlockRGB() );
fFlushed = false; fFlushed = false;
} }
@ -584,11 +591,13 @@ hsBool plDynSurfaceWriter::IsValid( void ) const
if( fCurrTarget == nil ) if( fCurrTarget == nil )
return false; return false;
#if HS_BUILD_FOR_WIN32
if( fRGBSurface.fDC == nil || fRGBSurface.fBitmap == nil ) if( fRGBSurface.fDC == nil || fRGBSurface.fBitmap == nil )
return false; return false;
if( ( fFlags & kSupportAlpha ) && ( fAlphaSurface.fDC == nil || fAlphaSurface.fBitmap == nil ) ) if( ( fFlags & kSupportAlpha ) && ( fAlphaSurface.fDC == nil || fAlphaSurface.fBitmap == nil ) )
return false; return false;
#endif
return true; return true;
} }
@ -696,6 +705,7 @@ void plDynSurfaceWriter::ISetFont( const char *face, UInt16 size, UInt8 fontF
{ {
fFlags = ( fFlags & ~kFontShadowed ) | ( fontFlags & kFontShadowed ); fFlags = ( fFlags & ~kFontShadowed ) | ( fontFlags & kFontShadowed );
#if HS_BUILD_FOR_WIN32
if( !fRGBSurface.FontMatches( face, size, fontFlags, antiAliasRGB ) ) if( !fRGBSurface.FontMatches( face, size, fontFlags, antiAliasRGB ) )
fRGBSurface.SetFont( face, size, fontFlags, antiAliasRGB ); fRGBSurface.SetFont( face, size, fontFlags, antiAliasRGB );
@ -704,6 +714,7 @@ void plDynSurfaceWriter::ISetFont( const char *face, UInt16 size, UInt8 fontF
if( !fAlphaSurface.FontMatches( face, size, fontFlags, !antiAliasRGB ) ) if( !fAlphaSurface.FontMatches( face, size, fontFlags, !antiAliasRGB ) )
fAlphaSurface.SetFont( face, size, fontFlags, !antiAliasRGB ); fAlphaSurface.SetFont( face, size, fontFlags, !antiAliasRGB );
} }
#endif
} }
//// SetTextColor ///////////////////////////////////////////////////////////// //// SetTextColor /////////////////////////////////////////////////////////////
@ -770,7 +781,8 @@ void plDynSurfaceWriter::IRefreshOSJustify( void )
if( !IsValid() ) if( !IsValid() )
return; return;
UINT justMode; #if HS_BUILD_FOR_WIN32
UInt32 justMode;
switch( fJustify ) switch( fJustify )
{ {
case kLeftJustify: justMode = TA_LEFT; break; case kLeftJustify: justMode = TA_LEFT; break;
@ -780,6 +792,7 @@ void plDynSurfaceWriter::IRefreshOSJustify( void )
::SetTextAlign( fRGBSurface.fDC, justMode ); ::SetTextAlign( fRGBSurface.fDC, justMode );
if( fFlags & kSupportAlpha ) if( fFlags & kSupportAlpha )
::SetTextAlign( fAlphaSurface.fDC, justMode ); ::SetTextAlign( fAlphaSurface.fDC, justMode );
#endif
} }
//// DrawString /////////////////////////////////////////////////////////////// //// DrawString ///////////////////////////////////////////////////////////////
@ -1122,4 +1135,4 @@ void plDynSurfaceWriter::DrawClippedImage( UInt16 x, UInt16 y, plMipmap *imag
::DeleteObject( brush ); ::DeleteObject( brush );
} }
} }
*/ */

2
Sources/Plasma/PubUtilLib/plGImage/plFont.cpp

@ -1024,7 +1024,7 @@ void plFont::CalcStringExtents( const wchar_t *string, UInt16 &width, UInt16
// firstClippedChar is an index into the given string that points to the start of the part of the string // firstClippedChar is an index into the given string that points to the start of the part of the string
// that got clipped (i.e. not rendered). // that got clipped (i.e. not rendered).
firstClippedChar = (UInt32)fRenderInfo.fVolatileStringPtr - (UInt32)string; firstClippedChar = (unsigned_ptr)fRenderInfo.fVolatileStringPtr - (unsigned_ptr)string;
firstClippedChar /= 2; // divide by 2 because a wchar_t is two bytes wide, instead of one (like a char) firstClippedChar /= 2; // divide by 2 because a wchar_t is two bytes wide, instead of one (like a char)
} }

Loading…
Cancel
Save