1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-09 13:22:24 +03:00

0029292: Coding Rules - remove Graphic3d_Vector duplicating gp_XYZ

Graphic3d_Vector has been replaced by gp_Pnt/gp_XYZ/gp_Dir depending on context.
StdSelect_ViewerSelector3d::ToPixMap() - fixed unsafe float math causing out-of-range color results.
This commit is contained in:
kgv
2017-11-02 16:29:17 +03:00
committed by bugmaster
parent 69f87d091e
commit 21b2385fcb
30 changed files with 309 additions and 1135 deletions

View File

@@ -811,14 +811,15 @@ namespace
//! Normalize the depth values.
virtual void Flush() Standard_OVERRIDE
{
Standard_Real aFrom = 0.0;
Standard_Real aDelta = 1.0;
float aFrom = 0.0f;
float aDelta = 1.0f;
if (myDepthMin <= myDepthMax)
{
aFrom = myDepthMin;
if (myDepthMin != myDepthMax)
aFrom = float(myDepthMin);
aDelta = float(myDepthMax) - float(myDepthMin);
if (aDelta <= ShortRealEpsilon())
{
aDelta = myDepthMax - myDepthMin;
aDelta = 1.0f;
}
}
for (Standard_Size aRowIter = 0; aRowIter < myUnnormImage.SizeY(); ++aRowIter)
@@ -834,7 +835,7 @@ namespace
continue;
}
float aNormDepth = float((Standard_Real(aDepth) - aFrom) / aDelta);
float aNormDepth = (aDepth - aFrom) / aDelta;
if (myToInverse)
{
aNormDepth = 1.0f - aNormDepth;
@@ -874,7 +875,7 @@ namespace
const SelectMgr_SortCriterion& aSortCriterion = myMainSel->PickedData (thePicked);
const float aDepth = float(aSortCriterion.Depth);
myImage->SetPixelColor (theCol, theRow, Quantity_ColorRGBA (aDepth, aDepth, aDepth, 1.0f));
myImage->SetPixelColor (theCol, theRow, Quantity_ColorRGBA (Graphic3d_Vec4 (aDepth, aDepth, aDepth, 1.0f)));
}
};