From 85eecec087aa35467e8f5f55f3f22a5998b2a6bd Mon Sep 17 00:00:00 2001 From: Myung Jin Kim Date: Tue, 4 Jun 2013 00:51:12 +0900 Subject: [PATCH] apply setimagesource Change-Id: I1cf4db1803d1aaef5e8c631e2725f4ed973e470a --- src/ui/controls/FUiCtrl_LabelPresenter.cpp | 55 ++++++++++++++++++++---------- 1 file changed, 37 insertions(+), 18 deletions(-) diff --git a/src/ui/controls/FUiCtrl_LabelPresenter.cpp b/src/ui/controls/FUiCtrl_LabelPresenter.cpp index 9985575..e441a14 100644 --- a/src/ui/controls/FUiCtrl_LabelPresenter.cpp +++ b/src/ui/controls/FUiCtrl_LabelPresenter.cpp @@ -271,41 +271,60 @@ _LabelPresenter::DrawBackground(void) Canvas* pCanvas = null; + String imagePath = L""; + if (pBitmap != null) { - pCanvas = __pLabel->GetCanvasN(); - if (pCanvas == null) + if (_BitmapImpl::CheckNinePatchedBitmapStrictly(*pBitmap) == false) { - SysLog(NID_UI_CTRL, "Cannot get a canvas."); - - return; + imagePath = _BitmapImpl::GetInstance(*pBitmap)->GetFileName(); } - pCanvas->SetBackgroundColor(Color(0, 0, 0, 0)); - pCanvas->Clear(); - - if (_BitmapImpl::CheckNinePatchedBitmapStrictly(*pBitmap)) + if (imagePath.IsEmpty() == false && __pLabel->GetText() == L"") { - pCanvas->DrawNinePatchedBitmap(bounds, *pBitmap); + __pBase->SetBackgroundColor(_Colorf( + (float)bgColor.GetRed() / 255, (float)bgColor.GetGreen() / 255, (float)bgColor.GetBlue() / 255, (float)bgColor.GetAlpha() / 255)); + + __pBase->SetImageSource(imagePath); } else { - pCanvas->DrawBitmap(FloatRectangle(0.0f, 0.0f, bounds.width, bounds.height), *pBitmap); - } + __pBase->SetImageSource(L""); - if (pEffectBitmap != null) - { - if (_BitmapImpl::CheckNinePatchedBitmapStrictly(*pEffectBitmap)) + pCanvas = __pLabel->GetCanvasN(); + if (pCanvas == null) { - pCanvas->DrawNinePatchedBitmap(bounds, *pEffectBitmap); + SysLog(NID_UI_CTRL, "Cannot get a canvas."); + + return; + } + + pCanvas->SetBackgroundColor(Color(0, 0, 0, 0)); + pCanvas->Clear(); + + if (_BitmapImpl::CheckNinePatchedBitmapStrictly(*pBitmap)) + { + pCanvas->DrawNinePatchedBitmap(bounds, *pBitmap); } else { - pCanvas->DrawBitmap(FloatRectangle(0.0f, 0.0f, bounds.width, bounds.height), *pEffectBitmap); + pCanvas->DrawBitmap(FloatRectangle(0.0f, 0.0f, bounds.width, bounds.height), *pBitmap); + } + + if (pEffectBitmap != null) + { + if (_BitmapImpl::CheckNinePatchedBitmapStrictly(*pEffectBitmap)) + { + pCanvas->DrawNinePatchedBitmap(bounds, *pEffectBitmap); + } + else + { + pCanvas->DrawBitmap(FloatRectangle(0.0f, 0.0f, bounds.width, bounds.height), *pEffectBitmap); + } } } } - else + else // pBitmap is null { if (__pLabel->GetText().IsEmpty() && __pLabel->IsCalledGetCanvasN() == false) { -- 2.7.4