Bug 1631214 - Fix oriented image invalidation rectangle calculation when a Flip is present. r=tnikkel
authorCameron McCormack <cam@mcc.id.au>
Fri, 15 May 2020 23:43:42 +0000
changeset 530413 ca33a89c9b324fe9ceb650c432c6c5f3cb02465c
parent 530412 399f99f8337ab9b6d63945d351162b2393e35ac8
child 530414 b903c581d871b387d2f513059d069138f633bd82
push id37421
push usercbrindusan@mozilla.com
push dateSat, 16 May 2020 09:34:57 +0000
treeherdermozilla-central@882de07e4cbe [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstnikkel
bugs1631214
milestone78.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1631214 - Fix oriented image invalidation rectangle calculation when a Flip is present. r=tnikkel Differential Revision: https://phabricator.services.mozilla.com/D75647
image/RasterImage.cpp
--- a/image/RasterImage.cpp
+++ b/image/RasterImage.cpp
@@ -1909,17 +1909,20 @@ OrientedIntRect RasterImage::ToOriented(
   MOZ_ASSERT(!UsedOrientation().flipFirst,
              "flipFirst should only be used by OrientedImage");
 
   // UsedOrientation() specifies the transformation from a correctly oriented
   // image to the pixels stored in the file, so we need to rotate by the
   // negation of the given angle.
   Angle angle = Orientation::InvertAngle(UsedOrientation().rotation);
   Rotate(rect, size.ToUnknownSize(), angle);
-  Flip(rect, size.ToUnknownSize(), UsedOrientation().flip);
+
+  // Use mSize instead of size, since after the Rotate call, the size of the
+  // space that rect is in has had its width and height swapped.
+  Flip(rect, mSize.ToUnknownSize(), UsedOrientation().flip);
 
   return OrientedIntRect::FromUnknownRect(rect);
 }
 
 UnorientedIntRect RasterImage::ToUnoriented(OrientedIntRect aRect) const {
   IntRect rect = aRect.ToUnknownRect();
 
   Flip(rect, mSize.ToUnknownSize(), UsedOrientation().flip);