Bug 1359155, part 3 - Convert BasicPlanarYCbCrImage::CopyData to use Moz2D's StrideForFormatAndWidth. r=mstange

MozReview-Commit-ID: F8EyjjQ0sX9
This commit is contained in:
Jonathan Watt 2017-03-30 15:58:31 +01:00
parent 5ca294eae0
commit cb165b4a0a

View File

@ -21,6 +21,7 @@
#include "nsISupportsImpl.h" // for Image::Release, etc
#include "nsThreadUtils.h" // for NS_IsMainThread
#include "mozilla/gfx/Point.h" // for IntSize
#include "mozilla/gfx/DataSurfaceHelpers.h"
#include "gfx2DGlue.h"
#include "YCbCrUtils.h" // for YCbCr conversions
@ -110,8 +111,7 @@ BasicPlanarYCbCrImage::CopyData(const Data& aData)
return false;
}
gfxImageFormat iFormat = gfx::SurfaceFormatToImageFormat(format);
mStride = gfxASurface::FormatStrideForWidth(iFormat, size.width);
mStride = gfx::StrideForFormatAndWidth(format, size.width);
mozilla::CheckedInt32 requiredBytes =
mozilla::CheckedInt32(size.height) * mozilla::CheckedInt32(mStride);
if (!requiredBytes.isValid()) {
@ -125,7 +125,7 @@ BasicPlanarYCbCrImage::CopyData(const Data& aData)
}
gfx::ConvertYCbCrToRGB(aData, format, size, mDecodedBuffer.get(), mStride);
SetOffscreenFormat(iFormat);
SetOffscreenFormat(gfx::SurfaceFormatToImageFormat(format));
mSize = size;
return true;