tor-browser

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

DMABUFTextureHostOGL.h (2268B)


      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_DMABUFTEXTUREHOSTOGL_H
      8 #define MOZILLA_GFX_DMABUFTEXTUREHOSTOGL_H
      9 
     10 #include "mozilla/gfx/2D.h"
     11 #include "mozilla/layers/CompositorOGL.h"
     12 #include "mozilla/layers/TextureHostOGL.h"
     13 
     14 class DMABufSurface;
     15 
     16 namespace mozilla {
     17 namespace layers {
     18 
     19 /**
     20 * A TextureHost for shared class DMABufSurface;
     21 */
     22 class DMABUFTextureHostOGL : public TextureHost {
     23 public:
     24  DMABUFTextureHostOGL(TextureFlags aFlags, const SurfaceDescriptor& aDesc);
     25  virtual ~DMABUFTextureHostOGL();
     26 
     27  bool IsValid() override { return !!mSurface; }
     28 
     29  gfx::SurfaceFormat GetFormat() const override;
     30 
     31  already_AddRefed<gfx::DataSourceSurface> GetAsSurface(
     32      gfx::DataSourceSurface* aSurface) override {
     33    return nullptr;  // XXX - implement this (for MOZ_DUMP_PAINTING)
     34  }
     35 
     36  gl::GLContext* gl() const;
     37 
     38  gfx::IntSize GetSize() const override;
     39 
     40 #ifdef MOZ_LAYERS_HAVE_LOG
     41  const char* Name() override { return "DMABUFTextureHostOGL"; }
     42 #endif
     43  uint32_t NumSubTextures() override;
     44 
     45  gfx::YUVColorSpace GetYUVColorSpace() const override;
     46  gfx::ColorRange GetColorRange() const override;
     47 
     48  void CreateRenderTexture(
     49      const wr::ExternalImageId& aExternalImageId) override;
     50 
     51  void PushResourceUpdates(wr::TransactionBuilder& aResources,
     52                           ResourceUpdateOp aOp,
     53                           const Range<wr::ImageKey>& aImageKeys,
     54                           const wr::ExternalImageId& aExtID) override;
     55 
     56  void PushDisplayItems(wr::DisplayListBuilder& aBuilder,
     57                        const wr::LayoutRect& aBounds,
     58                        const wr::LayoutRect& aClip, wr::ImageRendering aFilter,
     59                        const Range<wr::ImageKey>& aImageKeys,
     60                        PushDisplayItemFlagSet aFlags) override;
     61 
     62 protected:
     63  RefPtr<GLTextureSource> mTextureSource;
     64  RefPtr<DMABufSurface> mSurface;
     65 };
     66 
     67 }  // namespace layers
     68 }  // namespace mozilla
     69 
     70 #endif  // MOZILLA_GFX_DMABUFTEXTUREHOSTOGL_H