Closed Bug 316764 Opened 19 years ago Closed 19 years ago

Implement <svg:mask>

Categories

(Core :: SVG, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: tor, Assigned: tor)

References

()

Details

Attachments

(1 file, 6 obsolete files)

Attached patch <mask> implementation (obsolete) — Splinter Review
Attachment #203291 - Flags: review?(scootermorris)
Should nsSVGFeaturesList.h be modified to have http://www.w3.org/TR/SVG11/feature#Mask as a supported feature as part of this patch?
Attached patch modify feature list, too (obsolete) — Splinter Review
Attachment #203291 - Attachment is obsolete: true
Attachment #204045 - Flags: review?(scootermorris)
Attachment #203291 - Flags: review?(scootermorris)
Attached patch try the right attachment... (obsolete) — Splinter Review
Attachment #204045 - Attachment is obsolete: true
Attachment #204046 - Flags: review?(scootermorris)
Attachment #204045 - Flags: review?(scootermorris)
FYI: The tree has drifted underneath this patch (nsSVGUtils.h and nsSVGUtils.cpp to name two examples). Pretty simple to workaround, but I thought I'd let you know.
Attached patch update to tip (obsolete) — Splinter Review
Attachment #204046 - Attachment is obsolete: true
Attachment #207988 - Flags: review?(scootermorris)
Attachment #204046 - Flags: review?(scootermorris)
Attachment #207988 - Attachment is obsolete: true
Attachment #208766 - Flags: review?(scootermorris)
Attachment #207988 - Flags: review?(scootermorris)
Comment on attachment 208766 [details] [diff] [review] also fix clipPaths for multiple overlapping children >Index: layout/svg/base/src/nsSVGClipPathFrame.cpp > NS_IMETHODIMP > nsSVGClipPathFrame::ClipPaint(nsISVGRendererCanvas* canvas, >+ nsISVGRendererSurface* aClipSurface, > nsISVGChildFrame* aParent, > nsCOMPtr<nsIDOMSVGMatrix> aMatrix) > { > nsRect dirty; > nsresult rv; > > mClipParent = aParent, > mClipParentMatrix = aMatrix; > > NotifyCanvasTMChanged(PR_TRUE); > >- rv = canvas->SetRenderMode(nsISVGRendererCanvas::SVG_RENDER_MODE_CLIP); Could you provide a comment here about what IsTrivial means? Something like: // See if we have more than one SVG child. If not do a simple clip. >+ PRBool isTrivial; >+ IsTrivial(&isTrivial); >+ >+ if (isTrivial) >+ rv = canvas->SetRenderMode(nsISVGRendererCanvas::SVG_RENDER_MODE_CLIP); >+ else { >+ rv = canvas->SetRenderMode(nsISVGRendererCanvas::SVG_RENDER_MODE_CLIP_MASK); >+ >+ canvas->PushSurface(aClipSurface); >+ } >+ > > >Index: layout/svg/base/src/nsSVGGFrame.cpp >=================================================================== >@@ -112,66 +110,106 @@ nsSVGGFrame::PaintSVG(nsISVGRendererCanv > if (mFilter) { > if (!mFilterRegion) > mFilter->GetInvalidationRegion(this, getter_AddRefs(mFilterRegion)); > mFilter->FilterPaint(canvas, this); > return NS_OK; > } > } > >+ nsISVGOuterSVGFrame* outerSVGFrame = GetOuterSVGFrame(); >+ >+ /* check for a clip path */ >+ >+ PRBool trivialClip = PR_TRUE; > nsSVGClipPathFrame *clip = NULL; >+ nsCOMPtr<nsISVGRendererSurface> clipMaskSurface; >+ > aURI = GetStyleSVGReset()->mClipPath; > if (aURI) { > NS_GetSVGClipPathFrame(&clip, aURI, mContent); > > if (clip) { >- nsCOMPtr<nsIDOMSVGMatrix> matrix = GetCanvasTM(); >- canvas->PushClip(); >- clip->ClipPaint(canvas, this, matrix); Again, a comment would be helpful... >+ clip->IsTrivial(&trivialClip); >+ >+ if (trivialClip) { >+ canvas->PushClip(); >+ } else { >+ nsSVGUtils::GetSurface(outerSVGFrame, getter_AddRefs(clipMaskSurface)); >+ if (!clipMaskSurface) >+ clip = nsnull; >+ } >+ >+ if (clip) { >+ nsCOMPtr<nsIDOMSVGMatrix> matrix = GetCanvasTM(); >+ clip->ClipPaint(canvas, clipMaskSurface, this, matrix); >+ } > } > } >+ /* check for mask */ >+ >+ nsSVGMaskFrame *mask = nsnull; >+ nsCOMPtr<nsISVGRendererSurface> maskSurface, maskedSurface; >+ >+ aURI = GetStyleSVGReset()->mMask; >+ if (aURI) { >+ NS_GetSVGMaskFrame(&mask, aURI, mContent); >+ >+ if (mask) { >+ nsSVGUtils::GetSurface(outerSVGFrame, getter_AddRefs(maskSurface)); >+ >+ if (maskSurface) { >+ nsCOMPtr<nsIDOMSVGMatrix> matrix = GetCanvasTM(); >+ if (NS_FAILED(mask->MaskPaint(canvas, maskSurface, this, matrix, >+ display->mOpacity))) >+ maskSurface = nsnull; > } > } > } > >+ if (maskSurface || clipMaskSurface || display->mOpacity != 1.0) { >+ nsSVGUtils::GetSurface(outerSVGFrame, getter_AddRefs(maskedSurface)); >+ if (maskedSurface) { >+ canvas->PushSurface(maskedSurface); >+ } else >+ maskSurface = nsnull; Why is this needed? A comment is probably in order. >+NS_IMETHODIMP >+nsSVGMaskFrame::QueryInterface(REFNSIID aIID, void** aInstancePtr) >+{ >+ if (nsnull == aInstancePtr) { >+ return NS_ERROR_NULL_POINTER; >+ } >+ if (aIID.Equals(nsSVGMaskFrame::GetCID())) { >+ *aInstancePtr = (void*)(nsSVGMaskFrame*)this; Addref'ing a frame is probably not a good idea... >+ NS_ADDREF_THIS(); >+ return NS_OK; >+ } >+ return (nsSVGDefsFrame::QueryInterface(aIID, aInstancePtr)); >+} >+NS_IMETHODIMP >+nsSVGMaskFrame::InitSVG() >+{ >+ nsresult rv = nsSVGDefsFrame::InitSVG(); >+ if (NS_FAILED(rv)) >+ return rv; >+ Shouldn't this be mMaskParentMatrix = nsnull; ? >+ mMaskParentMatrix = NULL; >+
Attached patch adjust per review comments (obsolete) — Splinter Review
Attachment #208766 - Attachment is obsolete: true
Attachment #209004 - Flags: review?(scootermorris)
Attachment #208766 - Flags: review?(scootermorris)
Attached patch right version...Splinter Review
Attachment #209004 - Attachment is obsolete: true
Attachment #209009 - Flags: review?(scootermorris)
Attachment #209004 - Flags: review?(scootermorris)
Comment on attachment 209009 [details] [diff] [review] right version... Looks fine to me
Attachment #209009 - Flags: review?(scootermorris) → review+
Checked in.
Status: NEW → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
This broke the AIX build: /home/tbox/sb/tinderbox/AIX_5.1_Clobber/mozilla/layout/svg/base/src/nsSVGClipPathFrame.cpp "/usr/include/math.h", line 236.9: 1540-0848 (S) The macro name "M_PI" is already defined with a different definition. "/home/tbox/sb/tinderbox/AIX_5.1_Clobber/mozilla/layout/svg/base/src/nsSVGUtils.h", line 60.9: 1540-0425 (I) "M_PI" is defined on line 60 of "/home/tbox/sb/tinderbox/AIX_5.1_Clobber/mozilla/layout/svg/base/src/nsSVGClipPathFrame.cpp".
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: