diff options
Diffstat (limited to 'indra/newview/llsnapshotlivepreview.cpp')
-rw-r--r-- | indra/newview/llsnapshotlivepreview.cpp | 50 |
1 files changed, 26 insertions, 24 deletions
diff --git a/indra/newview/llsnapshotlivepreview.cpp b/indra/newview/llsnapshotlivepreview.cpp index 623565817d..049aae1336 100644 --- a/indra/newview/llsnapshotlivepreview.cpp +++ b/indra/newview/llsnapshotlivepreview.cpp @@ -86,13 +86,13 @@ LLSnapshotLivePreview::LLSnapshotLivePreview (const LLSnapshotLivePreview::Param mNeedsFlash(TRUE), mSnapshotQuality(gSavedSettings.getS32("SnapshotQuality")), mDataSize(0), - mSnapshotType(SNAPSHOT_POSTCARD), - mSnapshotFormat(LLFloaterSnapshot::ESnapshotFormat(gSavedSettings.getS32("SnapshotFormat"))), + mSnapshotType(LLSnapshotModel::SNAPSHOT_POSTCARD), + mSnapshotFormat(LLSnapshotModel::ESnapshotFormat(gSavedSettings.getS32("SnapshotFormat"))), mSnapshotUpToDate(FALSE), mCameraPos(LLViewerCamera::getInstance()->getOrigin()), mCameraRot(LLViewerCamera::getInstance()->getQuaternion()), mSnapshotActive(FALSE), - mSnapshotBufferType(LLViewerWindow::SNAPSHOT_TYPE_COLOR), + mSnapshotBufferType(LLSnapshotModel::SNAPSHOT_TYPE_COLOR), mFilterName(""), mAllowRenderUI(TRUE), mAllowFullScreenPreview(TRUE), @@ -737,7 +737,7 @@ BOOL LLSnapshotLivePreview::onIdle( void* snapshot_preview ) previewp->getWidth(), previewp->getHeight(), previewp->mKeepAspectRatio,//gSavedSettings.getBOOL("KeepAspectForSnapshot"), - previewp->getSnapshotType() == LLSnapshotLivePreview::SNAPSHOT_TEXTURE, + previewp->getSnapshotType() == LLSnapshotModel::SNAPSHOT_TEXTURE, previewp->mAllowRenderUI && gSavedSettings.getBOOL("RenderUIInSnapshot"), FALSE, previewp->mSnapshotBufferType, @@ -813,7 +813,7 @@ void LLSnapshotLivePreview::prepareFreezeFrame() mViewerImage[mCurImageIndex] = LLViewerTextureManager::getLocalTexture(scaled.get(), FALSE); LLPointer<LLViewerTexture> curr_preview_image = mViewerImage[mCurImageIndex]; gGL.getTexUnit(0)->bind(curr_preview_image); - curr_preview_image->setFilteringOption(getSnapshotType() == SNAPSHOT_TEXTURE ? LLTexUnit::TFO_ANISOTROPIC : LLTexUnit::TFO_POINT); + curr_preview_image->setFilteringOption(getSnapshotType() == LLSnapshotModel::SNAPSHOT_TEXTURE ? LLTexUnit::TFO_ANISOTROPIC : LLTexUnit::TFO_POINT); curr_preview_image->setAddressMode(LLTexUnit::TAM_CLAMP); @@ -827,7 +827,7 @@ void LLSnapshotLivePreview::prepareFreezeFrame() S32 LLSnapshotLivePreview::getEncodedImageWidth() const { S32 width = getWidth(); - if (getSnapshotType() == SNAPSHOT_TEXTURE) + if (getSnapshotType() == LLSnapshotModel::SNAPSHOT_TEXTURE) { width = LLImageRaw::biasedDimToPowerOfTwo(width,MAX_TEXTURE_SIZE); } @@ -836,7 +836,7 @@ S32 LLSnapshotLivePreview::getEncodedImageWidth() const S32 LLSnapshotLivePreview::getEncodedImageHeight() const { S32 height = getHeight(); - if (getSnapshotType() == SNAPSHOT_TEXTURE) + if (getSnapshotType() == LLSnapshotModel::SNAPSHOT_TEXTURE) { height = LLImageRaw::biasedDimToPowerOfTwo(height,MAX_TEXTURE_SIZE); } @@ -854,7 +854,7 @@ LLPointer<LLImageRaw> LLSnapshotLivePreview::getEncodedImage() mPreviewImage->getHeight(), mPreviewImage->getComponents()); - if (getSnapshotType() == SNAPSHOT_TEXTURE) + if (getSnapshotType() == LLSnapshotModel::SNAPSHOT_TEXTURE) { // We don't store the intermediate formatted image in mFormattedImage in the J2C case LL_DEBUGS() << "Encoding new image of format J2C" << LL_ENDL; @@ -881,7 +881,7 @@ LLPointer<LLImageRaw> LLSnapshotLivePreview::getEncodedImage() { // Update mFormattedImage if necessary getFormattedImage(); - if (getSnapshotFormat() == LLFloaterSnapshot::SNAPSHOT_FORMAT_BMP) + if (getSnapshotFormat() == LLSnapshotModel::SNAPSHOT_FORMAT_BMP) { // BMP hack : copy instead of decode otherwise decode will crash. mPreviewImageEncoded->copy(mPreviewImage); @@ -903,23 +903,23 @@ void LLSnapshotLivePreview::estimateDataSize() // Compression ratio F32 ratio = 1.0; - if (getSnapshotType() == SNAPSHOT_TEXTURE) + if (getSnapshotType() == LLSnapshotModel::SNAPSHOT_TEXTURE) { ratio = 8.0; // This is what we shoot for when compressing to J2C } else { - LLFloaterSnapshot::ESnapshotFormat format = getSnapshotFormat(); + LLSnapshotModel::ESnapshotFormat format = getSnapshotFormat(); switch (format) { - case LLFloaterSnapshot::SNAPSHOT_FORMAT_PNG: + case LLSnapshotModel::SNAPSHOT_FORMAT_PNG: ratio = 3.0; // Average observed PNG compression ratio break; - case LLFloaterSnapshot::SNAPSHOT_FORMAT_JPEG: + case LLSnapshotModel::SNAPSHOT_FORMAT_JPEG: // Observed from JPG compression tests ratio = (110 - mSnapshotQuality) / 2; break; - case LLFloaterSnapshot::SNAPSHOT_FORMAT_BMP: + case LLSnapshotModel::SNAPSHOT_FORMAT_BMP: ratio = 1.0; // No compression with BMP break; } @@ -947,18 +947,18 @@ LLPointer<LLImageFormatted> LLSnapshotLivePreview::getFormattedImage() } // Create the new formatted image of the appropriate format. - LLFloaterSnapshot::ESnapshotFormat format = getSnapshotFormat(); + LLSnapshotModel::ESnapshotFormat format = getSnapshotFormat(); LL_DEBUGS() << "Encoding new image of format " << format << LL_ENDL; switch (format) { - case LLFloaterSnapshot::SNAPSHOT_FORMAT_PNG: + case LLSnapshotModel::SNAPSHOT_FORMAT_PNG: mFormattedImage = new LLImagePNG(); break; - case LLFloaterSnapshot::SNAPSHOT_FORMAT_JPEG: + case LLSnapshotModel::SNAPSHOT_FORMAT_JPEG: mFormattedImage = new LLImageJPEG(mSnapshotQuality); break; - case LLFloaterSnapshot::SNAPSHOT_FORMAT_BMP: + case LLSnapshotModel::SNAPSHOT_FORMAT_BMP: mFormattedImage = new LLImageBMP(); break; } @@ -978,7 +978,7 @@ void LLSnapshotLivePreview::setSize(S32 w, S32 h) setHeight(h); } -void LLSnapshotLivePreview::setSnapshotFormat(LLFloaterSnapshot::ESnapshotFormat format) +void LLSnapshotLivePreview::setSnapshotFormat(LLSnapshotModel::ESnapshotFormat format) { if (mSnapshotFormat != format) { @@ -993,7 +993,7 @@ void LLSnapshotLivePreview::getSize(S32& w, S32& h) const h = getHeight(); } -void LLSnapshotLivePreview::saveTexture() +void LLSnapshotLivePreview::saveTexture(BOOL outfit_snapshot, std::string name) { LL_DEBUGS() << "saving texture: " << mPreviewImage->getWidth() << "x" << mPreviewImage->getHeight() << LL_ENDL; // gen a new uuid for this asset @@ -1033,12 +1033,14 @@ void LLSnapshotLivePreview::saveTexture() std::string who_took_it; LLAgentUI::buildFullname(who_took_it); S32 expected_upload_cost = LLGlobalEconomy::Singleton::getInstance()->getPriceUpload(); - std::string name = "Snapshot: " + pos_string; - std::string desc = "Taken by " + who_took_it + " at " + pos_string; + std::string res_name = outfit_snapshot ? name : "Snapshot : " + pos_string; + std::string res_desc = outfit_snapshot ? "" : "Taken by " + who_took_it + " at " + pos_string; + LLFolderType::EType folder_type = outfit_snapshot ? LLFolderType::FT_NONE : LLFolderType::FT_SNAPSHOT_CATEGORY; + LLInventoryType::EType inv_type = outfit_snapshot ? LLInventoryType::IT_NONE : LLInventoryType::IT_SNAPSHOT; LLResourceUploadInfo::ptr_t assetUploadInfo(new LLResourceUploadInfo( - tid, LLAssetType::AT_TEXTURE, name, desc, 0, - LLFolderType::FT_SNAPSHOT_CATEGORY, LLInventoryType::IT_SNAPSHOT, + tid, LLAssetType::AT_TEXTURE, res_name, res_desc, 0, + folder_type, inv_type, PERM_ALL, LLFloaterPerms::getGroupPerms("Uploads"), LLFloaterPerms::getEveryonePerms("Uploads"), expected_upload_cost)); |