Bug 1604684 - Make opacity a compositor surface property rather than a tile property. r=sotaro

This will allow use of the DirectComposition virtual surface API. If
it turns out that some pages recreate surfaces a lot due to opacity
changing, we can add some extra logic to avoid recreating surfaces
as often, and making use of per-tile opacity in some cases.

Differential Revision: https://phabricator.services.mozilla.com/D57592
This commit is contained in:
Glenn Watson
2020-01-06 20:11:21 +00:00
parent 3546db4e1e
commit c1ef1223d7
16 changed files with 111 additions and 93 deletions

View File

@@ -276,8 +276,9 @@ void RenderCompositorOGL::Unbind() {
}
void RenderCompositorOGL::CreateSurface(wr::NativeSurfaceId aId,
wr::DeviceIntSize aTileSize) {
Surface surface(aTileSize);
wr::DeviceIntSize aTileSize,
bool aIsOpaque) {
Surface surface(aTileSize, aIsOpaque);
mSurfaces.insert({aId, surface});
}
@@ -285,15 +286,14 @@ void RenderCompositorOGL::DestroySurface(NativeSurfaceId aId) {
mSurfaces.erase(aId);
}
void RenderCompositorOGL::CreateTile(wr::NativeSurfaceId aId, int aX, int aY,
bool aIsOpaque) {
void RenderCompositorOGL::CreateTile(wr::NativeSurfaceId aId, int aX, int aY) {
auto surfaceCursor = mSurfaces.find(aId);
MOZ_RELEASE_ASSERT(surfaceCursor != mSurfaces.end());
Surface& surface = surfaceCursor->second;
RefPtr<layers::NativeLayer> layer = mNativeLayerRoot->CreateLayer(
IntSize(surface.mTileSize.width, surface.mTileSize.height), aIsOpaque,
mSurfacePoolHandle);
IntSize(surface.mTileSize.width, surface.mTileSize.height),
surface.mIsOpaque, mSurfacePoolHandle);
surface.mNativeLayers.insert({TileKey(aX, aY), layer});
mTotalPixelCount += gfx::IntRect({}, layer->GetSize()).Area();
}