Closed
Bug 1073363
Opened 9 years ago
Closed 9 years ago
Add a GeneralPattern class to Moz2D to solve the problem of writing general pattern creation functions
Categories
(Core :: Graphics, defect)
Core
Graphics
Tracking
()
RESOLVED
FIXED
mozilla35
People
(Reporter: jwatt, Assigned: jwatt)
Details
Attachments
(3 files, 3 obsolete files)
5.29 KB,
patch
|
bas.schouten
:
review+
|
Details | Diff | Splinter Review |
5.61 KB,
patch
|
bas.schouten
:
review+
|
Details | Diff | Splinter Review |
12.88 KB,
patch
|
bas.schouten
:
review+
|
Details | Diff | Splinter Review |
No description provided.
![]() |
Assignee | |
Comment 1•9 years ago
|
||
Attachment #8495694 -
Flags: review?(bas)
![]() |
Assignee | |
Comment 2•9 years ago
|
||
An alternative to the Init* functions would be to replace them with a function that returns an address for use with the placement operator: Pattern* ctorAddr(PatternType aType) { MOZ_ASSERT(!mPattern); switch (aType) { case PatternType::COLOR: return mPattern = mColorPattern.addr(); case PatternType::LINEAR_GRADIENT: return mPattern = mLinearGradientPattern.addr(); case PatternType::RADIAL_GRADIENT: return mPattern = mRadialGradientPattern.addr(); case PatternType::SURFACE: return mPattern = mSurfacePattern.addr(); default: MOZ_MAKE_COMPILER_ASSUME_IS_UNREACHABLE("Unexpected pattern type"); } Assuming that in the general pattern creation function the GeneralPattern is aPattern, you'd then initialize a pattern like: ColorPattern pattern = new (aPattern->ctorAddr(PatternType::COLOR) ColorPattern(color); instead of: ColorPattern pattern = aPattern->InitColorPattern(color); Other than making calling code a bit more verbose, I'm not totally loving that this would mean assigning to mPattern without actually knowing that the ctorAddr caller is calling the [appropriate] ctor.
![]() |
Assignee | |
Comment 3•9 years ago
|
||
Attachment #8495694 -
Attachment is obsolete: true
Attachment #8495694 -
Flags: review?(bas)
Attachment #8495762 -
Flags: review?(bas)
![]() |
Assignee | |
Comment 4•9 years ago
|
||
Attachment #8495764 -
Flags: review?(bas)
![]() |
Assignee | |
Comment 5•9 years ago
|
||
Feel free to r- this part, or just r+ the canvas part (not sure the gfxPattern changes are worth it, given that it's going to go away in the short to medium term).
Attachment #8495765 -
Flags: review?(bas)
![]() |
Assignee | |
Comment 6•9 years ago
|
||
Put in its own file, as requested on IRC.
Attachment #8495764 -
Attachment is obsolete: true
Attachment #8495764 -
Flags: review?(bas)
Attachment #8496448 -
Flags: review?(bas)
![]() |
Assignee | |
Comment 7•9 years ago
|
||
Attachment #8495765 -
Attachment is obsolete: true
Attachment #8495765 -
Flags: review?(bas)
Attachment #8496449 -
Flags: review?(bas)
Updated•9 years ago
|
Attachment #8495762 -
Flags: review?(bas) → review+
Updated•9 years ago
|
Attachment #8496448 -
Flags: review?(bas) → review+
Updated•9 years ago
|
Attachment #8496449 -
Flags: review?(bas) → review+
![]() |
Assignee | |
Comment 8•9 years ago
|
||
https://hg.mozilla.org/integration/mozilla-inbound/rev/51d7456575e8 https://hg.mozilla.org/integration/mozilla-inbound/rev/f3e489423a76 https://hg.mozilla.org/integration/mozilla-inbound/rev/3255a9151456
Comment 9•9 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/51d7456575e8 https://hg.mozilla.org/mozilla-central/rev/f3e489423a76 https://hg.mozilla.org/mozilla-central/rev/3255a9151456
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla35
You need to log in
before you can comment on or make changes to this bug.
Description
•