tor-browser

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

TextureWrapperImage.h (1374B)


      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 GFX_LAYERS_TEXTUREWRAPPINGIMAGE_H_
      8 #define GFX_LAYERS_TEXTUREWRAPPINGIMAGE_H_
      9 
     10 #include "mozilla/RefPtr.h"
     11 #include "ImageContainer.h"
     12 #include "mozilla/layers/TextureClient.h"
     13 
     14 namespace mozilla {
     15 namespace layers {
     16 
     17 // Wraps a TextureClient into an Image. This may only be used on the main
     18 // thread, and only with TextureClients that support BorrowDrawTarget().
     19 class TextureWrapperImage final : public Image {
     20 public:
     21  TextureWrapperImage(TextureClient* aClient, const gfx::IntRect& aPictureRect);
     22  virtual ~TextureWrapperImage();
     23 
     24  gfx::IntSize GetSize() const override;
     25  gfx::IntRect GetPictureRect() const override;
     26  already_AddRefed<gfx::SourceSurface> GetAsSourceSurface() override;
     27  TextureClient* GetTextureClient(KnowsCompositor* aKnowsCompositor) override;
     28  void OnPrepareForwardToHost() override;
     29  void OnAbandonForwardToHost() override;
     30 
     31 private:
     32  gfx::IntRect mPictureRect;
     33  RefPtr<TextureClient> mTextureClient;
     34 };
     35 
     36 }  // namespace layers
     37 }  // namespace mozilla
     38 
     39 #endif  // GFX_LAYERS_TEXTUREWRAPPINGIMAGE_H_