--Bug fixes

-Crash when supersample minus final spatial filter width was negative.
This commit is contained in:
mfeemster 2016-02-15 18:54:24 -08:00
parent 73356301da
commit d92a600ced
4 changed files with 15 additions and 13 deletions

View File

@ -82,7 +82,9 @@ template <typename T, typename bucketT>
void Renderer<T, bucketT>::ComputeBounds() void Renderer<T, bucketT>::ComputeBounds()
{ {
size_t maxDEFilterWidth = 0; size_t maxDEFilterWidth = 0;
m_GutterWidth = ClampGte((m_SpatialFilter->FinalFilterWidth() - Supersample()) / 2, size_t(0)); //Use type T to account for negative numbers which will occur with a larger supersample and smaller filter width.
//The final value will be of type size_t.
m_GutterWidth = size_t(ClampGte<T>((T(m_SpatialFilter->FinalFilterWidth()) - T(Supersample())) / 2, 0));
//Check the size of the density estimation filter. //Check the size of the density estimation filter.
//If the radius of the density estimation filter is greater than the //If the radius of the density estimation filter is greater than the

View File

@ -213,7 +213,7 @@ Fractorium::~Fractorium()
void Fractorium::SetCoordinateStatus(int rasX, int rasY, float worldX, float worldY) void Fractorium::SetCoordinateStatus(int rasX, int rasY, float worldX, float worldY)
{ {
//Use sprintf rather than allocating and concatenating 6 QStrings for efficiency since this is called on every mouse move. //Use sprintf rather than allocating and concatenating 6 QStrings for efficiency since this is called on every mouse move.
sprintf_s(m_CoordinateString, 128, "Window: %4d, %4d World: %2.2f, %2.2f", rasX, rasY, worldX, worldY); sprintf_s(m_CoordinateString, sizeof(m_CoordinateString), "Window: %4d, %4d World: %2.2f, %2.2f", rasX, rasY, worldX, worldY);
m_CoordinateStatusLabel->setText(QString(m_CoordinateString)); m_CoordinateStatusLabel->setText(QString(m_CoordinateString));
} }

View File

@ -488,12 +488,12 @@ private:
QLabel* m_RenderStatusLabel; QLabel* m_RenderStatusLabel;
QLabel* m_CoordinateStatusLabel; QLabel* m_CoordinateStatusLabel;
FractoriumSettings* m_Settings; FractoriumSettings* m_Settings;
char m_ULString[32]; char m_ULString[64];
char m_URString[32]; char m_URString[64];
char m_LRString[32]; char m_LRString[64];
char m_LLString[32]; char m_LLString[64];
char m_WHString[64]; char m_WHString[64];
char m_DEString[16]; char m_DEString[64];
char m_CoordinateString[128]; char m_CoordinateString[128];
QColor m_XformComboColors[XFORM_COLOR_COUNT], m_FinalXformComboColor; QColor m_XformComboColors[XFORM_COLOR_COUNT], m_FinalXformComboColor;
QIcon m_XformComboIcons[XFORM_COLOR_COUNT], m_FinalXformComboIcon; QIcon m_XformComboIcons[XFORM_COLOR_COUNT], m_FinalXformComboIcon;

View File

@ -185,11 +185,11 @@ void Fractorium::UpdateHistogramBounds()
{ {
if (RendererBase* r = m_Controller->Renderer()) if (RendererBase* r = m_Controller->Renderer())
{ {
sprintf_s(m_ULString, 32, "UL: %3.3f, %3.3f", r->LowerLeftX(), r->UpperRightY());//These bounds include gutter padding. sprintf_s(m_ULString, sizeof(m_ULString), "UL: %3.3f, %3.3f", r->LowerLeftX(), r->UpperRightY());//These bounds include gutter padding.
sprintf_s(m_URString, 32, "UR: %3.3f, %3.3f", -r->LowerLeftX(), r->UpperRightY()); sprintf_s(m_URString, sizeof(m_URString), "UR: %3.3f, %3.3f", -r->LowerLeftX(), r->UpperRightY());
sprintf_s(m_LRString, 32, "LR: %3.3f, %3.3f", -r->LowerLeftX(), r->LowerLeftY()); sprintf_s(m_LRString, sizeof(m_LRString), "LR: %3.3f, %3.3f", -r->LowerLeftX(), r->LowerLeftY());
sprintf_s(m_LLString, 32, "LL: %3.3f, %3.3f", r->LowerLeftX(), r->LowerLeftY()); sprintf_s(m_LLString, sizeof(m_LLString), "LL: %3.3f, %3.3f", r->LowerLeftX(), r->LowerLeftY());
sprintf_s(m_WHString, 32, "W x H: %4lu x %4lu", r->SuperRasW(), r->SuperRasH()); sprintf_s(m_WHString, sizeof(m_WHString), "W x H: %4lu x %4lu", r->SuperRasW(), r->SuperRasH());
ui.InfoBoundsLabelUL->setText(QString(m_ULString)); ui.InfoBoundsLabelUL->setText(QString(m_ULString));
ui.InfoBoundsLabelUR->setText(QString(m_URString)); ui.InfoBoundsLabelUR->setText(QString(m_URString));
ui.InfoBoundsLabelLR->setText(QString(m_LRString)); ui.InfoBoundsLabelLR->setText(QString(m_LRString));
@ -200,7 +200,7 @@ void Fractorium::UpdateHistogramBounds()
if (r->GetDensityFilter()) if (r->GetDensityFilter())
{ {
uint deWidth = (r->GetDensityFilter()->FilterWidth() * 2) + 1; uint deWidth = (r->GetDensityFilter()->FilterWidth() * 2) + 1;
sprintf_s(m_DEString, 16, "%d x %d", deWidth, deWidth); sprintf_s(m_DEString, sizeof(m_DEString), "%d x %d", deWidth, deWidth);
ui.InfoBoundsTable->item(1, 1)->setText(QString(m_DEString)); ui.InfoBoundsTable->item(1, 1)->setText(QString(m_DEString));
} }
else else