Bug 1059023 - Do not compose layer hidden under the opaque layer. r=mattwoodrow

This commit is contained in:
Sushil Chauhan 2014-08-28 10:44:03 -07:00
Родитель effb885bd5
Коммит 3cadfcb55f
3 изменённых файлов: 19 добавлений и 6 удалений

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

@ -397,17 +397,21 @@ HwcComposer2D::PrepareLayerList(Layer* aLayer,
// OK! We can compose this layer with hwc.
int current = mList ? mList->numHwLayers : 0;
// Do not compose any layer below full-screen Opaque layer
// Note: It can be generalized to non-fullscreen Opaque layers.
bool isOpaque = (opacity == 0xFF) && (aLayer->GetContentFlags() & Layer::CONTENT_OPAQUE);
if (current && isOpaque) {
nsIntRect displayRect = nsIntRect(displayFrame.left, displayFrame.top,
displayFrame.right - displayFrame.left, displayFrame.bottom - displayFrame.top);
nsIntRect displayRect = HwcUtils::HwcToIntRect(displayFrame);
if (displayRect.Contains(mScreenRect)) {
// In z-order, all previous layers are below
// the current layer. We can ignore them now.
// In z-order, all previous layers are below current layer
// Do not compose any layer below full-screen opaque layer
mList->numHwLayers = current = 0;
mHwcLayerMap.Clear();
} else {
nsIntRect rect = HwcUtils::HwcToIntRect(mList->hwLayers[current-1].displayFrame);
if (displayRect.Contains(rect)) {
// Do not compose layer hidden under the opaque layer
mHwcLayerMap.RemoveElementAt(current-1);
current = --mList->numHwLayers;
}
}
}

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

@ -146,4 +146,10 @@ HwcUtils::CalculateClipRect(const gfx::Matrix& transform,
return true;
}
nsIntRect
HwcUtils::HwcToIntRect(hwc_rect_t aRect) {
return nsIntRect(aRect.left, aRect.top, aRect.right - aRect.left,
aRect.bottom - aRect.top);
}
} // namespace mozilla

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

@ -118,6 +118,9 @@ static bool PrepareLayerRects(nsIntRect aVisible, const gfx::Matrix& aTransform,
hwc_rect_t* aSourceCrop,
hwc_rect_t* aVisibleRegionScreen);
/* Converts hwc_rect_t to nsIntRect */
static nsIntRect HwcToIntRect(hwc_rect_t aRect);
};
} // namespace mozilla