OptimalBitmapRenderCallback Class Reference

Inheritance diagram for OptimalBitmapRenderCallback:

RenderCallback CCObject SimpleCCObject List of all members.

Public Types

enum  RenderStateType { RS_BEFORECOMPLEX = 0, RS_INCOMPLEX, RS_AFTERCOMPLEX }

Public Member Functions

 OptimalBitmapRenderCallback (View *pView, BOOL bRenderAll, Node *pFirstComplex, Node *pNextNormal, BOOL bRenderMask, double RegionArea, INT32 *pNodesSoFar, ProgressDisplay *pProgress, BOOL bCount, double NodeIncrement=1.0)
virtual BOOL BeforeNode (RenderRegion *pRegion, Node *pNode)
virtual BOOL BeforeSubtree (RenderRegion *pRegion, Node *pNode, Node **ppNextNode, BOOL bClip, SubtreeRenderState *pState)

Private Attributes

Viewm_pView
BOOL m_bRenderAll
Nodem_pFirstComplex
Nodem_pNextNormal
BOOL m_bRenderMask
RenderStateType m_RenderState
double m_RegionArea
INT32 * m_pNodesSoFar
ProgressDisplaym_pProgress
BOOL m_bCount
double m_NodeIncrement
double m_dNodesSoFar

Detailed Description

Definition at line 2461 of file view.cpp.


Member Enumeration Documentation

enum OptimalBitmapRenderCallback::RenderStateType
 

Enumerator:
RS_BEFORECOMPLEX 
RS_INCOMPLEX 
RS_AFTERCOMPLEX 

Definition at line 2464 of file view.cpp.

02465     {
02466         RS_BEFORECOMPLEX = 0,
02467         RS_INCOMPLEX,
02468         RS_AFTERCOMPLEX,
02469     } RenderStateType;


Constructor & Destructor Documentation

OptimalBitmapRenderCallback::OptimalBitmapRenderCallback View pView,
BOOL  bRenderAll,
Node pFirstComplex,
Node pNextNormal,
BOOL  bRenderMask,
double  RegionArea,
INT32 *  pNodesSoFar,
ProgressDisplay pProgress,
BOOL  bCount,
double  NodeIncrement = 1.0
[inline]
 

Definition at line 2471 of file view.cpp.

02473     {
02474         m_pView = pView;
02475         m_bRenderAll = bRenderAll;
02476         m_pFirstComplex = pFirstComplex;
02477         m_pNextNormal = pNextNormal;
02478         m_bRenderMask = bRenderMask;
02479         m_RenderState = RS_BEFORECOMPLEX;
02480         m_RegionArea = RegionArea;
02481         m_pNodesSoFar = pNodesSoFar;
02482         m_pProgress = pProgress;
02483         m_bCount = bCount;
02484         m_NodeIncrement = NodeIncrement;
02485         m_dNodesSoFar = m_pNodesSoFar ? *pNodesSoFar : 0;
02486     }


Member Function Documentation

virtual BOOL OptimalBitmapRenderCallback::BeforeNode RenderRegion pRegion,
Node pNode
[inline, virtual]
 

Reimplemented from RenderCallback.

Definition at line 2488 of file view.cpp.

02489     {
02490         if (m_bCount)
02491         {
02492             if (m_pNodesSoFar)
02493                 (*m_pNodesSoFar)++;
02494 
02495             return(FALSE);
02496         }
02497         else
02498         {
02499             m_dNodesSoFar += m_NodeIncrement;
02500             if (m_pNodesSoFar)
02501                 *m_pNodesSoFar = (INT32)m_dNodesSoFar;
02502             if (m_pProgress)
02503             {
02504                 if (!m_pProgress->SetNodesRendered(*m_pNodesSoFar))
02505                 {
02506                     TRACE( _T("*****************************\n"));
02507                     TRACE( _T("************ User aborted job\n"));
02508                     TRACE( _T("*****************************\n"));
02509                 }
02510             }
02511         }
02512 //      BOOL bRender = (m_bRenderAll || m_pView->IsPrintableNodeSelected(pNode)) && pNode->NeedsToRender(pRegion);
02513         BOOL bRender = (m_bRenderAll || m_pView->IsPrintableNodeSelected(pNode));
02514         if (bRender)
02515         {
02516             if (m_bRenderMask)
02517             {
02518                 switch (m_RenderState)
02519                 {
02520                     case RS_BEFORECOMPLEX:
02521                         // We must skip nodes except for attributes and clipviews
02522                         bRender = FALSE;
02523                         if (pNode->IsAnAttribute() || pNode->IsANodeClipView())
02524                         {
02525                             // Let it render normally
02526                             bRender = TRUE;
02527                         }
02528                         break;
02529 
02530                     case RS_INCOMPLEX:
02531                         // Use the standard case below
02532                         break;
02533                     
02534                     case RS_AFTERCOMPLEX:
02535                         // if it is bounded, then decide if it is worth doing this
02536                         // Don't do this for NodeClipView's or large objects clipped by small ones
02537                         // Will not get clipped when they are rendered causing holes in the complex
02538                         // area that really shouldn't be there
02539                         if (pNode->IsBounded() && !pNode->IsANodeClipView())
02540                         {
02541                             // Find out the bounds
02542                             DocRect BoundsRect = ((NodeRenderableBounded*)pNode)->GetBoundingRect();
02543                             
02544                             // if it is small, then don't draw it
02545                             double BoundsArea = (double)BoundsRect.Width() * (double)BoundsRect.Height();
02546                             if (BoundsArea > 0)
02547                             {
02548                                 // work out the coverage of this node as a percentage of the whole region
02549                                 if (m_RegionArea != 0)
02550                                 {
02551                                     BoundsArea = (BoundsArea * 100) / m_RegionArea;
02552                                     if (BoundsArea < 6.0)
02553                                         bRender = FALSE;
02554                                 }
02555                             }
02556                         }
02557                         break;
02558 
02559                     default:
02560                         TRACE( _T("OBRC# Bad RenderState in BeforeNode\n"));
02561                         break;
02562                 }           
02563             }
02564             else    // m_bRenderMask
02565             {
02566 
02567                 switch (m_RenderState)
02568                 {
02569                     case RS_BEFORECOMPLEX:
02570                     case RS_INCOMPLEX:
02571                         // Use the standard case below
02572                         break;
02573                     
02574                     case RS_AFTERCOMPLEX:
02575                         // Must skip everything until the end
02576                         bRender = FALSE;
02577                         break;
02578 
02579                     default:
02580                         TRACE( _T("OBRC# Bad RenderState in BeforeNode\n"));
02581                         break;
02582                 }           
02583             }
02584         }       
02585 
02586 //      TRACE( _T("OBRC%s# BeforeNode    0x%08x - %s    returning %s\n", m_bRenderMask?"M":"B", pNode, pNode->GetRuntimeClass()->GetClassName(), bRender ? "true" : "false"));
02587         return(bRender);
02588     }

