|
1 /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*- |
|
2 // * This Source Code Form is subject to the terms of the Mozilla Public |
|
3 * License, v. 2.0. If a copy of the MPL was not distributed with this |
|
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
5 |
|
6 #ifndef MOZILLA_GFX_TEXTURECLIENT_X11_H |
|
7 #define MOZILLA_GFX_TEXTURECLIENT_X11_H |
|
8 |
|
9 #include "mozilla/layers/TextureClient.h" |
|
10 #include "ISurfaceAllocator.h" // For IsSurfaceDescriptorValid |
|
11 #include "mozilla/layers/ShadowLayerUtilsX11.h" |
|
12 |
|
13 namespace mozilla { |
|
14 namespace layers { |
|
15 |
|
16 /** |
|
17 * A TextureClient implementation based on Xlib. |
|
18 */ |
|
19 class TextureClientX11 : public TextureClient |
|
20 { |
|
21 public: |
|
22 TextureClientX11(gfx::SurfaceFormat format, TextureFlags aFlags = TEXTURE_FLAGS_DEFAULT); |
|
23 |
|
24 ~TextureClientX11(); |
|
25 |
|
26 // TextureClient |
|
27 |
|
28 virtual bool IsAllocated() const MOZ_OVERRIDE; |
|
29 |
|
30 virtual bool ToSurfaceDescriptor(SurfaceDescriptor& aOutDescriptor) MOZ_OVERRIDE; |
|
31 |
|
32 virtual TextureClientData* DropTextureData() MOZ_OVERRIDE; |
|
33 |
|
34 virtual gfx::IntSize GetSize() const MOZ_OVERRIDE { return mSize; } |
|
35 |
|
36 virtual bool Lock(OpenMode aMode) MOZ_OVERRIDE; |
|
37 |
|
38 virtual void Unlock() MOZ_OVERRIDE; |
|
39 |
|
40 virtual bool IsLocked() const MOZ_OVERRIDE { return mLocked; } |
|
41 |
|
42 virtual bool AllocateForSurface(gfx::IntSize aSize, TextureAllocationFlags flags) MOZ_OVERRIDE; |
|
43 |
|
44 virtual bool CanExposeDrawTarget() const MOZ_OVERRIDE { return true; } |
|
45 |
|
46 virtual TemporaryRef<gfx::DrawTarget> GetAsDrawTarget() MOZ_OVERRIDE; |
|
47 |
|
48 virtual gfx::SurfaceFormat GetFormat() const { return mFormat; } |
|
49 |
|
50 virtual bool HasInternalBuffer() const MOZ_OVERRIDE { return false; } |
|
51 |
|
52 private: |
|
53 gfx::SurfaceFormat mFormat; |
|
54 gfx::IntSize mSize; |
|
55 RefPtr<gfxXlibSurface> mSurface; |
|
56 bool mLocked; |
|
57 }; |
|
58 |
|
59 } // namespace layers |
|
60 } // namespace mozilla |
|
61 |
|
62 #endif |