PVS43: two if with same condition in BBitmap::SetBits

This commit is contained in:
Adrien Destugues 2015-04-30 18:40:25 +02:00
parent 744ab983f3
commit 487d015ab7
2 changed files with 13 additions and 8 deletions

View File

@ -216,9 +216,11 @@ get_raw_bytes_per_row(color_space colorSpace, int32 width)
case B_YCbCr420: case B_YUV420: case B_YCbCr420: case B_YUV420:
bpr = (width + 3) / 4 * 6; bpr = (width + 3) / 4 * 6;
break; break;
case B_YUV9:
bpr = (width + 15) / 16 * 18;
// unsupported // unsupported
case B_NO_COLOR_SPACE: case B_NO_COLOR_SPACE:
case B_YUV9: case B_YUV12: case B_YUV12:
break; break;
} }
return bpr; return bpr;
@ -1761,10 +1763,10 @@ BBitmap::SetBits(const void *data, int32 length, int32 offset,
// ignore source data row padding. // ignore source data row padding.
} else if (colorSpace == B_CMAP8 && fColorSpace != B_CMAP8) } else if (colorSpace == B_CMAP8 && fColorSpace != B_CMAP8)
inBPR = width; inBPR = width;
}
// call the sane method, which does the actual work // call the sane method, which does the actual work
if (error == B_OK)
error = ImportBits(data, length, inBPR, offset, colorSpace); error = ImportBits(data, length, inBPR, offset, colorSpace);
}
} }

View File

@ -124,9 +124,12 @@ get_raw_bytes_per_row(color_space colorSpace, int32 width)
case B_YCbCr420: case B_YUV420: case B_YCbCr420: case B_YUV420:
bpr = (width + 3) / 4 * 6; bpr = (width + 3) / 4 * 6;
break; break;
case B_YUV9:
bpr = (width + 15) / 16 * 18;
break;
// unsupported // unsupported
case B_NO_COLOR_SPACE: case B_NO_COLOR_SPACE:
case B_YUV9: case B_YUV12: case B_YUV12:
break; break;
} }
return bpr; return bpr;
@ -644,10 +647,10 @@ BBitmap::SetBits(const void* data, int32 length, int32 offset,
// ignore source data row padding. // ignore source data row padding.
inBPR = width; inBPR = width;
} }
}
// call the sane method, which does the actual work // call the sane method, which does the actual work
if (error == B_OK)
error = ImportBits(data, length, inBPR, offset, colorSpace); error = ImportBits(data, length, inBPR, offset, colorSpace);
}
} }