Coverage Report

Created: 2018-09-25 14:53

/src/mozilla-central/gfx/webrender_bindings/RenderBufferTextureHost.h
Line
Count
Source (jump to first uncovered line)
1
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
3
/* This Source Code Form is subject to the terms of the Mozilla Public
4
 * License, v. 2.0. If a copy of the MPL was not distributed with this
5
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6
7
#ifndef MOZILLA_GFX_RENDERBUFFERTEXTUREHOST_H
8
#define MOZILLA_GFX_RENDERBUFFERTEXTUREHOST_H
9
10
#include "RenderTextureHost.h"
11
12
namespace mozilla {
13
namespace wr {
14
15
class RenderBufferTextureHost final : public RenderTextureHost
16
{
17
public:
18
  RenderBufferTextureHost(uint8_t* aBuffer,
19
                          const layers::BufferDescriptor& aDescriptor);
20
21
  wr::WrExternalImage Lock(uint8_t aChannelIndex,
22
                           gl::GLContext* aGL,
23
                           wr::ImageRendering aRendering) override;
24
  void Unlock() override;
25
26
  class RenderBufferData
27
  {
28
  public:
29
    RenderBufferData(uint8_t* aData, size_t aBufferSize)
30
      : mData(aData)
31
      , mBufferSize(aBufferSize)
32
0
    {
33
0
    }
34
    const uint8_t* mData;
35
    size_t mBufferSize;
36
  };
37
38
  RenderBufferData GetBufferDataForRender(uint8_t aChannelIndex);
39
40
private:
41
  virtual ~RenderBufferTextureHost();
42
43
  uint8_t* GetBuffer() const
44
0
  {
45
0
    return mBuffer;
46
0
  }
47
48
  uint8_t* mBuffer;
49
  layers::BufferDescriptor mDescriptor;
50
  gfx::IntSize mSize;
51
  gfx::SurfaceFormat mFormat;
52
53
  RefPtr<gfx::DataSourceSurface> mSurface;
54
  gfx::DataSourceSurface::MappedSurface mMap;
55
56
  RefPtr<gfx::DataSourceSurface> mYSurface;
57
  RefPtr<gfx::DataSourceSurface> mCbSurface;
58
  RefPtr<gfx::DataSourceSurface> mCrSurface;
59
  gfx::DataSourceSurface::MappedSurface mYMap;
60
  gfx::DataSourceSurface::MappedSurface mCbMap;
61
  gfx::DataSourceSurface::MappedSurface mCrMap;
62
63
  bool mLocked;
64
};
65
66
} // namespace wr
67
} // namespace mozilla
68
69
#endif // MOZILLA_GFX_RENDERBUFFERTEXTUREHOST_H