зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1330945 - Part1. Apply opacity to webrender stacking context as an opacity filter. r=jrmuizel
This commit is contained in:
Родитель
16ff67be84
Коммит
b4d6b03c03
|
@ -29,6 +29,7 @@ struct OpDPPushStackingContext {
|
|||
WrRect bounds;
|
||||
WrRect overflow;
|
||||
MaybeImageMask mask;
|
||||
float opacity;
|
||||
Animation[] animations;
|
||||
Matrix4x4 matrix;
|
||||
WrMixBlendMode mixBlendMode;
|
||||
|
|
|
@ -47,6 +47,7 @@ WebRenderBorderLayer::RenderLayer()
|
|||
OpDPPushStackingContext(wr::ToWrRect(relBounds),
|
||||
wr::ToWrRect(overflow),
|
||||
Nothing(),
|
||||
1.0f,
|
||||
GetAnimations(),
|
||||
transform,
|
||||
WrMixBlendMode::Normal,
|
||||
|
|
|
@ -311,7 +311,7 @@ WebRenderBridgeParent::ProcessWebrenderCommands(InfallibleTArray<WebRenderComman
|
|||
switch (cmd.type()) {
|
||||
case WebRenderCommand::TOpDPPushStackingContext: {
|
||||
const OpDPPushStackingContext& op = cmd.get_OpDPPushStackingContext();
|
||||
builder.PushStackingContext(op.bounds(), op.overflow(), op.mask().ptrOr(nullptr), op.matrix(), op.mixBlendMode());
|
||||
builder.PushStackingContext(op.bounds(), op.overflow(), op.mask().ptrOr(nullptr), op.opacity(), op.matrix(), op.mixBlendMode());
|
||||
break;
|
||||
}
|
||||
case WebRenderCommand::TOpDPPopStackingContext: {
|
||||
|
|
|
@ -92,6 +92,7 @@ WebRenderCanvasLayer::RenderLayer()
|
|||
OpDPPushStackingContext(wr::ToWrRect(relBounds),
|
||||
wr::ToWrRect(overflow),
|
||||
mask,
|
||||
1.0f,
|
||||
GetAnimations(),
|
||||
transform,
|
||||
mixBlendMode,
|
||||
|
|
|
@ -50,6 +50,7 @@ WebRenderColorLayer::RenderLayer()
|
|||
OpDPPushStackingContext(wr::ToWrRect(relBounds),
|
||||
wr::ToWrRect(overflow),
|
||||
mask,
|
||||
1.0f,
|
||||
GetAnimations(),
|
||||
transform,
|
||||
mixBlendMode,
|
||||
|
|
|
@ -39,6 +39,7 @@ WebRenderContainerLayer::RenderLayer()
|
|||
OpDPPushStackingContext(wr::ToWrRect(relBounds),
|
||||
wr::ToWrRect(overflow),
|
||||
mask,
|
||||
GetLocalOpacity(),
|
||||
GetLayer()->GetAnimations(),
|
||||
transform,
|
||||
mixBlendMode,
|
||||
|
|
|
@ -160,6 +160,7 @@ WebRenderImageLayer::RenderLayer()
|
|||
OpDPPushStackingContext(wr::ToWrRect(relBounds),
|
||||
wr::ToWrRect(overflow),
|
||||
mask,
|
||||
1.0f,
|
||||
GetAnimations(),
|
||||
transform,
|
||||
mixBlendMode,
|
||||
|
|
|
@ -161,6 +161,7 @@ WrScrollFrameStackingContextGenerator::WrScrollFrameStackingContextGenerator(
|
|||
OpDPPushStackingContext(wr::ToWrRect(bounds),
|
||||
wr::ToWrRect(overflow),
|
||||
Nothing(),
|
||||
1.0f,
|
||||
layer->GetAnimations(),
|
||||
identity,
|
||||
WrMixBlendMode::Normal,
|
||||
|
|
|
@ -162,6 +162,7 @@ WebRenderPaintedLayer::RenderLayer()
|
|||
OpDPPushStackingContext(wr::ToWrRect(relBounds),
|
||||
wr::ToWrRect(overflow),
|
||||
mask,
|
||||
1.0f,
|
||||
GetAnimations(),
|
||||
transform,
|
||||
mixBlendMode,
|
||||
|
|
|
@ -342,10 +342,11 @@ void
|
|||
DisplayListBuilder::PushStackingContext(const WrRect& aBounds,
|
||||
const WrRect& aOverflow,
|
||||
const WrImageMask* aMask,
|
||||
const float aOpacity,
|
||||
const gfx::Matrix4x4& aTransform,
|
||||
const WrMixBlendMode& aMixBlendMode)
|
||||
{
|
||||
wr_dp_push_stacking_context(mWrState, aBounds, aOverflow, aMask,
|
||||
wr_dp_push_stacking_context(mWrState, aBounds, aOverflow, aMask, aOpacity,
|
||||
&aTransform.components[0], aMixBlendMode);
|
||||
}
|
||||
|
||||
|
|
|
@ -108,6 +108,7 @@ public:
|
|||
void PushStackingContext(const WrRect& aBounds, // TODO: We should work with strongly typed rects
|
||||
const WrRect& aOverflow,
|
||||
const WrImageMask* aMask, // TODO: needs a wrapper.
|
||||
const float aOpacity,
|
||||
const gfx::Matrix4x4& aTransform,
|
||||
const WrMixBlendMode& aMixBlendMode);
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ use gleam::gl;
|
|||
use webrender_traits::{BorderSide, BorderStyle, BorderRadius};
|
||||
use webrender_traits::{PipelineId, ClipRegion};
|
||||
use webrender_traits::{Epoch, ColorF, GlyphInstance, ImageDescriptor};
|
||||
use webrender_traits::{ImageData, ImageFormat, ImageKey, ImageMask, ImageRendering, RendererKind, MixBlendMode};
|
||||
use webrender_traits::{FilterOp, ImageData, ImageFormat, ImageKey, ImageMask, ImageRendering, RendererKind, MixBlendMode};
|
||||
use webrender_traits::{ExternalImageId, RenderApi, FontKey};
|
||||
use webrender_traits::{DeviceUintSize, ExternalEvent};
|
||||
use webrender_traits::{LayoutPoint, LayoutRect, LayoutSize, LayoutTransform};
|
||||
|
@ -561,7 +561,7 @@ pub extern fn wr_window_dp_begin(window: &mut WrWindowState, state: &mut WrState
|
|||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern fn wr_dp_push_stacking_context(state:&mut WrState, bounds: WrRect, overflow: WrRect, mask: *const WrImageMask, transform: &LayoutTransform, mix_blend_mode: WrMixBlendMode)
|
||||
pub extern fn wr_dp_push_stacking_context(state:&mut WrState, bounds: WrRect, overflow: WrRect, mask: *const WrImageMask, opacity: f32, transform: &LayoutTransform, mix_blend_mode: WrMixBlendMode)
|
||||
{
|
||||
assert!( unsafe { is_in_compositor_thread() });
|
||||
state.z_index += 1;
|
||||
|
@ -574,6 +574,11 @@ pub extern fn wr_dp_push_stacking_context(state:&mut WrState, bounds: WrRect, ov
|
|||
|
||||
let clip_region = state.frame_builder.dl_builder.new_clip_region(&overflow, vec![], mask);
|
||||
|
||||
let mut filters: Vec<FilterOp> = Vec::new();
|
||||
if opacity < 1.0 {
|
||||
filters.push(FilterOp::Opacity(opacity));
|
||||
}
|
||||
|
||||
state.frame_builder.dl_builder.push_stacking_context(webrender_traits::ScrollPolicy::Scrollable,
|
||||
bounds,
|
||||
clip_region,
|
||||
|
@ -581,7 +586,7 @@ pub extern fn wr_dp_push_stacking_context(state:&mut WrState, bounds: WrRect, ov
|
|||
transform,
|
||||
&LayoutTransform::identity(),
|
||||
mix_blend_mode,
|
||||
Vec::new());
|
||||
filters);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -431,7 +431,8 @@ WR_FUNC;
|
|||
WR_INLINE void
|
||||
wr_dp_push_stacking_context(WrState *wrState, WrRect bounds,
|
||||
WrRect overflow, const WrImageMask *mask,
|
||||
const float* matrix, WrMixBlendMode mixBlendMode)
|
||||
float opacity, const float* matrix,
|
||||
WrMixBlendMode mixBlendMode)
|
||||
WR_FUNC;
|
||||
|
||||
//XXX: matrix should use a proper type
|
||||
|
|
Загрузка…
Ссылка в новой задаче