javauis/lcdui_akn/lcdui/src/CMIDCanvas.cpp
branchRCL_3
changeset 25 9ac0a0a7da70
parent 24 0fd27995241b
child 34 71c436fe3ce0
equal deleted inserted replaced
24:0fd27995241b 25:9ac0a0a7da70
   144                                    sizeof(TBitBltData) / sizeof(TMIDBufferOp))));
   144                                    sizeof(TBitBltData) / sizeof(TMIDBufferOp))));
   145 
   145 
   146     return *static_cast< const TBitBltData* >(aOp->Data());
   146     return *static_cast< const TBitBltData* >(aOp->Data());
   147 }
   147 }
   148 
   148 
   149 
   149 #ifdef RD_JAVA_NGA_ENABLED
   150 // ---------------------------------------------------------------------------
   150 // ---------------------------------------------------------------------------
   151 // IsDownScaling
   151 // IsDownScaling
   152 // Check if downscaling in use.
   152 // Check if downscaling in use.
   153 // @param aSourceSize Source rect size.
   153 // @param aSourceSize Source rect size.
   154 // @param aDestRect Destination rect.
   154 // @param aDestRect Destination rect.
   155 // ---------------------------------------------------------------------------
   155 // ---------------------------------------------------------------------------
   156 //
   156 //
   157 inline TBool IsDownScaling(const TSize& aSourceSize, const TRect& aDestRect)
   157 inline TBool IsDownScaling(const TSize& aSourceSize, const TRect& aDestRect, TBool aM3GContent)
   158 {
   158 {
       
   159     // if m3G is drawing then downscaling is turn off
       
   160     if (aM3GContent)
       
   161     {
       
   162         return EFalse;
       
   163     }
   159     return (aSourceSize.iWidth > aDestRect.Width() ||
   164     return (aSourceSize.iWidth > aDestRect.Width() ||
   160             aSourceSize.iHeight > aDestRect.Height());
   165             aSourceSize.iHeight > aDestRect.Height());
   161 }
   166 }
   162 
   167 #else
   163 
   168 // ---------------------------------------------------------------------------
       
   169 // IsDownScaling
       
   170 // Check if downscaling in use.
       
   171 // @param aSourceSize Source rect size.
       
   172 // @param aDestRect Destination rect.
       
   173 // ---------------------------------------------------------------------------
       
   174 inline TBool IsDownScaling(const TSize& aSourceSize, const TRect& aDestRect)
       
   175 {
       
   176     return (aSourceSize.iWidth > aDestRect.Width() ||
       
   177             aSourceSize.iHeight > aDestRect.Height());
       
   178 }
       
   179 
       
   180 #endif //RD_JAVA_NGA_ENABLED
   164 // ======== MEMBER FUNCTIONS ========
   181 // ======== MEMBER FUNCTIONS ========
   165 
   182 
   166 // ---------------------------------------------------------------------------
   183 // ---------------------------------------------------------------------------
   167 // CMIDCanvas::NewL
   184 // CMIDCanvas::NewL
   168 // Two-phased constructor. Use this method to create a CMIDCanvas instance.
   185 // Two-phased constructor. Use this method to create a CMIDCanvas instance.
   382 // (other items are commented in the header file)
   399 // (other items are commented in the header file)
   383 // ---------------------------------------------------------------------------
   400 // ---------------------------------------------------------------------------
   384 //
   401 //
   385 void CMIDCanvas::SetFocusedComponent(MMIDCustomComponent* aComponent)
   402 void CMIDCanvas::SetFocusedComponent(MMIDCustomComponent* aComponent)
   386 {
   403 {
   387     if (aComponent == NULL)
   404     if (!aComponent)
   388     {
   405     {
   389         iFocusedComponent = KComponentFocusedNone;
   406         iFocusedComponent = KComponentFocusedNone;
   390         iPressedComponent = NULL;
   407         iPressedComponent = NULL;
   391     }
   408     }
   392     else
   409     else
   827                 iDirectContents.Count() == 0)
   844                 iDirectContents.Count() == 0)
   828         {
   845         {
   829             DEBUG("CMIDCanvas::ProcessL - M3G content start");
   846             DEBUG("CMIDCanvas::ProcessL - M3G content start");
   830             iM3GContent = ETrue;
   847             iM3GContent = ETrue;
   831             iM3GStart = ETrue;
   848             iM3GStart = ETrue;
   832 
   849             PostEvent(EM3GDraw, iM3GContent, 0);
   833             // First time when M3G content is drawn =>
   850             // First time when M3G content is drawn =>
   834             // switch to EGL surface drawing.
   851             // switch to EGL surface drawing.
   835             // Pixel source must be disposed first.
   852             // Pixel source must be disposed first.
   836             DisposePixelSource();
   853             DisposePixelSource();
   837             OpenEglL();
   854             OpenEglL();
   852     {
   869     {
   853         if (iFirstPaintState == EFirstPaintNeverOccurred)
   870         if (iFirstPaintState == EFirstPaintNeverOccurred)
   854         {
   871         {
   855             iFirstPaintState = EFirstPaintInitiated;
   872             iFirstPaintState = EFirstPaintInitiated;
   856         }
   873         }
   857         
   874 
   858         const TBitBltData& data = BitBltData(aRead);
   875         const TBitBltData& data = BitBltData(aRead);
   859         UpdateL(data.iRect);
   876         UpdateL(data.iRect);
   860     }
   877     }
   861     break;
   878     break;
   862     case EDrwOpcBitBlt:
   879     case EDrwOpcBitBlt:
   863     {
   880     {
   864         if (iFirstPaintState == EFirstPaintNeverOccurred)
   881         if (iFirstPaintState == EFirstPaintNeverOccurred)
   865         {
   882         {
   866             iFirstPaintState = EFirstPaintInitiated;
   883             iFirstPaintState = EFirstPaintInitiated;
   867         }
   884         }
   868         
   885 
   869         UpdateL(iViewRect);
   886         UpdateL(iViewRect);
   870     }
   887     }
   871     break;
   888     break;
   872     default:
   889     default:
   873         User::Leave(KErrNotSupported);
   890         User::Leave(KErrNotSupported);
   961         }
   978         }
   962 
   979 
   963         aRead += aRead->Size();
   980         aRead += aRead->Size();
   964     }
   981     }
   965 #endif // CANVAS_DOUBLE_BUFFER
   982 #endif // CANVAS_DOUBLE_BUFFER
   966     
   983 
   967     if (iFirstPaintState == EFirstPaintNeverOccurred)
   984     if (iFirstPaintState == EFirstPaintNeverOccurred)
   968     {
   985     {
   969         if (iForeground)
   986         if (iForeground)
   970         {
   987         {
   971             // The canvas is current, therefore we can flush 
   988             // The canvas is current, therefore we can flush
   972             // the graphics and take the start screen snapshot.
   989             // the graphics and take the start screen snapshot.
   973             iFirstPaintState = EFirstPaintOccurred;
   990             iFirstPaintState = EFirstPaintOccurred;
   974             java::ui::CoreUiAvkonLcdui::getInstance().getJavaUiAppUi()->stopStartScreen();
   991             java::ui::CoreUiAvkonLcdui::getInstance().getJavaUiAppUi()->stopStartScreen();
   975         }
   992         }
   976         else
   993         else
   978             // The window is not visible, the start screen snapshot
   995             // The window is not visible, the start screen snapshot
   979             // will be taken when the canvas will be set current.
   996             // will be taken when the canvas will be set current.
   980             iFirstPaintState = EFirstPaintInitiated;
   997             iFirstPaintState = EFirstPaintInitiated;
   981         }
   998         }
   982     }
   999     }
   983     
  1000 
   984     DEBUG("- CMIDCanvas::ProcessL");
  1001     DEBUG("- CMIDCanvas::ProcessL");
   985     
  1002 
   986     return EFalse;
  1003     return EFalse;
   987 }
  1004 }
   988 #endif // RD_JAVA_NGA_ENABLED
  1005 #endif // RD_JAVA_NGA_ENABLED
   989 
  1006 
   990 
  1007 
  1532         DrawWindowNgaL(aRect);
  1549         DrawWindowNgaL(aRect);
  1533     }
  1550     }
  1534     else
  1551     else
  1535     {
  1552     {
  1536         // Must draw via CCoeControl framework
  1553         // Must draw via CCoeControl framework
  1537         DrawNow(aRect);
  1554         if (iFullScreen && iScalingOn)
       
  1555         {
       
  1556             DrawNow(iViewRect);
       
  1557         }
       
  1558         else
       
  1559         {
       
  1560             DrawNow(aRect);
       
  1561         }
  1538     }
  1562     }
  1539 
  1563 
  1540     // This is needed to avoid artifacting after orientation switch.
  1564     // This is needed to avoid artifacting after orientation switch.
  1541     // It is called once after orientation change.
  1565     // It is called once after orientation change.
  1542     if (iWndUpdate)
  1566     if (iWndUpdate)
  1723         if (eglSwapBuffers(iEglDisplay, iEglWindowSurface) == EGL_FALSE)
  1747         if (eglSwapBuffers(iEglDisplay, iEglWindowSurface) == EGL_FALSE)
  1724         {
  1748         {
  1725             ELOG1(EJavaUI, "eglSwapBuffers() failed, eglError=%d", eglGetError());
  1749             ELOG1(EJavaUI, "eglSwapBuffers() failed, eglError=%d", eglGetError());
  1726             ASSERT(EFalse);
  1750             ASSERT(EFalse);
  1727         }
  1751         }
  1728         
  1752 
  1729         SetCurrentEglType(EEglNone);
  1753         SetCurrentEglType(EEglNone);
  1730         
  1754 
  1731         if (iFirstPaintState != EFirstPaintOccurred)
  1755         if (iFirstPaintState != EFirstPaintOccurred)
  1732         {
  1756         {
  1733             iFirstPaintState = EFirstPaintOccurred;
  1757             iFirstPaintState = EFirstPaintOccurred;
  1734             java::ui::CoreUiAvkonLcdui::getInstance().getJavaUiAppUi()->stopStartScreen();
  1758             java::ui::CoreUiAvkonLcdui::getInstance().getJavaUiAppUi()->stopStartScreen();
  1735         }
  1759         }
  1766     if (iViewRect.Size() == iContentSize)
  1790     if (iViewRect.Size() == iContentSize)
  1767     {
  1791     {
  1768         DEBUG("DrawWindow - Not scaled - BitBlt");
  1792         DEBUG("DrawWindow - Not scaled - BitBlt");
  1769         gc.BitBlt(windowRect.iTl, iFrameBuffer, windowRect);
  1793         gc.BitBlt(windowRect.iTl, iFrameBuffer, windowRect);
  1770     }
  1794     }
  1771     else if (IsDownScaling(iContentSize, iViewRect))
  1795     else
  1772     {
  1796 #ifdef RD_JAVA_NGA_ENABLED
  1773         DEBUG("DrawWindow - Downscaling - BitBlt");
  1797         if (IsDownScaling(iContentSize, iViewRect, iM3GContent))
  1774         gc.BitBlt(windowRect.iTl, iFrameBuffer, windowRect.Size());
  1798 #else
  1775     }
  1799         if (IsDownScaling(iContentSize, iViewRect))
       
  1800 #endif //RD_JAVA_NGA_ENABLED
       
  1801         {
       
  1802             DEBUG("DrawWindow - Downscaling - BitBlt");
       
  1803             gc.BitBlt(windowRect.iTl, iFrameBuffer, windowRect.Size());
       
  1804         }
  1776     // Upscaling
  1805     // Upscaling
  1777     else if (iScaler)
  1806         else if (iScaler)
  1778     {
  1807         {
  1779         iFrameBuffer->LockHeap();
  1808             iFrameBuffer->LockHeap();
  1780         TUint32* pixelData = iFrameBuffer->DataAddress();
  1809             TUint32* pixelData = iFrameBuffer->DataAddress();
  1781 
  1810 
  1782         // Scale the framebuffer content.
  1811             // Scale the framebuffer content.
  1783         CFbsBitmap* map = iScaler->Process(
  1812             CFbsBitmap* map = iScaler->Process(
  1784                               iFrameBuffer->DisplayMode(),
  1813                                   iFrameBuffer->DisplayMode(),
  1785                               pixelData,
  1814                                   pixelData,
  1786                               iContentSize.iWidth,
  1815                                   iContentSize.iWidth,
  1787                               iContentSize.iHeight,
  1816                                   iContentSize.iHeight,
  1788                               iFrameBuffer->SizeInPixels().iWidth - iContentSize.iWidth,
  1817                                   iFrameBuffer->SizeInPixels().iWidth - iContentSize.iWidth,
  1789                               iViewRect.Width(),
  1818                                   iViewRect.Width(),
  1790                               iViewRect.Height());
  1819                                   iViewRect.Height());
  1791 
  1820 
  1792         iFrameBuffer->UnlockHeap();
  1821             iFrameBuffer->UnlockHeap();
  1793 
  1822 
  1794         if (map)
  1823             if (map)
  1795         {
  1824             {
  1796             DEBUG("DrawWindow - Upscaling - BitBlt - map ok");
  1825                 DEBUG("DrawWindow - Upscaling - BitBlt - map ok");
  1797             gc.BitBlt(windowRect.iTl, map, windowRect.Size());
  1826                 gc.BitBlt(windowRect.iTl, map, windowRect.Size());
  1798         }
  1827             }
  1799         else
  1828             else
  1800         {
  1829             {
  1801             DEBUG("DrawWindow - Upscaling - DrawBitmap - no map");
  1830                 DEBUG("DrawWindow - Upscaling - DrawBitmap - no map");
  1802             gc.DrawBitmap(windowRect, iFrameBuffer, iContentSize);
  1831                 gc.DrawBitmap(windowRect, iFrameBuffer, iContentSize);
  1803         }
  1832             }
  1804     }
  1833         }
  1805 
  1834 
  1806 #ifdef RD_JAVA_NGA_ENABLED
  1835 #ifdef RD_JAVA_NGA_ENABLED
  1807     iCoeEnv->WsSession().Finish();
  1836     iCoeEnv->WsSession().Finish();
  1808 #endif
  1837 #endif
  1809 
  1838 
  2038     }
  2067     }
  2039     if (aType == KEikDynamicLayoutVariantSwitch)
  2068     if (aType == KEikDynamicLayoutVariantSwitch)
  2040     {
  2069     {
  2041         // If orientation change is done,
  2070         // If orientation change is done,
  2042         // then we have to inform all components about it.
  2071         // then we have to inform all components about it.
  2043         if (iFocusedComponent != KComponentFocusedNone &&
  2072         if (iFullScreen && iScalingOn)
  2044                 iFullScreen)
       
  2045         {
  2073         {
  2046             for (int i = 0; i < iCustomComponents.Count(); i++)
  2074             for (int i = 0; i < iCustomComponents.Count(); i++)
  2047             {
  2075             {
  2048                 iCustomComponents[i]->HandleResolutionChange();
  2076                 iCustomComponents[i]->HandleResolutionChange();
  2049             }
  2077             }
  2391         {
  2419         {
  2392             iCustomComponents[iFocusedComponent]->
  2420             iCustomComponents[iFocusedComponent]->
  2393             CustomComponentControl(KComponentMainControl)->
  2421             CustomComponentControl(KComponentMainControl)->
  2394             SetFocus(EFalse);
  2422             SetFocus(EFalse);
  2395         }
  2423         }
  2396         
  2424 
  2397 #ifdef RD_JAVA_NGA_ENABLED        
  2425 #ifdef RD_JAVA_NGA_ENABLED
  2398         // Avoid the situation when the content is drawn over the menu
  2426         // Avoid the situation when the content is drawn over the menu
  2399         SuspendPixelSource();
  2427         SuspendPixelSource();
  2400 #endif // RD_JAVA_NGA_ENABLED
  2428 #endif // RD_JAVA_NGA_ENABLED
  2401         
  2429 
  2402         // Repaint to ensure that fading will be displayed correctly for Alert
  2430         // Repaint to ensure that fading will be displayed correctly for Alert
  2403         // or PopupTextBox when DSA is paused.
  2431         // or PopupTextBox when DSA is paused.
  2404         DrawDeferred();
  2432         DrawDeferred();
  2405     }
  2433     }
  2406 
  2434 
  2629     TBool /*aUpdateRequired*/
  2657     TBool /*aUpdateRequired*/
  2630 #else
  2658 #else
  2631     TBool aUpdateRequired
  2659     TBool aUpdateRequired
  2632 #endif // CANVAS_DIRECT_ACCESS
  2660 #endif // CANVAS_DIRECT_ACCESS
  2633 ) :
  2661 ) :
  2634         CCoeControl()
  2662     CCoeControl()
  2635         ,iEnv(aEnv)
  2663     ,iEnv(aEnv)
  2636 #ifdef CANVAS_DOUBLE_BUFFER
  2664 #ifdef CANVAS_DOUBLE_BUFFER
  2637         ,iFrameBuffer(NULL)
  2665     ,iFrameBuffer(NULL)
  2638 #endif // CANVAS_DOUBLE_BUFFER
  2666 #endif // CANVAS_DOUBLE_BUFFER
  2639         ,iIsGameCanvas((
  2667     ,iIsGameCanvas((
  2640                            aComponentType == MMIDComponent::EGameCanvas ? ETrue : EFalse))
  2668                        aComponentType == MMIDComponent::EGameCanvas ? ETrue : EFalse))
  2641         ,iFlags(EPostKeyEvents)
  2669     ,iFlags(EPostKeyEvents)
  2642         ,iFullScreen(EFalse)
  2670     ,iFullScreen(EFalse)
  2643         ,iScalingOn(EFalse)
  2671     ,iScalingOn(EFalse)
  2644         ,iS60SelectionKeyCompatibility(EFalse)
  2672     ,iS60SelectionKeyCompatibility(EFalse)
  2645         ,iRestoreContentWhenUnfaded(EFalse)
  2673     ,iRestoreContentWhenUnfaded(EFalse)
  2646         ,iLastFadeMessage(0)
  2674     ,iLastFadeMessage(0)
  2647 #ifdef CANVAS_DIRECT_ACCESS
  2675 #ifdef CANVAS_DIRECT_ACCESS
  2648         ,iDcDsaToStart(EFalse)
  2676     ,iDcDsaToStart(EFalse)
  2649 #endif // CANVAS_DIRECT_ACCESS
  2677 #endif // CANVAS_DIRECT_ACCESS
  2650         ,iDragEventsStartedInside(EFalse)
  2678     ,iDragEventsStartedInside(EFalse)
  2651 {
  2679 {
  2652     DEBUG("+ CMIDCanvas::CMIDCanvas - EDirectEnabled");
  2680     DEBUG("+ CMIDCanvas::CMIDCanvas - EDirectEnabled");
  2653 
  2681 
  2654 #ifdef CANVAS_DIRECT_ACCESS
  2682 #ifdef CANVAS_DIRECT_ACCESS
  2655     iFlags |= (EDirectPaused | EDirectEnabled | EUpdateRequired);
  2683     iFlags |= (EDirectPaused | EDirectEnabled | EUpdateRequired);
  3405 // ---------------------------------------------------------------------------
  3433 // ---------------------------------------------------------------------------
  3406 //
  3434 //
  3407 void CMIDCanvas::HandleForeground(TBool aForeground)
  3435 void CMIDCanvas::HandleForeground(TBool aForeground)
  3408 {
  3436 {
  3409     DEBUG_INT("CMIDCanvas::HandleForeground(%d) ++", aForeground);
  3437     DEBUG_INT("CMIDCanvas::HandleForeground(%d) ++", aForeground);
  3410     
  3438 
  3411     iForeground = aForeground;
  3439     iForeground = aForeground;
  3412 
  3440 
  3413 #ifdef RD_JAVA_NGA_ENABLED
  3441 #ifdef RD_JAVA_NGA_ENABLED
  3414     if (!iForeground)
  3442     if (!iForeground)
  3415     {
  3443     {
  3427         }
  3455         }
  3428 
  3456 
  3429         SuspendPixelSource();
  3457         SuspendPixelSource();
  3430     }
  3458     }
  3431 #endif // RD_JAVA_NGA_ENABLED
  3459 #endif // RD_JAVA_NGA_ENABLED
  3432     
  3460 
  3433     DEBUG("CMIDCanvas::HandleForeground --");
  3461     DEBUG("CMIDCanvas::HandleForeground --");
  3434 }
  3462 }
  3435 
  3463 
  3436 #ifdef RD_JAVA_NGA_ENABLED
  3464 #ifdef RD_JAVA_NGA_ENABLED
  3437 
  3465 
  3509     if (iDirectContents.Count() > 0)
  3537     if (iDirectContents.Count() > 0)
  3510     {
  3538     {
  3511         return;
  3539         return;
  3512     }
  3540     }
  3513 
  3541 
  3514     // ProduceNewFrameL() is called in some cases 
  3542     // ProduceNewFrameL() is called in some cases
  3515     // directly from ActivateSyncL(), need to set iFrameReady
  3543     // directly from ActivateSyncL(), need to set iFrameReady
  3516     // before ActivateSyncL()
  3544     // before ActivateSyncL()
  3517     iFrameReady = ETrue;
  3545     iFrameReady = ETrue;
  3518     TRAPD(err, iAlfCompositionPixelSource->ActivateSyncL());
  3546     TRAPD(err, iAlfCompositionPixelSource->ActivateSyncL());
  3519     if (err != KErrNone)
  3547     if (err != KErrNone)
  3587         res = EFalse;
  3615         res = EFalse;
  3588     }
  3616     }
  3589     else
  3617     else
  3590     {
  3618     {
  3591         NotifyMonitor();
  3619         NotifyMonitor();
  3592     
  3620 
  3593         TUint8* from = (TUint8*)iFrameBuffer->DataAddress();
  3621         TUint8* from = (TUint8*)iFrameBuffer->DataAddress();
  3594     
  3622 
  3595         TBool downScaling = IsDownScaling(iContentSize, iViewRect);
  3623         TBool downScaling = IsDownScaling(iContentSize, iViewRect, iM3GContent);
  3596         TInt width =  downScaling ? iViewRect.Width()  : iContentSize.iWidth;
  3624         TInt width =  downScaling ? iViewRect.Width()  : iContentSize.iWidth;
  3597         TInt height = downScaling ? iViewRect.Height() : iContentSize.iHeight;
  3625         TInt height = downScaling ? iViewRect.Height() : iContentSize.iHeight;
  3598     
  3626 
  3599         TUint bytes = width * KBytesPerPixel;
  3627         TUint bytes = width * KBytesPerPixel;
  3600         TInt scanLength = CFbsBitmap::ScanLineLength(
  3628         TInt scanLength = CFbsBitmap::ScanLineLength(
  3601                               iFrameBuffer->SizeInPixels().iWidth, iFrameBuffer->DisplayMode());
  3629                               iFrameBuffer->SizeInPixels().iWidth, iFrameBuffer->DisplayMode());
  3602     
  3630 
  3603         for (TInt y = 0; y < height; ++y)
  3631         for (TInt y = 0; y < height; ++y)
  3604         {
  3632         {
  3605             Mem::Copy(aBuffer, from, bytes);
  3633             Mem::Copy(aBuffer, from, bytes);
  3606             aBuffer += iAlfBufferAttributes.iStride;
  3634             aBuffer += iAlfBufferAttributes.iStride;
  3607             from += scanLength;
  3635             from += scanLength;
  3608         }
  3636         }
  3609     
  3637 
  3610         res = ETrue;
  3638         res = ETrue;
  3611     }
  3639     }
  3612     
  3640 
  3613     if (iFirstPaintState == EFirstPaintInitiated || iFirstPaintState == EFirstPaintPrepared)
  3641     if (iFirstPaintState == EFirstPaintInitiated || iFirstPaintState == EFirstPaintPrepared)
  3614     {
  3642     {
  3615         if (iFirstPaintState == EFirstPaintInitiated)
  3643         if (iFirstPaintState == EFirstPaintInitiated)
  3616         {
  3644         {
  3617             iFirstPaintState = EFirstPaintPrepared;
  3645             iFirstPaintState = EFirstPaintPrepared;
  3620         {
  3648         {
  3621             iFirstPaintState = EFirstPaintOccurred;
  3649             iFirstPaintState = EFirstPaintOccurred;
  3622             java::ui::CoreUiAvkonLcdui::getInstance().getJavaUiAppUi()->stopStartScreen();
  3650             java::ui::CoreUiAvkonLcdui::getInstance().getJavaUiAppUi()->stopStartScreen();
  3623         }
  3651         }
  3624     }
  3652     }
  3625     
  3653 
  3626     DEBUG("CMIDCanvas::ProduceNewFrameL --");
  3654     DEBUG("CMIDCanvas::ProduceNewFrameL --");
  3627     
  3655 
  3628     return res;
  3656     return res;
  3629 }
  3657 }
  3630 
  3658 
  3631 // ---------------------------------------------------------------------------
  3659 // ---------------------------------------------------------------------------
  3632 // From MAlfBufferProvider
  3660 // From MAlfBufferProvider
  3637 MAlfBufferProvider::TBufferCreationAttributes& CMIDCanvas::BufferAttributes()
  3665 MAlfBufferProvider::TBufferCreationAttributes& CMIDCanvas::BufferAttributes()
  3638 {
  3666 {
  3639     DEBUG_INT2("CMIDCanvas::BufferAttributes - iContentSize(w=%d, h=%d) ++",
  3667     DEBUG_INT2("CMIDCanvas::BufferAttributes - iContentSize(w=%d, h=%d) ++",
  3640                iContentSize.iWidth, iContentSize.iHeight);
  3668                iContentSize.iWidth, iContentSize.iHeight);
  3641 
  3669 
  3642     TBool downScaling = IsDownScaling(iContentSize, iViewRect);
  3670     TBool downScaling = IsDownScaling(iContentSize, iViewRect, iM3GContent);
  3643     iAlfBufferAttributes.iWidth  = downScaling ? iViewRect.Width() : iContentSize.iWidth;
  3671     iAlfBufferAttributes.iWidth  = downScaling ? iViewRect.Width() : iContentSize.iWidth;
  3644     iAlfBufferAttributes.iHeight = downScaling ? iViewRect.Height() : iContentSize.iHeight;
  3672     iAlfBufferAttributes.iHeight = downScaling ? iViewRect.Height() : iContentSize.iHeight;
  3645 
  3673 
  3646     iAlfBufferAttributes.iStride = iAlfBufferAttributes.iWidth * KBytesPerPixel;
  3674     iAlfBufferAttributes.iStride = iAlfBufferAttributes.iWidth * KBytesPerPixel;
  3647     return iAlfBufferAttributes;
  3675     return iAlfBufferAttributes;
  3802 
  3830 
  3803     iM3GContent = EFalse;
  3831     iM3GContent = EFalse;
  3804     iM3GStart = EFalse;
  3832     iM3GStart = EFalse;
  3805     iEglPendingResize = EFalse;
  3833     iEglPendingResize = EFalse;
  3806     iEglPendingDispose = EFalse;
  3834     iEglPendingDispose = EFalse;
  3807 
  3835     PostEvent(EM3GDraw, iM3GContent, 0);
  3808     if (iEglDisplay == EGL_NO_DISPLAY)
  3836     if (iEglDisplay == EGL_NO_DISPLAY)
  3809     {
  3837     {
  3810         return;
  3838         return;
  3811     }
  3839     }
  3812 
  3840 
  4207     if (!IsEglAvailable())
  4235     if (!IsEglAvailable())
  4208     {
  4236     {
  4209         return EFalse;
  4237         return EFalse;
  4210     }
  4238     }
  4211     TEglType current = GetCurrentEglType();
  4239     TEglType current = GetCurrentEglType();
  4212     if (aSurfaceType == EEglNone || aRgba == NULL)
  4240     if (aSurfaceType == EEglNone || !aRgba)
  4213     {
  4241     {
  4214         if (iScalingOn && iFullScreen)
  4242         if (iScalingOn && iFullScreen)
  4215         {
  4243         {
  4216             if (aSurfaceType == EEglNone)
  4244             if (aSurfaceType == EEglNone)
  4217             {
  4245             {
  4218                 aSurfaceType = EEglPbuffer;
  4246                 aSurfaceType = EEglPbuffer;
  4219             }
  4247             }
  4220             if (aRgba == NULL)
  4248             if (!aRgba)
  4221             {
  4249             {
  4222                 glClearColor(0.f, 0.f, 0.f, 1.f);
  4250                 glClearColor(0.f, 0.f, 0.f, 1.f);
  4223             }
  4251             }
  4224         }
  4252         }
  4225         else
  4253         else
  4226         {
  4254         {
  4227             if (aSurfaceType == EEglNone)
  4255             if (aSurfaceType == EEglNone)
  4228             {
  4256             {
  4229                 aSurfaceType = EEglWindow;
  4257                 aSurfaceType = EEglWindow;
  4230             }
  4258             }
  4231             if (aRgba == NULL)
  4259             if (!aRgba)
  4232             {
  4260             {
  4233                 glClearColor(1.f, 1.f, 1.f, 1.f);
  4261                 glClearColor(1.f, 1.f, 1.f, 1.f);
  4234             }
  4262             }
  4235         }
  4263         }
  4236     }
  4264     }
  4237     SetCurrentEglType(aSurfaceType);
  4265     SetCurrentEglType(aSurfaceType);
  4238     if (aRgba != NULL)
  4266     if (aRgba)
  4239     {
  4267     {
  4240         glClearColor(
  4268         glClearColor(
  4241             aRgba->Red() / 255.f, aRgba->Green() / 255.0f,
  4269             aRgba->Red() / 255.f, aRgba->Green() / 255.0f,
  4242             aRgba->Blue() / 255.0f, aRgba->Alpha() / 255.0f);
  4270             aRgba->Blue() / 255.0f, aRgba->Alpha() / 255.0f);
  4243     }
  4271     }
  4258     {
  4286     {
  4259         return;
  4287         return;
  4260     }
  4288     }
  4261 
  4289 
  4262     TRect rect(aRect);
  4290     TRect rect(aRect);
  4263     TRect canvasRect = IsDownScaling(iContentSize, iViewRect) ?
  4291     TRect canvasRect = IsDownScaling(iContentSize, iViewRect, iM3GContent) ?
  4264                        TRect(iViewRect.Size()) : TRect(iContentSize);
  4292                        TRect(iViewRect.Size()) : TRect(iContentSize);
  4265     rect.Intersection(canvasRect);
  4293     rect.Intersection(canvasRect);
  4266 
  4294 
  4267     // Update the member rects
  4295     // Update the member rects
  4268     if (iUpperUpdateRect.Intersects(rect))
  4296     if (iUpperUpdateRect.Intersects(rect))
  4895         return KEglBadNativeWindow;
  4923         return KEglBadNativeWindow;
  4896     }
  4924     }
  4897     return KEglSuccess;
  4925     return KEglSuccess;
  4898 }
  4926 }
  4899 
  4927 
  4900 
       
  4901 #endif // RD_JAVA_NGA_ENABLED        
  4928 #endif // RD_JAVA_NGA_ENABLED        
  4902 // End of File.
  4929 // End of File.