Skip to content

Commit

Permalink
Bug 1374729 - Use correct format for MacIOSurface. r=nical
Browse files Browse the repository at this point in the history
MozReview-Commit-ID: 43JBSi5mqT7
  • Loading branch information
mephisto41 committed Jan 9, 2018
1 parent f5844bc commit ae9a064
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
12 changes: 7 additions & 5 deletions gfx/layers/opengl/MacIOSurfaceTextureHostOGL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -161,12 +161,14 @@ MacIOSurfaceTextureHostOGL::PushResourceUpdates(wr::ResourceUpdateQueue& aResour

switch (GetFormat()) {
case gfx::SurfaceFormat::R8G8B8X8:
case gfx::SurfaceFormat::R8G8B8A8:
case gfx::SurfaceFormat::B8G8R8A8:
case gfx::SurfaceFormat::B8G8R8X8: {
case gfx::SurfaceFormat::R8G8B8A8: {
MOZ_ASSERT(aImageKeys.length() == 1);
MOZ_ASSERT(mSurface->GetPlaneCount() == 0);
wr::ImageDescriptor descriptor(GetSize(), GetFormat());
// The internal pixel format of MacIOSurface is always BGRX or BGRA
// format.
auto format = GetFormat() == gfx::SurfaceFormat::R8G8B8A8 ? gfx::SurfaceFormat::B8G8R8A8
: gfx::SurfaceFormat::B8G8R8X8;
wr::ImageDescriptor descriptor(GetSize(), format);
(aResources.*method)(aImageKeys[0], descriptor, aExtID, bufferType, 0);
break;
}
Expand All @@ -177,7 +179,7 @@ MacIOSurfaceTextureHostOGL::PushResourceUpdates(wr::ResourceUpdateQueue& aResour
// and YCbCr at OpenGL 3.1)
MOZ_ASSERT(aImageKeys.length() == 1);
MOZ_ASSERT(mSurface->GetPlaneCount() == 0);
wr::ImageDescriptor descriptor(GetSize(), gfx::SurfaceFormat::R8G8B8X8);
wr::ImageDescriptor descriptor(GetSize(), gfx::SurfaceFormat::B8G8R8X8);
(aResources.*method)(aImageKeys[0], descriptor, aExtID, bufferType, 0);
break;
}
Expand Down
5 changes: 3 additions & 2 deletions gfx/webrender_bindings/WebRenderTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,10 @@ inline Maybe<wr::ImageFormat>
SurfaceFormatToImageFormat(gfx::SurfaceFormat aFormat) {
switch (aFormat) {
case gfx::SurfaceFormat::R8G8B8X8:
// TODO: use RGBA + opaque flag
case gfx::SurfaceFormat::R8G8B8A8:
return Some(wr::ImageFormat::BGRA8);
// WebRender not support RGBA8 and RGBX8. Assert here.
MOZ_ASSERT(false);
return Nothing();
case gfx::SurfaceFormat::B8G8R8X8:
// TODO: WebRender will have a BGRA + opaque flag for this but does not
// have it yet (cf. issue #732).
Expand Down

0 comments on commit ae9a064

Please sign in to comment.