viewer#2212 Bulk upload makes an incorrect cost estimate

meow-7.2.2
Andrey Kleshchev 2024-08-07 16:06:26 +03:00 committed by Andrey Kleshchev
parent 93164fc560
commit 8754ce088f
1 changed files with 11 additions and 10 deletions

View File

@ -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++;
}