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
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,
theHeight, 0, 0, widthPx, heightPx, aDataPtr,
aBitmapData, DIB_RGB_COLORS, SRCCOPY);
- if (aPassed != heightPx)
+ if ((unsigned)aPassed != heightPx)
return false;
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,
return Standard_False;
}
-#ifdef WNT
+#ifdef _WIN32
if (!Activate())
{
if (!aViewBuffer)
{
- aFrameBuffer->Release (GetGlContext());
+ aFrameBuffer->Release (GetGlContext().operator->());
aViewBuffer = NULL;
aViewImage = NULL;
}
{
if (hViewBitmap)
DeleteObject (hViewBitmap);
- aFrameBuffer->Release (GetGlContext());
+ aFrameBuffer->Release (GetGlContext().operator->());
hViewBitmap = NULL;
}
else
{
myPrintContext->SetScale ((GLfloat )aFrameWidth /viewWidth,
(GLfloat )aFrameHeight/viewHeight);
- aFrameBuffer->SetupViewport ();
+ aFrameBuffer->SetupViewport (GetGlContext());
Redraw1(ACView, ACUnderLayer, ACOverLayer, 0);
if (!myTransientDrawToFront)
{
aFrameHeight;
// draw to the offscreen buffer and capture the result
- aFrameBuffer->SetupViewport ();
+ aFrameBuffer->SetupViewport (GetGlContext());
Redraw1(ACView, ACUnderLayer, ACOverLayer, 0);
if (!myTransientDrawToFront)
{
}
else
{
- aFrameBuffer->Release (GetGlContext ());
+ aFrameBuffer->Release (GetGlContext().operator->());
delete aFrameBuffer;
}
myPrintContext.Nullify();
return (Standard_Boolean) isDone;
-#else // not WNT
+#else // not _WIN32
myPrintContext.Nullify();
return Standard_False;
#endif