diff --git a/gfx/2d/Rect.h b/gfx/2d/Rect.h index 89b98f78560f..b1f9a71a7be2 100644 --- a/gfx/2d/Rect.h +++ b/gfx/2d/Rect.h @@ -292,13 +292,6 @@ IntRectTyped RoundedToInt(const RectTyped& aRect) int32_t(copy.Height())); } -template -bool RectIsInt32Safe(const RectTyped& aRect) { - float min = (float)std::numeric_limits::min(); - float max = (float)std::numeric_limits::max(); - return aRect.x > min && aRect.y > min && aRect.XMost() < max && aRect.YMost() < max; -} - template IntRectTyped RoundedIn(const RectTyped& aRect) { diff --git a/gfx/tests/reftest/1474722-ref.html b/gfx/tests/reftest/1474722-ref.html deleted file mode 100644 index e0fadcf53f22..000000000000 --- a/gfx/tests/reftest/1474722-ref.html +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - -
long shadow
- - diff --git a/gfx/tests/reftest/1474722.html b/gfx/tests/reftest/1474722.html deleted file mode 100644 index 9920eee23841..000000000000 --- a/gfx/tests/reftest/1474722.html +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - -
long shadow
- - diff --git a/gfx/tests/reftest/reftest.list b/gfx/tests/reftest/reftest.list index 1c6e15f95b0e..b29dd3bfae44 100644 --- a/gfx/tests/reftest/reftest.list +++ b/gfx/tests/reftest/reftest.list @@ -13,6 +13,5 @@ fuzzy(100,30) == 1149923.html 1149923-ref.html # use fuzzy due to few distorted == 1435143.html 1435143-ref.html == 1444904.html 1444904-ref.html == 1451168.html 1451168-ref.html -== 1474722.html 1474722-ref.html fuzzy(5-32,21908-26354) fuzzy-if(webrender,0-1,0-3) == 1463802.html 1463802-ref.html == 1461313.html 1461313-ref.html diff --git a/gfx/thebes/gfxBlur.cpp b/gfx/thebes/gfxBlur.cpp index 91ff23412efc..15ce9d7a9e3e 100644 --- a/gfx/thebes/gfxBlur.cpp +++ b/gfx/thebes/gfxBlur.cpp @@ -594,12 +594,6 @@ GetBlur(gfxContext* aDestinationCtx, if (useDestRect) { minSize = aRectSize; } - - int32_t maxTextureSize = gfxPlatform::MaxTextureSize(); - if (minSize.width > maxTextureSize || minSize.height > maxTextureSize) { - return nullptr; - } - aOutMinSize = minSize; DrawTarget* destDT = aDestinationCtx->GetDrawTarget(); @@ -961,7 +955,13 @@ gfxAlphaBoxBlur::BlurRectangle(gfxContext* aDestinationCtx, const gfxRect& aDirtyRect, const gfxRect& aSkipRect) { - if (!RectIsInt32Safe(ToRect(aRect))) { + const double maxSize = (double)gfxPlatform::MaxTextureSize(); + const double maxPos = (double)std::numeric_limits::max(); + if (aRect.width > maxSize || aRect.height > maxSize || + std::abs(aRect.x) > maxPos || std::abs(aRect.y) > maxPos) { + // The rectangle is huge, perhaps due to a very strong perspective or some other + // transform. We won't be able to blur something this big so give up now before + // overflowing or running into texture size limits later. return; } @@ -1020,12 +1020,17 @@ gfxAlphaBoxBlur::BlurRectangle(gfxContext* aDestinationCtx, // so if there's a transform on destDrawTarget that is not pixel-aligned, // there will be seams between adjacent parts of the box-shadow. It's hard to // avoid those without the use of an intermediate surface. - // You might think that we could avoid those by just turning off AA, but there + // You might think that we could avoid those by just turning of AA, but there // is a problem with that: Box-shadow rendering needs to clip out the // element's border box, and we'd like that clip to have anti-aliasing - // especially if the element has rounded corners! So we can't do that unless // we have a way to say "Please anti-alias the clip, but don't antialias the // destination rect of the DrawSurface call". + // On OS X there is an additional problem with turning off AA: CoreGraphics + // will not just fill the pixels that have their pixel center inside the + // filled shape. Instead, it will fill all the pixels which are partially + // covered by the shape. So for pixels on the edge between two adjacent parts, + // all those pixels will be painted to by both parts, which looks very bad. destDrawTarget->PopClip(); }