gfx/layers/d3d10/ThebesLayerD3D10.h

changeset 0
6474c204b198
equal deleted inserted replaced
-1:000000000000 0:1c19b8fdf727
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 GFX_THEBESLAYERD3D10_H
7 #define GFX_THEBESLAYERD3D10_H
8
9 #include "LayerManagerD3D10.h"
10
11 namespace mozilla {
12 namespace layers {
13
14 class ThebesLayerD3D10 : public ThebesLayer,
15 public LayerD3D10
16 {
17 public:
18 ThebesLayerD3D10(LayerManagerD3D10 *aManager);
19 virtual ~ThebesLayerD3D10();
20
21 void Validate(ReadbackProcessor *aReadback);
22
23 /* ThebesLayer implementation */
24 void InvalidateRegion(const nsIntRegion& aRegion);
25
26 /* LayerD3D10 implementation */
27 virtual Layer* GetLayer();
28 virtual void RenderLayer();
29 virtual void Validate() { Validate(nullptr); }
30 virtual void LayerManagerDestroyed();
31
32 private:
33 /* Texture with our surface data */
34 nsRefPtr<ID3D10Texture2D> mTexture;
35
36 /* Shader resource view for our texture */
37 nsRefPtr<ID3D10ShaderResourceView> mSRView;
38
39 /* Texture for render-on-whitew when doing component alpha */
40 nsRefPtr<ID3D10Texture2D> mTextureOnWhite;
41
42 /* Shader resource view for our render-on-white texture */
43 nsRefPtr<ID3D10ShaderResourceView> mSRViewOnWhite;
44
45 /* Area of layer currently stored in texture(s) */
46 nsIntRect mTextureRect;
47
48 /* Last surface mode set in Validate() */
49 SurfaceMode mCurrentSurfaceMode;
50
51 /* Checks if our D2D surface has the right content type */
52 void VerifyContentType(SurfaceMode aMode);
53
54 /* This contains the thebes surface */
55 nsRefPtr<gfxASurface> mD2DSurface;
56
57 mozilla::RefPtr<mozilla::gfx::DrawTarget> mDrawTarget;
58
59 /* This contains the thebes surface for our render-on-white texture */
60 nsRefPtr<gfxASurface> mD2DSurfaceOnWhite;
61
62 /* Have a region of our layer drawn */
63 void DrawRegion(nsIntRegion &aRegion, SurfaceMode aMode);
64
65 /* Create a new texture */
66 void CreateNewTextures(const gfx::IntSize &aSize, SurfaceMode aMode);
67
68 // Fill textures with opaque black and white in the specified region.
69 void FillTexturesBlackWhite(const nsIntRegion& aRegion, const nsIntPoint& aOffset);
70
71 /* Copy a texture region */
72 void CopyRegion(ID3D10Texture2D* aSrc, const nsIntPoint &aSrcOffset,
73 ID3D10Texture2D* aDest, const nsIntPoint &aDestOffset,
74 const nsIntRegion &aCopyRegion, nsIntRegion* aValidRegion);
75 };
76
77 } /* layers */
78 } /* mozilla */
79 #endif /* GFX_THEBESLAYERD3D10_H */

mercurial