From a180e3849f0853fad39ac015033f84a3ec276b52 Mon Sep 17 00:00:00 2001 From: abv Date: Fri, 14 Sep 2012 13:09:39 +0400 Subject: [PATCH] 0023433: Compiler warnings in Graphic3d_ArrayOfPrimitives.lxx Conversion of color components from real [0,1] to char [0,255] corrected to avoid compiler warnings --- src/Graphic3d/Graphic3d_ArrayOfPrimitives.lxx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Graphic3d/Graphic3d_ArrayOfPrimitives.lxx b/src/Graphic3d/Graphic3d_ArrayOfPrimitives.lxx index 462c94f730..dba08d15d8 100755 --- a/src/Graphic3d/Graphic3d_ArrayOfPrimitives.lxx +++ b/src/Graphic3d/Graphic3d_ArrayOfPrimitives.lxx @@ -98,9 +98,9 @@ inline void Graphic3d_ArrayOfPrimitives::SetVertexColor( } if( myPrimitiveArray->vcolours ) { - unsigned char red = (unsigned int)(R * 255.); - unsigned char green = (unsigned int)(G * 255.); - unsigned char blue = (unsigned int)(B * 255.); + unsigned char red = (unsigned char)(R <= 0. ? 0. : R >= 1. ? 255. : R * 255.); + unsigned char green = (unsigned char)(G <= 0. ? 0. : G >= 1. ? 255. : G * 255.); + unsigned char blue = (unsigned char)(B <= 0. ? 0. : B >= 1. ? 255. : B * 255.); unsigned char alpha = 0; Standard_Integer outColor ; outColor = red;