Closed Bug 930451 Opened 12 years ago Closed 12 years ago

SVG doesn't cache its gradient stops

Categories

(Core :: Graphics, defect)

x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla28
Tracking Status
firefox26 --- fixed
firefox27 --- fixed
firefox28 --- fixed
b2g-v1.2 --- fixed

People

(Reporter: gal, Assigned: gal)

References

(Blocks 1 open bug)

Details

(Whiteboard: [qa-])

Attachments

(3 files, 7 obsolete files)

10.92 KB, patch
gal
: review+
Details | Diff | Splinter Review
4.02 KB, patch
gal
: review+
Details | Diff | Splinter Review
18.09 KB, patch
roc
: review+
Details | Diff | Splinter Review
Azure backends rely on this for caching. I will factor out the caching code in nsCSSRendering and then use that for SVG as well. nsCSSRenderingBorders has its own cache, thats fine I guess, because those gradients are kinda special.
Blocks: 930445
Assignee: nobody → gal
Attachment #821910 - Flags: review?(roc)
Attachment #821912 - Flags: review?(roc)
Attachment #821914 - Flags: review?(roc)
Comment on attachment 821910 [details] [diff] [review] Part 1: Factor out CSS gradient cache into a new class Rendering Review of attachment 821910 [details] [diff] [review]: ----------------------------------------------------------------- Did you forget to "hg add" the new files?
Attachment #821910 - Flags: review?(roc) → review-
Amateur mistake. How embarrassing. Sigh.
Attachment #821910 - Attachment is obsolete: true
Attachment #821967 - Flags: review?(roc)
Attachment #821912 - Attachment is obsolete: true
Attachment #821912 - Flags: review?(roc)
Attachment #821968 - Flags: review?(roc)
Attachment #821914 - Attachment is obsolete: true
Attachment #821914 - Flags: review?(roc)
Attachment #821970 - Flags: review?(roc)
Comment on attachment 821967 [details] [diff] [review] Part 1: Factor out CSS gradient cache into a new class Rendering Review of attachment 821967 [details] [diff] [review]: ----------------------------------------------------------------- Driving by... What else is planned for the Rendering class? I'm asking because it has a very general name, so I'm anticipating more things are coming. If that's the case, it may be worth putting a comment in the class header to cover this... ::: layout/base/Rendering.h @@ +16,5 @@ > + static void Shutdown(); > + > + static Rendering &Instance(); > + > + gfx::GradientStops *GetGradientStops(gfx::DrawTarget *aDT, You may get called on the white space usage of "Class *var" instead of "Class* var", but I think all of those are inherited from the cut and paste code, so that may be a way to leave it?
Comment on attachment 821967 [details] [diff] [review] Part 1: Factor out CSS gradient cache into a new class Rendering Review of attachment 821967 [details] [diff] [review]: ----------------------------------------------------------------- ::: layout/base/Rendering.h @@ +4,5 @@ > + * License, v. 2.0. If a copy of the MPL was not distributed with this > + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ > + > +#include "nsTArray.h" > +#include "gfxPattern.h" I don't think you need to #include gfxPattern.h. @@ +9,5 @@ > +#include "mozilla/gfx/2D.h" > + > +namespace mozilla { > + > +class Rendering { This needs a more descriptive name. LayoutGradientCache? @@ +14,5 @@ > +public: > + static void Init(); > + static void Shutdown(); > + > + static Rendering &Instance(); We don't need an instance of this class. Just make the methods static.
Attachment #821967 - Flags: review?(roc) → review-
Comment on attachment 821970 [details] [diff] [review] Part 3: Use the Rendering gradient cache for SVG gradients as well. Review of attachment 821970 [details] [diff] [review]: ----------------------------------------------------------------- ::: gfx/thebes/gfxPattern.cpp @@ +106,5 @@ > + gfxGradientCache &aCache) > +{ > + if (mPattern) { > + mStops = nullptr; > + nsTArray<GradientStop> stops; nsAutoTArray<GradientStop,3> or something like that @@ +120,5 @@ > + mStops = aCache.GetOrCreateGradientStops(aDT, > + stops, > + (cairo_pattern_get_extend(mPattern) == CAIRO_EXTEND_REPEAT) > + ? mozilla::gfx::EXTEND_REPEAT > + : mozilla::gfx::EXTEND_CLAMP); This file should have "using mozilla::gfx;" if it doesn't already so we don't have to use these prefixes.
Attachment #821970 - Flags: review?(roc) → review+
Comment on attachment 821967 [details] [diff] [review] Part 1: Factor out CSS gradient cache into a new class Rendering Review of attachment 821967 [details] [diff] [review]: ----------------------------------------------------------------- Actually, since you're going to use this from gfx, I think it should live in gfx.
Rendering was meant as an abstraction nsCSSRendering and something equivalent for SVG rendering (nsSVGRendering, we just don't have it) into -> Rendering, that is used by both. As usual, I am totally neutral on naming. I will name it anything you want.
I think we should move it to gfx/thebes and call it gfxGradientCache.
I thought we are deleting thebes? Happy to do it but isn't gfx/src better?
There's a lot of stuff in gfx/thebes that's not gfxContext-related (e.g. all of our text stuff). I'd put it there with a gfx prefix (like gfxGradientCache), and we can have a reshuffling at some point in the future when we're bored :)
Attachment #821967 - Attachment is obsolete: true
Attachment #822664 - Flags: review?(roc)
Attachment #821970 - Attachment is obsolete: true
Attachment #822666 - Flags: review+
Attachment #822664 - Attachment is obsolete: true
Attachment #822664 - Flags: review?(roc)
Attachment #822668 - Flags: review?(roc)
(In reply to Ryan VanderMeulen [:RyanVM UTC-5] from comment #22) > Backports on top of bug 934860: > Aurora: https://tbpl.mozilla.org/?tree=Try&rev=72effc5856f0 > Beta: https://tbpl.mozilla.org/?tree=Try&rev=c13c3ee1695c Had to do another beta push due to Try not liking to build Windows off beta with the switch to rev2 build slaves. https://tbpl.mozilla.org/?tree=Try&rev=0059fd7074b6 The good news is that we're all green :)
Comment on attachment 822668 [details] [diff] [review] Part 1: Factor out CSS gradient cache into a new class gfxGradientCache [Approval Request Comment] Bug caused by (feature/regressing bug #): None, but fixes a performance regression caused by bug 934860 User impact if declined: SVG gradient performance regression if uplift bug 934860. Testing completed (on m-c, etc.): Been on m-c for a few days, Ryan has done try pushes for aurora/beta that came back green. Risk to taking this patch (and alternatives if risky): Should be fairly low risk, mostly just refactoring and then caching gradients in one extra place. String or IDL/UUID changes made by this patch: None
Attachment #822668 - Flags: approval-mozilla-beta?
Attachment #822668 - Flags: approval-mozilla-aurora?
Attachment #822668 - Flags: approval-mozilla-beta?
Attachment #822668 - Flags: approval-mozilla-beta+
Attachment #822668 - Flags: approval-mozilla-aurora?
Attachment #822668 - Flags: approval-mozilla-aurora+
Whiteboard: [qa-]
Depends on: 989230
Depends on: 1154865
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: