From: abv Date: Fri, 14 Sep 2012 09:09:39 +0000 (+0400) Subject: 0023433: Compiler warnings in Graphic3d_ArrayOfPrimitives.lxx X-Git-Tag: V6_5_4_beta1~33 X-Git-Url: http://git.dev.opencascade.org/gitweb/?a=commitdiff_plain;h=a180e3849f0853fad39ac015033f84a3ec276b52;p=occt-copy.git 0023433: Compiler warnings in Graphic3d_ArrayOfPrimitives.lxx Conversion of color components from real [0,1] to char [0,255] corrected to avoid compiler warnings --- 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;