Open Bug 1429792 Opened 8 years ago Updated 3 years ago

Expose const pointer to BaseRect internal data for special and limited use

Categories

(Core :: Graphics, enhancement, P3)

enhancement

Tracking

()

People

(Reporter: milan, Unassigned)

References

Details

(Whiteboard: [gfx-noted])

Attachments

(1 file)

Example is a Hash() method https://dxr.mozilla.org/mozilla-central/source/layout/painting/MaskLayerImageCache.h#112 that wants a pointer to data in order to hash, but doesn't try to interpret the data in any particular way.
This didn't occur to me yesterday, but now I'm wondering -- can't we just directly use the Rect pointer itself for hashing etc, rather than needing a pointer to its member data? e.g. in MaskLayerImageCache.h's hash function, couldn't we replace this... PLDHashNumber hash = HashBytes(&mRect.x, 4*sizeof(gfxFloat)); ...with this: HashBytes(&mRect, sizeof(mRect)); ? I can imagine this general approach being problematic if we expected arbitrarily-filled packing space between the member-variables or stuff like that, but I don't think that should happen here...
(Sorry, I was of course missing a "PLDHashNumber hash =" in my possible-replacement code -- but you get the idea.)
I don't have a preference.
Comment on attachment 8941844 [details] Bug 1429792: Allow const pointer access to underlying BaseRect data, for special and limited use. .schouten https://reviewboard.mozilla.org/r/212072/#review217980 If that's the only usecase, for the sake of simplicity I agree with Daniel.
Attachment #8941844 - Flags: review?(bas) → review-
So far, the only use case. I'm going to keep this open with bug 1390110 in mind.
See Also: → 1390110
Priority: -- → P3
Whiteboard: [gfx-noted]
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: