Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*- |
michael@0 | 2 | * This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 3 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 4 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 5 | |
michael@0 | 6 | #ifndef GFX_THEBESLAYERD3D10_H |
michael@0 | 7 | #define GFX_THEBESLAYERD3D10_H |
michael@0 | 8 | |
michael@0 | 9 | #include "LayerManagerD3D10.h" |
michael@0 | 10 | |
michael@0 | 11 | namespace mozilla { |
michael@0 | 12 | namespace layers { |
michael@0 | 13 | |
michael@0 | 14 | class ThebesLayerD3D10 : public ThebesLayer, |
michael@0 | 15 | public LayerD3D10 |
michael@0 | 16 | { |
michael@0 | 17 | public: |
michael@0 | 18 | ThebesLayerD3D10(LayerManagerD3D10 *aManager); |
michael@0 | 19 | virtual ~ThebesLayerD3D10(); |
michael@0 | 20 | |
michael@0 | 21 | void Validate(ReadbackProcessor *aReadback); |
michael@0 | 22 | |
michael@0 | 23 | /* ThebesLayer implementation */ |
michael@0 | 24 | void InvalidateRegion(const nsIntRegion& aRegion); |
michael@0 | 25 | |
michael@0 | 26 | /* LayerD3D10 implementation */ |
michael@0 | 27 | virtual Layer* GetLayer(); |
michael@0 | 28 | virtual void RenderLayer(); |
michael@0 | 29 | virtual void Validate() { Validate(nullptr); } |
michael@0 | 30 | virtual void LayerManagerDestroyed(); |
michael@0 | 31 | |
michael@0 | 32 | private: |
michael@0 | 33 | /* Texture with our surface data */ |
michael@0 | 34 | nsRefPtr<ID3D10Texture2D> mTexture; |
michael@0 | 35 | |
michael@0 | 36 | /* Shader resource view for our texture */ |
michael@0 | 37 | nsRefPtr<ID3D10ShaderResourceView> mSRView; |
michael@0 | 38 | |
michael@0 | 39 | /* Texture for render-on-whitew when doing component alpha */ |
michael@0 | 40 | nsRefPtr<ID3D10Texture2D> mTextureOnWhite; |
michael@0 | 41 | |
michael@0 | 42 | /* Shader resource view for our render-on-white texture */ |
michael@0 | 43 | nsRefPtr<ID3D10ShaderResourceView> mSRViewOnWhite; |
michael@0 | 44 | |
michael@0 | 45 | /* Area of layer currently stored in texture(s) */ |
michael@0 | 46 | nsIntRect mTextureRect; |
michael@0 | 47 | |
michael@0 | 48 | /* Last surface mode set in Validate() */ |
michael@0 | 49 | SurfaceMode mCurrentSurfaceMode; |
michael@0 | 50 | |
michael@0 | 51 | /* Checks if our D2D surface has the right content type */ |
michael@0 | 52 | void VerifyContentType(SurfaceMode aMode); |
michael@0 | 53 | |
michael@0 | 54 | /* This contains the thebes surface */ |
michael@0 | 55 | nsRefPtr<gfxASurface> mD2DSurface; |
michael@0 | 56 | |
michael@0 | 57 | mozilla::RefPtr<mozilla::gfx::DrawTarget> mDrawTarget; |
michael@0 | 58 | |
michael@0 | 59 | /* This contains the thebes surface for our render-on-white texture */ |
michael@0 | 60 | nsRefPtr<gfxASurface> mD2DSurfaceOnWhite; |
michael@0 | 61 | |
michael@0 | 62 | /* Have a region of our layer drawn */ |
michael@0 | 63 | void DrawRegion(nsIntRegion &aRegion, SurfaceMode aMode); |
michael@0 | 64 | |
michael@0 | 65 | /* Create a new texture */ |
michael@0 | 66 | void CreateNewTextures(const gfx::IntSize &aSize, SurfaceMode aMode); |
michael@0 | 67 | |
michael@0 | 68 | // Fill textures with opaque black and white in the specified region. |
michael@0 | 69 | void FillTexturesBlackWhite(const nsIntRegion& aRegion, const nsIntPoint& aOffset); |
michael@0 | 70 | |
michael@0 | 71 | /* Copy a texture region */ |
michael@0 | 72 | void CopyRegion(ID3D10Texture2D* aSrc, const nsIntPoint &aSrcOffset, |
michael@0 | 73 | ID3D10Texture2D* aDest, const nsIntPoint &aDestOffset, |
michael@0 | 74 | const nsIntRegion &aCopyRegion, nsIntRegion* aValidRegion); |
michael@0 | 75 | }; |
michael@0 | 76 | |
michael@0 | 77 | } /* layers */ |
michael@0 | 78 | } /* mozilla */ |
michael@0 | 79 | #endif /* GFX_THEBESLAYERD3D10_H */ |