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"
16 class RenderCompositorRecordedFrame final
: public layers::RecordedFrame
{
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
{
25 return do_AddRef(mSurface
);
28 gfx::IntSize size
= mBuffer
->Size();
29 mSurface
= gfx::Factory::CreateDataSourceSurface(
30 size
, gfx::SurfaceFormat::B8G8R8A8
,
33 if (!mBuffer
->MapAndCopyInto(mSurface
, size
)) {
38 return do_AddRef(mSurface
);
42 RefPtr
<layers::profiler_screenshots::AsyncReadbackBuffer
> mBuffer
;
43 RefPtr
<gfx::DataSourceSurface
> mSurface
;
47 } // namespace mozilla