Expand BitmapText::UpdateBaseZoom()
The macro here is unnecessary.
This commit is contained in:
+36
-20
@@ -598,28 +598,44 @@ void BitmapText::UpdateBaseZoom()
|
|||||||
// Never apply a zoom greater than 1.
|
// Never apply a zoom greater than 1.
|
||||||
// Factor in the non-base zoom so that maxwidth will be in terms of theme
|
// Factor in the non-base zoom so that maxwidth will be in terms of theme
|
||||||
// pixels when zoom is used.
|
// pixels when zoom is used.
|
||||||
#define APPLY_DIMENSION_ZOOM(dimension_max, dimension_get, dimension_zoom_get, base_zoom_set) \
|
|
||||||
if(dimension_max == 0) \
|
constexpr float maxZoom = 1.0f;
|
||||||
{ \
|
|
||||||
base_zoom_set(1); \
|
if (m_fMaxWidth == 0)
|
||||||
} \
|
{
|
||||||
else \
|
SetBaseZoomX(1);
|
||||||
{ \
|
}
|
||||||
float dimension= dimension_get(); \
|
else
|
||||||
if(m_MaxDimensionUsesZoom) \
|
{
|
||||||
{ \
|
float width = GetUnzoomedWidth();
|
||||||
dimension/= dimension_zoom_get(); \
|
if (m_MaxDimensionUsesZoom)
|
||||||
} \
|
{
|
||||||
if(dimension != 0) \
|
width /= GetZoomX();
|
||||||
{ \
|
}
|
||||||
const float zoom= std::fmin(1, dimension_max / dimension); \
|
if (width != 0)
|
||||||
base_zoom_set(zoom); \
|
{
|
||||||
} \
|
const float zoom = std::fmin(maxZoom, m_fMaxWidth / width);
|
||||||
|
SetBaseZoomX(zoom);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
APPLY_DIMENSION_ZOOM(m_fMaxWidth, GetUnzoomedWidth, GetZoomX, SetBaseZoomX);
|
if (m_fMaxHeight == 0)
|
||||||
APPLY_DIMENSION_ZOOM(m_fMaxHeight, GetUnzoomedHeight, GetZoomY, SetBaseZoomY);
|
{
|
||||||
#undef APPLY_DIMENSION_ZOOM
|
SetBaseZoomY(1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
float height = GetUnzoomedHeight();
|
||||||
|
if (m_MaxDimensionUsesZoom)
|
||||||
|
{
|
||||||
|
height /= GetZoomY();
|
||||||
|
}
|
||||||
|
if (height != 0)
|
||||||
|
{
|
||||||
|
const float zoom = std::fmin(maxZoom, m_fMaxHeight / height);
|
||||||
|
SetBaseZoomY(zoom);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BitmapText::StringWillUseAlternate( const RString& sText, const RString& sAlternateText ) const
|
bool BitmapText::StringWillUseAlternate( const RString& sText, const RString& sAlternateText ) const
|
||||||
|
|||||||
Reference in New Issue
Block a user