[S.P.] Merge getContentPicture into createContentPicture.
BUG=462077
Review URL: https://codereview.chromium.org/974903003
git-svn-id: svn://svn.chromium.org/blink/trunk@191268 bbb929c8-8fbe-4397-9dbb-9b2b20218538
diff --git a/Source/core/layout/svg/LayoutSVGResourceMasker.cpp b/Source/core/layout/svg/LayoutSVGResourceMasker.cpp
index 0cb26dd..8fd467b 100644
--- a/Source/core/layout/svg/LayoutSVGResourceMasker.cpp
+++ b/Source/core/layout/svg/LayoutSVGResourceMasker.cpp
@@ -52,8 +52,19 @@
markClientForInvalidation(client, markForInvalidation ? BoundariesInvalidation : ParentOnlyInvalidation);
}
-PassRefPtr<const SkPicture> LayoutSVGResourceMasker::createContentPicture()
+PassRefPtr<const SkPicture> LayoutSVGResourceMasker::createContentPicture(AffineTransform& contentTransformation, const FloatRect& targetBoundingBox)
{
+ SVGUnitTypes::SVGUnitType contentUnits = toSVGMaskElement(element())->maskContentUnits()->currentValue()->enumValue();
+ if (contentUnits == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) {
+ contentTransformation.translate(targetBoundingBox.x(), targetBoundingBox.y());
+ contentTransformation.scaleNonUniform(targetBoundingBox.width(), targetBoundingBox.height());
+ }
+
+ if (m_maskContentPicture)
+ return m_maskContentPicture;
+
+ SubtreeContentTransformScope contentTransformScope(contentTransformation);
+
// Using strokeBoundingBox (instead of paintInvalidationRectInLocalCoordinates) to avoid the intersection
// with local clips/mask, which may yield incorrect results when mixing objectBoundingBox and
// userSpaceOnUse units (http://crbug.com/294900).
@@ -82,22 +93,7 @@
if (displayItemList)
displayItemList->replay(&context);
- return context.endRecording();
-}
-
-PassRefPtr<const SkPicture> LayoutSVGResourceMasker::getContentPicture(AffineTransform& contentTransformation, const FloatRect& targetBoundingBox)
-{
- SVGUnitTypes::SVGUnitType contentUnits = toSVGMaskElement(element())->maskContentUnits()->currentValue()->enumValue();
- if (contentUnits == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) {
- contentTransformation.translate(targetBoundingBox.x(), targetBoundingBox.y());
- contentTransformation.scaleNonUniform(targetBoundingBox.width(), targetBoundingBox.height());
- }
-
- if (!m_maskContentPicture) {
- SubtreeContentTransformScope contentTransformScope(contentTransformation);
- m_maskContentPicture = createContentPicture();
- }
-
+ m_maskContentPicture = context.endRecording();
return m_maskContentPicture;
}
diff --git a/Source/core/layout/svg/LayoutSVGResourceMasker.h b/Source/core/layout/svg/LayoutSVGResourceMasker.h
index 91e1226..cad7bb1 100644
--- a/Source/core/layout/svg/LayoutSVGResourceMasker.h
+++ b/Source/core/layout/svg/LayoutSVGResourceMasker.h
@@ -55,11 +55,10 @@
static const LayoutSVGResourceType s_resourceType = MaskerResourceType;
virtual LayoutSVGResourceType resourceType() const override { return s_resourceType; }
- PassRefPtr<const SkPicture> getContentPicture(AffineTransform&, const FloatRect&);
+ PassRefPtr<const SkPicture> createContentPicture(AffineTransform&, const FloatRect&);
private:
void calculateMaskContentPaintInvalidationRect();
- PassRefPtr<const SkPicture> createContentPicture();
RefPtr<const SkPicture> m_maskContentPicture;
FloatRect m_maskContentBoundaries;
diff --git a/Source/core/paint/SVGMaskPainter.cpp b/Source/core/paint/SVGMaskPainter.cpp
index 3606e0a..4e7a14c 100644
--- a/Source/core/paint/SVGMaskPainter.cpp
+++ b/Source/core/paint/SVGMaskPainter.cpp
@@ -68,7 +68,7 @@
ASSERT(context);
AffineTransform contentTransformation;
- RefPtr<const SkPicture> maskContentPicture = m_mask.getContentPicture(contentTransformation, targetBoundingBox);
+ RefPtr<const SkPicture> maskContentPicture = m_mask.createContentPicture(contentTransformation, targetBoundingBox);
TransformRecorder recorder(*context, client, contentTransformation);