Bug 824642 - PlanarYCbCrImage::GetAsSurface does not create surface optimized for platform. r=joe, r=nsilva

This commit is contained in:
Oleg Romashin 2013-01-23 18:08:16 -05:00
parent 28db8f365c
commit ada40fe742
2 changed files with 10 additions and 2 deletions

View File

@ -17,6 +17,7 @@
#include "gfxSharedImageSurface.h" #include "gfxSharedImageSurface.h"
#include "yuv_convert.h" #include "yuv_convert.h"
#include "gfxUtils.h" #include "gfxUtils.h"
#include "gfxPlatform.h"
#ifdef XP_MACOSX #ifdef XP_MACOSX
#include "mozilla/gfx/QuartzSupport.h" #include "mozilla/gfx/QuartzSupport.h"
@ -477,6 +478,14 @@ PlanarYCbCrImage::SetData(const Data &aData)
CopyData(aData); CopyData(aData);
} }
gfxASurface::gfxImageFormat
PlanarYCbCrImage::GetOffscreenFormat()
{
return mOffscreenFormat != gfxASurface::ImageFormatUnknown ?
gfxPlatform::GetPlatform()->GetOffscreenFormat() :
mOffscreenFormat;
}
already_AddRefed<gfxASurface> already_AddRefed<gfxASurface>
PlanarYCbCrImage::GetAsSurface() PlanarYCbCrImage::GetAsSurface()
{ {
@ -486,7 +495,6 @@ PlanarYCbCrImage::GetAsSurface()
} }
gfxASurface::gfxImageFormat format = GetOffscreenFormat(); gfxASurface::gfxImageFormat format = GetOffscreenFormat();
gfxIntSize size(mSize); gfxIntSize size(mSize);
gfxUtils::GetYCbCrToRGBDestFormatAndSize(mData, format, size); gfxUtils::GetYCbCrToRGBDestFormatAndSize(mData, format, size);
if (size.width > PlanarYCbCrImage::MAX_DIMENSION || if (size.width > PlanarYCbCrImage::MAX_DIMENSION ||

View File

@ -722,7 +722,7 @@ protected:
already_AddRefed<gfxASurface> GetAsSurface(); already_AddRefed<gfxASurface> GetAsSurface();
void SetOffscreenFormat(gfxASurface::gfxImageFormat aFormat) { mOffscreenFormat = aFormat; } void SetOffscreenFormat(gfxASurface::gfxImageFormat aFormat) { mOffscreenFormat = aFormat; }
gfxASurface::gfxImageFormat GetOffscreenFormat() { return mOffscreenFormat; } gfxASurface::gfxImageFormat GetOffscreenFormat();
nsAutoArrayPtr<uint8_t> mBuffer; nsAutoArrayPtr<uint8_t> mBuffer;
uint32_t mBufferSize; uint32_t mBufferSize;