gfx/layers/opengl/X11TextureSourceOGL.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/gfx/layers/opengl/X11TextureSourceOGL.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,60 @@
     1.4 +/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
     1.5 + * This Source Code Form is subject to the terms of the Mozilla Public
     1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.8 +
     1.9 +#ifndef MOZILLA_GFX_X11TEXTURESOURCEOGL__H
    1.10 +#define MOZILLA_GFX_X11TEXTURESOURCEOGL__H
    1.11 +
    1.12 +#ifdef GL_PROVIDER_GLX
    1.13 +
    1.14 +#include "mozilla/layers/TextureHostOGL.h"
    1.15 +#include "mozilla/gfx/2D.h"
    1.16 +
    1.17 +namespace mozilla {
    1.18 +namespace layers {
    1.19 +
    1.20 +// TextureSource for Xlib-backed surfaces.
    1.21 +class X11TextureSourceOGL
    1.22 +  : public TextureSourceOGL
    1.23 +  , public NewTextureSource
    1.24 +{
    1.25 +public:
    1.26 +  X11TextureSourceOGL(CompositorOGL* aCompositor, gfxXlibSurface* aSurface);
    1.27 +  ~X11TextureSourceOGL();
    1.28 +
    1.29 +  virtual X11TextureSourceOGL* AsSourceOGL() MOZ_OVERRIDE { return this; }
    1.30 +
    1.31 +  virtual bool IsValid() const MOZ_OVERRIDE { return !!gl(); } ;
    1.32 +
    1.33 +  virtual void BindTexture(GLenum aTextureUnit, gfx::Filter aFilter) MOZ_OVERRIDE;
    1.34 +
    1.35 +  virtual gfx::IntSize GetSize() const MOZ_OVERRIDE;
    1.36 +
    1.37 +  virtual GLenum GetTextureTarget() const MOZ_OVERRIDE { return LOCAL_GL_TEXTURE_2D; }
    1.38 +
    1.39 +  virtual gfx::SurfaceFormat GetFormat() const MOZ_OVERRIDE;
    1.40 +
    1.41 +  virtual GLenum GetWrapMode() const MOZ_OVERRIDE { return LOCAL_GL_CLAMP_TO_EDGE; }
    1.42 +
    1.43 +  virtual void DeallocateDeviceData() MOZ_OVERRIDE;
    1.44 +
    1.45 +  virtual void SetCompositor(Compositor* aCompositor) MOZ_OVERRIDE;
    1.46 +
    1.47 +  gl::GLContext* gl() const;
    1.48 +
    1.49 +  static gfx::SurfaceFormat ContentTypeToSurfaceFormat(gfxContentType aType);
    1.50 +
    1.51 +protected:
    1.52 +  CompositorOGL* mCompositor;
    1.53 +  nsRefPtr<gfxXlibSurface> mSurface;
    1.54 +  RefPtr<gfx::SourceSurface> mSourceSurface;
    1.55 +  GLuint mTexture;
    1.56 +};
    1.57 +
    1.58 +} // namespace layers
    1.59 +} // namespace mozilla
    1.60 +
    1.61 +#endif
    1.62 +
    1.63 +#endif // MOZILLA_GFX_X11TEXTURESOURCEOGL__H

mercurial