if (pPanel != null)
{
pSaveButton = static_cast<Button*>(pPanel->GetControl(L"IDC_SAVE_BUTTON"));
- if (pSaveButton != null)
+ if (pSaveButton != null && pSaveButtonBitmap != null)
{
Point startPoint((pSaveButton->GetWidth() - pSaveButtonBitmap->GetWidth()) / 2,
(pSaveButton->GetHeight() - pSaveButtonBitmap->GetHeight()) / 2);
pSaveButton->SetNormalBitmap(startPoint, *pSaveButtonBitmap);
pSaveButton->AddActionEventListener(*this);
pSaveButton->SetActionId(IDA_BUTTON_SAVE);
+ delete pSaveButtonBitmap;
}
pCancelButton = static_cast<Button*>(pPanel->GetControl(L"IDC_CANCEL_BUTTON"));
- if (pCancelButton != null)
+ if (pCancelButton != null && pCancelButtonBitmap != null)
{
Point startPoint((pCancelButton->GetWidth() - pCancelButtonBitmap->GetWidth()) / 2,
(pCancelButton->GetHeight() - pCancelButtonBitmap->GetHeight()) / 2);
pCancelButton->SetNormalBitmap(startPoint, *pCancelButtonBitmap);
pCancelButton->AddActionEventListener(*this);
pCancelButton->SetActionId(IDA_BUTTON_CANCEL);
+ delete pCancelButtonBitmap;
}
+ SetControlAlwaysOnTop(*pPanel, true);
Label* pLabel = static_cast<Label*>(pPanel->GetControl(L"IDC_PANEL_LABEL"));
if (pLabel != null)
{
- SetControlAlwaysOnTop(*pPanel, true);
+ SetControlAlwaysAtBottom(*pLabel, true);
}
- SetControlAlwaysAtBottom(*pLabel, true);
}
AddTouchEventListener(*this);
AddOrientationEventListener(*this);
- delete pSaveButtonBitmap;
- delete pCancelButtonBitmap;
delete pCWRotationButtonBitmap;
delete pCCWRotationButtonBitmap;
return r;
}
MainFrame* pMainFrame = dynamic_cast<MainFrame*>(GetFrameAt(0));
- pMainFrame->SetEnabled(true);
- pMainFrame->Invalidate(true);
+ if (pMainFrame != null)
+ {
+ pMainFrame->SetEnabled(true);
+ pMainFrame->Invalidate(true);
+ }
SceneManager* pSceneManager = SceneManager::GetInstance();
AppAssert(pSceneManager);
ImageViewerApp::SetFrameEnabled(bool enabled)
{
MainFrame* pMainFrame = dynamic_cast<MainFrame*>(GetFrameAt(0));
- pMainFrame->SetEnabled(enabled);
+ if (pMainFrame != null)
+ {
+ pMainFrame->SetEnabled(enabled);
+ }
}
__pPresentationModel->SetImageRotateStatus(true);
RotateImage(filePath, rotateMode);
__pPresentationModel->RequestImage(filePath);
- //Invalidate(true);
ContentManager::ScanFile(filePath);
}
break;
__pPresentationModel->SetImageRotateStatus(true);
RotateImage(filePath, rotateMode);
__pPresentationModel->RequestImage(filePath);
- //Invalidate(true);
ContentManager::ScanFile(filePath);
}
break;
ImageViewerForm::RotateImage(String& filePath, RotateMode rotateMode)
{
result r = E_SUCCESS;
+ ImageBuffer rotateBuffer;
ImageBuffer* pRotatedBuffer = null;
- ImageBuffer* pRotatedBuffer1 = null;
ImageFormat imageFormat;
- int width = 0;
- int height = 0;
- pRotatedBuffer = new (std::nothrow) ImageBuffer();
- r = pRotatedBuffer->Construct(filePath);
- pRotatedBuffer->GetImageInfo(filePath, imageFormat, width, height);
+ Image img;
+ r = img.Construct();
+ if (r == E_SUCCESS)
+ {
+ imageFormat = img.GetImageFormat(filePath);
+ }
+ r = rotateBuffer.Construct(filePath);
+
+ //ImageBuffer::GetImageInfo(filePath, imageFormat, width, height);
if (r == E_SUCCESS)
{
if (rotateMode == ROTATE_MODE_RIGHT)
{
- pRotatedBuffer1 = pRotatedBuffer->RotateN(IMAGE_ROTATION_90);
+ pRotatedBuffer = rotateBuffer.RotateN(IMAGE_ROTATION_90);
}
else
{
- pRotatedBuffer1 = pRotatedBuffer->RotateN(IMAGE_ROTATION_270);
+ pRotatedBuffer = rotateBuffer.RotateN(IMAGE_ROTATION_270);
}
}
- TryCatch(pRotatedBuffer1 != null, r = GetLastResult(), "RotateN failed:%s", GetErrorMessage(GetLastResult()));
- pRotatedBuffer1->EncodeToFile(filePath, imageFormat, true, 100);
- delete pRotatedBuffer1;
- delete pRotatedBuffer;
- return;
- CATCH:
- if (pRotatedBuffer != null) //this buffer is no longer used
+ if (pRotatedBuffer != null)
{
+ r = pRotatedBuffer->EncodeToFile(filePath, imageFormat, true, 100);
delete pRotatedBuffer;
}
- if (pRotatedBuffer1 != null) //this buffer is no longer used
- {
- delete pRotatedBuffer1;
- }
return;
}