Bug 785339 - Restore BasicPlanarYCbCrImage::SetDelayedConversion. r=roc

This commit is contained in:
Kan-Ru Chen (陳侃如) 2012-09-03 15:36:04 +08:00
parent ac89c3d827
commit da002e7c2d
2 changed files with 10 additions and 1 deletions

View File

@ -233,6 +233,7 @@ VideoData* VideoData::Create(nsVideoInfo& aInfo,
data.mPicSize = gfxIntSize(aPicture.width, aPicture.height);
data.mStereoMode = aInfo.mStereoMode;
videoImage->SetDelayedConversion(true);
videoImage->SetData(data);
return v.forget();
}

View File

@ -30,6 +30,7 @@ public:
BasicPlanarYCbCrImage(const gfxIntSize& aScaleHint, gfxImageFormat aOffscreenFormat, BufferRecycleBin *aRecycleBin)
: PlanarYCbCrImage(aRecycleBin)
, mScaleHint(aScaleHint)
, mDelayedConversion(false)
{
SetOffscreenFormat(aOffscreenFormat);
}
@ -44,12 +45,15 @@ public:
}
virtual void SetData(const Data& aData);
virtual void SetDelayedConversion(bool aDelayed) { mDelayedConversion = aDelayed; }
already_AddRefed<gfxASurface> GetAsSurface();
private:
nsAutoArrayPtr<uint8_t> mDecodedBuffer;
gfxIntSize mScaleHint;
int mStride;
nsAutoArrayPtr<uint8_t> mDecodedBuffer;
bool mDelayedConversion;
};
class BasicImageFactory : public ImageFactory
@ -81,6 +85,10 @@ BasicPlanarYCbCrImage::SetData(const Data& aData)
{
PlanarYCbCrImage::SetData(aData);
if (mDelayedConversion) {
return;
}
// Do some sanity checks to prevent integer overflow
if (aData.mYSize.width > PlanarYCbCrImage::MAX_DIMENSION ||
aData.mYSize.height > PlanarYCbCrImage::MAX_DIMENSION) {