uiacceltk/hitchcock/AlfRenderStage/src/alfrenderstage.cpp
changeset 13 8f67d927ea57
parent 0 15bf7259bb7c
child 14 83d2d132aa58
equal deleted inserted replaced
0:15bf7259bb7c 13:8f67d927ea57
     1 /*
     1 /*
     2 * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). 
     2 * Copyright (c) 2006-2008 Nokia Corporation and/or its subsidiary(-ies). 
     3 * All rights reserved.
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     4 * This component and the accompanying materials are made available
     5 * under the terms of "Eclipse Public License v1.0"
     5 * under the terms of "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
    69 	iScreen = NULL;
    69 	iScreen = NULL;
    70 	delete iAlfSendBuffer;
    70 	delete iAlfSendBuffer;
    71 	delete iWsGraphicsContext;
    71 	delete iWsGraphicsContext;
    72 	delete iGoomSession;
    72 	delete iGoomSession;
    73 	
    73 	
    74 	// Used just as a temporary holding place, do not delete!
    74     #ifdef USE_MODULE_TEST_HOOKS_FOR_ALF
       
    75     if (Dll::Tls()!=NULL) 
       
    76         {
       
    77         delete AMT_CONTROL();
       
    78         Dll::FreeTls();
       
    79         }
       
    80     #endif
       
    81 
       
    82     // Used just as a temporary holding place, do not delete!
    75 	iWindowDrawingNode = NULL;	
    83 	iWindowDrawingNode = NULL;	
    76 	}
    84 	}
    77 
    85 
    78 // ---------------------------------------------------------------------------
    86 // ---------------------------------------------------------------------------
    79 // ConstructL
    87 // ConstructL
   107     if (compcntrl)
   115     if (compcntrl)
   108       {
   116       {
   109       compcntrl->AlfBridgeCallback(MAlfBridge::ESetWindowTreeObserver,(MAlfCompositionAgnosticWindowTreeObserver*)this);  
   117       compcntrl->AlfBridgeCallback(MAlfBridge::ESetWindowTreeObserver,(MAlfCompositionAgnosticWindowTreeObserver*)this);  
   110       }
   118       }
   111 
   119 
       
   120     #ifdef USE_MODULE_TEST_HOOKS_FOR_ALF    
       
   121     // Setup TLS and open global module testing chunk and mutex
       
   122     if (Dll::Tls()==NULL) // create only for the first render stage!
       
   123         {
       
   124         User::LeaveIfError(Dll::SetTls(new(ELeave) CAlfModuleTestDataControl()));
       
   125         User::LeaveIfError(AMT_CONTROL()->OpenGlobalObjects());
       
   126         }
       
   127     #endif         
       
   128     
   112     __ALFLOGSTRING("CAlfRenderStage: ready to rock");
   129     __ALFLOGSTRING("CAlfRenderStage: ready to rock");
   113     }
   130     }
   114 
   131 
   115 // ---------------------------------------------------------------------------
   132 // ---------------------------------------------------------------------------
   116 // InitL
   133 // InitL
   138     	case MAlfHintObserver::EWsObjectInterfaceId:
   155     	case MAlfHintObserver::EWsObjectInterfaceId:
   139     	    return static_cast<MAlfHintObserver*>(this);
   156     	    return static_cast<MAlfHintObserver*>(this);
   140 			
   157 			
   141     	case MWsDrawAnnotationObserver::EWsObjectInterfaceId:
   158     	case MWsDrawAnnotationObserver::EWsObjectInterfaceId:
   142     	    return static_cast<MWsDrawAnnotationObserver*>(this);
   159     	    return static_cast<MWsDrawAnnotationObserver*>(this);
       
   160         case KAlfSynchronizationInterfaceUid:
       
   161             return static_cast<MAlfSynchronizationInterface*>(this);
   143     	default:
   162     	default:
   144     	    return CWsRenderStage::ResolveObjectInterface(aTypeId);
   163     	    return CWsRenderStage::ResolveObjectInterface(aTypeId);
   145 		}
   164 		}
   146 	}
   165 	}
   147 
   166 
   160 	    }
   179 	    }
   161 		
   180 		
   162 	iUpdateRegion = aRegion;
   181 	iUpdateRegion = aRegion;
   163 	iNext->Begin(aRegion);
   182 	iNext->Begin(aRegion);
   164 	}
   183 	}
       
   184 
       
   185 // ---------------------------------------------------------------------------
       
   186 // Synchronize
       
   187 // ---------------------------------------------------------------------------
       
   188 //
       
   189 TInt CAlfRenderStage::Synchronize(TInt& aId)
       
   190     {
       
   191     if ( iAlfSendBuffer )
       
   192         {
       
   193         ++iSyncId;
       
   194         aId = iSyncId;
       
   195         iAlfSendBuffer->Synchronize(iSyncId);
       
   196         return KErrNone;
       
   197         }
       
   198     return KErrGeneral;
       
   199     }
   165 
   200 
   166 // ---------------------------------------------------------------------------
   201 // ---------------------------------------------------------------------------
   167 // End
   202 // End
   168 // ---------------------------------------------------------------------------
   203 // ---------------------------------------------------------------------------
   169 //
   204 //
   328     
   363     
   329     TRegionFix<1> drawRegion;
   364     TRegionFix<1> drawRegion;
   330     drawRegion.AddRect( aExtent );
   365     drawRegion.AddRect( aExtent );
   331     TRegionFix<1> clipRegion;
   366     TRegionFix<1> clipRegion;
   332     clipRegion.AddRect( aClipRect );
   367     clipRegion.AddRect( aClipRect );
   333             
   368 
       
   369     TRgb penColor = TRgb(0x555555); 
       
   370     TRgb brushColor = TRgb(0x555555); 
       
   371     TRgb dotColor = TRgb(0xBBBBBB); 
       
   372     
   334     WindowRedrawStart( aWindowTreeNode, drawRegion );
   373     WindowRedrawStart( aWindowTreeNode, drawRegion );
   335     iWsGraphicsContext->Reset();
   374     iWsGraphicsContext->Reset();
   336     iWsGraphicsContext->SetDrawMode( MWsGraphicsContext::EDrawModePEN );
   375     iWsGraphicsContext->SetDrawMode( MWsGraphicsContext::EDrawModePEN );
   337     iWsGraphicsContext->SetBrushStyle( MWsGraphicsContext::ESolidBrush );
   376     iWsGraphicsContext->SetBrushStyle( MWsGraphicsContext::ESolidBrush );
   338     iWsGraphicsContext->SetPenStyle( MWsGraphicsContext::ESolidPen );
   377     iWsGraphicsContext->SetPenStyle( MWsGraphicsContext::ESolidPen );
   339     iWsGraphicsContext->SetBrushColor( KRgbBlack ); // color from interface is white, so temporirily putting black
   378     iWsGraphicsContext->SetBrushColor( brushColor ); 
   340     //const TRect clipRect = cursor->ClipRect();
   379     iWsGraphicsContext->SetPenColor( penColor );
   341     //const TRect cursorRect = cursor->Rect();
   380     iWsGraphicsContext->SetClippingRegion( clipRegion );    
   342     iWsGraphicsContext->SetClippingRegion( clipRegion );
       
   343     iWsGraphicsContext->DrawRect( aCursorRect );    
   381     iWsGraphicsContext->DrawRect( aCursorRect );    
       
   382 
       
   383     // Draw pattern to cursor so that it is visible in any color backgrounds.
       
   384     iWsGraphicsContext->SetPenColor( dotColor );    
       
   385     TPoint start = aCursorRect.iTl;
       
   386     TPoint end = TPoint(aCursorRect.iTl.iX, aCursorRect.iBr.iY);
       
   387     
       
   388     for (TInt i=0; i<aCursorRect.Width();i++)
       
   389         {    
       
   390         TPoint point = start;
       
   391         for (TInt j=0; j<aCursorRect.Height();j++)
       
   392             {
       
   393             if ((i % 2))
       
   394                 {
       
   395                 if (j % 2)
       
   396                     iWsGraphicsContext->Plot(point);            
       
   397                 }
       
   398             else
       
   399                 {
       
   400                 if (!(j % 2))
       
   401                     iWsGraphicsContext->Plot(point);                        
       
   402                 }                
       
   403             point.iY++;
       
   404             }
       
   405         start.iX++;
       
   406         }
       
   407         
   344     WindowRedrawEnd( aWindowTreeNode );
   408     WindowRedrawEnd( aWindowTreeNode );
   345     }
   409     }
   346 
   410 
   347 // ---------------------------------------------------------------------------
   411 // ---------------------------------------------------------------------------
   348 // NodeCreated
   412 // NodeCreated
   418 
   482 
   419 #ifndef __WINS__  
   483 #ifndef __WINS__  
   420             if( iScreenNumber == 0 )
   484             if( iScreenNumber == 0 )
   421 		        {          
   485 		        {          
   422                 if ( secureId != 0x10207218 && // Capserver / AKA goom
   486                 if ( secureId != 0x10207218 && // Capserver / AKA goom
   423                      secureId != 0x10204c27 )  // Policy server 
   487                      secureId != 0x10204c27 && // Policy server
       
   488                      secureId != 0x2000f85a )  // IAD application updater
   424                     {
   489                     {
   425                     // Todo: Must actually check whether the configuration uses goom
   490                     // Todo: Must actually check whether the configuration uses goom
   426                     // would create drastic performance hit in a system that does not need
   491                     // would create drastic performance hit in a system that does not need
   427                     // (and construct) goom
   492                     // (and construct) goom
   428                     if ( !iGoomSession )
   493                     if ( !iGoomSession )
   523         {
   588         {
   524         iAlfSendBuffer->WriteIntsL( EAlfDebugTrackNode, 2, (TInt32)&aWindowTreeNode, 1 );
   589         iAlfSendBuffer->WriteIntsL( EAlfDebugTrackNode, 2, (TInt32)&aWindowTreeNode, 1 );
   525         }
   590         }
   526 #endif    
   591 #endif    
   527 	iAlfSendBuffer->CommitL();
   592 	iAlfSendBuffer->CommitL();
       
   593 	
       
   594     AMT_INC_COUNTER_IF(nodeType==MWsWindowTreeNode::EWinTreeNodeClient, iRsWindowNodeCount ); 
       
   595     AMT_INC_COUNTER_IF(nodeType==MWsWindowTreeNode::EWinTreeNodeGroup,  iRsWindowGroupNodeCount ); 
       
   596     AMT_INC_COUNTER(iRsWindowGroupNodeCount ); 
   528     }
   597     }
   529 
   598 
   530 // ---------------------------------------------------------------------------
   599 // ---------------------------------------------------------------------------
   531 // NodeReleased
   600 // NodeReleased
   532 // ---------------------------------------------------------------------------
   601 // ---------------------------------------------------------------------------
   563 	else
   632 	else
   564 	    {
   633 	    {
   565 	    __ALFLOGSTRING("CAlfRenderStage::NodeReleased - WARNING: Node not found!!");
   634 	    __ALFLOGSTRING("CAlfRenderStage::NodeReleased - WARNING: Node not found!!");
   566 	    }
   635 	    }
   567 
   636 
       
   637     AMT_DEC_COUNTER_IF(nodeType==MWsWindowTreeNode::EWinTreeNodeClient, iRsWindowNodeCount ); 
       
   638     AMT_DEC_COUNTER_IF(nodeType==MWsWindowTreeNode::EWinTreeNodeGroup,  iRsWindowGroupNodeCount ); 
       
   639     AMT_DEC_COUNTER(iRsWindowGroupNodeCount ); 
   568     }
   640     }
   569 
   641 
   570 // ---------------------------------------------------------------------------
   642 // ---------------------------------------------------------------------------
   571 // NodeActivated
   643 // NodeActivated
   572 // ---------------------------------------------------------------------------
   644 // ---------------------------------------------------------------------------
   580         nodeType,
   652         nodeType,
   581         &aWindowTreeNode );
   653         &aWindowTreeNode );
   582 
   654 
   583 	iAlfSendBuffer->CommitL();
   655 	iAlfSendBuffer->CommitL();
   584     __ALFLOGSTRING("CAlfRenderStage::NodeActivated <<");
   656     __ALFLOGSTRING("CAlfRenderStage::NodeActivated <<");
       
   657    
       
   658     AMT_INC_COUNTER_IF(nodeType==MWsWindowTreeNode::EWinTreeNodeClient, iRsWindowNodeActivatedCount ); 
   585     }
   659     }
   586 
   660 
   587 // ---------------------------------------------------------------------------
   661 // ---------------------------------------------------------------------------
   588 // NodeExtentChanged
   662 // NodeExtentChanged
   589 // ---------------------------------------------------------------------------
   663 // ---------------------------------------------------------------------------
   616             aRect.iBr.iY,
   690             aRect.iBr.iY,
   617             &aWindowTreeNode
   691             &aWindowTreeNode
   618             );    
   692             );    
   619         }
   693         }
   620 	iAlfSendBuffer->CommitL();
   694 	iAlfSendBuffer->CommitL();
       
   695 
       
   696     AMT_INC_COUNTER( iRsNodeExtentChangedCount );
       
   697     AMT_SET_VALUE( iRsLatestNodeExtentRect, aRect );
   621     }
   698     }
   622 
   699 
   623 // ---------------------------------------------------------------------------
   700 // ---------------------------------------------------------------------------
   624 // SiblingOrderChanged
   701 // SiblingOrderChanged
   625 // ---------------------------------------------------------------------------
   702 // ---------------------------------------------------------------------------
   648             3,
   725             3,
   649             aFlag,
   726             aFlag,
   650             aNewValue,
   727             aNewValue,
   651             &aWindowTreeNode   );
   728             &aWindowTreeNode   );
   652 	iAlfSendBuffer->CommitL();
   729 	iAlfSendBuffer->CommitL();
       
   730 
       
   731     AMT_INC_COUNTER( iRsTotalNodeFlagChangedCount );
   653     }
   732     }
   654 
   733 
   655 // ---------------------------------------------------------------------------
   734 // ---------------------------------------------------------------------------
   656 // AttributeChanged
   735 // AttributeChanged
   657 // ---------------------------------------------------------------------------
   736 // ---------------------------------------------------------------------------
   710                         aWindowTreeNode.StandardTextCursor()->Color().Internal() );
   789                         aWindowTreeNode.StandardTextCursor()->Color().Internal() );
   711                 break;
   790                 break;
   712                 }
   791                 }
   713             }
   792             }
   714         iAlfSendBuffer->CommitL();
   793         iAlfSendBuffer->CommitL();
   715         } 
   794         
       
   795         AMT_INC_COUNTER( iRsTotalNodeAttributeChangedCount );
       
   796         }    
   716     }
   797     }
   717 
   798 
   718 // ---------------------------------------------------------------------------
   799 // ---------------------------------------------------------------------------
   719 // FadeCountChanged
   800 // FadeCountChanged
   720 // ---------------------------------------------------------------------------
   801 // ---------------------------------------------------------------------------