398 if (!EffectActive() && CanSkipDrawing()) |
397 if (!EffectActive() && CanSkipDrawing()) |
399 { |
398 { |
400 return; |
399 return; |
401 } |
400 } |
402 |
401 |
403 if ((IsDelayedEffectSource() || Freezed())) |
402 if ((IsDelayedEffectSource() || Freezed())) |
404 { |
403 { |
405 // Select right draw mode |
404 // Select right draw mode |
406 THuiCanvasDrawMode drawMode = (Flags() & EHuiVisualFlagOpaqueHint) ? EHuiCanvasDrawModeNormal : EHuiCanvasDrawModeBlend; |
405 THuiCanvasDrawMode drawMode = (Flags() & EHuiVisualFlagOpaqueHint) ? EHuiCanvasDrawModeNormal : EHuiCanvasDrawModeBlend; |
407 |
406 if(Effectable()->ExternalTexture()) |
408 if (StoredRenderBuffer()) |
407 { |
|
408 DrawExternalImage(aGc); |
|
409 return; |
|
410 } |
|
411 else if (StoredRenderBuffer()) |
409 { |
412 { |
410 DrawStoredFullScreenRenderBuffer(drawMode, aGc); |
413 DrawStoredFullScreenRenderBuffer(drawMode, aGc); |
411 return; |
414 return; |
412 } |
415 } |
413 else if (iCanvasVisualData->iStoredRenderBuffer) |
416 else if (iCanvasVisualData->iStoredRenderBuffer) |
598 if (hasStoredContent) |
601 if (hasStoredContent) |
599 { |
602 { |
600 // Select right draw mode |
603 // Select right draw mode |
601 THuiCanvasDrawMode drawMode = (Flags() & EHuiVisualFlagOpaqueHint) ? EHuiCanvasDrawModeNormal : EHuiCanvasDrawModeBlend; |
604 THuiCanvasDrawMode drawMode = (Flags() & EHuiVisualFlagOpaqueHint) ? EHuiCanvasDrawModeNormal : EHuiCanvasDrawModeBlend; |
602 |
605 |
603 if (StoredRenderBuffer()) |
606 THuiFxVisualSrcType effectSource = Effectable()->EffectGetSource(); |
|
607 |
|
608 if(effectSource == EVisualSrcBitmap && Effectable()->ExternalTexture()) |
|
609 { |
|
610 DrawExternalImage(aGc); |
|
611 return; |
|
612 } |
|
613 else if (effectSource == EVisualSrcInput1 && StoredRenderBuffer()) |
604 { |
614 { |
605 DrawStoredFullScreenRenderBuffer(drawMode, aGc); |
615 DrawStoredFullScreenRenderBuffer(drawMode, aGc); |
606 return; |
616 return; |
607 } |
617 } |
608 else if (iCanvasVisualData->iStoredRenderBuffer) |
618 else if (iCanvasVisualData->iStoredRenderBuffer) |
1436 gc.EnableEffectiveOpacity(EFalse); |
1446 gc.EnableEffectiveOpacity(EFalse); |
1437 } |
1447 } |
1438 gc.PopTransformationMatrix(); |
1448 gc.PopTransformationMatrix(); |
1439 } |
1449 } |
1440 |
1450 |
|
1451 |
|
1452 void CHuiCanvasVisual::DrawExternalImage(CHuiGc& aGc) const |
|
1453 { |
|
1454 if (!Display()) |
|
1455 { |
|
1456 return; |
|
1457 } |
|
1458 |
|
1459 if (!iHuiLayoutPrivateData->iGc) |
|
1460 { |
|
1461 CHuiRenderPlugin& renderplugin = CHuiStatic::Renderer(); |
|
1462 // iHuiLayoutPrivateData->iGc is deleted in CHuiLayout destructor or CHuiCanvasVisual::FreeRenderBuffer when not needed anymore |
|
1463 iHuiLayoutPrivateData->iGc = renderplugin.CreateCanvasGcL(); |
|
1464 } |
|
1465 |
|
1466 TRect displayArea = Display()->VisibleArea(); |
|
1467 |
|
1468 if (Effectable()->ExternalTexture()) |
|
1469 { |
|
1470 CHuiCanvasGc& gc = *iHuiLayoutPrivateData->iGc; |
|
1471 gc.SetGc(aGc); |
|
1472 gc.SetDefaults(); |
|
1473 gc.PushTransformationMatrix(); |
|
1474 |
|
1475 TInt height = displayArea.Height(); |
|
1476 TInt width = displayArea.Width(); |
|
1477 |
|
1478 // Move the center of the image to the center of the screen |
|
1479 TInt tlX = width/2 - Effectable()->ExternalTexture()->Size().iWidth/2; |
|
1480 TInt tlY = height/2 - Effectable()->ExternalTexture()->Size().iHeight/2; |
|
1481 gc.Translate(tlX, tlY, 0.0f); |
|
1482 |
|
1483 // Draw the image and do the cleanup |
|
1484 gc.DrawImage(*Effectable()->ExternalTexture(), displayArea, TRect(TPoint(0,0), Effectable()->ExternalTexture()->Size()), CHuiGc::EStretchNone); |
|
1485 |
|
1486 gc.PopTransformationMatrix(); |
|
1487 |
|
1488 } |
|
1489 } |
|
1490 |
1441 EXPORT_C void CHuiCanvasVisual::FreeRenderBuffer() |
1491 EXPORT_C void CHuiCanvasVisual::FreeRenderBuffer() |
1442 { |
1492 { |
1443 if (iCanvasVisualData) |
1493 if (iCanvasVisualData) |
1444 { |
1494 { |
1445 if (iCanvasVisualData->iStoredRenderBuffer) |
1495 delete iCanvasVisualData->iStoredRenderBuffer; |
1446 { |
1496 iCanvasVisualData->iStoredRenderBuffer = NULL; |
1447 delete iCanvasVisualData->iStoredRenderBuffer; |
1497 } |
1448 iCanvasVisualData->iStoredRenderBuffer = NULL; |
1498 if (iHuiLayoutPrivateData) |
1449 delete iHuiLayoutPrivateData->iGc; |
1499 { |
1450 iHuiLayoutPrivateData->iGc = NULL; |
1500 delete iHuiLayoutPrivateData->iGc; |
1451 } |
1501 iHuiLayoutPrivateData->iGc = NULL; |
1452 } |
1502 } |
1453 } |
1503 } |
1454 |
1504 |
1455 // Goes through visual hierarchy and checks if any visual has command buffers |
1505 // Goes through visual hierarchy and checks if any visual has command buffers |
1456 // or other drawable content. |
1506 // or other drawable content. |