void TextureBrowser::updateInfoConverted() { if(NULL != curTexture && NULL != curDescriptor) { char tmp[1024]; const char *formatStr = ""; int datasize = 0; int filesize = 0; switch(curTextureView) { case ViewPVR: if(curDescriptor->pvrCompression.format != DAVA::FORMAT_INVALID) { DAVA::String compressedTexturePath = DAVA::TextureDescriptor::GetPathnameForFormat(curTexture->GetPathname(), DAVA::PVR_FILE); formatStr = DAVA::Texture::GetPixelFormatString(curDescriptor->pvrCompression.format); filesize = QFileInfo(compressedTexturePath.c_str()).size(); datasize = DAVA::LibPVRHelper::GetDataLength(compressedTexturePath); } break; case ViewDXT: if(curDescriptor->dxtCompression.format != DAVA::FORMAT_INVALID) { DAVA::String compressedTexturePath = DAVA::TextureDescriptor::GetPathnameForFormat(curTexture->GetPathname(), DAVA::DXT_FILE); formatStr = DAVA::Texture::GetPixelFormatString(curDescriptor->dxtCompression.format); filesize = QFileInfo(compressedTexturePath.c_str()).size(); // TODO: more accurate dxt data size calculation //datasize = (curTexture->width * curTexture->height * DAVA::Texture::GetPixelFormatSizeInBits(curDescriptor->dxtCompression.format)) >> 3; datasize = LibDxtHelper::GetDataSize(compressedTexturePath.c_str()); } break; } sprintf(tmp, "Format\t: %s\nSize\t: %dx%d\nData size\t: %s\nFile size\t: %s", formatStr, curTexture->width, curTexture->height, SizeInBytesToString(datasize).c_str(), SizeInBytesToString(filesize).c_str()); ui->labelConvertedFormat->setText(tmp); } else { ui->labelConvertedFormat->setText(""); } }
void TextureBrowser::updateInfoConverted() { if(NULL != curTexture && NULL != curDescriptor) { char tmp[1024]; const char *formatStr = "Unknown"; int datasize = 0; int filesize = 0; QSize imgSize(0, 0); if(curDescriptor->compression[curTextureView].format != DAVA::FORMAT_INVALID) { DAVA::FilePath compressedTexturePath = DAVA::GPUFamilyDescriptor::CreatePathnameForGPU(curDescriptor, curTextureView); filesize = QFileInfo(compressedTexturePath.GetAbsolutePathname().c_str()).size(); formatStr = GlobalEnumMap<DAVA::PixelFormat>::Instance()->ToString(curDescriptor->compression[curTextureView].format); int w = curDescriptor->compression[curTextureView].compressToWidth; int h = curDescriptor->compression[curTextureView].compressToHeight; if(0 != w && 0 != h) { imgSize = QSize(w, h); } else { imgSize = QSize(curTexture->width, curTexture->height); } // get data size datasize = ImageTools::GetTexturePhysicalSize(curDescriptor, curTextureView); } sprintf(tmp, "Format\t: %s\nSize\t: %dx%d\nData size\t: %s\nFile size\t: %s", formatStr, imgSize.width(), imgSize.height(), SizeInBytesToString(datasize).c_str(), SizeInBytesToString(filesize).c_str()); ui->labelConvertedFormat->setText(tmp); } else { ui->labelConvertedFormat->setText(""); } }
void TextureBrowser::updateInfoOriginal(const DAVA::Vector<QImage> &images) { if(NULL != curTexture && NULL != curDescriptor) { char tmp[1024]; const char *formatStr = DAVA::Texture::GetPixelFormatString(DAVA::FORMAT_RGBA8888); int datasize = 0; int filesize = 0; for(size_t i = 0; i < images.size(); ++i) { datasize += images[i].width() * images[i].height() * DAVA::Texture::GetPixelFormatSizeInBytes(DAVA::FORMAT_RGBA8888); } if(!curDescriptor->IsCubeMap()) { filesize = QFileInfo(curDescriptor->GetSourceTexturePathname().GetAbsolutePathname().c_str()).size(); } else { DAVA::Vector<DAVA::String> faceNames; CubemapUtils::GenerateFaceNames(curDescriptor->pathname.GetAbsolutePathname(), faceNames); for(size_t i = 0; i < faceNames.size(); ++i) { filesize += QFileInfo(faceNames[i].c_str()).size(); } } sprintf(tmp, "Format\t: %s\nSize\t: %dx%d\nData size\t: %s\nFile size\t: %s", formatStr, images[0].width(), images[0].height(), SizeInBytesToString(datasize).c_str(), SizeInBytesToString(filesize).c_str()); ui->labelOriginalFormat->setText(tmp); } else { ui->labelOriginalFormat->setText(""); } }
void TextureBrowser::updateInfoOriginal(const QImage &origImage) { if(NULL != curTexture && NULL != curDescriptor) { char tmp[1024]; const char *formatStr = DAVA::Texture::GetPixelFormatString(DAVA::FORMAT_RGBA8888); int datasize = origImage.width() * origImage.height() * DAVA::Texture::GetPixelFormatSizeInBytes(DAVA::FORMAT_RGBA8888); int filesize = QFileInfo(curDescriptor->GetSourceTexturePathname().GetAbsolutePathname().c_str()).size(); sprintf(tmp, "Format\t: %s\nSize\t: %dx%d\nData size\t: %s\nFile size\t: %s", formatStr, origImage.width(), origImage.height(), SizeInBytesToString(datasize).c_str(), SizeInBytesToString(filesize).c_str()); ui->labelOriginalFormat->setText(tmp); } else { ui->labelOriginalFormat->setText(""); } }