242 // may be smaller than the visuals displayarea. In that case we dont expand |
242 // may be smaller than the visuals displayarea. In that case we dont expand |
243 // rect but make it smaller. |
243 // rect but make it smaller. |
244 HandleBuffer(scannedRect, EScanBuffer, NULL); |
244 HandleBuffer(scannedRect, EScanBuffer, NULL); |
245 |
245 |
246 // Note: this could be improved to take care of dirty rects |
246 // Note: this could be improved to take care of dirty rects |
247 if (Effect() && Display()) |
247 if (Effect() && Display() && CHuiEnv::Static()->MemoryLevel() != EHuiMemoryLevelLowest ) |
248 { |
248 { |
249 // If there is effect enabled, we cannot say anything about dirty area so |
249 // If there is effect enabled, we cannot say anything about dirty area so |
250 // we set whole screen dirty. |
250 // we set whole screen dirty. |
251 scannedRect = TRect(TPoint(0,0), Display()->VisibleArea().Size()); |
251 scannedRect = TRect(TPoint(0,0), Display()->VisibleArea().Size()); |
252 } |
252 } |
253 else if (IsBackgroundDrawingEnabled() || IsExternalContentDrawingEnabled()) |
253 else if (IsExternalContentDrawingEnabled()) |
254 { |
254 { |
255 // If the visual has external content or draws background, |
255 // If the visual has external content or draws background, |
256 // set always the whole window area as a content. |
256 // set always the whole window area as a content. |
257 scannedRect = aRect; |
257 scannedRect = aRect; |
258 } |
258 } |
359 if( !childWindowEffectActive && |
361 if( !childWindowEffectActive && |
360 !effectAppliedToSurfacePixels && |
362 !effectAppliedToSurfacePixels && |
361 !HasCommandBuffers(ETrue /*include children*/) && |
363 !HasCommandBuffers(ETrue /*include children*/) && |
362 !IsBackgroundDrawingEnabled() && |
364 !IsBackgroundDrawingEnabled() && |
363 !IsExternalContentDrawingEnabled()&& |
365 !IsExternalContentDrawingEnabled()&& |
364 !IsExternalContentDrawingEnabled(ETrue /*include children*/)) |
366 !IsExternalContentDrawingEnabled(ETrue /*include children*/) && |
|
367 !hasStoredContent ) |
365 { |
368 { |
366 return ETrue; |
369 return ETrue; |
367 } |
370 } |
368 } |
371 } |
369 else |
372 else |
454 TBool transparent = EFalse; |
457 TBool transparent = EFalse; |
455 transparent |= (!(Flags() & EHuiVisualFlagOpaqueHint)); // Does not have opaque hint -> always transparent |
458 transparent |= (!(Flags() & EHuiVisualFlagOpaqueHint)); // Does not have opaque hint -> always transparent |
456 transparent |= iOpacity.Now() < 1.0f; // Opacity less than 1.0f -> always transparent |
459 transparent |= iOpacity.Now() < 1.0f; // Opacity less than 1.0f -> always transparent |
457 |
460 |
458 TBool refreshCache = EFalse; |
461 TBool refreshCache = EFalse; |
|
462 TBool layer = EFalse; |
459 if (EffectIsAppliedToChildren()) |
463 if (EffectIsAppliedToChildren()) |
460 { |
464 { |
461 refreshCache |= ChildTreeChanged(EHuiCanvasFlagExcludeFromParentEffect); |
465 refreshCache |= ChildTreeChanged(EHuiCanvasFlagExcludeFromParentEffect); |
462 |
466 |
463 iCanvasVisualData->iPaintedRegion.Clear(); |
467 iCanvasVisualData->iPaintedRegion.Clear(); |
464 CollectRecursivePaintedRegion(iCanvasVisualData->iPaintedRegion, EHuiCanvasFlagExcludeFromParentEffect); |
468 layer = CollectRecursivePaintedRegion(iCanvasVisualData->iPaintedRegion, EHuiCanvasFlagExcludeFromParentEffect); |
465 } |
469 } |
466 else |
470 else |
467 { |
471 { |
468 refreshCache |= Changed(); |
472 refreshCache |= Changed(); |
469 |
473 |
470 iCanvasVisualData->iPaintedRegion.Clear(); |
474 iCanvasVisualData->iPaintedRegion.Clear(); |
471 CollectPaintedRegion(iCanvasVisualData->iPaintedRegion, 0); |
475 layer = CollectPaintedRegion(iCanvasVisualData->iPaintedRegion, 0); |
472 } |
476 } |
473 |
477 |
474 if(Display()->RosterImpl().AlfEventWindow() == this) |
478 if(Display()->RosterImpl().AlfEventWindow() == this) |
475 { |
479 { |
476 refreshCache |= Display()->RosterImpl().NativeAppsContentChanged(); |
480 refreshCache |= Display()->RosterImpl().NativeAppsContentChanged(); |
477 } |
481 } |
478 didDrawEffect = Effect()->CachedDraw(aGc, area, refreshCache, !transparent, iCanvasVisualData->iPaintedRegion); |
482 didDrawEffect = Effect()->CachedDraw(aGc, area, refreshCache, !transparent, iCanvasVisualData->iPaintedRegion,layer ); |
479 |
483 |
480 } |
484 } |
481 |
485 |
482 if ( !didDrawEffect ) |
486 if ( !didDrawEffect ) |
483 { |
487 { |
545 RDebug::Print(_L("CHuiCanvasVisual::DrawSelf - tracked visual")); |
549 RDebug::Print(_L("CHuiCanvasVisual::DrawSelf - tracked visual")); |
546 } |
550 } |
547 #endif |
551 #endif |
548 TBool alfEventWindow = (Display()->RosterImpl().AlfEventWindow() == this); |
552 TBool alfEventWindow = (Display()->RosterImpl().AlfEventWindow() == this); |
549 TReal32 effectiveOpacity = EffectiveOpacity(); |
553 TReal32 effectiveOpacity = EffectiveOpacity(); |
550 |
554 TBool hasStoredContent = (IsContentDrawingEnabled() && (IsDelayedEffectSource() || Freezed())) && (StoredRenderBuffer() || iCanvasVisualData->iStoredRenderBuffer); |
551 if ((effectiveOpacity <= 0 || !HasCommandBuffers(ETrue)) && !alfEventWindow) |
555 if ((effectiveOpacity <= 0 || !HasCommandBuffers(ETrue)) && !alfEventWindow && !hasStoredContent) |
552 { |
556 { |
553 // In case background drawing is enabled, and even if we don't have command buffers we still |
557 // In case background drawing is enabled, and even if we don't have command buffers we still |
554 // want to issue clear. If the background drawing is enabled here, it means that the |
558 // want to issue clear. If the background drawing is enabled here, it means that the |
555 // window bound to this visual has a background surface. If we dont do the clear, the |
559 // window bound to this visual has a background surface. If we dont do the clear, the |
556 // surface will be covered by the Alf surface, ie. the underlying surface is not visible |
560 // surface will be covered by the Alf surface, ie. the underlying surface is not visible |
887 else |
891 else |
888 { |
892 { |
889 PrepareCache(); |
893 PrepareCache(); |
890 } |
894 } |
891 |
895 |
892 SetChanged(); |
896 // don't call setchanged directly here, as it changes all |
|
897 // the command buffers dirty. We don't want to do that |
|
898 // as the drawing area might be significantly smaller in |
|
899 // some cases |
|
900 CHuiLayout::SetChanged(); |
|
901 Env().ContinueRefresh(ETrue); |
893 Env().CanvasTextureCache().EnableTouchCountCheck(EFalse); |
902 Env().CanvasTextureCache().EnableTouchCountCheck(EFalse); |
894 } |
903 } |
895 |
904 |
896 EXPORT_C void CHuiCanvasVisual::AddPartialCommandSetL( const TDesC8& aMoreCommands, TBool aLastPart ) |
905 EXPORT_C void CHuiCanvasVisual::AddPartialCommandSetL( const TDesC8& aMoreCommands, TBool aLastPart ) |
897 { |
906 { |
1523 { |
1532 { |
1524 CHuiVisual::VisualExtension(aExtensionUid, aExtensionParams); |
1533 CHuiVisual::VisualExtension(aExtensionUid, aExtensionParams); |
1525 } |
1534 } |
1526 } |
1535 } |
1527 |
1536 |
1528 void CHuiCanvasVisual::CollectPaintedRegion(TRegion& aPaintRegion, TInt aExcludeCanvasFlags) const |
1537 TBool CHuiCanvasVisual::CollectPaintedRegion(TRegion& aPaintRegion, TInt aExcludeCanvasFlags) const |
1529 { |
1538 { |
1530 // Only our own painted areas. |
1539 // Only our own painted areas. |
1531 TInt paintedAreaCount = PaintedAreaCount(); |
1540 TInt paintedAreaCount = PaintedAreaCount(); |
1532 for (TInt i=0; i<paintedAreaCount; i++ ) |
1541 for (TInt i=0; i<paintedAreaCount; i++ ) |
1533 { |
1542 { |
1534 aPaintRegion.AddRect( CanvasPaintedArea(i).iPaintedRect.Round() ); |
1543 aPaintRegion.AddRect( CanvasPaintedArea(i).iPaintedRect.Round() ); |
1535 } |
1544 } |
1536 aPaintRegion.Tidy(); |
1545 aPaintRegion.Tidy(); |
1537 } |
1546 return !iCanvasVisualData->iLayerExtent.IsEmpty(); |
1538 |
1547 } |
1539 void CHuiCanvasVisual::CollectRecursivePaintedRegion(TRegion& aRecursivePaintRegion, TInt aExcludeCanvasFlags) const |
1548 |
|
1549 TBool CHuiCanvasVisual::CollectRecursivePaintedRegion(TRegion& aRecursivePaintRegion, TInt aExcludeCanvasFlags) const |
1540 { |
1550 { |
1541 // First our own painted areas... |
1551 // First our own painted areas... |
1542 CollectPaintedRegion(aRecursivePaintRegion, aExcludeCanvasFlags); |
1552 TBool layer = CollectPaintedRegion(aRecursivePaintRegion, aExcludeCanvasFlags); |
1543 |
1553 |
1544 // ...then children (and their children). |
1554 // ...then children (and their children). |
1545 const TInt count = Count(); |
1555 const TInt count = Count(); |
1546 for(TInt i = 0; i < count; ++i) |
1556 for(TInt i = 0; i < count; ++i) |
1547 { |
1557 { |
1557 { |
1567 { |
1558 // If this is marked as Wserv visual, it should be safe to cast. |
1568 // If this is marked as Wserv visual, it should be safe to cast. |
1559 if (visual->Flags() & EHuiVisualFlagWserv) |
1569 if (visual->Flags() & EHuiVisualFlagWserv) |
1560 { |
1570 { |
1561 CHuiCanvasVisual* canvasVisual = (CHuiCanvasVisual*)visual; |
1571 CHuiCanvasVisual* canvasVisual = (CHuiCanvasVisual*)visual; |
1562 canvasVisual->CollectRecursivePaintedRegion(aRecursivePaintRegion, aExcludeCanvasFlags); |
1572 layer |= canvasVisual->CollectRecursivePaintedRegion(aRecursivePaintRegion, aExcludeCanvasFlags); |
1563 } |
1573 } |
1564 } |
1574 } |
1565 } |
1575 } |
1566 } |
1576 } |
1567 } |
1577 } |
1568 aRecursivePaintRegion.Tidy(); |
1578 aRecursivePaintRegion.Tidy(); |
|
1579 return layer; |
1569 } |
1580 } |
1570 |
1581 |
1571 EXPORT_C TRect CHuiCanvasVisual::CommandBufferCoverage(TInt aOrientation) |
1582 EXPORT_C TRect CHuiCanvasVisual::CommandBufferCoverage(TInt aOrientation) |
1572 { |
1583 { |
1573 return iCanvasVisualData->iCanvasPainter->CommandBufferCoverage(aOrientation); |
1584 return iCanvasVisualData->iCanvasPainter->CommandBufferCoverage(aOrientation); |