Bug 1006123, part 1: Revert bug 929513's imagelib changes to go back to using double-based gfxSize (instead of float-based gfx::Size) in RasterImage. r=seth
authorDaniel Holbert <dholbert@cs.stanford.edu>
Sun, 11 May 2014 17:14:17 -0700
changeset 182535 cc363e379b2a3fca85125f41aad90f13681296be
parent 182534 71b5ff901bc1cb7f70502fa64d96d293498cd29e
child 182536 ab35e36bf2b5a47ac39111817fbd648ee162fa1a
push id26764
push usercbook@mozilla.com
push dateMon, 12 May 2014 11:35:17 +0000
treeherdermozilla-central@a64ed5aba131 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersseth
bugs1006123, 929513
milestone32.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 1006123, part 1: Revert bug 929513's imagelib changes to go back to using double-based gfxSize (instead of float-based gfx::Size) in RasterImage. r=seth
image/src/RasterImage.cpp
image/src/RasterImage.h
--- a/image/src/RasterImage.cpp
+++ b/image/src/RasterImage.cpp
@@ -177,17 +177,17 @@ DiscardingEnabled()
   }
 
   return enabled;
 }
 
 class ScaleRequest
 {
 public:
-  ScaleRequest(RasterImage* aImage, const gfx::Size& aScale, imgFrame* aSrcFrame)
+  ScaleRequest(RasterImage* aImage, const gfxSize& aScale, imgFrame* aSrcFrame)
     : scale(aScale)
     , dstLocked(false)
     , done(false)
     , stopped(false)
   {
     MOZ_ASSERT(!aSrcFrame->GetIsPaletted());
     MOZ_ASSERT(aScale.width > 0 && aScale.height > 0);
 
@@ -271,17 +271,17 @@ public:
 
   // These values may only be touched on the main thread.
   WeakPtr<RasterImage> weakImage;
   nsAutoPtr<imgFrame> dstFrame;
   nsRefPtr<gfxImageSurface> srcSurface;
   nsRefPtr<gfxImageSurface> dstSurface;
 
   // Below are the values that may be touched on the scaling thread.
-  gfx::Size scale;
+  gfxSize scale;
   uint8_t* srcData;
   uint8_t* dstData;
   nsIntRect srcRect;
   gfxIntSize dstSize;
   uint32_t srcStride;
   uint32_t dstStride;
   mozilla::gfx::SurfaceFormat srcFormat;
   bool dstLocked;
@@ -322,17 +322,17 @@ public:
 
 private: /* members */
   nsAutoPtr<ScaleRequest> mScaleRequest;
 };
 
 class ScaleRunner : public nsRunnable
 {
 public:
-  ScaleRunner(RasterImage* aImage, const gfx::Size& aScale, imgFrame* aSrcFrame)
+  ScaleRunner(RasterImage* aImage, const gfxSize& aScale, imgFrame* aSrcFrame)
   {
     nsAutoPtr<ScaleRequest> request(new ScaleRequest(aImage, aScale, aSrcFrame));
 
     // Destination is unconditionally ARGB32 because that's what the scaler
     // outputs.
     request->dstFrame = new imgFrame();
     nsresult rv = request->dstFrame->Init(0, 0, request->dstSize.width, request->dstSize.height,
                                           gfxImageFormat::ARGB32);
@@ -2505,17 +2505,17 @@ RasterImage::SyncDecode()
     DecodePool::Singleton()->RequestDecode(this);
   }
 
   // All good if no errors!
   return mError ? NS_ERROR_FAILURE : NS_OK;
 }
 
 bool
-RasterImage::CanQualityScale(const gfx::Size& scale)
+RasterImage::CanQualityScale(const gfxSize& scale)
 {
   // If target size is 1:1 with original, don't scale.
   if (scale.width == 1.0 && scale.height == 1.0)
     return false;
 
   // To save memory don't quality upscale images bigger than the limit.
   if (scale.width > 1.0 || scale.height > 1.0) {
     uint32_t scaled_size = static_cast<uint32_t>(mSize.width * mSize.height * scale.width * scale.height);
@@ -2523,17 +2523,17 @@ RasterImage::CanQualityScale(const gfx::
       return false;
   }
 
   return true;
 }
 
 bool
 RasterImage::CanScale(GraphicsFilter aFilter,
-                      gfx::Size aScale, uint32_t aFlags)
+                      gfxSize aScale, uint32_t aFlags)
 {
 // The high-quality scaler requires Skia.
 #ifdef MOZ_ENABLE_SKIA
   // We don't use the scaler for animated or multipart images to avoid doing a
   // bunch of work on an image that just gets thrown away.
   // We only use the scaler when drawing to the window because, if we're not
   // drawing to a window (eg a canvas), updates to that image will be ignored.
   if (gHQDownscaling && aFilter == GraphicsFilter::FILTER_GOOD &&
@@ -2599,17 +2599,17 @@ RasterImage::DrawWithPreDownscaleIfNeede
                                           const nsIntRect &aSubimage,
                                           uint32_t aFlags)
 {
   imgFrame *frame = aFrame;
   nsIntRect framerect = frame->GetRect();
   gfxMatrix userSpaceToImageSpace = aUserSpaceToImageSpace;
   gfxMatrix imageSpaceToUserSpace = aUserSpaceToImageSpace;
   imageSpaceToUserSpace.Invert();
-  gfx::Size scale = ToSize(imageSpaceToUserSpace.ScaleFactors(true));
+  gfxSize scale = imageSpaceToUserSpace.ScaleFactors(true);
   nsIntRect subimage = aSubimage;
   nsRefPtr<gfxASurface> surf;
 
   if (CanScale(aFilter, scale, aFlags) && !frame->IsSinglePixel()) {
     // If scale factor is still the same that we scaled for and
     // ScaleWorker isn't still working, then we can use pre-downscaled frame.
     // If scale factor has changed, order new request.
     // FIXME: Current implementation doesn't support pre-downscale
--- a/image/src/RasterImage.h
+++ b/image/src/RasterImage.h
@@ -728,26 +728,26 @@ private: // data
   nsresult WantDecodedFrames();
   nsresult SyncDecode();
   nsresult InitDecoder(bool aDoSizeDecode);
   nsresult WriteToDecoder(const char *aBuffer, uint32_t aCount, DecodeStrategy aStrategy);
   nsresult DecodeSomeData(size_t aMaxBytes, DecodeStrategy aStrategy);
   bool     IsDecodeFinished();
   TimeStamp mDrawStartTime;
 
-  inline bool CanQualityScale(const gfx::Size& scale);
-  inline bool CanScale(GraphicsFilter aFilter, gfx::Size aScale, uint32_t aFlags);
+  inline bool CanQualityScale(const gfxSize& scale);
+  inline bool CanScale(GraphicsFilter aFilter, gfxSize aScale, uint32_t aFlags);
 
   struct ScaleResult
   {
     ScaleResult()
      : status(SCALE_INVALID)
     {}
 
-    gfx::Size scale;
+    gfxSize scale;
     nsAutoPtr<imgFrame> frame;
     ScaleStatus status;
   };
 
   ScaleResult mScaleResult;
 
   // We hold on to a bare pointer to a ScaleRequest while it's outstanding so
   // we can mark it as stopped if necessary. The ScaleWorker/DrawWorker duo