#include <offscrn.h>
Inheritance diagram for ConcurrentRenderer:
Public Member Functions | |
ConcurrentRenderer () | |
~ConcurrentRenderer () | |
virtual BOOL | Initialise (GRenderRegion *pActiveRR, double ResFactor, DocRect AreaOfDocumentToRender, UINT32 bpp, BOOL NeedsTransp) |
virtual BOOL | RestorePreviousRendererState () |
Private Attributes | |
GDrawContext * | m_pOldGD |
GDrawContext * | m_pNewGD |
View * | m_pView |
Definition at line 252 of file offscrn.h.
|
Definition at line 677 of file offscrn.cpp.
|
|
Definition at line 684 of file offscrn.cpp. 00685 { 00686 if (m_pOldGD != NULL || m_pNewGD != NULL) 00687 { 00688 TRACEUSER( "Gerry", _T("GDraw context not restored in ConcurrentRenderer::~ConcurrentRenderer\n")); 00689 } 00690 }
|
|
Reimplemented from QuickRenderer. Definition at line 705 of file offscrn.cpp. 00712 { 00713 // if we have no source render-region, then we need to manufacture a rendering matrix 00714 // for ourself. 00715 // to generate our render-matrix, we use the current view and spread, together with 00716 // a user-specified dpi value. 00717 Matrix SourceMat; 00718 if (pActiveRR == NULL) 00719 { 00720 View* pView = View::GetCurrent(); 00721 if (pView == NULL) 00722 return FALSE; 00723 00724 double PixelsPerInch = pView->GetConvertToEditableShapesDPI(); 00725 00726 Spread* pSpread = Document::GetSelectedSpread(); 00727 if (pSpread == NULL) 00728 return FALSE; 00729 00730 FIXED16 ViewPixelWidth = pView->GetScaledPixelWidth(); 00731 const double AppPixelWidth = MILLIPOINTS_PER_INCH / (double)PixelsPerInch; 00732 double ViewScaleFactor = ViewPixelWidth.MakeDouble() / AppPixelWidth; 00733 00734 SourceMat = pView->ConstructScaledRenderingMatrix(pSpread, ViewScaleFactor); 00735 } 00736 00737 // we have a source render-region, so get its matrix and scale up ResFactor 00738 // so that our offscreen RR would effectively have the same scaled pixel width 00739 // as its source render-region (not taking into account the original value of ResFactor). 00740 else 00741 { 00742 SourceMat = pActiveRR->GetMatrix(); 00743 const double ActualPixelWidth = (double)pActiveRR->GetPixelWidth(); 00744 const double DefPixelWidth = MILLIPOINTS_PER_INCH / (double)GRenderRegion::GetDefaultDPI(); 00745 ResFactor *= DefPixelWidth / ActualPixelWidth; 00746 } 00747 00748 // m_pView = pActiveRR->GetRenderView(); 00749 // m_pView = View::GetCurrent(); 00750 // if (m_pView) 00751 // { 00752 // TRACEUSER( "Gerry", _T("Forcing default context\n")); 00753 // m_bOldForce = m_pView->SetForceDefaultColourContexts(); 00754 // } 00755 00756 m_pNewGD = new GDrawAsm; 00757 if (m_pNewGD && m_pNewGD->Init()) 00758 { 00759 // Save current device context 00760 m_pOldGD = GRenderRegion::SetTempDrawContext(m_pNewGD); 00761 // m_pOldGD = GRenderRegion::GetStaticDrawContext(); 00762 // GRenderRegion::GD = pGDAsm; 00763 } 00764 00765 // Setup a new GRenderDIB (NB also initialises memory). 00766 m_pNewRR = CreateGRenderDIB(ResFactor, AreaOfDocumentToRender, bpp, NeedsTransp, &SourceMat); 00767 if (m_pNewRR != NULL) 00768 { 00769 return TRUE; 00770 } 00771 00772 // If we get here then we have failed so clean up and return false 00773 delete m_pNewGD; 00774 m_pNewGD = NULL; 00775 GRenderRegion::SetTempDrawContext(m_pOldGD); 00776 m_pOldGD = NULL; 00777 return FALSE; 00778 }
|
|
Reimplemented from QuickRenderer. Definition at line 787 of file offscrn.cpp. 00788 { 00789 // Dismantle the GRenderDIB render region we created 00790 // WHILE it's still in the temp GDraw Context that we created before we created 00791 // the GRenderDIB 00792 QuickRenderer::RestoreSimple(); 00793 00794 // Now restore the device context's state, and free the memory used 00795 if(!m_pOldGD) 00796 { 00797 ERROR2(FALSE,"State of previous device context was not saved."); 00798 } 00799 else 00800 { 00801 if (GRenderRegion::SetTempDrawContext(m_pOldGD) != m_pNewGD) 00802 { 00803 TRACEUSER( "Gerry", _T("Not m_pNewGD when restoring\n")); 00804 } 00805 m_pOldGD = NULL; 00806 delete m_pNewGD; 00807 m_pNewGD = NULL; 00808 } 00809 00810 // Behave like other versions of this function and delete ourselves (urgh) 00811 delete this; 00812 00813 return TRUE; 00814 }
|
|
|
|
|
|
|