Bug 1287492 - WIP draft
authorcku <cku@mozilla.com>
Thu, 09 Feb 2017 16:54:49 +0800
changeset 481107 b430b88512571e9116a5056f130c88a09c09c5fe
parent 480952 f505911eb333d5ae8c2bf5c44f7b85add6450b53
child 545114 894a62053b660cd86eef2250eb1d759e206b8db6
push id44722
push userbmo:cku@mozilla.com
push dateThu, 09 Feb 2017 08:55:32 +0000
bugs1287492
milestone54.0a1
Bug 1287492 - WIP MozReview-Commit-ID: AXNUZvPT91k
layout/svg/nsFilterInstance.cpp
--- a/layout/svg/nsFilterInstance.cpp
+++ b/layout/svg/nsFilterInstance.cpp
@@ -354,16 +354,17 @@ nsFilterInstance::ComputeNeededBoxes()
   mStrokePaint.mNeededBounds = strokePaintNeededRegion.GetBounds();
 }
 
 DrawResult
 nsFilterInstance::BuildSourcePaint(SourceInfo *aSource)
 {
   MOZ_ASSERT(mTargetFrame);
   nsIntRect neededRect = aSource->mNeededBounds;
+  neededRect = neededRect.Intersect(mTargetBBoxInFilterSpace);
 
   RefPtr<DrawTarget> offscreenDT =
     gfxPlatform::GetPlatform()->CreateOffscreenContentDrawTarget(
       neededRect.Size(), SurfaceFormat::B8G8R8A8);
   if (!offscreenDT || !offscreenDT->IsValid()) {
     return DrawResult::TEMPORARY_ERROR;
   }
 
@@ -416,16 +417,18 @@ nsFilterInstance::BuildSourceImage()
 {
   MOZ_ASSERT(mTargetFrame);
 
   nsIntRect neededRect = mSourceGraphic.mNeededBounds;
   if (neededRect.IsEmpty()) {
     return DrawResult::SUCCESS;
   }
 
+  neededRect = neededRect.Intersect(mTargetBBoxInFilterSpace);
+
   RefPtr<DrawTarget> offscreenDT =
     gfxPlatform::GetPlatform()->CreateOffscreenContentDrawTarget(
       neededRect.Size(), SurfaceFormat::B8G8R8A8);
   if (!offscreenDT || !offscreenDT->IsValid()) {
     return DrawResult::TEMPORARY_ERROR;
   }
 
   gfxRect r = FilterSpaceToUserSpace(ThebesRect(neededRect));
@@ -547,19 +550,19 @@ nsFilterInstance::OutputFilterSpaceBound
 {
   uint32_t numPrimitives = mPrimitiveDescriptions.Length();
   if (numPrimitives <= 0)
     return nsIntRect();
 
   nsIntRect bounds =
     mPrimitiveDescriptions[numPrimitives - 1].PrimitiveSubregion();
   bool overflow;
-  IntSize surfaceSize =
-    nsSVGUtils::ConvertToSurfaceSize(bounds.Size(), &overflow);
-  bounds.SizeTo(surfaceSize);
+  //IntSize surfaceSize =
+  //  nsSVGUtils::ConvertToSurfaceSize(bounds.Size(), &overflow);
+  //bounds.SizeTo(surfaceSize);
   return bounds;
 }
 
 nsIntRect
 nsFilterInstance::FrameSpaceToFilterSpace(const nsRect* aRect) const
 {
   nsIntRect rect = OutputFilterSpaceBounds();
   if (aRect) {