Fixed off by one error that would cause the array to be not filled entirely

when the gradient finished earlier than the area to be filled. This is visible
when drawing only one line of the gradient when it's outside the gradient area
as in ticket #3749. Though I am seriously wondering why it works when drawing
more than one line. Maybe a buffer overflow in the regular case? Will
investigate.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31821 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stephan Aßmus 2009-07-27 16:25:43 +00:00
parent bb1325a30e
commit 41969dbaf9

View File

@ -2905,7 +2905,7 @@ Painter::_MakeGradient(const BGradient& gradient, int32 colorCount,
from = to;
}
// make sure we fill the entire array
if (index < arraySize - 1) {
if (index < arraySize) {
int32 startIndex = max_c(index, 0);
uint8* c = (uint8*)&colors[startIndex];
for (int32 i = startIndex; i < arraySize; i++) {