tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

SharedSurfaceGL.cpp (1391B)


      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/. */
      5 
      6 #include "SharedSurfaceGL.h"
      7 
      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"
     14 
     15 namespace mozilla {
     16 namespace gl {
     17 
     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;
     23 
     24  return AsUnique(new SharedSurface_Basic(desc, std::move(fb)));
     25 }
     26 
     27 SharedSurface_Basic::SharedSurface_Basic(const SharedSurfaceDesc& desc,
     28                                         UniquePtr<MozFramebuffer>&& fb)
     29    : SharedSurface(desc, std::move(fb)) {}
     30 
     31 Maybe<layers::SurfaceDescriptor> SharedSurface_Basic::ToSurfaceDescriptor() {
     32  return Nothing();
     33 }
     34 
     35 ////////////////////////////////////////////////////////////////////////
     36 
     37 SurfaceFactory_Basic::SurfaceFactory_Basic(GLContext& gl)
     38    : SurfaceFactory({&gl, SharedSurfaceType::Basic,
     39                      layers::TextureType::Unknown, true}) {}
     40 
     41 }  // namespace gl
     42 }  // namespace mozilla