Backed out changesets aed22a2d8353 and c61fe8e1f887 (bug 908006) for OSX reftest failures.

This commit is contained in:
Ryan VanderMeulen 2013-08-23 15:45:27 -04:00
parent 06ce771f6f
commit c8e81dd315
2 changed files with 7 additions and 13 deletions

View File

@ -62,17 +62,13 @@ ImageDataSerializer::InitializeBufferInfo(gfx::IntSize aSize,
info->format = aFormat;
}
static inline uint32_t
ComputeStride(gfx::SurfaceFormat aFormat, uint32_t aWidth)
{
return gfx::GetAlignedStride<4>(gfx::BytesPerPixel(aFormat) * aWidth);
}
uint32_t
ImageDataSerializer::ComputeMinBufferSize(gfx::IntSize aSize,
gfx::SurfaceFormat aFormat)
{
uint32_t bufsize = aSize.height * ComputeStride(aFormat, aSize.width);
// Note that at the moment we pack the image data with the minimum possible
// stride, we may decide to change that if we want aligned stride.
uint32_t bufsize = aSize.height * gfx::BytesPerPixel(aFormat) * aSize.width;
return SurfaceBufferInfo::GetOffset()
+ gfx::GetAlignedStride<16>(bufsize);
}
@ -111,7 +107,8 @@ ImageDataSerializerBase::GetAsThebesSurface()
{
MOZ_ASSERT(IsValid());
SurfaceBufferInfo* info = GetBufferInfo(mData);
uint32_t stride = ComputeStride(GetFormat(), info->width);
uint32_t stride = gfxASurface::BytesPerPixel(
gfx::SurfaceFormatToImageFormat(GetFormat())) * info->width;
gfxIntSize size(info->width, info->height);
RefPtr<gfxImageSurface> surf =
new gfxImageSurface(GetData(), size, stride,
@ -125,7 +122,8 @@ ImageDataSerializerBase::GetAsSurface()
MOZ_ASSERT(IsValid());
SurfaceBufferInfo* info = GetBufferInfo(mData);
gfx::IntSize size(info->width, info->height);
uint32_t stride = ComputeStride(GetFormat(), info->width);
uint32_t stride = gfxASurface::BytesPerPixel(
gfx::SurfaceFormatToImageFormat(GetFormat())) * info->width;
RefPtr<gfx::DataSourceSurface> surf =
gfx::Factory::CreateWrappingDataSourceSurface(GetData(), stride, size, GetFormat());
return surf.forget();

View File

@ -120,10 +120,6 @@ already_AddRefed<gfxASurface>
LayerManager::CreateOptimalSurface(const gfxIntSize &aSize,
gfxASurface::gfxImageFormat aFormat)
{
if (aFormat == gfxASurface::ImageFormatA8) {
nsRefPtr<gfxASurface> surf = new gfxImageSurface(aSize, aFormat);
return surf.forget();
}
return gfxPlatform::GetPlatform()->
CreateOffscreenSurface(aSize, gfxASurface::ContentFromFormat(aFormat));
}