Bug 1882703 [wpt PR 44848] - Update wpt metadata, a=testonly
[gecko.git] / gfx / layers / TextureWrapperImage.h
blob455cc113001ecebcb7e5f4807071f72a6492c429
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/. */
7 #ifndef GFX_LAYERS_TEXTUREWRAPPINGIMAGE_H_
8 #define GFX_LAYERS_TEXTUREWRAPPINGIMAGE_H_
10 #include "mozilla/RefPtr.h"
11 #include "ImageContainer.h"
12 #include "mozilla/layers/TextureClient.h"
14 namespace mozilla {
15 namespace layers {
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();
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;
31 private:
32 gfx::IntRect mPictureRect;
33 RefPtr<TextureClient> mTextureClient;
36 } // namespace layers
37 } // namespace mozilla
39 #endif // GFX_LAYERS_TEXTUREWRAPPINGIMAGE_H_