diff --git a/layout/base/nsLayoutUtils.cpp b/layout/base/nsLayoutUtils.cpp index e74ccb4c5d0..666a5c638e8 100644 --- a/layout/base/nsLayoutUtils.cpp +++ b/layout/base/nsLayoutUtils.cpp @@ -5070,49 +5070,6 @@ DrawImageInternal(nsRenderingContext* aRenderingContext, return NS_OK; } -/* static */ void -nsLayoutUtils::DrawPixelSnapped(nsRenderingContext* aRenderingContext, - nsPresContext* aPresContext, - gfxDrawable* aDrawable, - GraphicsFilter aFilter, - const nsRect& aDest, - const nsRect& aFill, - const nsPoint& aAnchor, - const nsRect& aDirty) -{ - int32_t appUnitsPerDevPixel = - aPresContext->AppUnitsPerDevPixel(); - gfxContext* ctx = aRenderingContext->ThebesContext(); - gfxIntSize drawableSize = aDrawable->Size(); - nsIntSize imageSize(drawableSize.width, drawableSize.height); - - SnappedImageDrawingParameters drawingParams = - ComputeSnappedImageDrawingParameters(ctx, appUnitsPerDevPixel, aDest, aFill, - aAnchor, aDirty, imageSize); - - if (!drawingParams.mShouldDraw) - return; - - gfxContextMatrixAutoSaveRestore saveMatrix(ctx); - if (drawingParams.mResetCTM) { - ctx->IdentityMatrix(); - } - - gfxRect sourceRect = - drawingParams.mUserSpaceToImageSpace.Transform(drawingParams.mFillRect); - gfxRect imageRect(0, 0, imageSize.width, imageSize.height); - gfxRect subimage(drawingParams.mSubimage.x, drawingParams.mSubimage.y, - drawingParams.mSubimage.width, drawingParams.mSubimage.height); - - NS_ASSERTION(!sourceRect.Intersect(subimage).IsEmpty(), - "We must be allowed to sample *some* source pixels!"); - - gfxUtils::DrawPixelSnapped(ctx, aDrawable, - drawingParams.mUserSpaceToImageSpace, subimage, - sourceRect, imageRect, drawingParams.mFillRect, - gfx::SurfaceFormat::B8G8R8A8, aFilter); -} - /* static */ nsresult nsLayoutUtils::DrawSingleUnscaledImage(nsRenderingContext* aRenderingContext, nsPresContext* aPresContext, diff --git a/layout/base/nsLayoutUtils.h b/layout/base/nsLayoutUtils.h index 6e65aba22cb..3d484db85f1 100644 --- a/layout/base/nsLayoutUtils.h +++ b/layout/base/nsLayoutUtils.h @@ -1494,30 +1494,6 @@ public: static gfxRect RectToGfxRect(const nsRect& aRect, int32_t aAppUnitsPerDevPixel); - /** - * Draw a drawable using the pixel snapping algorithm. - * See https://wiki.mozilla.org/Gecko:Image_Snapping_and_Rendering - * @param aRenderingContext Where to draw the image, set up with an - * appropriate scale and transform for drawing in - * app units. - * @param aDrawable The drawable we want to draw. - * @param aFilter The graphics filter we should draw with. - * @param aDest Where one copy of the image should mapped to. - * @param aFill The area to be filled with copies of the - * image. - * @param aAnchor A point in aFill which we will ensure is - * pixel-aligned in the output. - * @param aDirty Pixels outside this area may be skipped. - */ - static void DrawPixelSnapped(nsRenderingContext* aRenderingContext, - nsPresContext* aPresContext, - gfxDrawable* aDrawable, - GraphicsFilter aFilter, - const nsRect& aDest, - const nsRect& aFill, - const nsPoint& aAnchor, - const nsRect& aDirty); - /** * Draw a whole image without scaling or tiling. *