| 423 | } |
| 424 | |
| 425 | bool TextureRegion::saveToFile( const std::string& filepath, const Image::SaveType& Format, |
| 426 | const Image::FormatConfiguration& imageFormatConfiguration ) { |
| 427 | bool Res = false; |
| 428 | |
| 429 | lock(); |
| 430 | |
| 431 | if ( NULL != mTexture ) { |
| 432 | if ( Image::SaveType::JPG != Format ) { |
| 433 | Res = 0 != ( SOIL_save_image( filepath.c_str(), (int)Format, getRealSize().getWidth(), |
| 434 | getRealSize().getHeight(), mTexture->getChannels(), |
| 435 | getPixelsPtr() ) ); |
| 436 | } else { |
| 437 | jpge::params params; |
| 438 | params.m_quality = imageFormatConfiguration.jpegSaveQuality(); |
| 439 | Res = jpge::compress_image_to_jpeg_file( |
| 440 | filepath.c_str(), getRealSize().getWidth(), getRealSize().getHeight(), |
| 441 | mTexture->getChannels(), getPixelsPtr(), params ); |
| 442 | } |
| 443 | } |
| 444 | |
| 445 | unlock(); |
| 446 | |
| 447 | return Res; |
| 448 | } |
| 449 | |
| 450 | void TextureRegion::resetDestSize() { |
| 451 | mDestSize.x = mOriDestSize.getWidth(); |
nothing calls this directly
no test coverage detected