Closed
Bug 1233605
Opened 9 years ago
Closed 8 years ago
Cull some uses of gfxContext
Categories
(Core :: Layout, defect)
Core
Layout
Tracking
()
RESOLVED
FIXED
mozilla46
Tracking | Status | |
---|---|---|
firefox46 | --- | fixed |
People
(Reporter: n.nethercote, Assigned: n.nethercote)
Details
Attachments
(1 file)
10.77 KB,
patch
|
dholbert
:
review+
|
Details | Diff | Splinter Review |
Simple stuff.
Assignee | ||
Comment 1•9 years ago
|
||
Attachment #8699768 -
Flags: review?(dholbert)
Comment 2•9 years ago
|
||
Comment on attachment 8699768 [details] [diff] [review] Cull some uses of gfxContext Review of attachment 8699768 [details] [diff] [review]: ----------------------------------------------------------------- [Looks like this is a no-op change; just pushing some DrawTarget lookups that are already happening to happen at more logical points, to reduce gfxContext usage. Cool.] Just one nit: ::: gfx/thebes/gfxFont.cpp @@ +1798,5 @@ > } > } > > if (fontParams.haveColorGlyphs && > + RenderColorGlyph(runParams.context->GetDrawTarget(), [tl;dr: use runParams.dt here.] Technically, this looks correct (in that you're just pushing the context->GetDrawTarget() lookup up one stack-level). *But*: runParams.context->GetDrawTarget() is probably overly-verbose, because runParams has an explicit ".dt" member (which is a reference to a DrawTarget), and we use that elsewhere in this file: https://mxr.mozilla.org/mozilla-central/search?string=arams.dt&find=gfxFont.cpp And it looks like it's set up to be the same value you're using here (context->GetDrawTarget()), at least in the TextRunDrawParams that are instantiated in gfxTextRun.cpp (the only ones I found in some quick looking). So I'm 99% sure you can assume .dt is equivalent to what you're using, and shorter & better (because it removes another gfxContext usage, hooray). ::: layout/base/FrameLayerBuilder.cpp @@ +5728,5 @@ > * items separately for each rect in the visible region rather > * than clipping to a complex region. > */ > +static bool > +ShouldDrawRectsSeparately(DrawTarget& aDrawTarget, DrawRegionClip aClip) <tangent> I'm uncomfortable passing around C++ references to refcounted objects, for reasons discussed in bug 1230056 comment 3. But I guess the caller already has a "DrawTarget&" in this case, so it's semi-natural for this helper-function to take that as well. Maybe this is more common than I thought, and I should relax my uneasiness? not sure. </tangent> In any case, this seems fine given that you're just using what the calling code already has.)
Attachment #8699768 -
Flags: review?(dholbert) → review+
Comment 3•9 years ago
|
||
(In reply to Daniel Holbert [:dholbert] from comment #2) > <tangent> > I'm uncomfortable passing around C++ references to refcounted objects, for > reasons discussed in bug 1230056 comment 3. Sorry, wrong comment-number -- I meant to say "bug 1230056 comment 6" here.
Assignee | ||
Comment 4•9 years ago
|
||
Thank you for the fast review. > [Looks like this is a no-op change; just pushing some DrawTarget lookups > that are already happening to happen at more logical points, to reduce > gfxContext usage. Cool.] Correct. > [tl;dr: use runParams.dt here.] Ah yes. I previously considered removing rumParams.dt and using runParams.context.GetDrawTarget() throughout to make things clearer but didn't because it made things more verbose. > <tangent> > I'm uncomfortable passing around C++ references to refcounted objects, for > reasons discussed in bug 1230056 comment 3. But I guess the caller already > has a "DrawTarget&" in this case, so it's semi-natural for this > helper-function to take that as well. Maybe this is more common than I > thought, and I should relax my uneasiness? not sure. > </tangent> > > In any case, this seems fine given that you're just using what the calling > code already has.) We do have plenty of gfxContext& and DrawTarget& parameters in the code, but it's a reasonable objection and I've mostly been using DrawTarget* in other code I've converted, so I'll do likewise here.
Assignee | ||
Comment 5•8 years ago
|
||
https://hg.mozilla.org/integration/mozilla-inbound/rev/41a7345c2c4aa3b2a4dbf7b5a6b65fc28027d523 Bug 1233605 - Cull some uses of gfxContext. r=dholbert.
Comment 6•8 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/41a7345c2c4a
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
status-firefox46:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla46
You need to log in
before you can comment on or make changes to this bug.
Description
•