diff options
author | Andrey Kleshchev <andreykproductengine@lindenlab.com> | 2024-08-07 16:06:26 +0300 |
---|---|---|
committer | Andrey Kleshchev <117672381+akleshchev@users.noreply.github.com> | 2024-08-07 17:43:24 +0300 |
commit | 8754ce088fd0e901ad2d9dfd7bfc70266340bc39 (patch) | |
tree | 7e9842ce7d902f90eca625f407b564bd020b909a /indra/newview/llviewermenufile.cpp | |
parent | 93164fc5605a2b3d0d7a21d39c297cd392f75b60 (diff) |
viewer#2212 Bulk upload makes an incorrect cost estimate
Diffstat (limited to 'indra/newview/llviewermenufile.cpp')
-rw-r--r-- | indra/newview/llviewermenufile.cpp | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/indra/newview/llviewermenufile.cpp b/indra/newview/llviewermenufile.cpp index c4fecf8dff..83f8e96f9a 100644 --- a/indra/newview/llviewermenufile.cpp +++ b/indra/newview/llviewermenufile.cpp @@ -547,9 +547,11 @@ void do_bulk_upload(std::vector<std::string> filenames, bool allow_2k) if (asset_type == LLAssetType::AT_TEXTURE && allow_2k) { LLPointer<LLImageFormatted> image_frmted = LLImageFormatted::createFromType(codec); - if (gDirUtilp->fileExists(filename) && image_frmted->load(filename)) + if (gDirUtilp->fileExists(filename) && image_frmted && image_frmted->load(filename)) { - expected_upload_cost = LLAgentBenefitsMgr::current().getTextureUploadCost(image_frmted); + S32 biased_width = LLImageRaw::biasedDimToPowerOfTwo(image_frmted->getWidth(), LLViewerFetchedTexture::MAX_IMAGE_SIZE_DEFAULT); + S32 biased_height = LLImageRaw::biasedDimToPowerOfTwo(image_frmted->getHeight(), LLViewerFetchedTexture::MAX_IMAGE_SIZE_DEFAULT); + expected_upload_cost = LLAgentBenefitsMgr::current().getTextureUploadCost(biased_width, biased_height); resource_upload = true; } } @@ -643,16 +645,15 @@ bool get_bulk_upload_expected_cost( if (asset_type == LLAssetType::AT_TEXTURE && allow_2k) { LLPointer<LLImageFormatted> image_frmted = LLImageFormatted::createFromType(codec); - if (gDirUtilp->fileExists(filename) && image_frmted->load(filename)) + if (gDirUtilp->fileExists(filename) && image_frmted && image_frmted->load(filename)) { - total_cost += LLAgentBenefitsMgr::current().getTextureUploadCost(image_frmted); - if (image_frmted) + S32 biased_width = LLImageRaw::biasedDimToPowerOfTwo(image_frmted->getWidth(), LLViewerFetchedTexture::MAX_IMAGE_SIZE_DEFAULT); + S32 biased_height = LLImageRaw::biasedDimToPowerOfTwo(image_frmted->getHeight(), LLViewerFetchedTexture::MAX_IMAGE_SIZE_DEFAULT); + total_cost += LLAgentBenefitsMgr::current().getTextureUploadCost(biased_width, biased_height); + S32 area = biased_width * biased_height; + if (area >= LLAgentBenefits::MIN_2K_TEXTURE_AREA) { - S32 area = image_frmted->getHeight() * image_frmted->getWidth(); - if (area >= LLAgentBenefits::MIN_2K_TEXTURE_AREA) - { - textures_2k_count++; - } + textures_2k_count++; } file_count++; } |