Kaydet (Commit) 0f614959 authored tarafından Tor Lillqvist's avatar Tor Lillqvist

Make it easier to catch code that assumes SalBitmaps are created pre-cleared

In a DBG_UTIL build fill the maContextBuffer and maUserBuffer of a
QuartzSalBitmap with an easily recognized pattern. Helps catch
situations where by coincidence they appear pre-filled with zeros most
of the time and almost everything usually looks fine.

Or is the QuartzSalBitmap implementation wrong, and SalBitmaps
*should* be created filled with zeros?

Change-Id: Ib5207779f2a47b9b7e539d8646b4128fea0ec150
üst 077bdc73
...@@ -211,6 +211,10 @@ bool QuartzSalBitmap::CreateContext() ...@@ -211,6 +211,10 @@ bool QuartzSalBitmap::CreateContext()
try try
{ {
maContextBuffer.reset( new sal_uInt8[ mnHeight * nContextBytesPerRow ] ); maContextBuffer.reset( new sal_uInt8[ mnHeight * nContextBytesPerRow ] );
#ifdef DBG_UTIL
for (size_t i = 0; i < mnHeight * nContextBytesPerRow; i++)
maContextBuffer.get()[i] = (i & 0xFF);
#endif
if( !bSkipConversion ) if( !bSkipConversion )
ConvertBitmapData( mnWidth, mnHeight, ConvertBitmapData( mnWidth, mnHeight,
...@@ -261,6 +265,10 @@ bool QuartzSalBitmap::AllocateUserData() ...@@ -261,6 +265,10 @@ bool QuartzSalBitmap::AllocateUserData()
{ {
if( mnBytesPerRow ) if( mnBytesPerRow )
maUserBuffer.reset( new sal_uInt8[mnBytesPerRow * mnHeight] ); maUserBuffer.reset( new sal_uInt8[mnBytesPerRow * mnHeight] );
#ifdef DBG_UTIL
for (size_t i = 0; i < mnBytesPerRow * mnHeight; i++)
maUserBuffer.get()[i] = (i & 0xFF);
#endif
} }
catch( const std::bad_alloc& ) catch( const std::bad_alloc& )
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment