summaryrefslogtreecommitdiff
path: root/indra/newview/llfloaterimagepreview.cpp
diff options
context:
space:
mode:
authorRoxie Linden <roxie@lindenlab.com>2024-06-13 14:59:28 -0700
committerRoxie Linden <roxie@lindenlab.com>2024-06-13 14:59:28 -0700
commit5e60392c273f0c9c5efa765a05414c618381780a (patch)
treed1eedbb1dfa86e66532a6d8746b7a81e5a444d3a /indra/newview/llfloaterimagepreview.cpp
parent0f3c3563b0861e8ea82b201aab8343d99f993bbc (diff)
parent100ebbab2437de7f5d124a0d7b8279a7a7b57656 (diff)
Merge branch 'develop' of github.com:secondlife/viewer into roxie/webrtc-voice
Diffstat (limited to 'indra/newview/llfloaterimagepreview.cpp')
-rw-r--r--indra/newview/llfloaterimagepreview.cpp171
1 files changed, 86 insertions, 85 deletions
diff --git a/indra/newview/llfloaterimagepreview.cpp b/indra/newview/llfloaterimagepreview.cpp
index 73adb2175a..ea49c88755 100644
--- a/indra/newview/llfloaterimagepreview.cpp
+++ b/indra/newview/llfloaterimagepreview.cpp
@@ -87,11 +87,11 @@ LLFloaterImagePreview::LLFloaterImagePreview(const std::string& filename) :
//-----------------------------------------------------------------------------
// postBuild()
//-----------------------------------------------------------------------------
-BOOL LLFloaterImagePreview::postBuild()
+bool LLFloaterImagePreview::postBuild()
{
if (!LLFloaterNameDesc::postBuild())
{
- return FALSE;
+ return false;
}
LLCtrlSelectionInterface* iface = childGetSelectionInterface("clothing_type_combo");
@@ -107,12 +107,12 @@ BOOL LLFloaterImagePreview::postBuild()
PREVIEW_HPAD + PREF_BUTTON_HEIGHT + PREVIEW_HPAD);
mPreviewImageRect.set(0.f, 1.f, 1.f, 0.f);
- getChildView("bad_image_text")->setVisible(FALSE);
+ getChildView("bad_image_text")->setVisible(false);
if (mRawImagep.notNull() && gAgent.getRegion() != NULL)
{
mAvatarPreview = new LLImagePreviewAvatar(256, 256);
- mAvatarPreview->setPreviewTarget("mPelvis", "mUpperBodyMesh0", mRawImagep, 2.f, FALSE);
+ mAvatarPreview->setPreviewTarget("mPelvis", "mUpperBodyMesh0", mRawImagep, 2.f, false);
mSculptedPreview = new LLImagePreviewSculpted(256, 256);
mSculptedPreview->setPreviewTarget(mRawImagep, 2.0f);
@@ -122,7 +122,7 @@ BOOL LLFloaterImagePreview::postBuild()
// We want "lossless_check" to be unchecked when it is disabled, regardless of
// LosslessJ2CUpload state, so only assign control when enabling checkbox
LLCheckBoxCtrl* check_box = getChild<LLCheckBoxCtrl>("lossless_check");
- check_box->setEnabled(TRUE);
+ check_box->setEnabled(true);
check_box->setControlVariable(gSavedSettings.getControl("LosslessJ2CUpload"));
}
}
@@ -130,9 +130,9 @@ BOOL LLFloaterImagePreview::postBuild()
{
mAvatarPreview = NULL;
mSculptedPreview = NULL;
- getChildView("bad_image_text")->setVisible(TRUE);
- getChildView("clothing_type_combo")->setEnabled(FALSE);
- getChildView("ok_btn")->setEnabled(FALSE);
+ getChildView("bad_image_text")->setVisible(true);
+ getChildView("clothing_type_combo")->setEnabled(false);
+ getChildView("ok_btn")->setEnabled(false);
if(!mImageLoadError.empty())
{
@@ -142,7 +142,7 @@ BOOL LLFloaterImagePreview::postBuild()
getChild<LLUICtrl>("ok_btn")->setCommitCallback(boost::bind(&LLFloaterNameDesc::onBtnOK, this));
- return TRUE;
+ return true;
}
@@ -191,28 +191,28 @@ void LLFloaterImagePreview::onPreviewTypeCommit(LLUICtrl* ctrl, void* userdat
case 0:
break;
case 1:
- fp->mAvatarPreview->setPreviewTarget("mSkull", "mHairMesh0", fp->mRawImagep, 0.4f, FALSE);
+ fp->mAvatarPreview->setPreviewTarget("mSkull", "mHairMesh0", fp->mRawImagep, 0.4f, false);
break;
case 2:
- fp->mAvatarPreview->setPreviewTarget("mSkull", "mHeadMesh0", fp->mRawImagep, 0.4f, FALSE);
+ fp->mAvatarPreview->setPreviewTarget("mSkull", "mHeadMesh0", fp->mRawImagep, 0.4f, false);
break;
case 3:
- fp->mAvatarPreview->setPreviewTarget("mChest", "mUpperBodyMesh0", fp->mRawImagep, 1.0f, FALSE);
+ fp->mAvatarPreview->setPreviewTarget("mChest", "mUpperBodyMesh0", fp->mRawImagep, 1.0f, false);
break;
case 4:
- fp->mAvatarPreview->setPreviewTarget("mKneeLeft", "mLowerBodyMesh0", fp->mRawImagep, 1.2f, FALSE);
+ fp->mAvatarPreview->setPreviewTarget("mKneeLeft", "mLowerBodyMesh0", fp->mRawImagep, 1.2f, false);
break;
case 5:
- fp->mAvatarPreview->setPreviewTarget("mSkull", "mHeadMesh0", fp->mRawImagep, 0.4f, TRUE);
+ fp->mAvatarPreview->setPreviewTarget("mSkull", "mHeadMesh0", fp->mRawImagep, 0.4f, true);
break;
case 6:
- fp->mAvatarPreview->setPreviewTarget("mChest", "mUpperBodyMesh0", fp->mRawImagep, 1.2f, TRUE);
+ fp->mAvatarPreview->setPreviewTarget("mChest", "mUpperBodyMesh0", fp->mRawImagep, 1.2f, true);
break;
case 7:
- fp->mAvatarPreview->setPreviewTarget("mKneeLeft", "mLowerBodyMesh0", fp->mRawImagep, 1.2f, TRUE);
+ fp->mAvatarPreview->setPreviewTarget("mKneeLeft", "mLowerBodyMesh0", fp->mRawImagep, 1.2f, true);
break;
case 8:
- fp->mAvatarPreview->setPreviewTarget("mKneeLeft", "mSkirtMesh0", fp->mRawImagep, 1.3f, FALSE);
+ fp->mAvatarPreview->setPreviewTarget("mKneeLeft", "mSkirtMesh0", fp->mRawImagep, 1.3f, false);
break;
case 9:
fp->mSculptedPreview->setPreviewTarget(fp->mRawImagep, 2.0f);
@@ -268,7 +268,7 @@ void LLFloaterImagePreview::draw()
}
else
{
- mImagep = LLViewerTextureManager::getLocalTexture(mRawImagep.get(), FALSE) ;
+ mImagep = LLViewerTextureManager::getLocalTexture(mRawImagep.get(), false) ;
gGL.getTexUnit(0)->unbind(mImagep->getTarget()) ;
gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_TEXTURE, mImagep->getTexName());
@@ -344,54 +344,54 @@ bool LLFloaterImagePreview::loadImage(const std::string& src_filename)
{
try
{
- std::string exten = gDirUtilp->getExtension(src_filename);
- U32 codec = LLImageBase::getCodecFromExtension(exten);
+ std::string exten = gDirUtilp->getExtension(src_filename);
+ U32 codec = LLImageBase::getCodecFromExtension(exten);
- LLImageDimensionsInfo image_info;
- if (!image_info.load(src_filename, codec))
- {
- mImageLoadError = image_info.getLastError();
- return false;
- }
+ LLImageDimensionsInfo image_info;
+ if (!image_info.load(src_filename,codec))
+ {
+ mImageLoadError = image_info.getLastError();
+ return false;
+ }
- S32 max_width = gSavedSettings.getS32("max_texture_dimension_X");
- S32 max_height = gSavedSettings.getS32("max_texture_dimension_Y");
+ S32 max_width = gSavedSettings.getS32("max_texture_dimension_X");
+ S32 max_height = gSavedSettings.getS32("max_texture_dimension_Y");
- if ((image_info.getWidth() > max_width) || (image_info.getHeight() > max_height))
- {
- LLStringUtil::format_map_t args;
- args["WIDTH"] = llformat("%d", max_width);
- args["HEIGHT"] = llformat("%d", max_height);
+ if ((image_info.getWidth() > max_width) || (image_info.getHeight() > max_height))
+ {
+ LLStringUtil::format_map_t args;
+ args["WIDTH"] = llformat("%d", max_width);
+ args["HEIGHT"] = llformat("%d", max_height);
- mImageLoadError = LLTrans::getString("texture_load_dimensions_error", args);
- return false;
- }
+ mImageLoadError = LLTrans::getString("texture_load_dimensions_error", args);
+ return false;
+ }
- // Load the image
- LLPointer<LLImageFormatted> image = LLImageFormatted::createFromType(codec);
- if (image.isNull())
- {
- return false;
- }
- if (!image->load(src_filename))
- {
- return false;
- }
- // Decompress or expand it in a raw image structure
- LLPointer<LLImageRaw> raw_image = new LLImageRaw;
- if (!image->decode(raw_image, 0.0f))
- {
- return false;
- }
- // Check the image constraints
- if ((image->getComponents() != 3) && (image->getComponents() != 4))
- {
- image->setLastError("Image files with less than 3 or more than 4 components are not supported.");
- return false;
- }
+ // Load the image
+ LLPointer<LLImageFormatted> image = LLImageFormatted::createFromType(codec);
+ if (image.isNull())
+ {
+ return false;
+ }
+ if (!image->load(src_filename))
+ {
+ return false;
+ }
+ // Decompress or expand it in a raw image structure
+ LLPointer<LLImageRaw> raw_image = new LLImageRaw;
+ if (!image->decode(raw_image, 0.0f))
+ {
+ return false;
+ }
+ // Check the image constraints
+ if ((image->getComponents() != 3) && (image->getComponents() != 4))
+ {
+ image->setLastError("Image files with less than 3 or more than 4 components are not supported.");
+ return false;
+ }
- raw_image->biasedScaleToPowerOfTwo(LLViewerFetchedTexture::MAX_IMAGE_SIZE_DEFAULT);
- mRawImagep = raw_image;
+ raw_image->biasedScaleToPowerOfTwo(LLViewerFetchedTexture::MAX_IMAGE_SIZE_DEFAULT);
+ mRawImagep = raw_image;
}
catch (...)
{
@@ -405,7 +405,7 @@ bool LLFloaterImagePreview::loadImage(const std::string& src_filename)
//-----------------------------------------------------------------------------
// handleMouseDown()
//-----------------------------------------------------------------------------
-BOOL LLFloaterImagePreview::handleMouseDown(S32 x, S32 y, MASK mask)
+bool LLFloaterImagePreview::handleMouseDown(S32 x, S32 y, MASK mask)
{
if (mPreviewRect.pointInRect(x, y))
{
@@ -414,7 +414,7 @@ BOOL LLFloaterImagePreview::handleMouseDown(S32 x, S32 y, MASK mask)
gViewerWindow->hideCursor();
mLastMouseX = x;
mLastMouseY = y;
- return TRUE;
+ return true;
}
return LLFloater::handleMouseDown(x, y, mask);
@@ -423,9 +423,9 @@ BOOL LLFloaterImagePreview::handleMouseDown(S32 x, S32 y, MASK mask)
//-----------------------------------------------------------------------------
// handleMouseUp()
//-----------------------------------------------------------------------------
-BOOL LLFloaterImagePreview::handleMouseUp(S32 x, S32 y, MASK mask)
+bool LLFloaterImagePreview::handleMouseUp(S32 x, S32 y, MASK mask)
{
- gFocusMgr.setMouseCapture(FALSE);
+ gFocusMgr.setMouseCapture(nullptr);
gViewerWindow->showCursor();
return LLFloater::handleMouseUp(x, y, mask);
}
@@ -433,7 +433,7 @@ BOOL LLFloaterImagePreview::handleMouseUp(S32 x, S32 y, MASK mask)
//-----------------------------------------------------------------------------
// handleHover()
//-----------------------------------------------------------------------------
-BOOL LLFloaterImagePreview::handleHover(S32 x, S32 y, MASK mask)
+bool LLFloaterImagePreview::handleHover(S32 x, S32 y, MASK mask)
{
MASK local_mask = mask & ~MASK_ALT;
@@ -547,13 +547,13 @@ BOOL LLFloaterImagePreview::handleHover(S32 x, S32 y, MASK mask)
gViewerWindow->setCursor(UI_CURSOR_TOOLZOOMIN);
}
- return TRUE;
+ return true;
}
//-----------------------------------------------------------------------------
// handleScrollWheel()
//-----------------------------------------------------------------------------
-BOOL LLFloaterImagePreview::handleScrollWheel(S32 x, S32 y, S32 clicks)
+bool LLFloaterImagePreview::handleScrollWheel(S32 x, S32 y, S32 clicks)
{
if (mPreviewRect.pointInRect(x, y) && mAvatarPreview)
{
@@ -564,7 +564,7 @@ BOOL LLFloaterImagePreview::handleScrollWheel(S32 x, S32 y, S32 clicks)
mSculptedPreview->refresh();
}
- return TRUE;
+ return true;
}
//-----------------------------------------------------------------------------
@@ -580,9 +580,9 @@ void LLFloaterImagePreview::onMouseCaptureLostImagePreview(LLMouseHandler* handl
//-----------------------------------------------------------------------------
// LLImagePreviewAvatar
//-----------------------------------------------------------------------------
-LLImagePreviewAvatar::LLImagePreviewAvatar(S32 width, S32 height) : LLViewerDynamicTexture(width, height, 3, ORDER_MIDDLE, FALSE)
+LLImagePreviewAvatar::LLImagePreviewAvatar(S32 width, S32 height) : LLViewerDynamicTexture(width, height, 3, ORDER_MIDDLE, false)
{
- mNeedsUpdate = TRUE;
+ mNeedsUpdate = true;
mTargetJoint = NULL;
mTargetMesh = NULL;
mCameraDistance = 0.f;
@@ -608,7 +608,7 @@ S8 LLImagePreviewAvatar::getType() const
return LLViewerDynamicTexture::LL_IMAGE_PREVIEW_AVATAR ;
}
-void LLImagePreviewAvatar::setPreviewTarget(const std::string& joint_name, const std::string& mesh_name, LLImageRaw* imagep, F32 distance, BOOL male)
+void LLImagePreviewAvatar::setPreviewTarget(const std::string& joint_name, const std::string& mesh_name, LLImageRaw* imagep, F32 distance, bool male)
{
mTargetJoint = mDummyAvatar->mRoot->findJoint(joint_name);
// clear out existing test mesh
@@ -629,11 +629,11 @@ void LLImagePreviewAvatar::setPreviewTarget(const std::string& joint_name, const
mDummyAvatar->updateVisualParams();
mDummyAvatar->updateGeometry(mDummyAvatar->mDrawable);
}
- mDummyAvatar->mRoot->setVisible(FALSE, TRUE);
+ mDummyAvatar->mRoot->setVisible(false, true);
mTargetMesh = dynamic_cast<LLViewerJointMesh*>(mDummyAvatar->mRoot->findJoint(mesh_name));
mTargetMesh->setTestTexture(mTextureName);
- mTargetMesh->setVisible(TRUE, FALSE);
+ mTargetMesh->setVisible(true, false);
mCameraDistance = distance;
mCameraZoom = 1.f;
mCameraPitch = 0.f;
@@ -660,9 +660,9 @@ void LLImagePreviewAvatar::clearPreviewTexture(const std::string& mesh_name)
//-----------------------------------------------------------------------------
// update()
//-----------------------------------------------------------------------------
-BOOL LLImagePreviewAvatar::render()
+bool LLImagePreviewAvatar::render()
{
- mNeedsUpdate = FALSE;
+ mNeedsUpdate = false;
LLVOAvatar* avatarp = mDummyAvatar;
gGL.pushUIMatrix();
@@ -707,7 +707,7 @@ BOOL LLImagePreviewAvatar::render()
LLViewerCamera::getInstance()->setAspect((F32)mFullWidth / mFullHeight);
LLViewerCamera::getInstance()->setView(LLViewerCamera::getInstance()->getDefaultFOV() / mCameraZoom);
- LLViewerCamera::getInstance()->setPerspective(FALSE, mOrigin.mX, mOrigin.mY, mFullWidth, mFullHeight, FALSE);
+ LLViewerCamera::getInstance()->setPerspective(false, mOrigin.mX, mOrigin.mY, mFullWidth, mFullHeight, false);
LLVertexBuffer::unbind();
avatarp->updateLOD();
@@ -729,7 +729,7 @@ BOOL LLImagePreviewAvatar::render()
gGL.popUIMatrix();
gGL.color4f(1,1,1,1);
- return TRUE;
+ return true;
}
//-----------------------------------------------------------------------------
@@ -737,7 +737,7 @@ BOOL LLImagePreviewAvatar::render()
//-----------------------------------------------------------------------------
void LLImagePreviewAvatar::refresh()
{
- mNeedsUpdate = TRUE;
+ mNeedsUpdate = true;
}
//-----------------------------------------------------------------------------
@@ -769,9 +769,9 @@ void LLImagePreviewAvatar::pan(F32 right, F32 up)
// LLImagePreviewSculpted
//-----------------------------------------------------------------------------
-LLImagePreviewSculpted::LLImagePreviewSculpted(S32 width, S32 height) : LLViewerDynamicTexture(width, height, 3, ORDER_MIDDLE, FALSE)
+LLImagePreviewSculpted::LLImagePreviewSculpted(S32 width, S32 height) : LLViewerDynamicTexture(width, height, 3, ORDER_MIDDLE, false)
{
- mNeedsUpdate = TRUE;
+ mNeedsUpdate = true;
mCameraDistance = 0.f;
mCameraYaw = 0.f;
mCameraPitch = 0.f;
@@ -807,6 +807,7 @@ void LLImagePreviewSculpted::setPreviewTarget(LLImageRaw* imagep, F32 distance)
if (imagep)
{
+ LLImageDataSharedLock lock(imagep);
mVolume->sculpt(imagep->getWidth(), imagep->getHeight(), imagep->getComponents(), imagep->getData(), 0, false);
}
@@ -863,9 +864,9 @@ void LLImagePreviewSculpted::setPreviewTarget(LLImageRaw* imagep, F32 distance)
//-----------------------------------------------------------------------------
// render()
//-----------------------------------------------------------------------------
-BOOL LLImagePreviewSculpted::render()
+bool LLImagePreviewSculpted::render()
{
- mNeedsUpdate = FALSE;
+ mNeedsUpdate = false;
LLGLSUIDefault def;
LLGLDisable no_blend(GL_BLEND);
LLGLEnable cull(GL_CULL_FACE);
@@ -909,7 +910,7 @@ BOOL LLImagePreviewSculpted::render()
LLViewerCamera::getInstance()->setAspect((F32) mFullWidth / mFullHeight);
LLViewerCamera::getInstance()->setView(LLViewerCamera::getInstance()->getDefaultFOV() / mCameraZoom);
- LLViewerCamera::getInstance()->setPerspective(FALSE, mOrigin.mX, mOrigin.mY, mFullWidth, mFullHeight, FALSE);
+ LLViewerCamera::getInstance()->setPerspective(false, mOrigin.mX, mOrigin.mY, mFullWidth, mFullHeight, false);
const LLVolumeFace &vf = mVolume->getVolumeFace(0);
U32 num_indices = vf.mNumIndices;
@@ -932,7 +933,7 @@ BOOL LLImagePreviewSculpted::render()
gObjectPreviewProgram.unbind();
- return TRUE;
+ return true;
}
//-----------------------------------------------------------------------------
@@ -940,7 +941,7 @@ BOOL LLImagePreviewSculpted::render()
//-----------------------------------------------------------------------------
void LLImagePreviewSculpted::refresh()
{
- mNeedsUpdate = TRUE;
+ mNeedsUpdate = true;
}
//-----------------------------------------------------------------------------