Closed
Bug 1345523
Opened 7 years ago
Closed 7 years ago
Clean up duplicated WebRenderLayer code
Categories
(Core :: Graphics: WebRender, enhancement)
Tracking
()
RESOLVED
FIXED
mozilla55
People
(Reporter: mchang, Assigned: mchang)
Details
Attachments
(4 files, 1 obsolete file)
2.30 KB,
patch
|
kats
:
review+
|
Details | Diff | Splinter Review |
4.94 KB,
patch
|
kats
:
review+
|
Details | Diff | Splinter Review |
7.36 KB,
patch
|
kats
:
review+
|
Details | Diff | Splinter Review |
7.64 KB,
patch
|
kats
:
review+
|
Details | Diff | Splinter Review |
Lots of the layers have the same duplicated code of get a rect, get clip rect, rel bounds, and dumping the layer info. Refactor it out a bit.
Assignee | ||
Comment 1•7 years ago
|
||
Attachment #8844972 -
Flags: review?(bugmail)
Comment 2•7 years ago
|
||
Comment on attachment 8844972 [details] [diff] [review] Refactor out duplicate code in WebRenderLayer Review of attachment 8844972 [details] [diff] [review]: ----------------------------------------------------------------- Conceptually ok, but it's hard to review and make sure there's no errors. I found at least one (see below). It might be better to split this patch into a series where you extract one method at a time. It would be much easier to review. ::: gfx/layers/wr/WebRenderLayerManager.cpp @@ +187,5 @@ > > +void > +WebRenderLayer::DumpLayersInfo(const char* aLayerType) > +{ > + Layer* layer = GetLayer(); You can refactor the DumpLayersInfo function to also use the helpers (GetBounds, GetWrClipRect, etc). But more importantly, move the "if (gfxPrefs::LayersDump())" guard up to the top and do an early-exit so we don't spend all this time computing variables we're never going to print. ::: gfx/layers/wr/WebRenderTextLayer.cpp @@ -26,5 @@ > > gfx::Rect rect = RelativeToParent(GetTransform().TransformBounds(IntRectToRect(mBounds))); > - gfx::Rect clip; > - if (GetClipRect().isSome()) { > - clip = RelativeToParent(IntRectToRect(GetClipRect().ref().ToUnknownRect())); This one does a RelativeToParent, but GetWrClipRect does a RelativeToVisible with some transform stuff. That seems different.
Attachment #8844972 -
Flags: review?(bugmail)
Assignee | ||
Comment 3•7 years ago
|
||
Attachment #8844972 -
Attachment is obsolete: true
Attachment #8845018 -
Flags: review?(bugmail)
Assignee | ||
Comment 4•7 years ago
|
||
Attachment #8845019 -
Flags: review?(bugmail)
Assignee | ||
Comment 5•7 years ago
|
||
Attachment #8845020 -
Flags: review?(bugmail)
Assignee | ||
Comment 6•7 years ago
|
||
Attachment #8845022 -
Flags: review?(bugmail)
Comment 7•7 years ago
|
||
Comment on attachment 8845018 [details] [diff] [review] Part 1: Extract out WrBoundsRect Review of attachment 8845018 [details] [diff] [review]: ----------------------------------------------------------------- Patch is backwards but otherwise r+
Attachment #8845018 -
Flags: review?(bugmail) → review+
Comment 8•7 years ago
|
||
Comment on attachment 8845019 [details] [diff] [review] Part 2: Extract out WrClipRect Review of attachment 8845019 [details] [diff] [review]: ----------------------------------------------------------------- ::: gfx/layers/wr/WebRenderLayerManager.cpp @@ +162,5 @@ > + clip = RelativeToVisible(transform.Inverse().TransformBounds( > + IntRectToRect(layer->GetClipRect().ref().ToUnknownRect())) > + ); > + } else { > + clip = aRect; nit: fix indent to be 2-spaces
Attachment #8845019 -
Flags: review?(bugmail) → review+
Updated•7 years ago
|
Attachment #8845020 -
Flags: review?(bugmail) → review+
Comment 9•7 years ago
|
||
Comment on attachment 8845022 [details] [diff] [review] Part 4: Extract out layers logging Review of attachment 8845022 [details] [diff] [review]: ----------------------------------------------------------------- ::: gfx/layers/wr/WebRenderBorderLayer.cpp @@ +33,5 @@ > wr::ToWrRect(overflow), > nullptr, > 1.0f, > //GetAnimations(), > + GetLayer()->GetTransform(), Drop the "GetLayer()->"
Attachment #8845022 -
Flags: review?(bugmail) → review+
Assignee | ||
Comment 10•7 years ago
|
||
Try looks good - https://treeherder.mozilla.org/#/jobs?repo=try&revision=3dc38fcf6afa9771801a57d690e936fecbb74ebd
Comment 11•7 years ago
|
||
Pushed by mchang@mozilla.com: https://hg.mozilla.org/projects/graphics/rev/0820edb5e1f5 Clean up duplicated WebRenderLayer code. r=kats
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Comment 12•7 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/0820edb5e1f5
Target Milestone: --- → mozilla55
You need to log in
before you can comment on or make changes to this bug.
Description
•