diff options
Diffstat (limited to 'Minecraft.Client/Xbox/Font/XUI_FontRenderer.cpp')
| -rw-r--r-- | Minecraft.Client/Xbox/Font/XUI_FontRenderer.cpp | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/Minecraft.Client/Xbox/Font/XUI_FontRenderer.cpp b/Minecraft.Client/Xbox/Font/XUI_FontRenderer.cpp index d708af79..f6619fd5 100644 --- a/Minecraft.Client/Xbox/Font/XUI_FontRenderer.cpp +++ b/Minecraft.Client/Xbox/Font/XUI_FontRenderer.cpp @@ -36,7 +36,7 @@ VOID XUI_FontRenderer::Term() HRESULT XUI_FontRenderer::GetCaps( DWORD * pdwCaps ) { - if( pdwCaps != NULL ) + if( pdwCaps != nullptr ) { // setting this means XUI calls the DrawCharsToDevice method *pdwCaps = XUI_FONT_RENDERER_CAP_INTERNAL_GLYPH_CACHE | XUI_FONT_RENDERER_CAP_POINT_SIZE_RESPECTED | XUI_FONT_RENDERER_STYLE_DROPSHADOW; @@ -50,7 +50,7 @@ HRESULT XUI_FontRenderer::CreateFont( const TypefaceDescriptor * pTypefaceDescri //float fXuiSize = fPointSize * ( 16.0f / 16.0f ); fXuiSize /= 4.0f; fXuiSize = floor( fXuiSize ); - int xuiSize = (int)(fXuiSize * 4.0f); + int xuiSize = static_cast<int>(fXuiSize * 4.0f); if( xuiSize < 1 ) xuiSize = 8; // 4J Stu - We have fonts based on multiples of 8 or 12 @@ -60,8 +60,8 @@ HRESULT XUI_FontRenderer::CreateFont( const TypefaceDescriptor * pTypefaceDescri //app.DebugPrintf("point size is: %f, xuiSize is: %d\n", fPointSize, xuiSize); - XUI_Font *font = NULL; - XUI_FontData *fontData = NULL; + XUI_Font *font = nullptr; + XUI_FontData *fontData = nullptr; FLOAT scale = 1; eFontData efontdata; @@ -77,17 +77,17 @@ HRESULT XUI_FontRenderer::CreateFont( const TypefaceDescriptor * pTypefaceDescri } font = m_loadedFonts[efontdata][scale]; - if (font == NULL) + if (font == nullptr) { fontData = m_loadedFontData[efontdata]; - if (fontData == NULL) + if (fontData == nullptr) { SFontData *sfontdata; switch (efontdata) { case eFontData_Mojangles_7: sfontdata = &SFontData::Mojangles_7; break; case eFontData_Mojangles_11: sfontdata = &SFontData::Mojangles_11; break; - default: sfontdata = NULL; break; + default: sfontdata = nullptr; break; } fontData = new XUI_FontData(); @@ -101,14 +101,14 @@ HRESULT XUI_FontRenderer::CreateFont( const TypefaceDescriptor * pTypefaceDescri } font->IncRefCount(); - *phFont = (HFONTOBJ)font; + *phFont = static_cast<HFONTOBJ>(font); return S_OK; } VOID XUI_FontRenderer::ReleaseFont( HFONTOBJ hFont ) { - XUI_Font *xuiFont = (XUI_Font*) hFont; - if (xuiFont != NULL) + XUI_Font *xuiFont = static_cast<XUI_Font *>(hFont); + if (xuiFont != nullptr) { xuiFont->DecRefCount(); if (xuiFont->refCount <= 0) @@ -125,7 +125,7 @@ HRESULT XUI_FontRenderer::GetFontMetrics( HFONTOBJ hFont, XUIFontMetrics *pFontM { if( hFont == 0 || pFontMetrics == 0 ) return E_INVALIDARG; - XUI_Font *font = (XUI_Font *)hFont; + XUI_Font *font = static_cast<XUI_Font *>(hFont); pFontMetrics->fLineHeight = (font->m_fontData->getFontYAdvance() + 1) * font->m_fYScaleFactor; pFontMetrics->fMaxAscent = font->m_fontData->getMaxAscent() * font->m_fYScaleFactor; @@ -142,7 +142,7 @@ HRESULT XUI_FontRenderer::GetCharMetrics( HFONTOBJ hFont, WCHAR wch, XUICharMetr { if (hFont == 0 || pCharMetrics == 0) return E_INVALIDARG; - XUI_Font *font = (XUI_Font *)hFont; + XUI_Font *font = static_cast<XUI_Font *>(hFont); XUI_FontData::SChar sChar = font->m_fontData->getChar(wch); pCharMetrics->fMinX = sChar.getMinX() * font->m_fYScaleFactor; @@ -156,7 +156,7 @@ HRESULT XUI_FontRenderer::GetCharMetrics( HFONTOBJ hFont, WCHAR wch, XUICharMetr HRESULT XUI_FontRenderer::DrawCharToTexture( HFONTOBJ hFont, WCHAR wch, HXUIDC hDC, IXuiTexture * pTexture, UINT x, UINT y, UINT width, UINT height, UINT insetX, UINT insetY ) { - if( hFont==0 || pTexture==NULL ) return E_INVALIDARG; + if( hFont==0 || pTexture==nullptr ) return E_INVALIDARG; return( S_OK ); } @@ -169,7 +169,7 @@ HRESULT XUI_FontRenderer::DrawCharsToDevice( HFONTOBJ hFont, CharData * pCharDat DWORD SamplerStateA[5]; XMVECTOR vconsts[20]; XMVECTOR pconsts[20]; - XUI_Font *font = (XUI_Font *)hFont; + XUI_Font *font = static_cast<XUI_Font *>(hFont); // 4J-PB - if we're in 480 Widescreen mode, we need to ensure that the font characters are aligned on an even boundary if they are a 2x multiple if(!RenderManager.IsHiDef()) @@ -184,19 +184,19 @@ HRESULT XUI_FontRenderer::DrawCharsToDevice( HFONTOBJ hFont, CharData * pCharDat if(iScaleX%2==0) { int iWorldX=pWorldViewProj->_41; - pWorldViewProj->_41 = (float)(iWorldX & -2); + pWorldViewProj->_41 = static_cast<float>(iWorldX & -2); } if(iScaleY%2==0) { int iWorldY=pWorldViewProj->_42; - pWorldViewProj->_42 = (float)(iWorldY & -2); + pWorldViewProj->_42 = static_cast<float>(iWorldY & -2); } } else { // make x an even number for 480 4:3 int iWorldX=pWorldViewProj->_41; - pWorldViewProj->_41 = (float)(iWorldX & -2); + pWorldViewProj->_41 = static_cast<float>(iWorldX & -2); // 480 SD mode - y needs to be on a pixel boundary when multiplied by 1.5, so if it's an odd number, subtract 1/3 from it int iWorldY=pWorldViewProj->_42; |
