1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/gfx/layers/d3d10/ThebesLayerD3D10.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,79 @@ 1.4 +/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*- 1.5 + * This Source Code Form is subject to the terms of the Mozilla Public 1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.8 + 1.9 +#ifndef GFX_THEBESLAYERD3D10_H 1.10 +#define GFX_THEBESLAYERD3D10_H 1.11 + 1.12 +#include "LayerManagerD3D10.h" 1.13 + 1.14 +namespace mozilla { 1.15 +namespace layers { 1.16 + 1.17 +class ThebesLayerD3D10 : public ThebesLayer, 1.18 + public LayerD3D10 1.19 +{ 1.20 +public: 1.21 + ThebesLayerD3D10(LayerManagerD3D10 *aManager); 1.22 + virtual ~ThebesLayerD3D10(); 1.23 + 1.24 + void Validate(ReadbackProcessor *aReadback); 1.25 + 1.26 + /* ThebesLayer implementation */ 1.27 + void InvalidateRegion(const nsIntRegion& aRegion); 1.28 + 1.29 + /* LayerD3D10 implementation */ 1.30 + virtual Layer* GetLayer(); 1.31 + virtual void RenderLayer(); 1.32 + virtual void Validate() { Validate(nullptr); } 1.33 + virtual void LayerManagerDestroyed(); 1.34 + 1.35 +private: 1.36 + /* Texture with our surface data */ 1.37 + nsRefPtr<ID3D10Texture2D> mTexture; 1.38 + 1.39 + /* Shader resource view for our texture */ 1.40 + nsRefPtr<ID3D10ShaderResourceView> mSRView; 1.41 + 1.42 + /* Texture for render-on-whitew when doing component alpha */ 1.43 + nsRefPtr<ID3D10Texture2D> mTextureOnWhite; 1.44 + 1.45 + /* Shader resource view for our render-on-white texture */ 1.46 + nsRefPtr<ID3D10ShaderResourceView> mSRViewOnWhite; 1.47 + 1.48 + /* Area of layer currently stored in texture(s) */ 1.49 + nsIntRect mTextureRect; 1.50 + 1.51 + /* Last surface mode set in Validate() */ 1.52 + SurfaceMode mCurrentSurfaceMode; 1.53 + 1.54 + /* Checks if our D2D surface has the right content type */ 1.55 + void VerifyContentType(SurfaceMode aMode); 1.56 + 1.57 + /* This contains the thebes surface */ 1.58 + nsRefPtr<gfxASurface> mD2DSurface; 1.59 + 1.60 + mozilla::RefPtr<mozilla::gfx::DrawTarget> mDrawTarget; 1.61 + 1.62 + /* This contains the thebes surface for our render-on-white texture */ 1.63 + nsRefPtr<gfxASurface> mD2DSurfaceOnWhite; 1.64 + 1.65 + /* Have a region of our layer drawn */ 1.66 + void DrawRegion(nsIntRegion &aRegion, SurfaceMode aMode); 1.67 + 1.68 + /* Create a new texture */ 1.69 + void CreateNewTextures(const gfx::IntSize &aSize, SurfaceMode aMode); 1.70 + 1.71 + // Fill textures with opaque black and white in the specified region. 1.72 + void FillTexturesBlackWhite(const nsIntRegion& aRegion, const nsIntPoint& aOffset); 1.73 + 1.74 + /* Copy a texture region */ 1.75 + void CopyRegion(ID3D10Texture2D* aSrc, const nsIntPoint &aSrcOffset, 1.76 + ID3D10Texture2D* aDest, const nsIntPoint &aDestOffset, 1.77 + const nsIntRegion &aCopyRegion, nsIntRegion* aValidRegion); 1.78 +}; 1.79 + 1.80 +} /* layers */ 1.81 +} /* mozilla */ 1.82 +#endif /* GFX_THEBESLAYERD3D10_H */