Backed out changeset 66a9a3b1aadb (bug 1045929)

This commit is contained in:
Carsten "Tomcat" Book 2015-01-12 15:35:10 +01:00
parent ee2b4a260b
commit 24e92eafad
4 changed files with 9 additions and 62 deletions

View File

@ -139,20 +139,6 @@ nsJPEGDecoder::SpeedHistogram()
return Telemetry::IMAGE_DECODE_SPEED_JPEG;
}
nsresult
nsJPEGDecoder::SetTargetSize(const nsIntSize& aSize)
{
// Make sure the size is reasonable.
if (MOZ_UNLIKELY(aSize.width <= 0 || aSize.height <= 0)) {
return NS_ERROR_FAILURE;
}
// Create a downscaler that we'll filter our output through.
mDownscaler.emplace(aSize);
return NS_OK;
}
void
nsJPEGDecoder::InitInternal()
{
@ -408,17 +394,6 @@ nsJPEGDecoder::WriteInternal(const char* aBuffer, uint32_t aCount)
return;
}
if (mDownscaler) {
nsresult rv = mDownscaler->BeginFrame(GetSize(),
mImageData,
/* aHasAlpha = */ false);
if (NS_FAILED(rv)) {
mState = JPEG_ERROR;
return;
}
}
PR_LOG(GetJPEGDecoderAccountingLog(), PR_LOG_DEBUG,
(" JPEGDecoderAccounting: nsJPEGDecoder::"
"Write -- created image frame with %ux%u pixels",
@ -537,7 +512,6 @@ nsJPEGDecoder::WriteInternal(const char* aBuffer, uint32_t aCount)
break;
mInfo.output_scanline = 0;
mDownscaler->ResetForNextProgressivePass();
}
}
@ -617,15 +591,9 @@ nsJPEGDecoder::OutputScanlines(bool* suspend)
const uint32_t top = mInfo.output_scanline;
while ((mInfo.output_scanline < mInfo.output_height)) {
uint32_t* imageRow = nullptr;
if (mDownscaler) {
imageRow = reinterpret_cast<uint32_t*>(mDownscaler->RowBuffer());
} else {
imageRow = reinterpret_cast<uint32_t*>(mImageData) +
(mInfo.output_scanline * mInfo.output_width);
}
MOZ_ASSERT(imageRow, "Should have a row buffer here");
// Use the Cairo image buffer as scanline buffer
uint32_t* imageRow = ((uint32_t*)mImageData) +
(mInfo.output_scanline * mInfo.output_width);
if (mInfo.out_color_space == MOZ_JCS_EXT_NATIVE_ENDIAN_XRGB) {
// Special case: scanline will be directly converted into packed ARGB
@ -633,9 +601,6 @@ nsJPEGDecoder::OutputScanlines(bool* suspend)
*suspend = true; // suspend
break;
}
if (mDownscaler) {
mDownscaler->CommitRow();
}
continue; // all done for this row!
}
@ -711,19 +676,13 @@ nsJPEGDecoder::OutputScanlines(bool* suspend)
sampleRow[2]);
sampleRow += 3;
}
if (mDownscaler) {
mDownscaler->CommitRow();
}
}
if (mDownscaler && mDownscaler->HasInvalidation()) {
PostInvalidation(mDownscaler->TakeInvalidRect());
} else if (!mDownscaler && top != mInfo.output_scanline) {
PostInvalidation(nsIntRect(0, top,
mInfo.output_width,
mInfo.output_scanline - top));
if (top != mInfo.output_scanline) {
nsIntRect r(0, top, mInfo.output_width, mInfo.output_scanline-top);
PostInvalidation(r);
}
}

View File

@ -15,7 +15,6 @@
#include "Decoder.h"
#include "Downscaler.h"
#include "nsAutoPtr.h"
#include "nsIInputStream.h"
@ -56,8 +55,6 @@ public:
nsJPEGDecoder(RasterImage* aImage, Decoder::DecodeStyle aDecodeStyle);
virtual ~nsJPEGDecoder();
virtual nsresult SetTargetSize(const nsIntSize& aSize) MOZ_OVERRIDE;
virtual void InitInternal() MOZ_OVERRIDE;
virtual void WriteInternal(const char* aBuffer, uint32_t aCount) MOZ_OVERRIDE;
virtual void FinishInternal() MOZ_OVERRIDE;
@ -69,8 +66,6 @@ protected:
Orientation ReadOrientationFromEXIF();
void OutputScanlines(bool* suspend);
Maybe<Downscaler> mDownscaler;
public:
struct jpeg_decompress_struct mInfo;
struct jpeg_source_mgr mSourceMgr;

View File

@ -251,12 +251,6 @@ public:
PostSize(aSize.width, aSize.height, aOrientation);
}
nsIntSize GetSize() const
{
MOZ_ASSERT(HasSize());
return mImageMetadata.GetSize();
}
// Use HistogramCount as an invalid Histogram ID
virtual Telemetry::ID SpeedHistogram() { return Telemetry::HistogramCount; }

View File

@ -34,9 +34,8 @@ ImageFactory::Initialize()
static bool
ShouldDownscaleDuringDecode(const nsCString& aMimeType)
{
return aMimeType.EqualsLiteral(IMAGE_JPEG) ||
aMimeType.EqualsLiteral(IMAGE_JPG) ||
aMimeType.EqualsLiteral(IMAGE_PJPEG);
// Not enabled for anything yet.
return false;
}
static uint32_t