Open Bug 870287 Opened 11 years ago Updated 2 years ago

DisplayItemClip::AddOffsetAndComputeDifference doesn't take pixel snapping into account

Categories

(Core :: Layout, defect)

x86
macOS
defect

Tracking

()

People

(Reporter: mattwoodrow, Unassigned)

Details

Attachments

(1 file)

This is causing unnecessary invalidations and buffer self-copying in some cases.
Attachment #747327 - Flags: review?(roc)
Comment on attachment 747327 [details] [diff] [review]
Snap to pixels before comparing

Review of attachment 747327 [details] [diff] [review]:
-----------------------------------------------------------------

::: gfx/src/nsRect.h
@@ +362,5 @@
>  }
>  
> +inline nsRect
> +nsIntRect::ScaleToAppUnits(float aXScale, float aYScale,
> +                           nscoord aAppUnitsPerPixel) const

Shouldn't this be called ScaleToAppUnitsInverse?

::: layout/base/DisplayItemClip.cpp
@@ +291,5 @@
> +             nscoord aAppUnitsPerDevPixel)
> +{
> +  nsIntRect pixelRect =
> +    aRect.ScaleToNearestPixels(aXScale, aYScale, aAppUnitsPerDevPixel);
> +  return pixelRect.ScaleToAppUnits(aXScale, aYScale, aAppUnitsPerDevPixel);

I don't really like this. The extra rounding caused by the conversion back to appunits could hurt us. Can we avoid that by comparing things in layer pixels and returning the difference in layer pixels?
(In reply to Matt Woodrow (:mattwoodrow) from comment #0)
> This is causing unnecessary invalidations and buffer self-copying in some
> cases.

Do you have a testcase for this?
I don't remember, sorry. The initial bug comment is unfortunately pretty useless here.
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: