Revert "Modified the bitmap scaling"
authorDongjin Jeon <dongjin2193.jeon@samsung.com>
Mon, 17 Jun 2013 11:00:00 +0000 (11:00 +0000)
committerGerrit Code Review <gerrit@gerrit.vlan144.tizendev.org>
Mon, 17 Jun 2013 11:00:00 +0000 (11:00 +0000)
This reverts commit c33fc2f305634f86d456fad3ddaa0a9f38c51985

Change-Id: Ifb3dfc15f533481f8d67b3c9e8d67ac1a0bc22a0

src/ui/controls/FUiCtrl_GalleryCanvas.cpp
src/ui/inc/FUiCtrl_GalleryCanvas.h

index a92fee9..bc28487 100644 (file)
@@ -269,15 +269,12 @@ _GalleryCanvas::LoadImage(void)
                        r = pCanvas->Clear();
                        SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
 
-                       Bitmap* pScaledImage = ScaledBitmapN(pImage->GetInternalBitmap(), Dimension(rect.width, rect.height));
-
-                       r = pCanvas->DrawBitmap(Point(0,0), *pScaledImage);
+                       r = pCanvas->DrawBitmap(rect, *pImage->GetInternalBitmap());
                        SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
 
                        r = GetImageVisualElement().SetFlushNeeded();
                        SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
 
-                       delete pScaledImage;
                        delete pCanvas;
                }
                SetNeedUpdateImage(false);
@@ -286,7 +283,6 @@ _GalleryCanvas::LoadImage(void)
        return E_SUCCESS;
 
 CATCH:
-       delete pScaledImage;
        delete pCanvas;
        return r;
 }
@@ -642,57 +638,6 @@ _GalleryCanvas::GetScaledBitmapSize(_GalleryBitmap& galleryBitmap, const FloatDi
        return scaledSize;
 }
 
-Bitmap*
-_GalleryCanvas::ScaledBitmapN(Bitmap* pSourceBitmap, Dimension scaledSize)
-{
-       Bitmap* pScaledBitmap = new (std::nothrow) Bitmap();
-       SysTryReturn(NID_UI_CTRL, pScaledBitmap != null, null, E_OUT_OF_MEMORY,
-                                       "[E_OUT_OF_MEMORY] Failed to allocate the memory for the Bitmap.");
-
-       FloatRectangle rect(0, 0, pSourceBitmap->GetWidthF(), pSourceBitmap->GetHeightF());
-       int share = 1;
-       int widthShare = rect.width / scaledSize.width;
-       int heightShare = rect.height / scaledSize.height;
-       int power = 0;
-       Dimension realScaleSize = scaledSize;
-
-       result r = pScaledBitmap->Construct(*pSourceBitmap, rect);
-       SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
-
-       if (widthShare > heightShare)
-       {
-               share = widthShare;
-       }
-       else
-       {
-               share = heightShare;
-       }
-
-
-       while (share > pow(2, (power + 1)))
-       {
-               power++;
-       }
-
-       r = pScaledBitmap->SetScalingQuality(BITMAP_SCALING_QUALITY_HIGH);
-       SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
-
-       for (; power >= 0; power--)
-       {
-               realScaleSize.width = scaledSize.width * pow(2, power);
-               realScaleSize.height = scaledSize.height * pow(2, power);
-               r = pScaledBitmap->Scale(realScaleSize);
-               SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
-       }
-
-       return pScaledBitmap;
-
-CATCH:
-       delete pScaledBitmap;
-
-       return null;
-}
-
 
 // _GalleryRootCanvas
 _GalleryRootCanvas*
index 91337f5..efd4d9c 100644 (file)
@@ -121,7 +121,6 @@ private:
        void SetImageVisualElement(Tizen::Ui::Animations::_VisualElement& visualElement);
        void SetFrameVisualElement(Tizen::Ui::Animations::_VisualElement& visualElement);
        void SetAnimation(Tizen::Ui::Animations::VisualElementPropertyAnimation& animation);
-       Tizen::Graphics::Bitmap* ScaledBitmapN(Tizen::Graphics::Bitmap* pSourceBitmap, Tizen::Graphics::Dimension scaledSize);
 
 private:
        Tizen::Ui::Animations::_VisualElement* __pImageVisualElement;