Bug 1860959 [wpt PR 42048] - [webaudio] Convert test to testharness, a=testonly
[gecko.git] / gfx / gl / SharedSurfaceGL.cpp
blob5b33088e2e1c76ce4d3a3ac64d2e9aa229f41bc8
1 /* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 4; -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #include "SharedSurfaceGL.h"
8 #include "GLBlitHelper.h"
9 #include "GLContext.h"
10 #include "GLReadTexImageHelper.h"
11 #include "mozilla/gfx/2D.h"
12 #include "mozilla/layers/TextureForwarder.h"
13 #include "ScopedGLHelpers.h"
15 namespace mozilla {
16 namespace gl {
18 /*static*/
19 UniquePtr<SharedSurface_Basic> SharedSurface_Basic::Create(
20 const SharedSurfaceDesc& desc) {
21 auto fb = MozFramebuffer::Create(desc.gl, desc.size, 0, false);
22 if (!fb) return nullptr;
24 return AsUnique(new SharedSurface_Basic(desc, std::move(fb)));
27 SharedSurface_Basic::SharedSurface_Basic(const SharedSurfaceDesc& desc,
28 UniquePtr<MozFramebuffer>&& fb)
29 : SharedSurface(desc, std::move(fb)) {}
31 Maybe<layers::SurfaceDescriptor> SharedSurface_Basic::ToSurfaceDescriptor() {
32 return Nothing();
35 ////////////////////////////////////////////////////////////////////////
37 SurfaceFactory_Basic::SurfaceFactory_Basic(GLContext& gl)
38 : SurfaceFactory({&gl, SharedSurfaceType::Basic,
39 layers::TextureType::Unknown, true}) {}
41 } // namespace gl
42 } // namespace mozilla