Bug 635035, part 2: Ensure that the buffer rect only grows in the presence of scaling. r=roc

This commit is contained in:
Chris Jones 2011-03-09 11:27:37 -06:00
Родитель 6412fcd6b3
Коммит 464cc015eb
1 изменённых файлов: 6 добавлений и 1 удалений

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

@ -206,10 +206,12 @@ ThebesLayerBuffer::BeginPaint(ThebesLayer* aLayer, ContentType aContentType,
if (mBufferRect.Contains(neededRegion.GetBounds())) {
// We don't need to adjust mBufferRect.
destBufferRect = mBufferRect;
} else {
} else if (neededRegion.GetBounds().Size() <= mBufferRect.Size()) {
// The buffer's big enough but doesn't contain everything that's
// going to be visible. We'll move it.
destBufferRect = nsIntRect(neededRegion.GetBounds().TopLeft(), mBufferRect.Size());
} else {
destBufferRect = neededRegion.GetBounds();
}
} else {
destBufferRect = neededRegion.GetBounds();
@ -251,6 +253,9 @@ ThebesLayerBuffer::BeginPaint(ThebesLayer* aLayer, ContentType aContentType,
break;
}
NS_ASSERTION(destBufferRect.Contains(neededRegion.GetBounds()),
"Destination rect doesn't contain what we need to paint");
result.mRegionToDraw.Sub(neededRegion, validRegion);
if (result.mRegionToDraw.IsEmpty())
return result;