summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorMerov Linden <merov@lindenlab.com>2011-04-20 20:32:57 -0700
committerMerov Linden <merov@lindenlab.com>2011-04-20 20:32:57 -0700
commit968a26799be75df68527594a727a6ca12d9530f7 (patch)
treec3ef89161ea54f9528ac7a1f7899cda88fa43258 /indra
parent2e86084a15dc1efb6ff8c4c8191b6f41757f0945 (diff)
EXP-737 : Fix texture dimensions display in image preview
Diffstat (limited to 'indra')
-rw-r--r--indra/newview/llpreviewtexture.cpp34
1 files changed, 18 insertions, 16 deletions
diff --git a/indra/newview/llpreviewtexture.cpp b/indra/newview/llpreviewtexture.cpp
index 6cfb708112..18d6731fcb 100644
--- a/indra/newview/llpreviewtexture.cpp
+++ b/indra/newview/llpreviewtexture.cpp
@@ -143,10 +143,7 @@ void LLPreviewTexture::onSaveAsBtn(void* data)
void LLPreviewTexture::draw()
{
- if (mUpdateDimensions)
- {
- updateDimensions();
- }
+ updateDimensions();
LLPreview::draw();
@@ -396,27 +393,32 @@ void LLPreviewTexture::onFileLoadedForSave(BOOL success,
void LLPreviewTexture::updateDimensions()
{
if (!mImage)
+ {
return;
-
- if(mImage->getFullWidth() == 0 || mImage->getFullHeight() == 0)
+ }
+ if ((mImage->getFullWidth() * mImage->getFullHeight()) == 0)
{
return;
}
- mUpdateDimensions = FALSE;
-
- getChild<LLUICtrl>("dimensions")->setTextArg("[WIDTH]", llformat("%d", mImage->getFullWidth()));
+ // Update the width/height display every time
+ getChild<LLUICtrl>("dimensions")->setTextArg("[WIDTH]", llformat("%d", mImage->getFullWidth()));
getChild<LLUICtrl>("dimensions")->setTextArg("[HEIGHT]", llformat("%d", mImage->getFullHeight()));
-
- //reshape floater
- reshape(getRect().getWidth(), getRect().getHeight());
+ // Reshape the floater only when required
+ if (mUpdateDimensions)
+ {
+ mUpdateDimensions = FALSE;
+
+ //reshape floater
+ reshape(getRect().getWidth(), getRect().getHeight());
- gFloaterView->adjustToFitScreen(this, FALSE);
+ gFloaterView->adjustToFitScreen(this, FALSE);
- LLRect dim_rect(getChildView("dimensions")->getRect());
- LLRect aspect_label_rect(getChildView("aspect_ratio")->getRect());
- getChildView("aspect_ratio")->setVisible( dim_rect.mRight < aspect_label_rect.mLeft);
+ LLRect dim_rect(getChildView("dimensions")->getRect());
+ LLRect aspect_label_rect(getChildView("aspect_ratio")->getRect());
+ getChildView("aspect_ratio")->setVisible( dim_rect.mRight < aspect_label_rect.mLeft);
+ }
}