mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-30 00:01:50 +00:00
Bug 981732 - HwcComposer2D should not compose any layer below full screen Opaque layer. r=dwilson
This commit is contained in:
parent
ad647b1e0a
commit
bc827acabd
@ -267,17 +267,6 @@ HwcComposer2D::PrepareLayerList(Layer* aLayer,
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// OK! We can compose this layer with hwc.
|
||||
|
||||
int current = mList ? mList->numHwLayers : 0;
|
||||
if (!mList || current >= mMaxLayerCount) {
|
||||
if (!ReallocLayerList() || current >= mMaxLayerCount) {
|
||||
LOGE("PrepareLayerList failed! Could not increase the maximum layer count");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
nsIntRect visibleRect = visibleRegion.GetBounds();
|
||||
|
||||
nsIntRect bufferRect;
|
||||
@ -294,30 +283,51 @@ HwcComposer2D::PrepareLayerList(Layer* aLayer,
|
||||
}
|
||||
}
|
||||
|
||||
HwcLayer& hwcLayer = mList->hwLayers[current];
|
||||
hwc_rect_t sourceCrop;
|
||||
|
||||
hwc_rect_t sourceCrop, displayFrame;
|
||||
if(!HwcUtils::PrepareLayerRects(visibleRect,
|
||||
transform * aGLWorldTransform,
|
||||
clip,
|
||||
bufferRect,
|
||||
state.YFlipped(),
|
||||
&(sourceCrop),
|
||||
&(hwcLayer.displayFrame)))
|
||||
&(displayFrame)))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// 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);
|
||||
if (displayRect.Contains(mScreenRect)) {
|
||||
// In z-order, all previous layers are below
|
||||
// the current layer. We can ignore them now.
|
||||
mList->numHwLayers = current = 0;
|
||||
mHwcLayerMap.Clear();
|
||||
}
|
||||
}
|
||||
|
||||
if (!mList || current >= mMaxLayerCount) {
|
||||
if (!ReallocLayerList() || current >= mMaxLayerCount) {
|
||||
LOGE("PrepareLayerList failed! Could not increase the maximum layer count");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
HwcLayer& hwcLayer = mList->hwLayers[current];
|
||||
hwcLayer.displayFrame = displayFrame;
|
||||
setCrop(&hwcLayer, sourceCrop);
|
||||
buffer_handle_t handle = fillColor ? nullptr : state.mSurface->getNativeBuffer()->handle;
|
||||
hwcLayer.handle = handle;
|
||||
|
||||
hwcLayer.flags = 0;
|
||||
hwcLayer.hints = 0;
|
||||
hwcLayer.blending = HWC_BLENDING_PREMULT;
|
||||
if ((opacity == 0xFF) && (aLayer->GetContentFlags() & Layer::CONTENT_OPAQUE)) {
|
||||
hwcLayer.blending = HWC_BLENDING_NONE;
|
||||
}
|
||||
hwcLayer.blending = isOpaque ? HWC_BLENDING_NONE : HWC_BLENDING_PREMULT;
|
||||
#if ANDROID_VERSION >= 17
|
||||
hwcLayer.compositionType = HWC_FRAMEBUFFER;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user