Bug 1359155, part 2 - Convert gfxASurface::FormatStrideForWidth callers to Moz2D's StrideForFormatAndWidth. r=mstange

This commit is contained in:
Jonathan Watt 2017-03-30 15:58:31 +01:00
Родитель 9e7b994e33
Коммит fa7e506fa5
4 изменённых файлов: 6 добавлений и 18 удалений

Просмотреть файл

@ -6,6 +6,7 @@
#include "MediaEngineTabVideoSource.h"
#include "mozilla/gfx/2D.h"
#include "mozilla/gfx/DataSurfaceHelpers.h"
#include "mozilla/RefPtr.h"
#include "mozilla/UniquePtrExtensions.h"
#include "mozilla/dom/BindingDeclarations.h"
@ -303,8 +304,8 @@ MediaEngineTabVideoSource::Draw() {
}
}
gfxImageFormat format = SurfaceFormat::X8R8G8B8_UINT32;
uint32_t stride = gfxASurface::FormatStrideForWidth(format, size.width);
uint32_t stride = StrideForFormatAndWidth(SurfaceFormat::X8R8G8B8_UINT32,
size.width);
if (mDataSize < static_cast<size_t>(stride * size.height)) {
mDataSize = stride * size.height;

Просмотреть файл

@ -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;

Просмотреть файл

@ -340,14 +340,6 @@ gfxASurface::CairoStatus()
return cairo_surface_status(mSurface);
}
/* static */
int32_t
gfxASurface::FormatStrideForWidth(gfxImageFormat format, int32_t width)
{
cairo_format_t cformat = GfxFormatToCairoFormat(format);
return cairo_format_stride_for_width(cformat, (int)width);
}
nsresult
gfxASurface::BeginPrinting(const nsAString& aTitle, const nsAString& aPrintToFileName)
{

Просмотреть файл

@ -97,11 +97,6 @@ public:
int CairoStatus();
/* Provide a stride value that will respect all alignment requirements of
* the accelerated image-rendering code.
*/
static int32_t FormatStrideForWidth(gfxImageFormat format, int32_t width);
static gfxContentType ContentFromFormat(gfxImageFormat format);
/**