зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1668302 - Implement RenderTextureHostSWL for wrapper texture hosts. r=jrmuizel
Differential Revision: https://phabricator.services.mozilla.com/D92008
This commit is contained in:
Родитель
95178bd955
Коммит
dccc13919e
|
@ -22,7 +22,7 @@ RenderTextureHostWrapper::~RenderTextureHostWrapper() {
|
|||
MOZ_COUNT_DTOR_INHERITED(RenderTextureHostWrapper, RenderTextureHost);
|
||||
}
|
||||
|
||||
void RenderTextureHostWrapper::EnsureTextureHost() {
|
||||
void RenderTextureHostWrapper::EnsureTextureHost() const {
|
||||
if (!mTextureHost) {
|
||||
mTextureHost = RenderThread::Get()->GetRenderTexture(mExternalImageId);
|
||||
MOZ_ASSERT(mTextureHost);
|
||||
|
@ -73,5 +73,53 @@ RenderTextureHostWrapper::AsRenderDXGITextureHostOGL() {
|
|||
return mTextureHost->AsRenderDXGITextureHostOGL();
|
||||
}
|
||||
|
||||
size_t RenderTextureHostWrapper::GetPlaneCount() {
|
||||
EnsureTextureHost();
|
||||
if (!mTextureHost) {
|
||||
return 0;
|
||||
}
|
||||
RenderTextureHostSWGL* swglHost = mTextureHost->AsRenderTextureHostSWGL();
|
||||
if (!swglHost) {
|
||||
return 0;
|
||||
}
|
||||
return swglHost->GetPlaneCount();
|
||||
}
|
||||
|
||||
bool RenderTextureHostWrapper::MapPlane(uint8_t aChannelIndex,
|
||||
PlaneInfo& aPlaneInfo) {
|
||||
EnsureTextureHost();
|
||||
if (!mTextureHost) {
|
||||
return false;
|
||||
}
|
||||
RenderTextureHostSWGL* swglHost = mTextureHost->AsRenderTextureHostSWGL();
|
||||
if (!swglHost) {
|
||||
return false;
|
||||
}
|
||||
return swglHost->MapPlane(aChannelIndex, aPlaneInfo);
|
||||
}
|
||||
|
||||
void RenderTextureHostWrapper::UnmapPlanes() {
|
||||
EnsureTextureHost();
|
||||
if (!mTextureHost) {
|
||||
return;
|
||||
}
|
||||
RenderTextureHostSWGL* swglHost = mTextureHost->AsRenderTextureHostSWGL();
|
||||
if (swglHost) {
|
||||
swglHost->UnmapPlanes();
|
||||
}
|
||||
}
|
||||
|
||||
gfx::YUVColorSpace RenderTextureHostWrapper::GetYUVColorSpace() const {
|
||||
EnsureTextureHost();
|
||||
if (!mTextureHost) {
|
||||
return gfx::YUVColorSpace::UNKNOWN;
|
||||
}
|
||||
RenderTextureHostSWGL* swglHost = mTextureHost->AsRenderTextureHostSWGL();
|
||||
if (!swglHost) {
|
||||
return gfx::YUVColorSpace::UNKNOWN;
|
||||
}
|
||||
return swglHost->GetYUVColorSpace();
|
||||
}
|
||||
|
||||
} // namespace wr
|
||||
} // namespace mozilla
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
#ifndef MOZILLA_GFX_RENDERTEXTUREHOSTWRAPPER_H
|
||||
#define MOZILLA_GFX_RENDERTEXTUREHOSTWRAPPER_H
|
||||
|
||||
#include "RenderTextureHost.h"
|
||||
#include "RenderTextureHostSWGL.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
|
@ -24,27 +24,32 @@ namespace wr {
|
|||
* RenderTextureHosts(RenderDXGITextureHostOGL and
|
||||
* RenderDXGIYCbCrTextureHostOGL) have overhead.
|
||||
*/
|
||||
class RenderTextureHostWrapper final : public RenderTextureHost {
|
||||
class RenderTextureHostWrapper final : public RenderTextureHostSWGL {
|
||||
public:
|
||||
explicit RenderTextureHostWrapper(ExternalImageId aExternalImageId);
|
||||
|
||||
// RenderTextureHost
|
||||
wr::WrExternalImage Lock(uint8_t aChannelIndex, gl::GLContext* aGL,
|
||||
wr::ImageRendering aRendering) override;
|
||||
void Unlock() override;
|
||||
void ClearCachedResources() override;
|
||||
|
||||
RenderMacIOSurfaceTextureHostOGL* AsRenderMacIOSurfaceTextureHostOGL()
|
||||
override;
|
||||
RenderDXGITextureHostOGL* AsRenderDXGITextureHostOGL() override;
|
||||
|
||||
virtual RenderDXGITextureHostOGL* AsRenderDXGITextureHostOGL() override;
|
||||
// RenderTextureHostSWGL
|
||||
size_t GetPlaneCount() override;
|
||||
bool MapPlane(uint8_t aChannelIndex, PlaneInfo& aPlaneInfo) override;
|
||||
void UnmapPlanes() override;
|
||||
gfx::YUVColorSpace GetYUVColorSpace() const override;
|
||||
|
||||
private:
|
||||
~RenderTextureHostWrapper() override;
|
||||
|
||||
void EnsureTextureHost();
|
||||
void EnsureTextureHost() const;
|
||||
|
||||
const ExternalImageId mExternalImageId;
|
||||
RefPtr<RenderTextureHost> mTextureHost;
|
||||
mutable RefPtr<RenderTextureHost> mTextureHost;
|
||||
};
|
||||
|
||||
} // namespace wr
|
||||
|
|
Загрузка…
Ссылка в новой задаче