Bug 1241665 - Correctly convert IOSurfaces to SourceSurfaces in MacIOSurfaceTextureSourceBasic and MacIOSurfaceTextureData. r=mattwoodrow

--HG--
extra : rebase_source : 6cbb38cc4bb2338f76b1454e7e823dcb13d42f2d
This commit is contained in:
Markus Stange 2016-01-21 23:28:19 +01:00
parent 08b617259d
commit b59b3aeaf9
2 changed files with 7 additions and 3 deletions

View File

@ -5,6 +5,7 @@
#include "MacIOSurfaceTextureHostBasic.h"
#include "mozilla/gfx/MacIOSurface.h"
#include "MacIOSurfaceHelpers.h"
namespace mozilla {
namespace layers {
@ -33,7 +34,9 @@ MacIOSurfaceTextureSourceBasic::GetSize() const
gfx::SurfaceFormat
MacIOSurfaceTextureSourceBasic::GetFormat() const
{
return mSurface->HasAlpha() ? gfx::SurfaceFormat::R8G8B8A8 : gfx::SurfaceFormat::B8G8R8X8;
// Set the format the same way as CreateSourceSurfaceFromMacIOSurface.
return mSurface->GetFormat() == gfx::SurfaceFormat::NV12
? gfx::SurfaceFormat::B8G8R8X8 : gfx::SurfaceFormat::B8G8R8A8;
}
MacIOSurfaceTextureHostBasic::MacIOSurfaceTextureHostBasic(
@ -51,7 +54,7 @@ gfx::SourceSurface*
MacIOSurfaceTextureSourceBasic::GetSurface(gfx::DrawTarget* aTarget)
{
if (!mSourceSurface) {
mSourceSurface = mSurface->GetAsSurface();
mSourceSurface = CreateSourceSurfaceFromMacIOSurface(mSurface);
}
return mSourceSurface;
}

View File

@ -5,6 +5,7 @@
#include "MacIOSurfaceTextureClientOGL.h"
#include "mozilla/gfx/MacIOSurface.h"
#include "MacIOSurfaceHelpers.h"
namespace mozilla {
namespace layers {
@ -53,7 +54,7 @@ MacIOSurfaceTextureData::GetFormat() const
already_AddRefed<gfx::DataSourceSurface>
MacIOSurfaceTextureData::GetAsSurface()
{
RefPtr<gfx::SourceSurface> surf = mSurface->GetAsSurface();
RefPtr<gfx::SourceSurface> surf = CreateSourceSurfaceFromMacIOSurface(mSurface);
return surf->GetDataSurface();
}