summaryrefslogtreecommitdiff
path: root/indra/llimage/llimagebmp.cpp
diff options
context:
space:
mode:
authorAndrey Lihatskiy <alihatskiy@productengine.com>2024-06-10 20:03:54 +0300
committerGitHub <noreply@github.com>2024-06-10 20:03:54 +0300
commitf74c10c4ec6435471bac84473fe865f90843c2df (patch)
treeb2853d87789dbb84d6c26c259eab6639d3a7e482 /indra/llimage/llimagebmp.cpp
parent5fccb539937a52d286274a002266e022e2102e5e (diff)
parent32fcefc058ae38eff0572326ef3efd1c7b343144 (diff)
Merge branch 'DRTVWR-600-maint-A' into signal/trim-trailing
Diffstat (limited to 'indra/llimage/llimagebmp.cpp')
-rw-r--r--indra/llimage/llimagebmp.cpp20
1 files changed, 14 insertions, 6 deletions
diff --git a/indra/llimage/llimagebmp.cpp b/indra/llimage/llimagebmp.cpp
index 08fcdf39da..2a328675c2 100644
--- a/indra/llimage/llimagebmp.cpp
+++ b/indra/llimage/llimagebmp.cpp
@@ -96,6 +96,8 @@ bool LLImageBMP::updateData()
{
resetLastError();
+ LLImageDataLock lock(this);
+
// Check to make sure that this instance has been initialized with data
U8* mdata = getData();
if (!mdata || (0 == getDataSize()))
@@ -337,8 +339,11 @@ bool LLImageBMP::decode(LLImageRaw* raw_image, F32 decode_time)
resetLastError();
+ LLImageDataLock lockIn(this);
+ LLImageDataLock lockOut(raw_image);
+
// Check to make sure that this instance has been initialized with data
- U8* mdata = getData();
+ const U8* mdata = getData();
if (!mdata || (0 == getDataSize()))
{
setLastError("llimagebmp trying to decode an image with no data!");
@@ -351,7 +356,7 @@ bool LLImageBMP::decode(LLImageRaw* raw_image, F32 decode_time)
return false;
}
- U8* src = mdata + mBitmapOffset;
+ const U8* src = mdata + mBitmapOffset;
U8* dst = raw_image->getData();
bool success = false;
@@ -398,7 +403,7 @@ U32 LLImageBMP::countTrailingZeros( U32 m )
}
-bool LLImageBMP::decodeColorMask16( U8* dst, U8* src )
+bool LLImageBMP::decodeColorMask16( U8* dst, const U8* src )
{
llassert( 16 == mBitsPerPixel );
@@ -434,7 +439,7 @@ bool LLImageBMP::decodeColorMask16( U8* dst, U8* src )
return true;
}
-bool LLImageBMP::decodeColorMask32( U8* dst, U8* src )
+bool LLImageBMP::decodeColorMask32( U8* dst, const U8* src )
{
// Note: alpha is not supported
@@ -478,7 +483,7 @@ bool LLImageBMP::decodeColorMask32( U8* dst, U8* src )
}
-bool LLImageBMP::decodeColorTable8( U8* dst, U8* src )
+bool LLImageBMP::decodeColorTable8( U8* dst, const U8* src )
{
llassert( (8 == mBitsPerPixel) && (mColorPaletteColors >= 256) );
@@ -508,7 +513,7 @@ bool LLImageBMP::decodeColorTable8( U8* dst, U8* src )
}
-bool LLImageBMP::decodeTruecolor24( U8* dst, U8* src )
+bool LLImageBMP::decodeTruecolor24( U8* dst, const U8* src )
{
llassert( 24 == mBitsPerPixel );
llassert( 3 == getComponents() );
@@ -542,6 +547,9 @@ bool LLImageBMP::encode(const LLImageRaw* raw_image, F32 encode_time)
resetLastError();
+ LLImageDataSharedLock lockIn(raw_image);
+ LLImageDataLock lockOut(this);
+
S32 src_components = raw_image->getComponents();
S32 dst_components = ( src_components < 3 ) ? 1 : 3;