javauis/lcdui_akn/lcdui/src/CMIDCanvasGraphicsItemPainter.cpp
branchRCL_3
changeset 18 9ac0a0a7da70
parent 14 04becd199f91
child 21 4376525cdefb
--- a/javauis/lcdui_akn/lcdui/src/CMIDCanvasGraphicsItemPainter.cpp	Tue May 11 16:07:20 2010 +0300
+++ b/javauis/lcdui_akn/lcdui/src/CMIDCanvasGraphicsItemPainter.cpp	Tue May 25 12:34:19 2010 +0300
@@ -64,7 +64,7 @@
 // ---------------------------------------------------------------------------
 //
 CMIDCanvasGraphicsItemPainter::CMIDCanvasGraphicsItemPainter(MMIDEnv& aEnv) :
-        iEnv(aEnv)
+    iEnv(aEnv)
 {
     // No implementation.
 }
@@ -117,7 +117,8 @@
         switch (aOp->OpCode())
         {
         case ESync:
-            DrawNow();
+            // We redraw the proper drawing rect.
+            DrawNow(TRect(iPosition, iViewSize));
             break;
 
         case ESyncRect:
@@ -501,11 +502,38 @@
     DEBUG("+ CMIDCanvasGraphicsItemPainter::Draw");
     ASSERT(iFrameBuffer);
 
-    if (IsVisible())
+    // This verifies if canvas graphics item can be drawn.
+    if (iItem && IsVisible())
     {
+        // Gets a size of content.
+        TSize nonScaledSize = iContentRect.Size();
+
         CWindowGc& gc = SystemGc();
 
-        gc.BitBlt(iContentRect.iTl, iFrameBuffer);
+        if (nonScaledSize == iViewSize)
+        {
+            // It draws non-scaled canvas graphics item.
+            DEBUG("BitBlt - non-scaled - DrawBitmap");
+            gc.BitBlt(iContentRect.iTl, iFrameBuffer);
+        }
+        else
+        {
+            // Scaling.
+
+            // When scaling is on, move drawing position is needed.
+            TRect windowRect = TRect(iViewSize);
+            windowRect.Move(PositionRelativeToScreen());
+
+            // It sets clip of system gc to current canvas size.
+            gc.SetClippingRect(iOnScreenCanvasRect);
+
+            // It draws scaled canvas graphics item.
+            DEBUG("DrawWindow - Scaling - DrawBitmap");
+            gc.DrawBitmap(windowRect, iFrameBuffer, TRect(nonScaledSize));
+
+            // Cancel of clipping rect.
+            gc.CancelClippingRect();
+        }
     }
 
     DEBUG("- CMIDCanvasGraphicsItemPainter::Draw");