From b59b3aeaf90087e536d1004c3fd54268d08490a8 Mon Sep 17 00:00:00 2001 From: Markus Stange Date: Thu, 21 Jan 2016 23:28:19 +0100 Subject: [PATCH] Bug 1241665 - Correctly convert IOSurfaces to SourceSurfaces in MacIOSurfaceTextureSourceBasic and MacIOSurfaceTextureData. r=mattwoodrow --HG-- extra : rebase_source : 6cbb38cc4bb2338f76b1454e7e823dcb13d42f2d --- gfx/layers/basic/MacIOSurfaceTextureHostBasic.cpp | 7 +++++-- gfx/layers/opengl/MacIOSurfaceTextureClientOGL.cpp | 3 ++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/gfx/layers/basic/MacIOSurfaceTextureHostBasic.cpp b/gfx/layers/basic/MacIOSurfaceTextureHostBasic.cpp index f76e62488aea..d3341a200ba0 100644 --- a/gfx/layers/basic/MacIOSurfaceTextureHostBasic.cpp +++ b/gfx/layers/basic/MacIOSurfaceTextureHostBasic.cpp @@ -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; } diff --git a/gfx/layers/opengl/MacIOSurfaceTextureClientOGL.cpp b/gfx/layers/opengl/MacIOSurfaceTextureClientOGL.cpp index 2735a0b2219e..dc7c8ebae9b2 100644 --- a/gfx/layers/opengl/MacIOSurfaceTextureClientOGL.cpp +++ b/gfx/layers/opengl/MacIOSurfaceTextureClientOGL.cpp @@ -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 MacIOSurfaceTextureData::GetAsSurface() { - RefPtr surf = mSurface->GetAsSurface(); + RefPtr surf = CreateSourceSurfaceFromMacIOSurface(mSurface); return surf->GetDataSurface(); }