From: woojin nam Date: Fri, 28 Jun 2013 12:39:26 +0000 (+0000) Subject: Revert "Apply for SetImageSource() API and OnCanvasRequestedN()" X-Git-Tag: accepted/tizen/20130924.144426~1^2~263 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e619ae652e45f603072a080291c20f61415544e2;p=platform%2Fframework%2Fnative%2Fuifw.git Revert "Apply for SetImageSource() API and OnCanvasRequestedN()" This reverts commit 07973bb54122bb4981f377ad2689397a75c04416 Change-Id: Iaad722479413984956ff2cfd75a6a88bfa9b7161 --- diff --git a/src/ui/controls/FUiCtrl_IconListItem.cpp b/src/ui/controls/FUiCtrl_IconListItem.cpp index 96479e2..b237236 100644 --- a/src/ui/controls/FUiCtrl_IconListItem.cpp +++ b/src/ui/controls/FUiCtrl_IconListItem.cpp @@ -419,34 +419,22 @@ _IconListItem::DrawBitmap(Canvas& canvas, Bitmap& bitmap, float ratio) __pTouchAniVE->SetBounds(FloatRectangle(rect.x, rect.y, width, height)); __pTouchAniVE->SetShowState(true); + Canvas* pCanvas = __pTouchAniVE->GetCanvasN(); + SysTryReturn(NID_UI_CTRL, pCanvas != null, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult())); + + pCanvas->SetBackgroundColor(Color(0, 0, 0, 0)); + pCanvas->Clear(); + + if (_BitmapImpl::CheckNinePatchedBitmapStrictly(bitmap)) { - Canvas* pCanvas = __pTouchAniVE->GetCanvasN(); - SysTryReturn(NID_UI_CTRL, pCanvas != null, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult())); - pCanvas->SetBackgroundColor(Color(0, 0, 0, 0)); - pCanvas->Clear(); pCanvas->DrawNinePatchedBitmap(FloatRectangle(0.0f, 0.0f, bitmap.GetWidthF(), bitmap.GetHeightF()), bitmap); - delete pCanvas; } else { - String imagePath = _BitmapImpl::GetInstance(bitmap)->GetFileName(); - - if (!imagePath.IsEmpty()) - { - __pTouchAniVE->SetImageSource(imagePath); - } - else - { - __pTouchAniVE->SetImageSource(L""); - Canvas* pCanvas = __pTouchAniVE->GetCanvasN(); - SysTryReturn(NID_UI_CTRL, pCanvas != null, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult())); - pCanvas->SetBackgroundColor(Color(0, 0, 0, 0)); - pCanvas->Clear(); - pCanvas->DrawBitmap(FloatRectangle(0.0f, 0.0f, width, height), bitmap); - delete pCanvas; - } + pCanvas->DrawBitmap(FloatRectangle(0.0f, 0.0f, width, height), bitmap); } + delete pCanvas; if (!_FloatCompareGE(ratio, REFERENCE_FACTOR)) { @@ -756,14 +744,14 @@ _IconListItem::DrawBorder(Tizen::Graphics::Canvas& canvas, bool isFocused) __pFocusVE->SetBounds(FloatRectangle(focusUiBounds.x, focusUiBounds.y, focusUiBounds.width, focusUiBounds.height)); } - if (isFocused) - { - Canvas* pCanvas = __pFocusVE->GetCanvasN(); - SysTryReturn(NID_UI_CTRL, pCanvas != null, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult())); + Canvas* pCanvas = __pFocusVE->GetCanvasN(); + SysTryReturn(NID_UI_CTRL, pCanvas != null, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult())); - pCanvas->SetBackgroundColor(Color(0, 0, 0, 0)); - pCanvas->Clear(); + pCanvas->SetBackgroundColor(Color(0, 0, 0, 0)); + pCanvas->Clear(); + if (isFocused) + { if (__pProperty->GetFocusBitmap() != null) { const Bitmap* pShadowBitmap = __pProperty->GetFocusBitmap(); @@ -780,7 +768,6 @@ _IconListItem::DrawBorder(Tizen::Graphics::Canvas& canvas, bool isFocused) pCanvas->DrawBitmap(__pProperty->GetDropShadowBitmapBounds(), *pShadowBitmap); } __pFocusVE->SetShowState(true); - delete pCanvas; } } else diff --git a/src/ui/controls/FUiCtrl_IconListPresenter.cpp b/src/ui/controls/FUiCtrl_IconListPresenter.cpp index 4960896..4d7da9c 100644 --- a/src/ui/controls/FUiCtrl_IconListPresenter.cpp +++ b/src/ui/controls/FUiCtrl_IconListPresenter.cpp @@ -145,8 +145,6 @@ _IconListPresenter::_IconListPresenter(_IconListView* pIconListView, _ListViewMo , __firstTouchMoveDirection(ICON_LIST_VIEW_SCROLL_DIRECTION_VERTICAL) , __RequestToDrawAccessibilityFocusUi(false) , __runningAnimationBackupIndex(INVALID_INDEX) - , __lazyDecodeBackGroundBitmap(false) - , __lazyDecodeEmptyListBitmap(false) { } @@ -1371,39 +1369,24 @@ _IconListPresenter::Draw(void) const Bitmap* pBackgroundBitmap = __pIconListView->GetBackgroundBitmap(); if (pBackgroundBitmap != null) { + Canvas* pCanvas = __pVE->GetCanvasN(); + SysTryCatch(NID_UI_CTRL, (pCanvas!= null), , GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult())); + + pCanvas->SetBackgroundColor(backgroundColor); + pCanvas->Clear(); FloatRectangle bounds(__pIconListView->GetBoundsF()); bounds.SetPosition(0.0f, 0.0f); if (_BitmapImpl::CheckNinePatchedBitmapStrictly(*pBackgroundBitmap)) { - Canvas* pCanvas = __pVE->GetCanvasN(); - SysTryCatch(NID_UI_CTRL, (pCanvas!= null), , GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult())); - pCanvas->SetBackgroundColor(backgroundColor); - pCanvas->Clear(); pCanvas->DrawNinePatchedBitmap(bounds, *pBackgroundBitmap); - delete pCanvas; } else { - String imagePath = _BitmapImpl::GetInstance(*pBackgroundBitmap)->GetFileName(); - - if (!imagePath.IsEmpty()) - { - __pVE->SetImageSource(imagePath); - __lazyDecodeBackGroundBitmap = true; - } - else - { - __pVE->SetImageSource(L""); - __lazyDecodeBackGroundBitmap = false; - Canvas* pCanvas = __pVE->GetCanvasN(); - SysTryCatch(NID_UI_CTRL, (pCanvas!= null), , GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult())); - pCanvas->SetBackgroundColor(backgroundColor); - pCanvas->Clear(); - pCanvas->DrawBitmap(bounds, *pBackgroundBitmap); - delete pCanvas; - } + pCanvas->DrawBitmap(bounds, *pBackgroundBitmap); } + delete pCanvas; + __needBaseCanvas = true; } else @@ -1555,7 +1538,7 @@ _IconListPresenter::DrawEmptyList(void) } // set visual element or canvas for empty list - if (pBitmap != null && __pEmptyListVE == null) + if (!__needBaseCanvas && __pEmptyListVE == null) { __pEmptyListVE = new (std::nothrow) _VisualElement(); SysTryCatch(NID_UI, __pEmptyListVE != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed."); @@ -1659,11 +1642,18 @@ _IconListPresenter::DrawEmptyList(void) } // draw empty list - if (pBitmap != null && __pEmptyListVE != null) + if (!__needBaseCanvas) { __pEmptyListVE->SetBounds(bounds); __pEmptyListVE->SetShowState(true); + pCanvas = __pEmptyListVE->GetCanvasN(); + SysTryCatch(NID_UI, pCanvas != null, , GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult())); + + Color backgroundColor = __pIconListView->GetBackgroundColor(); + pCanvas->SetBackgroundColor(Color(0, 0, 0, 0)); + pCanvas->Clear(); + bounds.x = 0.0f; bounds.y = 0.0f; } @@ -1673,31 +1663,11 @@ _IconListPresenter::DrawEmptyList(void) FloatRectangle bitmapBounds(bounds.x + bitmapXPosition, bounds.y, bitmapWidth, bitmapHeight); if (_BitmapImpl::CheckNinePatchedBitmapStrictly(*pBitmap)) { - pCanvas = __pEmptyListVE->GetCanvasN(); - SysTryCatch(NID_UI, pCanvas != null, , GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult())); - pCanvas->SetBackgroundColor(Color(0, 0, 0, 0)); - pCanvas->Clear(); pCanvas->DrawNinePatchedBitmap(bitmapBounds, *pBitmap); } else { - String imagePath = _BitmapImpl::GetInstance(*pBitmap)->GetFileName(); - - if (!imagePath.IsEmpty()) - { - __pEmptyListVE->SetImageSource(imagePath); - __lazyDecodeEmptyListBitmap = true; - } - else - { - __pEmptyListVE->SetImageSource(L""); - __lazyDecodeEmptyListBitmap = false; - pCanvas = __pEmptyListVE->GetCanvasN(); - SysTryCatch(NID_UI, pCanvas != null, , GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult())); - pCanvas->SetBackgroundColor(Color(0, 0, 0, 0)); - pCanvas->Clear(); - pCanvas->DrawBitmap(bitmapBounds, *pBitmap); - } + pCanvas->DrawBitmap(bitmapBounds, *pBitmap); } } @@ -1711,14 +1681,7 @@ _IconListPresenter::DrawEmptyList(void) if (pCanvas == null) { - if (__pEmptyListVE != null) - { - pCanvas = __pEmptyListVE->GetCanvasN(); - } - else - { - pCanvas = __pVE->GetCanvasN(); - } + pCanvas = __pEmptyListVE->GetCanvasN(); SysTryCatch(NID_UI, pCanvas != null, , GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult())); pCanvas->SetBackgroundColor(Color(0, 0, 0, 0)); pCanvas->Clear(); @@ -1730,6 +1693,12 @@ _IconListPresenter::DrawEmptyList(void) __listStatusChanged = false; + if (__needBaseCanvas && __pEmptyListVE != null) + { + __pEmptyListVE->Destroy(); + __pEmptyListVE = null; + } + delete pCanvas; delete pTextObject; return r; @@ -2781,56 +2750,6 @@ _IconListPresenter::OnDrawFocus(void) DrawFocusUi(__highlightedIndex); } - -Canvas* -_IconListPresenter::OnCanvasRequestedN(const FloatRectangle& bounds) -{ - int itemCount = __pListModel->GetItemCountInGroup(DEFAULT_GROUP_INDEX); - - if (__pIconListView->GetBackgroundBitmap() != null && itemCount > 0) - { - if (__pVE != null && __lazyDecodeBackGroundBitmap == true) - { - const Bitmap* pBackgroundBitmap = __pIconListView->GetBackgroundBitmap(); - - if (pBackgroundBitmap != null) - { - Canvas* pCanvas = __pVE->GetCanvasN(); - SysTryCatch(NID_UI_CTRL, (pCanvas!= null), , GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult())); - Color backgroundColor = __pIconListView->GetBackgroundColor(); - pCanvas->SetBackgroundColor(backgroundColor); - pCanvas->Clear(); - - pBackgroundBitmap->IsNinePatchedBitmap(); - Draw(); - return pCanvas; - } - } - } - else if (__pIconListView->GetBitmapOfEmptyList() != null && itemCount <= 0) - { - if (__pEmptyListVE != null && __lazyDecodeEmptyListBitmap == true) - { - const Bitmap* pEmptyBitmap = __pIconListView->GetBitmapOfEmptyList(); - - if (pEmptyBitmap != null) - { - Canvas* pCanvas = __pEmptyListVE->GetCanvasN(); - SysTryCatch(NID_UI_CTRL, (pCanvas!= null), , GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult())); - pCanvas->SetBackgroundColor(Color(0, 0, 0, 0)); - pCanvas->Clear(); - - pEmptyBitmap->IsNinePatchedBitmap(); - DrawEmptyList(); - return pCanvas; - } - } - } - -CATCH: - return null; -} - // Tizen::Ui::_IKeyEventPreviewer bool _IconListPresenter::OnPreviewKeyPressed(const _Control& source, const _KeyInfo& keyInfo) diff --git a/src/ui/controls/FUiCtrl_IconListView.cpp b/src/ui/controls/FUiCtrl_IconListView.cpp index fd3cd51..ae10649 100644 --- a/src/ui/controls/FUiCtrl_IconListView.cpp +++ b/src/ui/controls/FUiCtrl_IconListView.cpp @@ -1083,13 +1083,6 @@ _IconListView::OnDrawFocus(void) __pIconListPresenter->OnDrawFocus(); } -Canvas* -_IconListView::OnCanvasRequestedN(const FloatRectangle& bounds) -{ - return __pIconListPresenter->OnCanvasRequestedN(bounds); -} - - // Tizen::Ui::_IPreviewKeyEventListener bool _IconListView::OnPreviewKeyPressed(const _Control& source, const _KeyInfo& keyInfo) diff --git a/src/ui/inc/FUiCtrl_IconListPresenter.h b/src/ui/inc/FUiCtrl_IconListPresenter.h index 6297db7..efd6cfe 100644 --- a/src/ui/inc/FUiCtrl_IconListPresenter.h +++ b/src/ui/inc/FUiCtrl_IconListPresenter.h @@ -199,7 +199,6 @@ public: virtual void OnFontChanged(Tizen::Graphics::Font* pFont); virtual void OnFocusModeStateChanged(void); virtual void OnDrawFocus(void); - Tizen::Graphics::Canvas* OnCanvasRequestedN(const Tizen::Graphics::FloatRectangle& bounds); // Tizen::Ui::_IKeyEventPreviewer virtual bool OnPreviewKeyPressed(const _Control& source, const _KeyInfo& keyInfo); @@ -473,8 +472,6 @@ private: IconListViewScrollDirection __firstTouchMoveDirection; bool __RequestToDrawAccessibilityFocusUi; int __runningAnimationBackupIndex; - bool __lazyDecodeBackGroundBitmap; - bool __lazyDecodeEmptyListBitmap; }; // _IconListPresenter }}} // Tizen::Ui::Controls diff --git a/src/ui/inc/FUiCtrl_IconListView.h b/src/ui/inc/FUiCtrl_IconListView.h index 88b6b04..28ab8c0 100644 --- a/src/ui/inc/FUiCtrl_IconListView.h +++ b/src/ui/inc/FUiCtrl_IconListView.h @@ -313,7 +313,6 @@ public: virtual void OnFontChanged(Tizen::Graphics::Font* pFont); virtual void OnFocusModeStateChanged(void); virtual void OnDrawFocus(void); - virtual Tizen::Graphics::Canvas* OnCanvasRequestedN(const Tizen::Graphics::FloatRectangle& bounds); // Tizen::Ui::_IKeyEventListenerPreviewer virtual bool OnPreviewKeyPressed(const _Control& source, const _KeyInfo& keyInfo);