From: ski Date: Fri, 1 Nov 2013 09:32:12 +0000 (+0400) Subject: 0024298: Eliminate GCC compiler warning about unused in linux functions X-Git-Tag: V6_7_0_beta~19 X-Git-Url: http://git.dev.opencascade.org/gitweb/?p=occt.git;a=commitdiff_plain;h=47afc3678840d3f21075591cc34b01952696e8a6 0024298: Eliminate GCC compiler warning about unused in linux functions Eliminated GCC compiler warning about functions for Win platform only. Illegal function definitions were fixed. --- diff --git a/src/OpenGl/OpenGl_Workspace_2.cxx b/src/OpenGl/OpenGl_Workspace_2.cxx index f1afc27cb6..1a3ed345e1 100644 --- a/src/OpenGl/OpenGl_Workspace_2.cxx +++ b/src/OpenGl/OpenGl_Workspace_2.cxx @@ -57,27 +57,6 @@ static GLsizei getNearestPowOfTwo (const GLsizei theNumber) return aLast; } -// --------------------------------------------------------------- -// Function: getMaxFrameSize -// Purpose: get the maximum possible frame size -// --------------------------------------------------------------- -static void getMaxFrameSize(Standard_Integer& theWidth, - Standard_Integer& theHeight) -{ - GLsizei aMaxX, aMaxY; - GLint aVpDim[2]; - GLint aTexDim = 2048; - glGetIntegerv (GL_MAX_VIEWPORT_DIMS, (GLint*) &aVpDim); - glGetIntegerv (GL_MAX_TEXTURE_SIZE, &aTexDim); - (aVpDim[0] >= aTexDim) ? aMaxX = (GLsizei) aTexDim : - aMaxX = getNearestPowOfTwo((GLsizei)aVpDim[0]); - (aVpDim[1] >= aTexDim) ? aMaxY = (GLsizei) aTexDim : - aMaxY = getNearestPowOfTwo((GLsizei)aVpDim[1]); - - theWidth = (Standard_Integer)aMaxX; - theHeight = (Standard_Integer)aMaxY; -} - // --------------------------------------------------------------- // Function: fitDimensionsRatio // Purpose: calculate correct width/height ratio for theWidth and @@ -95,81 +74,11 @@ static void fitDimensionsRatio (Standard_Integer& theWidth, theHeight = (Standard_Integer)(theWidth/theViewRatio); } -// --------------------------------------------------------------- -// Function: getDimensionsTiling -// Purpose: calculate maximum possible dimensions for framebuffer -// in tiling mode according to the view size -// --------------------------------------------------------------- -static void getDimensionsTiling (Standard_Integer& theFrameWidth, - Standard_Integer& theFrameHeight, - const int theViewWidth, - const int theViewHeight) -{ - // fit the maximum dimensions into the printing area - if (theFrameWidth > theViewWidth) - theFrameWidth = theViewWidth; - - if (theFrameHeight > theViewHeight) - theFrameHeight = theViewHeight; -} - -// --------------------------------------------------------------- -// Function: initBufferStretch -// Purpose: calculate initialization sizes for frame buffer -// when the stretch algorithm is selected -// --------------------------------------------------------------- -static void initBufferStretch (Standard_Integer& theFrameWidth, - Standard_Integer& theFrameHeight, - const int theViewWidth, - const int theViewHeight) -{ - - // Calculate correct width/height for framebuffer - Standard_Real aViewRatio = (Standard_Real)theViewWidth/theViewHeight; - fitDimensionsRatio (theFrameWidth, theFrameHeight, aViewRatio); - - // downscale the framebuffer if it is too large - Standard_Real aWidthRate = (Standard_Real)theFrameWidth /theViewWidth; - Standard_Real aHeightRate = (Standard_Real)theFrameHeight/theViewHeight; - - if ((aWidthRate > 1 && aHeightRate > 1 && aWidthRate >= aHeightRate) || - (aWidthRate > 1 && aHeightRate <= 1)) - { - theFrameWidth = (Standard_Integer)(theFrameWidth /aWidthRate); - theFrameHeight = (Standard_Integer)(theFrameHeight/aWidthRate); - } - else if ((aWidthRate > 1 && aHeightRate > 1 && aWidthRate < aHeightRate) || - (aWidthRate <= 1 && aHeightRate > 1)) - { - theFrameWidth = (Standard_Integer)(theFrameWidth /aHeightRate); - theFrameHeight = (Standard_Integer)(theFrameHeight/aHeightRate); - } - -} - -// --------------------------------------------------------------- -// Function: initBufferTiling -// Purpose: calculate initialization sizes for frame buffer -// when the tile algorithm is selected -// --------------------------------------------------------------- -static void initBufferTiling (Standard_Integer& theFrameWidth, - Standard_Integer &theFrameHeight, - const int theViewWidth, - const int theViewHeight) -{ - // fit framebuffer into the printing area - if (theFrameWidth > theViewWidth) - theFrameWidth = theViewWidth; - - if (theFrameHeight > theViewHeight) - theFrameHeight = theViewHeight; -} - // --------------------------------------------------------------- // Function: initBitmapBuffer // Purpose: init device independent bitmap to hold printing data // --------------------------------------------------------------- -#ifdef WNT +#ifdef _WIN32 #ifndef HAVE_FREEIMAGE static void initBitmapBuffer (const HDC theMemoryDC, HBITMAP &theMemoryBmp, @@ -290,12 +199,100 @@ static bool imageStretchDC(HDC theDstDC, FipHandle theImage, int theOffsetX, return true; } #endif + +// --------------------------------------------------------------- +// Function: getMaxFrameSize +// Purpose: get the maximum possible frame size +// --------------------------------------------------------------- +static void getMaxFrameSize(Standard_Integer& theWidth, + Standard_Integer& theHeight) +{ + GLsizei aMaxX, aMaxY; + GLint aVpDim[2]; + GLint aTexDim = 2048; + glGetIntegerv (GL_MAX_VIEWPORT_DIMS, (GLint*) &aVpDim); + glGetIntegerv (GL_MAX_TEXTURE_SIZE, &aTexDim); + (aVpDim[0] >= aTexDim) ? aMaxX = (GLsizei) aTexDim : + aMaxX = getNearestPowOfTwo((GLsizei)aVpDim[0]); + (aVpDim[1] >= aTexDim) ? aMaxY = (GLsizei) aTexDim : + aMaxY = getNearestPowOfTwo((GLsizei)aVpDim[1]); + + theWidth = (Standard_Integer)aMaxX; + theHeight = (Standard_Integer)aMaxY; +} +// --------------------------------------------------------------- +// Function: getDimensionsTiling +// Purpose: calculate maximum possible dimensions for framebuffer +// in tiling mode according to the view size +// --------------------------------------------------------------- +static void getDimensionsTiling (Standard_Integer& theFrameWidth, + Standard_Integer& theFrameHeight, + const int theViewWidth, + const int theViewHeight) +{ + // fit the maximum dimensions into the printing area + if (theFrameWidth > theViewWidth) + theFrameWidth = theViewWidth; + + if (theFrameHeight > theViewHeight) + theFrameHeight = theViewHeight; +} +// --------------------------------------------------------------- +// Function: initBufferStretch +// Purpose: calculate initialization sizes for frame buffer +// when the stretch algorithm is selected +// --------------------------------------------------------------- +static void initBufferStretch (Standard_Integer& theFrameWidth, + Standard_Integer& theFrameHeight, + const int theViewWidth, + const int theViewHeight) +{ + + // Calculate correct width/height for framebuffer + Standard_Real aViewRatio = (Standard_Real)theViewWidth/theViewHeight; + fitDimensionsRatio (theFrameWidth, theFrameHeight, aViewRatio); + + // downscale the framebuffer if it is too large + Standard_Real aWidthRate = (Standard_Real)theFrameWidth /theViewWidth; + Standard_Real aHeightRate = (Standard_Real)theFrameHeight/theViewHeight; + + if ((aWidthRate > 1 && aHeightRate > 1 && aWidthRate >= aHeightRate) || + (aWidthRate > 1 && aHeightRate <= 1)) + { + theFrameWidth = (Standard_Integer)(theFrameWidth /aWidthRate); + theFrameHeight = (Standard_Integer)(theFrameHeight/aWidthRate); + } + else if ((aWidthRate > 1 && aHeightRate > 1 && aWidthRate < aHeightRate) || + (aWidthRate <= 1 && aHeightRate > 1)) + { + theFrameWidth = (Standard_Integer)(theFrameWidth /aHeightRate); + theFrameHeight = (Standard_Integer)(theFrameHeight/aHeightRate); + } +} +// --------------------------------------------------------------- +// Function: initBufferTiling +// Purpose: calculate initialization sizes for frame buffer +// when the tile algorithm is selected +// --------------------------------------------------------------- +static void initBufferTiling (Standard_Integer& theFrameWidth, + Standard_Integer &theFrameHeight, + const int theViewWidth, + const int theViewHeight) +{ + // fit framebuffer into the printing area + if (theFrameWidth > theViewWidth) + theFrameWidth = theViewWidth; + + if (theFrameHeight > theViewHeight) + theFrameHeight = theViewHeight; +} #endif // --------------------------------------------------------------- // --------------------------------------------------------------- //call_togl_print + Standard_Boolean OpenGl_Workspace::Print (const Handle(OpenGl_PrinterContext)& thePrintContext, const Graphic3d_CView& ACView, @@ -312,7 +309,7 @@ Standard_Boolean OpenGl_Workspace::Print return Standard_False; } -#ifdef WNT +#ifdef _WIN32 if (!Activate()) { @@ -786,7 +783,7 @@ Standard_Boolean OpenGl_Workspace::Print myPrintContext.Nullify(); return (Standard_Boolean) isDone; -#else // not WNT +#else // not _WIN32 myPrintContext.Nullify(); return Standard_False; #endif