2017-10-28 02:10:06 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
2017-03-07 13:37:28 +03:00
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
2017-03-31 17:29:14 +03:00
|
|
|
#ifndef MOZILLA_GFX_RENDERBUFFERTEXTUREHOST_H
|
|
|
|
#define MOZILLA_GFX_RENDERBUFFERTEXTUREHOST_H
|
2017-03-07 13:37:28 +03:00
|
|
|
|
2017-03-31 17:29:14 +03:00
|
|
|
#include "RenderTextureHost.h"
|
2017-03-07 13:37:28 +03:00
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace wr {
|
|
|
|
|
2017-03-31 17:29:14 +03:00
|
|
|
class RenderBufferTextureHost final : public RenderTextureHost
|
2017-03-07 13:37:28 +03:00
|
|
|
{
|
|
|
|
public:
|
2017-03-31 17:29:14 +03:00
|
|
|
RenderBufferTextureHost(uint8_t* aBuffer,
|
|
|
|
const layers::BufferDescriptor& aDescriptor);
|
|
|
|
|
2018-09-03 22:43:31 +03:00
|
|
|
wr::WrExternalImage Lock(uint8_t aChannelIndex,
|
|
|
|
gl::GLContext* aGL,
|
|
|
|
wr::ImageRendering aRendering) override;
|
2017-10-30 20:10:29 +03:00
|
|
|
void Unlock() override;
|
2017-03-31 17:29:14 +03:00
|
|
|
|
2017-05-18 17:59:07 +03:00
|
|
|
class RenderBufferData
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
RenderBufferData(uint8_t* aData, size_t aBufferSize)
|
|
|
|
: mData(aData)
|
|
|
|
, mBufferSize(aBufferSize)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
const uint8_t* mData;
|
|
|
|
size_t mBufferSize;
|
|
|
|
};
|
|
|
|
|
|
|
|
RenderBufferData GetBufferDataForRender(uint8_t aChannelIndex);
|
2017-03-07 13:37:28 +03:00
|
|
|
|
2017-03-31 17:29:14 +03:00
|
|
|
private:
|
|
|
|
virtual ~RenderBufferTextureHost();
|
|
|
|
|
|
|
|
uint8_t* GetBuffer() const
|
|
|
|
{
|
|
|
|
return mBuffer;
|
|
|
|
}
|
2017-03-07 13:37:28 +03:00
|
|
|
|
|
|
|
uint8_t* mBuffer;
|
|
|
|
layers::BufferDescriptor mDescriptor;
|
|
|
|
gfx::IntSize mSize;
|
|
|
|
gfx::SurfaceFormat mFormat;
|
2017-06-07 18:44:04 +03:00
|
|
|
|
2017-03-07 13:37:28 +03:00
|
|
|
RefPtr<gfx::DataSourceSurface> mSurface;
|
|
|
|
gfx::DataSourceSurface::MappedSurface mMap;
|
2017-06-07 18:44:04 +03:00
|
|
|
|
|
|
|
RefPtr<gfx::DataSourceSurface> mYSurface;
|
|
|
|
RefPtr<gfx::DataSourceSurface> mCbSurface;
|
|
|
|
RefPtr<gfx::DataSourceSurface> mCrSurface;
|
|
|
|
gfx::DataSourceSurface::MappedSurface mYMap;
|
|
|
|
gfx::DataSourceSurface::MappedSurface mCbMap;
|
|
|
|
gfx::DataSourceSurface::MappedSurface mCrMap;
|
|
|
|
|
2017-03-07 13:37:28 +03:00
|
|
|
bool mLocked;
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace wr
|
|
|
|
} // namespace mozilla
|
|
|
|
|
2017-03-31 17:29:14 +03:00
|
|
|
#endif // MOZILLA_GFX_RENDERBUFFERTEXTUREHOST_H
|