mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-27 00:04:35 +00:00
Add const version of PackFrameImage().
Temporary buffer needs to be handled outside of the function.
This commit is contained in:
parent
b362baed5f
commit
e1e5d6bd47
@ -5199,6 +5199,20 @@ const char* Worker::GetFailureString( Worker::Failure failure )
|
|||||||
return s_failureReasons[(int)failure];
|
return s_failureReasons[(int)failure];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Worker::PackFrameImage( char*& buf, size_t& bufsz, const char* image, uint16_t w, uint16_t h, uint32_t& csz ) const
|
||||||
|
{
|
||||||
|
const auto insz = size_t( w ) * size_t( h ) / 2;
|
||||||
|
const auto maxout = LZ4_COMPRESSBOUND( insz );
|
||||||
|
if( bufsz < maxout )
|
||||||
|
{
|
||||||
|
bufsz = maxout;
|
||||||
|
delete[] buf;
|
||||||
|
buf = new char[maxout];
|
||||||
|
}
|
||||||
|
const auto outsz = LZ4_compress_default( image, buf, insz, maxout );
|
||||||
|
csz = uint32_t( outsz );
|
||||||
|
}
|
||||||
|
|
||||||
const char* Worker::PackFrameImage( const char* image, uint16_t w, uint16_t h, uint32_t& csz )
|
const char* Worker::PackFrameImage( const char* image, uint16_t w, uint16_t h, uint32_t& csz )
|
||||||
{
|
{
|
||||||
const auto insz = size_t( w ) * size_t( h ) / 2;
|
const auto insz = size_t( w ) * size_t( h ) / 2;
|
||||||
|
@ -393,6 +393,7 @@ public:
|
|||||||
const FailureData& GetFailureData() const { return m_failureData; }
|
const FailureData& GetFailureData() const { return m_failureData; }
|
||||||
static const char* GetFailureString( Failure failure );
|
static const char* GetFailureString( Failure failure );
|
||||||
|
|
||||||
|
void PackFrameImage( char*& buf, size_t& bufsz, const char* image, uint16_t w, uint16_t h, uint32_t& csz ) const;
|
||||||
const char* PackFrameImage( const char* image, uint16_t w, uint16_t h, uint32_t& csz );
|
const char* PackFrameImage( const char* image, uint16_t w, uint16_t h, uint32_t& csz );
|
||||||
const char* UnpackFrameImage( const FrameImage& image );
|
const char* UnpackFrameImage( const FrameImage& image );
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user