mirror of
https://bitbucket.org/mfeemster/fractorium.git
synced 2025-07-02 06:16:17 -04:00
Remove focus handling code from spin boxes. It was originally done to compensate for a bug in Qt, but required the user to make very precise mouse movements. This is no longer needed since the bug has been fixed.
Prevent spatial and density filters from returning empty filters. Another attempt at properly setting the locale for the affine rotate/move/scale combo boxes.
This commit is contained in:
@ -56,6 +56,12 @@ public:
|
||||
|
||||
if (m_MaxRad < m_MinRad)
|
||||
m_MaxRad = m_MinRad + 1;
|
||||
|
||||
//Ensure it's valid.
|
||||
while (!Valid())
|
||||
{
|
||||
m_Curve += T(0.1);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -244,6 +244,8 @@ bool Renderer<T, bucketT>::CreateSpatialFilter(bool& newAlloc)
|
||||
{
|
||||
m_SpatialFilter = unique_ptr<SpatialFilter<T>>(
|
||||
SpatialFilterCreator<T>::Create(m_Ember.m_SpatialFilterType, m_Ember.m_SpatialFilterRadius, m_Ember.m_Supersample, m_PixelAspectRatio));
|
||||
|
||||
m_Ember.m_SpatialFilterRadius = m_SpatialFilter->FilterRadius();//It may have been changed internally if it was too small, so ensure they're synced.
|
||||
newAlloc = true;
|
||||
}
|
||||
|
||||
|
@ -105,45 +105,51 @@ public:
|
||||
/// </summary>
|
||||
void Create()
|
||||
{
|
||||
T fw = T(2.0) * m_Support * m_Supersample * m_FilterRadius / m_PixelAspectRatio;
|
||||
T adjust, ii, jj;
|
||||
|
||||
int fwidth = ((int)fw) + 1;
|
||||
int i, j;
|
||||
|
||||
//Make sure the filter kernel has same parity as oversample.
|
||||
if ((fwidth ^ m_Supersample) & 1)
|
||||
fwidth++;
|
||||
|
||||
//Calculate the coordinate scaling factor for the kernel values.
|
||||
if (fw > 0.0)
|
||||
adjust = m_Support * fwidth / fw;
|
||||
else
|
||||
adjust = T(1.0);
|
||||
|
||||
m_Filter.resize(fwidth * fwidth);
|
||||
|
||||
//Fill in the coefs.
|
||||
for (i = 0; i < fwidth; i++)
|
||||
do
|
||||
{
|
||||
for (j = 0; j < fwidth; j++)
|
||||
T fw = T(2.0) * m_Support * m_Supersample * m_FilterRadius / m_PixelAspectRatio;
|
||||
T adjust, ii, jj;
|
||||
|
||||
int fwidth = ((int)fw) + 1;
|
||||
int i, j;
|
||||
|
||||
//Make sure the filter kernel has same parity as oversample.
|
||||
if ((fwidth ^ m_Supersample) & 1)
|
||||
fwidth++;
|
||||
|
||||
//Calculate the coordinate scaling factor for the kernel values.
|
||||
if (fw > 0.0)
|
||||
adjust = m_Support * fwidth / fw;
|
||||
else
|
||||
adjust = T(1.0);
|
||||
|
||||
m_Filter.resize(fwidth * fwidth);
|
||||
|
||||
//Fill in the coefs.
|
||||
for (i = 0; i < fwidth; i++)
|
||||
{
|
||||
//Calculate the function inputs for the kernel function.
|
||||
ii = ((T(2.0) * i + T(1.0)) / T(fwidth) - T(1.0)) * adjust;
|
||||
jj = ((T(2.0) * j + T(1.0)) / T(fwidth) - T(1.0)) * adjust;
|
||||
for (j = 0; j < fwidth; j++)
|
||||
{
|
||||
//Calculate the function inputs for the kernel function.
|
||||
ii = ((T(2.0) * i + T(1.0)) / T(fwidth) - T(1.0)) * adjust;
|
||||
jj = ((T(2.0) * j + T(1.0)) / T(fwidth) - T(1.0)) * adjust;
|
||||
|
||||
//Adjust for aspect ratio.
|
||||
jj /= m_PixelAspectRatio;
|
||||
//Adjust for aspect ratio.
|
||||
jj /= m_PixelAspectRatio;
|
||||
|
||||
m_Filter[i + j * fwidth] = Filter(ii) * Filter(jj);//Call virtual Filter(), implemented in specific derived filter classes.
|
||||
m_Filter[i + j * fwidth] = Filter(ii) * Filter(jj);//Call virtual Filter(), implemented in specific derived filter classes.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Normalize, and return a bad value if the values were too small.
|
||||
if (!Normalize())
|
||||
m_FinalFilterWidth = -1;
|
||||
else
|
||||
m_FinalFilterWidth = fwidth;
|
||||
//Attempt to normalize, and increase the filter width if the values were too small.
|
||||
if (!Normalize())
|
||||
{
|
||||
m_FinalFilterWidth = fwidth;
|
||||
break;
|
||||
}
|
||||
|
||||
m_FilterRadius += T(0.01);//Values were too small.
|
||||
} while (1);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
Reference in New Issue
Block a user