0022337: V3d_View::Print crashes in OCCT 6.5.0
[occt.git] / src / Visual3d / Visual3d_View_Print.cxx
1 // File         Visual3d_View_Print.cxx
2 // Created      March 2000
3 // Author       THA
4 // e-mail       t-hartl@muenchen.matra-dtv.fr
5
6 /************************************************************************/
7 /* Includes                                                             */
8 /************************************************************************/
9
10 #include <Visual3d_View.jxx>
11 #include <Visual3d_View.pxx>
12
13 /************************************************************************/
14 /* Print Methods                                                        */
15 /************************************************************************/
16
17 Standard_Boolean Visual3d_View::Print
18   (const Aspect_Handle    hPrintDC, 
19    const Standard_Boolean showBackground,
20    const Standard_CString filename,
21    const Aspect_PrintAlgo printAlgorithm,
22    const Standard_Real    theScaleFactor) const
23 {
24   return Print (MyViewManager->UnderLayer (),
25                 MyViewManager->OverLayer (),
26                 hPrintDC, showBackground,
27                 filename, printAlgorithm, 
28                 theScaleFactor);
29 }
30
31 Standard_Boolean Visual3d_View::Print
32   (const Handle(Visual3d_Layer)& AnUnderLayer,
33    const Handle(Visual3d_Layer)& AnOverLayer,
34    const Aspect_Handle           hPrintDC,
35    const Standard_Boolean        showBackground,
36    const Standard_CString        aFilename,
37    const Aspect_PrintAlgo        printAlgorithm,
38    const Standard_Real           theScaleFactor) const
39 {
40   if (IsDeleted ()) return Standard_False;
41
42   if ((! IsDefined ()) || (! IsActive ())) return Standard_False;
43
44   if (! MyWindow->IsMapped ()) return Standard_False;
45
46   Aspect_CLayer2d OverCLayer;
47   Aspect_CLayer2d UnderCLayer;
48
49   OverCLayer.ptrLayer = UnderCLayer.ptrLayer = NULL;
50   if (! AnOverLayer.IsNull ()) OverCLayer = AnOverLayer->CLayer ();
51   if (! AnUnderLayer.IsNull ()) UnderCLayer = AnUnderLayer->CLayer ();
52
53   return MyGraphicDriver->Print (MyCView, UnderCLayer, OverCLayer,
54                                  hPrintDC, showBackground, aFilename,
55                                  printAlgorithm, theScaleFactor);
56 }