Closed
Bug 602431
Opened 14 years ago
Closed 14 years ago
Post-process shadow layer tree to make its coordinates match up with parent's layer tree
Categories
(Core :: Layout, defect)
Core
Layout
Tracking
()
RESOLVED
FIXED
Tracking | Status | |
---|---|---|
fennec | 2.0b2+ | --- |
People
(Reporter: cjones, Assigned: cjones)
References
Details
Attachments
(7 files)
13.19 KB,
patch
|
roc
:
review+
vlad
:
superreview+
|
Details | Diff | Splinter Review |
8.42 KB,
patch
|
roc
:
superreview+
|
Details | Diff | Splinter Review |
12.24 KB,
patch
|
roc
:
superreview+
|
Details | Diff | Splinter Review |
5.84 KB,
patch
|
tnikkel
:
review+
|
Details | Diff | Splinter Review |
part 5: Add an extra phase to update shadow-layer attributes (not used for anything interesting yet)
5.85 KB,
patch
|
tnikkel
:
review+
|
Details | Diff | Splinter Review |
3.89 KB,
patch
|
roc
:
review+
|
Details | Diff | Splinter Review |
7.96 KB,
patch
|
vlad
:
review+
|
Details | Diff | Splinter Review |
We need to
(1) add a ShadowLayer base class
(2) add ShadowContainerLayer and ShadowColorLayer
(3) give ShadowLayer its own mShadowTransform, mShadowVisible, and mShadowClip (I think that's all we need atm)
(4) on shadow-tree updates, run a pass over the shadow tree somewhat analogous to FrameLayerBuilder (but much simpler!) to update the shadows' mShadowVisible et al. to be match compositor-process coordinates, taking viewportScale/Scroll etc. into account. This will be an expanded version of the current SetTransformFor() in RenderFrameParent.
(5) have *Shadow*Layer*::Paint/Render use the mShadowVisible et al. values when painting
We need all of these to be able to composite shadow layers with the GL backend. (Various hacks to get this working to various degrees are possible, but they're going to be fragile. Let's fix it for realz now.) We'll extend part (4) in bug 586288 to also take sub-frame scrolling into account when updating mShadow*.
Assignee | ||
Updated•14 years ago
|
tracking-fennec: --- → ?
Assignee | ||
Comment 1•14 years ago
|
||
Note re: risk: we can implement all this and (mostly) leave the current basic layers code alone, since it's forgiving enough to work with the values from the content process.
Assignee | ||
Comment 2•14 years ago
|
||
(In reply to comment #0)
> (4) on shadow-tree updates, run a pass over the shadow tree somewhat analogous
> to FrameLayerBuilder
Correction: this should run on nsDisplayRemote::BuildLayer().
Assignee | ||
Comment 3•14 years ago
|
||
We might be able to re-use this mechanism for recompositing layer subtrees in -moz-element and <canvas> for both local and remote layer trees: create a shadow subtree from the original subtree and then adjust the shadow attributes as necessary for the secondary render target.
Updated•14 years ago
|
tracking-fennec: ? → 2.0b2+
Comment 4•14 years ago
|
||
Making you (cjones) own this for now. Disown as you deem necessary.
Assignee: nobody → jones.chris.g
It's not clear to me why we need to add mShadow state. Why can't we just pass a context parameter block down through Paint/Render which we use to compute the final state-to-use?
Assignee | ||
Comment 6•14 years ago
|
||
The hard requirement for this is to transform (well, translate and scale) subtrees of the main shadow tree independently of the main tree (bug 586288). We don't want to touch the layers' own transform/clip/visible values because the shadow is immutable in the parent process. I can't think of a sane way to pass a context block down the tree to implement that; we can't do this with basic layers either.
Another cool use (though farfetched) for this would be to implement a "layers-spy" app. We could use shadow attributes to split the sublayers apart.
We can also use this feature to correct even untransformed shadow layers' visible and clip rects to parent-window space. Passing a transform matrix down the tree would also work, but that would change layer semantics, and we'd have to implement that for D3D9 and D3D10 as well. I'd rather fix up shadow layers so that they don't (completely) rely on cairo. (The exception is resolution-scaled drawing.)
This would also work well for -moz-element and <canvas>, but passing down a context matrix would work too. Same case as above.
OK, that makes sense.
Updated•14 years ago
|
Status: NEW → ASSIGNED
Assignee | ||
Comment 8•14 years ago
|
||
Attachment #482459 -
Flags: superreview?(vladimir)
Attachment #482459 -
Flags: review?(roc)
Assignee | ||
Comment 9•14 years ago
|
||
Attachment #482460 -
Flags: superreview?(roc)
Assignee | ||
Comment 10•14 years ago
|
||
Attachment #482461 -
Flags: superreview?(roc)
Assignee | ||
Comment 11•14 years ago
|
||
Attachment #482462 -
Flags: review?(tnikkel)
Assignee | ||
Comment 12•14 years ago
|
||
Attachment #482463 -
Flags: review?(tnikkel)
Assignee | ||
Comment 13•14 years ago
|
||
Attachment #482464 -
Flags: review?(roc)
Assignee | ||
Comment 14•14 years ago
|
||
Attachment #482465 -
Flags: review?(vladimir)
Attachment #482459 -
Flags: review?(roc) → review+
Attachment #482460 -
Flags: superreview?(roc) → superreview+
Attachment #482461 -
Flags: superreview?(roc) → superreview+
Attachment #482464 -
Flags: review?(roc) → review+
Blocks: 602200
Assignee | ||
Comment 15•14 years ago
|
||
What I had in mind for applying this mechanism with -moz-element and canvas is
- move ShadowLayers.h into gfx/layers
- make IPC layers special cases of shadows, Shadow*LayerIPC or something
- allow creating Shadow*Layer from *Layer
- postprocess Shadow*Layers for particular use
That might be overkill for -moz-element. I was thinking of creating a new layer type, which might have some advantages. But we can discuss that elsewhere.
Updated•14 years ago
|
Attachment #482462 -
Flags: review?(tnikkel) → review+
Comment 17•14 years ago
|
||
Comment on attachment 482463 [details] [diff] [review]
part 5: Add an extra phase to update shadow-layer attributes (not used for anything interesting yet)
>+TransformShadowTreeTo(ContainerLayer* aRoot,
>+ gfxMatrix shadowTransform;
>+ shadow->GetShadowTransform().Is2D(&shadowTransform);
>+ // Pre-multiply this transform into the shadow's transform, so that
>+ // it occurs before any transform set by the child
>+ shadowTransform.Translate(gfxPoint(aTranslation.x, aTranslation.y));
>+ shadowTransform.Scale(aXScale, aYScale);
>+ shadow->SetShadowTransform(gfx3DMatrix::From2D(shadowTransform));
It seems like every time BuildLayer calls this function we will adding one more copy of the translate and scale. Is that not the case?
Attachment #482459 -
Flags: superreview?(vladimir) → superreview+
Attachment #482465 -
Flags: review?(vladimir) → review+
Assignee | ||
Comment 18•14 years ago
|
||
(In reply to comment #17)
> Comment on attachment 482463 [details] [diff] [review]
> part 5: Add an extra phase to update shadow-layer attributes (not used for
> anything interesting yet)
>
> >+TransformShadowTreeTo(ContainerLayer* aRoot,
> >+ gfxMatrix shadowTransform;
> >+ shadow->GetShadowTransform().Is2D(&shadowTransform);
> >+ // Pre-multiply this transform into the shadow's transform, so that
> >+ // it occurs before any transform set by the child
> >+ shadowTransform.Translate(gfxPoint(aTranslation.x, aTranslation.y));
> >+ shadowTransform.Scale(aXScale, aYScale);
> >+ shadow->SetShadowTransform(gfx3DMatrix::From2D(shadowTransform));
>
> It seems like every time BuildLayer calls this function we will adding one more
> copy of the translate and scale. Is that not the case?
No. The UpdateShadowTree() pass will copy over the attributes from the child process, then this code will modify those attributes anew on each BuildLayer.
Comment 19•14 years ago
|
||
(In reply to comment #18)
> No. The UpdateShadowTree() pass will copy over the attributes from the child
> process, then this code will modify those attributes anew on each BuildLayer.
Ah, ok.
Updated•14 years ago
|
Attachment #482463 -
Flags: review?(tnikkel) → review+
Assignee | ||
Comment 20•14 years ago
|
||
http://hg.mozilla.org/mozilla-central/rev/0a5ff3652a09
http://hg.mozilla.org/mozilla-central/rev/a27e7290bad9
http://hg.mozilla.org/mozilla-central/rev/0beb5c409b69
http://hg.mozilla.org/mozilla-central/rev/d35dc3b25cfa
http://hg.mozilla.org/mozilla-central/rev/d580cff50255
http://hg.mozilla.org/mozilla-central/rev/8652586c3908
http://hg.mozilla.org/mozilla-central/rev/6ed4740747a0
Status: ASSIGNED → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•