зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changeset 598b2d26c136 (bug 1591627) as per Glenn's request. CLOSED TREE
This commit is contained in:
Родитель
e7f3e82efb
Коммит
ee9116f875
|
@ -43,9 +43,9 @@ void wr_compositor_bind(void* aCompositor, wr::NativeSurfaceId aId,
|
|||
}
|
||||
|
||||
void wr_compositor_create_surface(void* aCompositor, wr::NativeSurfaceId aId,
|
||||
wr::DeviceIntSize aSize, bool aIsOpaque) {
|
||||
wr::DeviceIntSize aSize) {
|
||||
RenderCompositor* compositor = static_cast<RenderCompositor*>(aCompositor);
|
||||
compositor->CreateSurface(aId, aSize, aIsOpaque);
|
||||
compositor->CreateSurface(aId, aSize);
|
||||
}
|
||||
|
||||
void wr_compositor_destroy_surface(void* aCompositor, NativeSurfaceId aId) {
|
||||
|
|
|
@ -70,8 +70,8 @@ class RenderCompositor {
|
|||
virtual void Bind(wr::NativeSurfaceId aId, wr::DeviceIntPoint* aOffset,
|
||||
uint32_t* aFboId, wr::DeviceIntRect aDirtyRect) {}
|
||||
virtual void Unbind() {}
|
||||
virtual void CreateSurface(wr::NativeSurfaceId aId, wr::DeviceIntSize aSize,
|
||||
bool aIsOpaque) {}
|
||||
virtual void CreateSurface(wr::NativeSurfaceId aId, wr::DeviceIntSize aSize) {
|
||||
}
|
||||
virtual void DestroySurface(NativeSurfaceId aId) {}
|
||||
virtual void AddSurface(wr::NativeSurfaceId aId, wr::DeviceIntPoint aPosition,
|
||||
wr::DeviceIntRect aClipRect) {}
|
||||
|
|
|
@ -1140,7 +1140,6 @@ extern "C" {
|
|||
compositor: *mut c_void,
|
||||
id: NativeSurfaceId,
|
||||
size: DeviceIntSize,
|
||||
is_opaque: bool,
|
||||
);
|
||||
fn wr_compositor_destroy_surface(
|
||||
compositor: *mut c_void,
|
||||
|
@ -1171,14 +1170,12 @@ impl Compositor for WrCompositor {
|
|||
&mut self,
|
||||
id: NativeSurfaceId,
|
||||
size: DeviceIntSize,
|
||||
is_opaque: bool,
|
||||
) {
|
||||
unsafe {
|
||||
wr_compositor_create_surface(
|
||||
self.0,
|
||||
id,
|
||||
size,
|
||||
is_opaque,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -311,21 +311,20 @@ extern "C" {
|
|||
Window *window,
|
||||
uint64_t id,
|
||||
int width,
|
||||
int height,
|
||||
bool is_opaque
|
||||
int height
|
||||
) {
|
||||
assert(window->tiles.count(id) == 0);
|
||||
|
||||
Tile tile;
|
||||
|
||||
DXGI_ALPHA_MODE alpha_mode = is_opaque ? DXGI_ALPHA_MODE_IGNORE : DXGI_ALPHA_MODE_PREMULTIPLIED;
|
||||
|
||||
// Create the video memory surface.
|
||||
// TODO(gw): We should set alpha mode appropriately so that DC
|
||||
// can do opaque composites when possible!
|
||||
HRESULT hr = window->pDCompDevice->CreateSurface(
|
||||
width,
|
||||
height,
|
||||
DXGI_FORMAT_B8G8R8A8_UNORM,
|
||||
alpha_mode,
|
||||
DXGI_ALPHA_MODE_PREMULTIPLIED,
|
||||
&tile.pSurface
|
||||
);
|
||||
assert(SUCCEEDED(hr));
|
||||
|
|
|
@ -33,7 +33,6 @@ extern {
|
|||
id: u64,
|
||||
width: i32,
|
||||
height: i32,
|
||||
is_opaque: bool,
|
||||
);
|
||||
|
||||
fn com_dc_destroy_surface(
|
||||
|
@ -98,15 +97,13 @@ pub fn create_surface(
|
|||
id: u64,
|
||||
width: i32,
|
||||
height: i32,
|
||||
is_opaque: bool,
|
||||
) {
|
||||
unsafe {
|
||||
com_dc_create_surface(
|
||||
window,
|
||||
id,
|
||||
width,
|
||||
height,
|
||||
is_opaque
|
||||
height
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -42,15 +42,8 @@ impl webrender::Compositor for DirectCompositeInterface {
|
|||
&mut self,
|
||||
id: webrender::NativeSurfaceId,
|
||||
size: DeviceIntSize,
|
||||
is_opaque: bool,
|
||||
) {
|
||||
compositor::create_surface(
|
||||
self.window,
|
||||
id.0,
|
||||
size.width,
|
||||
size.height,
|
||||
is_opaque,
|
||||
);
|
||||
compositor::create_surface(self.window, id.0, size.width, size.height);
|
||||
}
|
||||
|
||||
fn destroy_surface(
|
||||
|
|
|
@ -19,7 +19,6 @@ use crate::picture::{ResolvedSurfaceTexture, SurfaceTextureDescriptor};
|
|||
pub enum NativeSurfaceOperationDetails {
|
||||
CreateSurface {
|
||||
size: DeviceIntSize,
|
||||
is_opaque: bool,
|
||||
},
|
||||
DestroySurface,
|
||||
}
|
||||
|
@ -163,14 +162,12 @@ impl CompositeState {
|
|||
&mut self,
|
||||
id: NativeSurfaceId,
|
||||
size: DeviceIntSize,
|
||||
is_opaque: bool,
|
||||
) -> SurfaceTextureDescriptor {
|
||||
self.native_surface_updates.push(
|
||||
NativeSurfaceOperation {
|
||||
id,
|
||||
details: NativeSurfaceOperationDetails::CreateSurface {
|
||||
size,
|
||||
is_opaque,
|
||||
}
|
||||
}
|
||||
);
|
||||
|
@ -234,7 +231,6 @@ pub trait Compositor {
|
|||
&mut self,
|
||||
id: NativeSurfaceId,
|
||||
size: DeviceIntSize,
|
||||
is_opaque: bool,
|
||||
);
|
||||
|
||||
/// Destroy the surface with the specified id. WR may call this
|
||||
|
|
|
@ -726,9 +726,7 @@ impl Tile {
|
|||
state: &mut TilePostUpdateState,
|
||||
) -> bool {
|
||||
// Check if this tile can be considered opaque.
|
||||
let tile_is_opaque = ctx.backdrop.rect.contains_rect(&self.clipped_rect);
|
||||
let opacity_changed = tile_is_opaque != self.is_opaque;
|
||||
self.is_opaque = tile_is_opaque;
|
||||
self.is_opaque = ctx.backdrop.rect.contains_rect(&self.clipped_rect);
|
||||
|
||||
// Invalidate the tile based on the content changing.
|
||||
self.update_content_validity(ctx, state);
|
||||
|
@ -805,34 +803,8 @@ impl Tile {
|
|||
// the tile was previously a color, or not set, then just set
|
||||
// up a new texture cache handle.
|
||||
match self.surface.take() {
|
||||
Some(TileSurface::Texture { descriptor, visibility_mask }) => {
|
||||
// If opacity changed, and this is a native OS compositor surface,
|
||||
// it needs to be recreated.
|
||||
// TODO(gw): This is a limitation of the DirectComposite APIs. It might
|
||||
// make sense on other platforms to be able to change this as
|
||||
// a property on a surface, if we ever see pages where this
|
||||
// is changing frequently.
|
||||
if opacity_changed {
|
||||
if let SurfaceTextureDescriptor::NativeSurface { id, size } = descriptor {
|
||||
// Reset the dirty rect and tile validity in this case, to
|
||||
// force the new tile to be completely redrawn.
|
||||
self.dirty_rect = self.rect;
|
||||
self.is_valid = false;
|
||||
|
||||
state.composite_state.destroy_surface(id);
|
||||
state.composite_state.create_surface(
|
||||
id,
|
||||
size,
|
||||
self.is_opaque,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// Reuse the existing descriptor and vis mask
|
||||
TileSurface::Texture {
|
||||
descriptor,
|
||||
visibility_mask,
|
||||
}
|
||||
Some(old_surface @ TileSurface::Texture { .. }) => {
|
||||
old_surface
|
||||
}
|
||||
Some(TileSurface::Color { .. }) | Some(TileSurface::Clear) | None => {
|
||||
// This is the case where we are constructing a tile surface that
|
||||
|
@ -853,7 +825,6 @@ impl Tile {
|
|||
state.composite_state.create_surface(
|
||||
NativeSurfaceId(self.id.0 as u64),
|
||||
ctx.current_tile_size,
|
||||
self.is_opaque,
|
||||
)
|
||||
}
|
||||
};
|
||||
|
|
|
@ -4883,14 +4883,13 @@ impl Renderer {
|
|||
CompositorConfig::Native { ref mut compositor, .. } => {
|
||||
for op in &composite_state.native_surface_updates {
|
||||
match op.details {
|
||||
NativeSurfaceOperationDetails::CreateSurface { size, is_opaque } => {
|
||||
NativeSurfaceOperationDetails::CreateSurface { size } => {
|
||||
let _inserted = self.allocated_native_surfaces.insert(op.id);
|
||||
debug_assert!(_inserted, "bug: creating existing surface");
|
||||
|
||||
compositor.create_surface(
|
||||
op.id,
|
||||
size,
|
||||
is_opaque,
|
||||
);
|
||||
}
|
||||
NativeSurfaceOperationDetails::DestroySurface => {
|
||||
|
|
Загрузка…
Ссылка в новой задаче