michael@0: /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*- michael@0: * This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef GFX_THEBESLAYERD3D10_H michael@0: #define GFX_THEBESLAYERD3D10_H michael@0: michael@0: #include "LayerManagerD3D10.h" michael@0: michael@0: namespace mozilla { michael@0: namespace layers { michael@0: michael@0: class ThebesLayerD3D10 : public ThebesLayer, michael@0: public LayerD3D10 michael@0: { michael@0: public: michael@0: ThebesLayerD3D10(LayerManagerD3D10 *aManager); michael@0: virtual ~ThebesLayerD3D10(); michael@0: michael@0: void Validate(ReadbackProcessor *aReadback); michael@0: michael@0: /* ThebesLayer implementation */ michael@0: void InvalidateRegion(const nsIntRegion& aRegion); michael@0: michael@0: /* LayerD3D10 implementation */ michael@0: virtual Layer* GetLayer(); michael@0: virtual void RenderLayer(); michael@0: virtual void Validate() { Validate(nullptr); } michael@0: virtual void LayerManagerDestroyed(); michael@0: michael@0: private: michael@0: /* Texture with our surface data */ michael@0: nsRefPtr mTexture; michael@0: michael@0: /* Shader resource view for our texture */ michael@0: nsRefPtr mSRView; michael@0: michael@0: /* Texture for render-on-whitew when doing component alpha */ michael@0: nsRefPtr mTextureOnWhite; michael@0: michael@0: /* Shader resource view for our render-on-white texture */ michael@0: nsRefPtr mSRViewOnWhite; michael@0: michael@0: /* Area of layer currently stored in texture(s) */ michael@0: nsIntRect mTextureRect; michael@0: michael@0: /* Last surface mode set in Validate() */ michael@0: SurfaceMode mCurrentSurfaceMode; michael@0: michael@0: /* Checks if our D2D surface has the right content type */ michael@0: void VerifyContentType(SurfaceMode aMode); michael@0: michael@0: /* This contains the thebes surface */ michael@0: nsRefPtr mD2DSurface; michael@0: michael@0: mozilla::RefPtr mDrawTarget; michael@0: michael@0: /* This contains the thebes surface for our render-on-white texture */ michael@0: nsRefPtr mD2DSurfaceOnWhite; michael@0: michael@0: /* Have a region of our layer drawn */ michael@0: void DrawRegion(nsIntRegion &aRegion, SurfaceMode aMode); michael@0: michael@0: /* Create a new texture */ michael@0: void CreateNewTextures(const gfx::IntSize &aSize, SurfaceMode aMode); michael@0: michael@0: // Fill textures with opaque black and white in the specified region. michael@0: void FillTexturesBlackWhite(const nsIntRegion& aRegion, const nsIntPoint& aOffset); michael@0: michael@0: /* Copy a texture region */ michael@0: void CopyRegion(ID3D10Texture2D* aSrc, const nsIntPoint &aSrcOffset, michael@0: ID3D10Texture2D* aDest, const nsIntPoint &aDestOffset, michael@0: const nsIntRegion &aCopyRegion, nsIntRegion* aValidRegion); michael@0: }; michael@0: michael@0: } /* layers */ michael@0: } /* mozilla */ michael@0: #endif /* GFX_THEBESLAYERD3D10_H */