mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 22:01:30 +00:00
Bug 1241665 - Correctly convert IOSurfaces to SourceSurfaces in MacIOSurfaceTextureSourceBasic and MacIOSurfaceTextureData. r=mattwoodrow
--HG-- extra : rebase_source : 6cbb38cc4bb2338f76b1454e7e823dcb13d42f2d
This commit is contained in:
parent
08b617259d
commit
b59b3aeaf9
@ -5,6 +5,7 @@
|
|||||||
|
|
||||||
#include "MacIOSurfaceTextureHostBasic.h"
|
#include "MacIOSurfaceTextureHostBasic.h"
|
||||||
#include "mozilla/gfx/MacIOSurface.h"
|
#include "mozilla/gfx/MacIOSurface.h"
|
||||||
|
#include "MacIOSurfaceHelpers.h"
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
namespace layers {
|
namespace layers {
|
||||||
@ -33,7 +34,9 @@ MacIOSurfaceTextureSourceBasic::GetSize() const
|
|||||||
gfx::SurfaceFormat
|
gfx::SurfaceFormat
|
||||||
MacIOSurfaceTextureSourceBasic::GetFormat() const
|
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(
|
MacIOSurfaceTextureHostBasic::MacIOSurfaceTextureHostBasic(
|
||||||
@ -51,7 +54,7 @@ gfx::SourceSurface*
|
|||||||
MacIOSurfaceTextureSourceBasic::GetSurface(gfx::DrawTarget* aTarget)
|
MacIOSurfaceTextureSourceBasic::GetSurface(gfx::DrawTarget* aTarget)
|
||||||
{
|
{
|
||||||
if (!mSourceSurface) {
|
if (!mSourceSurface) {
|
||||||
mSourceSurface = mSurface->GetAsSurface();
|
mSourceSurface = CreateSourceSurfaceFromMacIOSurface(mSurface);
|
||||||
}
|
}
|
||||||
return mSourceSurface;
|
return mSourceSurface;
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
|
|
||||||
#include "MacIOSurfaceTextureClientOGL.h"
|
#include "MacIOSurfaceTextureClientOGL.h"
|
||||||
#include "mozilla/gfx/MacIOSurface.h"
|
#include "mozilla/gfx/MacIOSurface.h"
|
||||||
|
#include "MacIOSurfaceHelpers.h"
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
namespace layers {
|
namespace layers {
|
||||||
@ -53,7 +54,7 @@ MacIOSurfaceTextureData::GetFormat() const
|
|||||||
already_AddRefed<gfx::DataSourceSurface>
|
already_AddRefed<gfx::DataSourceSurface>
|
||||||
MacIOSurfaceTextureData::GetAsSurface()
|
MacIOSurfaceTextureData::GetAsSurface()
|
||||||
{
|
{
|
||||||
RefPtr<gfx::SourceSurface> surf = mSurface->GetAsSurface();
|
RefPtr<gfx::SourceSurface> surf = CreateSourceSurfaceFromMacIOSurface(mSurface);
|
||||||
return surf->GetDataSurface();
|
return surf->GetDataSurface();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user