/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* vim: set ts=8 sts=2 et sw=2 tw=80: */ /* This Source Code Form is subject to the terms of the Mozilla Public * 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/. */
already_AddRefed<SourceSurface> SVGMaskFrame::GetMaskForMaskedFrame(
MaskParams& aParams) { // Make sure we break reference loops and over long reference chains: static int16_t sRefChainLengthCounter = AutoReferenceChainGuard::noChain;
AutoReferenceChainGuard refChainGuard(this, &mInUse, &sRefChainLengthCounter); if (MOZ_UNLIKELY(!refChainGuard.Reference())) { // Break reference chain return nullptr;
}
gfxRect maskArea = GetMaskArea(aParams.maskedFrame); if (maskArea.IsEmpty()) { return nullptr;
} // Get the clip extents in device space: // Minimizing the mask surface extents (using both the current clip extents // and maskArea) is important for performance. //
gfxRect maskSurfaceRectDouble = aParams.toUserSpace.TransformBounds(maskArea);
Rect maskSurfaceRect = ToRect(maskSurfaceRectDouble);
maskSurfaceRect.RoundOut();
for (auto* kid : mFrames) {
gfxMatrix m = mMatrixForChildren;
// The CTM of each frame referencing us can be different
ISVGDisplayableFrame* SVGFrame = do_QueryFrame(kid); if (SVGFrame) {
SVGFrame->NotifySVGChanged(ISVGDisplayableFrame::TRANSFORM_CHANGED);
m = SVGUtils::GetTransformMatrixInUserSpace(kid) * m;
}
SVGUtils::PaintFrameWithEffects(kid, tmpCtx, m, aParams.imgParams);
}
RefPtr<SourceSurface> surface; if (maskType == StyleMaskType::Luminance) { auto luminanceType = LuminanceType::LUMINANCE; if (StyleSVG()->mColorInterpolation == StyleColorInterpolation::Linearrgb) {
luminanceType = LuminanceType::LINEARRGB;
}
uint16_t units =
maskElem->mEnumAttributes[SVGMaskElement::MASKUNITS].GetAnimValue();
gfxRect bbox; if (units == SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) {
bbox =
SVGUtils::GetBBox(aMaskedFrame, SVGUtils::eUseFrameBoundsForOuterSVG |
SVGUtils::eBBoxIncludeFillGeometry);
}
// Bounds in the user space of aMaskedFrame
gfxRect maskArea = SVGUtils::GetRelativeRect(
units, &maskElem->mLengthAttributes[SVGMaskElement::ATTR_X], bbox,
aMaskedFrame);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.