mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-09 03:15:11 +00:00
Bug 1092543. Intersect bufferRect with visibleRect to ensure that the gralloc buffer offset is taken into account. r=sotaro
The patch in bug 1073252 assumed that the gralloc buffer is always at (0,0,w,h) in layer coordinates, which is incorrect. When intersecting the gralloc buffer bounds with the visible rect, we need to take the gralloc buffer's offset (state.mOffset) into account. Fortunately bufferRect already contains this, so let's just use that. --HG-- extra : rebase_source : 6187200b29ed2913e335d5a710f1ba38d7b1cf18
This commit is contained in:
parent
a3fba57a19
commit
0191d8f84c
@ -395,36 +395,23 @@ HwcComposer2D::PrepareLayerList(Layer* aLayer,
|
||||
}
|
||||
|
||||
LayerRenderState state = aLayer->GetRenderState();
|
||||
nsIntSize surfaceSize;
|
||||
nsIntRect visibleRect = visibleRegion.GetBounds();
|
||||
|
||||
if (state.mSurface.get()) {
|
||||
surfaceSize = state.mSize;
|
||||
// In some cases the visible rect assigned to the layer can be larger
|
||||
// than the layer's surface, e.g., an ImageLayer with a small Image
|
||||
// in it.
|
||||
visibleRect.IntersectRect(visibleRect,
|
||||
nsIntRect(nsIntPoint(0, 0), surfaceSize));
|
||||
} else {
|
||||
if (aLayer->AsColorLayer() && mColorFill) {
|
||||
fillColor = true;
|
||||
} else {
|
||||
LOGD("%s Layer doesn't have a gralloc buffer", aLayer->Name());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
// Buffer rotation is not to be confused with the angled rotation done by a transform matrix
|
||||
// It's a fancy PaintedLayer feature used for scrolling
|
||||
if (state.BufferRotated()) {
|
||||
LOGD("%s Layer has a rotated buffer", aLayer->Name());
|
||||
return false;
|
||||
if (!state.mSurface.get()) {
|
||||
if (aLayer->AsColorLayer() && mColorFill) {
|
||||
fillColor = true;
|
||||
} else {
|
||||
LOGD("%s Layer doesn't have a gralloc buffer", aLayer->Name());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
nsIntRect visibleRect = visibleRegion.GetBounds();
|
||||
|
||||
nsIntRect bufferRect;
|
||||
if (fillColor) {
|
||||
bufferRect = nsIntRect(visibleRect);
|
||||
} else {
|
||||
if(state.mHasOwnOffset) {
|
||||
if (state.mHasOwnOffset) {
|
||||
bufferRect = nsIntRect(state.mOffset.x, state.mOffset.y,
|
||||
state.mSize.width, state.mSize.height);
|
||||
} else {
|
||||
@ -432,6 +419,17 @@ HwcComposer2D::PrepareLayerList(Layer* aLayer,
|
||||
//surface size as its buffer bounds
|
||||
bufferRect = nsIntRect(0, 0, state.mSize.width, state.mSize.height);
|
||||
}
|
||||
// In some cases the visible rect assigned to the layer can be larger
|
||||
// than the layer's surface, e.g., an ImageLayer with a small Image
|
||||
// in it.
|
||||
visibleRect.IntersectRect(visibleRect, bufferRect);
|
||||
}
|
||||
|
||||
// Buffer rotation is not to be confused with the angled rotation done by a transform matrix
|
||||
// It's a fancy PaintedLayer feature used for scrolling
|
||||
if (state.BufferRotated()) {
|
||||
LOGD("%s Layer has a rotated buffer", aLayer->Name());
|
||||
return false;
|
||||
}
|
||||
|
||||
hwc_rect_t sourceCrop, displayFrame;
|
||||
|
Loading…
Reference in New Issue
Block a user