virtual BOOL OptimalBitmapRenderCallback::BeforeSubtree RenderRegion pRegion,
Node pNode,
Node **  ppNextNode,
BOOL  bClip,
SubtreeRenderState pState
[inline, virtual]
 

Reimplemented from RenderCallback.

Definition at line 2590 of file view.cpp.

02591     {
02592 //      if (!m_bCount)
02593 //      {
02594 //          TRACE( _T("OBRC%s# BeforeSubtree 0x%08x - %s\n", m_bRenderMask?"M":"B"), pNode, pNode->GetRuntimeClass()->GetClassName());
02595 //      }
02596 
02597         switch (m_RenderState)
02598         {
02599             case RS_BEFORECOMPLEX:
02600                 if (pNode == m_pFirstComplex)
02601                 {
02602 //                  TRACE( _T("OBRC# Hit FirstComplex\n"));
02603                     if (m_bRenderMask)
02604                     {
02605                         // We must switch the render region to drawing complex
02606                         PrintingMaskedRenderRegion* pMaskRegion = (PrintingMaskedRenderRegion*)pRegion;
02607                         pMaskRegion->SetMaskDrawingMode(TRUE);
02608                     }
02609                     
02610                     // And change state to be in the complex span
02611                     m_RenderState = RS_INCOMPLEX;
02612                 }
02613                 break;
02614 
02615             case RS_INCOMPLEX:
02616                 if (pNode == m_pNextNormal)
02617                 {
02618 //                  TRACE( _T("OBRC# Hit NextNormal\n"));
02619                     if (m_bRenderMask)
02620                     {
02621                         // We must switch the render region to drawing simple
02622                         PrintingMaskedRenderRegion* pMaskRegion = (PrintingMaskedRenderRegion*)pRegion;
02623                         pMaskRegion->SetMaskDrawingMode(FALSE);
02624                     }
02625                     
02626                     // And change state to be after the complex span
02627                     m_RenderState = RS_AFTERCOMPLEX;
02628 
02629                     if (!m_bRenderMask)
02630                     {
02631                         *pState = SUBTREE_NORENDER;
02632                         return(TRUE);
02633                     }
02634                 }
02635                 break;
02636 
02637             case RS_AFTERCOMPLEX:
02638                 break;
02639 
02640             default:
02641                 TRACE( _T("OBRC# Bad RenderState in BeforeSubtree\n"));
02642                 break;
02643         }
02644         return(FALSE);
02645     }


Member Data Documentation

BOOL OptimalBitmapRenderCallback::m_bCount [private]
 

Definition at line 2659 of file view.cpp.

BOOL OptimalBitmapRenderCallback::m_bRenderAll [private]
 

Definition at line 2651 of file view.cpp.

BOOL OptimalBitmapRenderCallback::m_bRenderMask [private]
 

Definition at line 2654 of file view.cpp.

double OptimalBitmapRenderCallback::m_dNodesSoFar [private]
 

Definition at line 2661 of file view.cpp.

double OptimalBitmapRenderCallback::m_NodeIncrement [private]
 

Definition at line 2660 of file view.cpp.

Node* OptimalBitmapRenderCallback::m_pFirstComplex [private]
 

Definition at line 2652 of file view.cpp.

Node* OptimalBitmapRenderCallback::m_pNextNormal [private]
 

Definition at line 2653 of file view.cpp.

INT32* OptimalBitmapRenderCallback::m_pNodesSoFar [private]
 

Definition at line 2657 of file view.cpp.

ProgressDisplay* OptimalBitmapRenderCallback::m_pProgress [private]
 

Definition at line 2658 of file view.cpp.

View* OptimalBitmapRenderCallback::m_pView [private]
 

Definition at line 2650 of file view.cpp.

double OptimalBitmapRenderCallback::m_RegionArea [private]
 

Definition at line 2656 of file view.cpp.

RenderStateType OptimalBitmapRenderCallback::m_RenderState [private]
 

Definition at line 2655 of file view.cpp.


The documentation for this class was generated from the following file:
Generated on Sat Nov 10 03:59:04 2007 for Camelot by  doxygen 1.4.4