mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-26 14:46:02 +00:00
Backed out 2 changesets (bug 1359155) for failures in test_getUserMedia_basicTabshare.html a=backout
Backed out changeset 2e2e2ba5ecb2 (bug 1359155) Backed out changeset b695217bbfa7 (bug 1359155) MozReview-Commit-ID: HlCufP7I1cC --HG-- extra : rebase_source : d4014380423ba6ff4a4daa5a7e4e1893b0c9cba2
This commit is contained in:
parent
3dff01b95b
commit
0ce994139e
@ -6,7 +6,6 @@
|
||||
#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"
|
||||
@ -304,8 +303,8 @@ MediaEngineTabVideoSource::Draw() {
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t stride = StrideForFormatAndWidth(SurfaceFormat::X8R8G8B8_UINT32,
|
||||
size.width);
|
||||
gfxImageFormat format = SurfaceFormat::X8R8G8B8_UINT32;
|
||||
uint32_t stride = gfxASurface::FormatStrideForWidth(format, size.width);
|
||||
|
||||
if (mDataSize < static_cast<size_t>(stride * size.height)) {
|
||||
mDataSize = stride * size.height;
|
||||
|
@ -16,25 +16,6 @@
|
||||
namespace mozilla {
|
||||
namespace gfx {
|
||||
|
||||
int32_t
|
||||
StrideForFormatAndWidth(SurfaceFormat aFormat, int32_t aWidth)
|
||||
{
|
||||
MOZ_ASSERT(aFormat <= SurfaceFormat::UNKNOWN);
|
||||
MOZ_ASSERT(aWidth > 0);
|
||||
|
||||
// There's nothing special about this alignment, other than that it's what
|
||||
// cairo_format_stride_for_width uses.
|
||||
static const int32_t alignment = sizeof(int32_t);
|
||||
|
||||
const int32_t bpp = BytesPerPixel(aFormat);
|
||||
|
||||
if (aWidth >= (INT32_MAX - alignment) / bpp) {
|
||||
return -1; // too big
|
||||
}
|
||||
|
||||
return (bpp * aWidth + alignment-1) & ~alignment;
|
||||
}
|
||||
|
||||
already_AddRefed<DataSourceSurface>
|
||||
CreateDataSourceSurfaceFromData(const IntSize& aSize,
|
||||
SurfaceFormat aFormat,
|
||||
|
@ -13,9 +13,6 @@
|
||||
namespace mozilla {
|
||||
namespace gfx {
|
||||
|
||||
int32_t
|
||||
StrideForFormatAndWidth(SurfaceFormat aFormat, int32_t aWidth);
|
||||
|
||||
/**
|
||||
* Create a DataSourceSurface and init the surface with the |aData|. The stride
|
||||
* of this source surface might be different from the input data's |aDataStride|.
|
||||
|
@ -21,7 +21,6 @@
|
||||
#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
|
||||
|
||||
@ -111,7 +110,8 @@ BasicPlanarYCbCrImage::CopyData(const Data& aData)
|
||||
return false;
|
||||
}
|
||||
|
||||
mStride = gfx::StrideForFormatAndWidth(format, size.width);
|
||||
gfxImageFormat iFormat = gfx::SurfaceFormatToImageFormat(format);
|
||||
mStride = gfxASurface::FormatStrideForWidth(iFormat, 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(gfx::SurfaceFormatToImageFormat(format));
|
||||
SetOffscreenFormat(iFormat);
|
||||
mSize = size;
|
||||
|
||||
return true;
|
||||
|
@ -340,6 +340,14 @@ 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,6 +97,11 @@ 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);
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user