no bug - Bumping Firefox l10n changesets r=release a=l10n-bump DONTBUILD CLOSED TREE
[gecko.git] / gfx / webrender_bindings / RenderCompositorRecordedFrame.h
blobf7a516107b6cb46bb364a5385199cbd757be4e8d
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/. */
7 #ifndef MOZILLA_GFX_RENDERCOMPOSITOR_RECORDEDFRAME_H
8 #define MOZILLA_GFX_RENDERCOMPOSITOR_RECORDEDFRAME_H
10 #include "mozilla/layers/CompositionRecorder.h"
12 namespace mozilla {
14 namespace wr {
16 class RenderCompositorRecordedFrame final : public layers::RecordedFrame {
17 public:
18 RenderCompositorRecordedFrame(
19 const TimeStamp& aTimeStamp,
20 RefPtr<layers::profiler_screenshots::AsyncReadbackBuffer>&& aBuffer)
21 : RecordedFrame(aTimeStamp), mBuffer(aBuffer) {}
23 virtual already_AddRefed<gfx::DataSourceSurface> GetSourceSurface() override {
24 if (mSurface) {
25 return do_AddRef(mSurface);
28 gfx::IntSize size = mBuffer->Size();
29 mSurface = gfx::Factory::CreateDataSourceSurface(
30 size, gfx::SurfaceFormat::B8G8R8A8,
31 /* aZero = */ false);
33 if (!mBuffer->MapAndCopyInto(mSurface, size)) {
34 mSurface = nullptr;
35 return nullptr;
38 return do_AddRef(mSurface);
41 private:
42 RefPtr<layers::profiler_screenshots::AsyncReadbackBuffer> mBuffer;
43 RefPtr<gfx::DataSourceSurface> mSurface;
46 } // namespace wr
47 } // namespace mozilla
49 #endif