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"
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
{
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
;
32 gfx::IntRect mPictureRect
;
33 RefPtr
<TextureClient
> mTextureClient
;
37 } // namespace mozilla
39 #endif // GFX_LAYERS_TEXTUREWRAPPINGIMAGE_H_