Commit 19dc4aba authored by Seth Fowler's avatar Seth Fowler
Browse files

Bug 1292505 (Part 2) - Remove remaining references to Downscaler in the...

Bug 1292505 (Part 2) - Remove remaining references to Downscaler in the SurfacePipe decoders. r=edwin
parent 6a44833a
Loading
Loading
Loading
Loading
+3 −7
Original line number Diff line number Diff line
@@ -185,7 +185,7 @@ nsGIFDecoder2::BeginImageFrame(const IntRect& aFrameRect,
                                              : SurfaceFormat::B8G8R8X8;

  // Make sure there's no animation if we're downscaling.
  MOZ_ASSERT_IF(mDownscaler, !GetImageMetadata().HasAnimation());
  MOZ_ASSERT_IF(Size() != OutputSize(), !GetImageMetadata().HasAnimation());

  SurfacePipeFlags pipeFlags = aIsInterlaced
                             ? SurfacePipeFlags::DEINTERLACE
@@ -204,7 +204,7 @@ nsGIFDecoder2::BeginImageFrame(const IntRect& aFrameRect,
  } else {
    // This is an animation frame (and not the first). To minimize the memory
    // usage of animations, the image data is stored in paletted form.
    MOZ_ASSERT(!mDownscaler);
    MOZ_ASSERT(Size() == OutputSize());
    pipe =
      SurfacePipeFactory::CreatePalettedSurfacePipe(this, mGIFStruct.images_decoded,
                                                    Size(), aFrameRect, format,
@@ -775,11 +775,7 @@ nsGIFDecoder2::ReadImageDescriptor(const char* aData)
    return Transition::TerminateSuccess();
  }

  if (mDownscaler) {
    MOZ_ASSERT_UNREACHABLE("Doing downscale-during-decode for an animated "
                           "image?");
    mDownscaler.reset();
  }
  MOZ_ASSERT(Size() == OutputSize(), "Downscaling an animated image?");

  // Yield to allow access to the previous frame before we start a new one.
  return Transition::ToAfterYield(State::FINISH_IMAGE_DESCRIPTOR);
+6 −4
Original line number Diff line number Diff line
@@ -197,9 +197,10 @@ nsPNGDecoder::CreateFrame(const FrameInfo& aFrameInfo)
                       : SurfaceFormat::B8G8R8A8;

  // Make sure there's no animation or padding if we're downscaling.
  MOZ_ASSERT_IF(mDownscaler, mNumFrames == 0);
  MOZ_ASSERT_IF(mDownscaler, !GetImageMetadata().HasAnimation());
  MOZ_ASSERT_IF(mDownscaler, transparency != TransparencyType::eFrameRect);
  MOZ_ASSERT_IF(Size() != OutputSize(), mNumFrames == 0);
  MOZ_ASSERT_IF(Size() != OutputSize(), !GetImageMetadata().HasAnimation());
  MOZ_ASSERT_IF(Size() != OutputSize(),
                transparency != TransparencyType::eFrameRect);

  // If this image is interlaced, we can display better quality intermediate
  // results to the user by post processing them with ADAM7InterpolatingFilter.
@@ -675,7 +676,8 @@ nsPNGDecoder::info_callback(png_structp png_ptr, png_infop info_ptr)
    int32_t rawTimeout = GetNextFrameDelay(png_ptr, info_ptr);
    decoder->PostIsAnimated(FrameTimeout::FromRawMilliseconds(rawTimeout));

    if (decoder->mDownscaler && !decoder->IsFirstFrameDecode()) {
    if (decoder->Size() != decoder->OutputSize() &&
        !decoder->IsFirstFrameDecode()) {
      MOZ_ASSERT_UNREACHABLE("Doing downscale-during-decode "
                             "for an animated image?");
      png_error(decoder->mPNG, "Invalid downscale attempt"); // Abort decode.