Source code

Revision control

Other Tools

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
29
private:
30
gfx::IntRect mPictureRect;
31
RefPtr<TextureClient> mTextureClient;
32
};
33
34
} // namespace layers
35
} // namespace mozilla
36
37
#endif // GFX_LAYERS_TEXTUREWRAPPINGIMAGE_H_