0024276: Memory leak due to a static variable
[occt.git] / src / Visual3d / Visual3d_View_Print.cxx
CommitLineData
b311480e 1// Created by: THA
2// Copyright (c) 1999-2012 OPEN CASCADE SAS
3//
4// The content of this file is subject to the Open CASCADE Technology Public
5// License Version 6.5 (the "License"). You may not use the content of this file
6// except in compliance with the License. Please obtain a copy of the License
7// at http://www.opencascade.org and read it completely before using this file.
8//
9// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
10// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
11//
12// The Original Code and all software distributed under the License is
13// distributed on an "AS IS" basis, without warranty of any kind, and the
14// Initial Developer hereby disclaims all such warranties, including without
15// limitation, any warranties of merchantability, fitness for a particular
16// purpose or non-infringement. Please see the License for the specific terms
17// and conditions governing the rights and limitations under the License.
18
7fd59977 19// e-mail t-hartl@muenchen.matra-dtv.fr
20
21/************************************************************************/
22/* Includes */
23/************************************************************************/
24
25#include <Visual3d_View.jxx>
26#include <Visual3d_View.pxx>
27
28/************************************************************************/
29/* Print Methods */
30/************************************************************************/
31
7edf74fd
A
32Standard_Boolean Visual3d_View::Print
33 (const Aspect_Handle hPrintDC,
34 const Standard_Boolean showBackground,
35 const Standard_CString filename,
36 const Aspect_PrintAlgo printAlgorithm,
37 const Standard_Real theScaleFactor) const
7fd59977 38{
7edf74fd
A
39 return Print (MyViewManager->UnderLayer (),
40 MyViewManager->OverLayer (),
41 hPrintDC, showBackground,
42 filename, printAlgorithm,
43 theScaleFactor);
7fd59977 44}
45
7edf74fd
A
46Standard_Boolean Visual3d_View::Print
47 (const Handle(Visual3d_Layer)& AnUnderLayer,
48 const Handle(Visual3d_Layer)& AnOverLayer,
49 const Aspect_Handle hPrintDC,
50 const Standard_Boolean showBackground,
51 const Standard_CString aFilename,
52 const Aspect_PrintAlgo printAlgorithm,
53 const Standard_Real theScaleFactor) const
7fd59977 54{
7edf74fd 55 if (IsDeleted ()) return Standard_False;
7fd59977 56
7edf74fd 57 if ((! IsDefined ()) || (! IsActive ())) return Standard_False;
7fd59977 58
7edf74fd 59 if (! MyWindow->IsMapped ()) return Standard_False;
7fd59977 60
61 Aspect_CLayer2d OverCLayer;
62 Aspect_CLayer2d UnderCLayer;
63
64 OverCLayer.ptrLayer = UnderCLayer.ptrLayer = NULL;
65 if (! AnOverLayer.IsNull ()) OverCLayer = AnOverLayer->CLayer ();
66 if (! AnUnderLayer.IsNull ()) UnderCLayer = AnUnderLayer->CLayer ();
67
7edf74fd
A
68 return MyGraphicDriver->Print (MyCView, UnderCLayer, OverCLayer,
69 hPrintDC, showBackground, aFilename,
70 printAlgorithm, theScaleFactor);
7fd59977 71}