Bug 283343: GFX::nsBlender - wrong order of parameters may cause wrong color depth calculation; p=sergei_d@fi.tartu.ee r/sr=roc

This commit is contained in:
gandalf%firefox.pl 2005-03-17 01:39:51 +00:00
Родитель 64f214da68
Коммит 6b8b6cf650
1 изменённых файлов: 11 добавлений и 11 удалений

Просмотреть файл

@ -173,7 +173,7 @@ nsBlender::Blend(PRInt32 aSX, PRInt32 aSY, PRInt32 aWidth, PRInt32 aHeight, nsID
PRInt32 srcSpan, destSpan, secondSrcSpan;
PRInt32 srcRowBytes, destRowBytes, secondSrcRowBytes;
result = aSrc->Lock(aSX, aSY, aWidth, aHeight, (void**)&srcBytes, &srcRowBytes, &srcSpan, NS_LOCK_SURFACE_READ_ONLY);
result = aSrc->Lock(aSX, aSY, aWidth, aHeight, (void**)&srcBytes, &srcSpan, &srcRowBytes, NS_LOCK_SURFACE_READ_ONLY);
if (NS_SUCCEEDED(result)) {
// Compute depth like this to make sure it's consistent with the memory layout.
@ -181,20 +181,20 @@ nsBlender::Blend(PRInt32 aSX, PRInt32 aSY, PRInt32 aWidth, PRInt32 aHeight, nsID
// See bug 228399 for more information.
PRUint32 depth = (srcRowBytes / aWidth) * 8;
result = aDst->Lock(aDX, aDY, aWidth, aHeight, (void**)&destBytes, &destRowBytes, &destSpan, 0);
result = aDst->Lock(aDX, aDY, aWidth, aHeight, (void**)&destBytes, &destSpan, &destRowBytes, 0);
if (NS_SUCCEEDED(result)) {
NS_ASSERTION(srcSpan == destSpan, "Mismatched bitmap formats (src/dest) in Blender");
if (srcSpan == destSpan) {
NS_ASSERTION(srcRowBytes == destRowBytes, "Mismatched lock-bitmap sizes (src/dest) in Blender");
if (srcRowBytes == destRowBytes) {
if (aSecondSrc) {
result = aSecondSrc->Lock(aSX, aSY, aWidth, aHeight, (void**)&secondSrcBytes, &secondSrcRowBytes, &secondSrcSpan, NS_LOCK_SURFACE_READ_ONLY);
result = aSecondSrc->Lock(aSX, aSY, aWidth, aHeight, (void**)&secondSrcBytes, &secondSrcSpan, &secondSrcRowBytes, NS_LOCK_SURFACE_READ_ONLY);
if (NS_SUCCEEDED(result)) {
NS_ASSERTION(srcSpan == secondSrcSpan && srcRowBytes == secondSrcRowBytes,
"Mismatched bitmap formats (src/secondSrc) in Blender");
if (srcSpan == secondSrcSpan && srcRowBytes == secondSrcRowBytes) {
result = Blend(srcBytes, srcRowBytes,
destBytes, destRowBytes,
result = Blend(srcBytes, srcSpan,
destBytes, destSpan,
secondSrcBytes,
srcSpan, aHeight, aSrcOpacity, depth);
srcRowBytes, aHeight, aSrcOpacity, depth);
}
aSecondSrc->Unlock();
@ -202,10 +202,10 @@ nsBlender::Blend(PRInt32 aSX, PRInt32 aSY, PRInt32 aWidth, PRInt32 aHeight, nsID
}
else
{
result = Blend(srcBytes, srcRowBytes,
destBytes, destRowBytes,
result = Blend(srcBytes, srcSpan,
destBytes, destSpan,
secondSrcBytes,
srcSpan, aHeight, aSrcOpacity, depth);
srcRowBytes, aHeight, aSrcOpacity, depth);
}
}