mirror of
https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git
synced 2025-07-19 11:49:09 +00:00
Link shadowed text rendering to the plDynamicTextMap::kFontShadowed flag.
Conveniently enough, this existing but unimplemented flag is already set mostly the way we want it in the current PRPs.
This commit is contained in:
@ -380,6 +380,17 @@ void plDynamicTextMap::IClearFromBuffer( UInt32 *clearBuffer )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//// IPropagateFlags //////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
void plDynamicTextMap::IPropagateFlags()
|
||||||
|
{
|
||||||
|
SetJustify(fJustify);
|
||||||
|
fCurrFont->SetRenderFlag(plFont::kRenderShadow, fFontFlags & kFontShadowed);
|
||||||
|
fCurrFont->SetRenderFlag(plFont::kRenderIntoAlpha, fFontBlockRGB);
|
||||||
|
fCurrFont->SetRenderFlag(plFont::kRenderAlphaPremultiplied, fPremultipliedAlpha);
|
||||||
|
fCurrFont->SetRenderColor(fFontColor.ToARGB32());
|
||||||
|
}
|
||||||
|
|
||||||
//// ClearToColor /////////////////////////////////////////////////////////////
|
//// ClearToColor /////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
void plDynamicTextMap::ClearToColor( hsColorRGBA &color )
|
void plDynamicTextMap::ClearToColor( hsColorRGBA &color )
|
||||||
@ -454,6 +465,8 @@ void plDynamicTextMap::SetFont( const char *face, UInt16 size, UInt8 fontFlags,
|
|||||||
// This will be nil if we're just running the page optimizer.
|
// This will be nil if we're just running the page optimizer.
|
||||||
if (fCurrFont)
|
if (fCurrFont)
|
||||||
{
|
{
|
||||||
|
if (fFontFlags & kFontShadowed)
|
||||||
|
fCurrFont->SetRenderFlag(plFont::kRenderShadow, true);
|
||||||
fCurrFont->SetRenderYJustify( plFont::kRenderJustYTop );
|
fCurrFont->SetRenderYJustify( plFont::kRenderJustYTop );
|
||||||
SetJustify( fJustify );
|
SetJustify( fJustify );
|
||||||
}
|
}
|
||||||
@ -507,12 +520,9 @@ void plDynamicTextMap::DrawString( UInt16 x, UInt16 y, const wchar_t *text )
|
|||||||
if( !IIsValid() )
|
if( !IIsValid() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
SetJustify( fJustify );
|
IPropagateFlags();
|
||||||
fCurrFont->SetRenderFlag( plFont::kRenderWrap | plFont::kRenderClip, false );
|
fCurrFont->SetRenderFlag( plFont::kRenderWrap | plFont::kRenderClip, false );
|
||||||
fCurrFont->SetRenderClipRect( 0, 0, fVisWidth, fVisHeight );
|
fCurrFont->SetRenderClipRect( 0, 0, fVisWidth, fVisHeight );
|
||||||
fCurrFont->SetRenderColor( fFontColor.ToARGB32() );
|
|
||||||
fCurrFont->SetRenderFlag( plFont::kRenderIntoAlpha, fFontBlockRGB );
|
|
||||||
fCurrFont->SetRenderFlag( plFont::kRenderAlphaPremultiplied, fPremultipliedAlpha );
|
|
||||||
fCurrFont->RenderString( this, x, y, text );
|
fCurrFont->RenderString( this, x, y, text );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -530,11 +540,8 @@ void plDynamicTextMap::DrawClippedString( Int16 x, Int16 y, const wchar_t *text,
|
|||||||
if( !IIsValid() )
|
if( !IIsValid() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
SetJustify( fJustify );
|
IPropagateFlags();
|
||||||
fCurrFont->SetRenderClipping( x, y, width, height );
|
fCurrFont->SetRenderClipping( x, y, width, height );
|
||||||
fCurrFont->SetRenderColor( fFontColor.ToARGB32() );
|
|
||||||
fCurrFont->SetRenderFlag( plFont::kRenderIntoAlpha, fFontBlockRGB );
|
|
||||||
fCurrFont->SetRenderFlag( plFont::kRenderAlphaPremultiplied, fPremultipliedAlpha );
|
|
||||||
fCurrFont->RenderString( this, x, y, text );
|
fCurrFont->RenderString( this, x, y, text );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -552,10 +559,8 @@ void plDynamicTextMap::DrawClippedString( Int16 x, Int16 y, const wchar_t *text,
|
|||||||
if( !IIsValid() )
|
if( !IIsValid() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
SetJustify( fJustify );
|
IPropagateFlags();
|
||||||
fCurrFont->SetRenderClipping( clipX, clipY, width, height );
|
fCurrFont->SetRenderClipping( clipX, clipY, width, height );
|
||||||
fCurrFont->SetRenderColor( fFontColor.ToARGB32() );
|
|
||||||
fCurrFont->SetRenderFlag( plFont::kRenderAlphaPremultiplied, fPremultipliedAlpha );
|
|
||||||
fCurrFont->RenderString( this, x, y, text );
|
fCurrFont->RenderString( this, x, y, text );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -573,11 +578,8 @@ void plDynamicTextMap::DrawWrappedString( UInt16 x, UInt16 y, const wchar_t *tex
|
|||||||
if( !IIsValid() )
|
if( !IIsValid() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
SetJustify( fJustify );
|
IPropagateFlags();
|
||||||
fCurrFont->SetRenderWrapping( x, y, width, height );
|
fCurrFont->SetRenderWrapping( x, y, width, height );
|
||||||
fCurrFont->SetRenderColor( fFontColor.ToARGB32() );
|
|
||||||
fCurrFont->SetRenderFlag( plFont::kRenderIntoAlpha, fFontBlockRGB );
|
|
||||||
fCurrFont->SetRenderFlag( plFont::kRenderAlphaPremultiplied, fPremultipliedAlpha );
|
|
||||||
fCurrFont->RenderString( this, x, y, text, lastX, lastY );
|
fCurrFont->RenderString( this, x, y, text, lastX, lastY );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -222,6 +222,8 @@ class plDynamicTextMap : public plMipmap
|
|||||||
UInt32 *IAllocateOSSurface( UInt16 width, UInt16 height );
|
UInt32 *IAllocateOSSurface( UInt16 width, UInt16 height );
|
||||||
void IDestroyOSSurface( void );
|
void IDestroyOSSurface( void );
|
||||||
|
|
||||||
|
void IPropagateFlags();
|
||||||
|
|
||||||
hsBool fHasAlpha, fPremultipliedAlpha, fShadowed;
|
hsBool fHasAlpha, fPremultipliedAlpha, fShadowed;
|
||||||
|
|
||||||
Justify fJustify;
|
Justify fJustify;
|
||||||
|
@ -347,7 +347,7 @@ void plFont::IRenderString( plMipmap *mip, UInt16 x, UInt16 y, const wchar_t *st
|
|||||||
{
|
{
|
||||||
if( fRenderInfo.fFlags & kRenderAlphaPremultiplied )
|
if( fRenderInfo.fFlags & kRenderAlphaPremultiplied )
|
||||||
{
|
{
|
||||||
if (1)//( ( fRenderInfo.fColor & 0x00ffffff ) == 0x00ffffff ) //FIXME
|
if (fRenderInfo.fFlags & kRenderShadow)
|
||||||
fRenderInfo.fRenderFunc = &plFont::IRenderChar8To32AlphaPremShadow;
|
fRenderInfo.fRenderFunc = &plFont::IRenderChar8To32AlphaPremShadow;
|
||||||
else
|
else
|
||||||
fRenderInfo.fRenderFunc = &plFont::IRenderChar8To32AlphaPremultiplied;
|
fRenderInfo.fRenderFunc = &plFont::IRenderChar8To32AlphaPremultiplied;
|
||||||
|
@ -117,6 +117,7 @@ class plFont : public hsKeyedObject
|
|||||||
// leave the alpha as-is
|
// leave the alpha as-is
|
||||||
// This flag has no effect on monochrome fonts
|
// This flag has no effect on monochrome fonts
|
||||||
kRenderAlphaPremultiplied = 0x00001000, // Destination has color values premultiplied by alpha
|
kRenderAlphaPremultiplied = 0x00001000, // Destination has color values premultiplied by alpha
|
||||||
|
kRenderShadow = 0x00002000, // Render text shadows
|
||||||
};
|
};
|
||||||
|
|
||||||
enum Flags
|
enum Flags
|
||||||
|
Reference in New Issue
Block a user