gfx/layers/d3d9/ThebesLayerD3D9.h

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     1 /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*-
     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/. */
     6 #ifndef GFX_THEBESLAYERD3D9_H
     7 #define GFX_THEBESLAYERD3D9_H
     9 #include "Layers.h"
    10 #include "LayerManagerD3D9.h"
    11 #include "ReadbackProcessor.h"
    13 namespace mozilla {
    14 namespace layers {
    16 class ReadbackProcessor;
    18 class ThebesLayerD3D9 : public ThebesLayer,
    19                         public LayerD3D9
    20 {
    21 public:
    22   ThebesLayerD3D9(LayerManagerD3D9 *aManager);
    23   virtual ~ThebesLayerD3D9();
    25   /* ThebesLayer implementation */
    26   void InvalidateRegion(const nsIntRegion& aRegion);
    28   /* LayerD3D9 implementation */
    29   Layer* GetLayer();
    30   virtual bool IsEmpty();
    31   virtual void RenderLayer() { RenderThebesLayer(nullptr); }
    32   virtual void CleanResources();
    33   virtual void LayerManagerDestroyed();
    35   void RenderThebesLayer(ReadbackProcessor* aReadback);
    37 private:
    38   /*
    39    * D3D9 texture
    40    */
    41   nsRefPtr<IDirect3DTexture9> mTexture;
    42   /*
    43    * D3D9 texture for render-on-white when doing component alpha
    44    */
    45   nsRefPtr<IDirect3DTexture9> mTextureOnWhite;
    46   /**
    47    * Visible region bounds used when we drew the contents of the textures
    48    */
    49   nsIntRect mTextureRect;
    51   bool HaveTextures(SurfaceMode aMode)
    52   {
    53     return mTexture && (aMode != SurfaceMode::SURFACE_COMPONENT_ALPHA || mTextureOnWhite);
    54   }
    56   /* Checks if our surface has the right content type */
    57   void VerifyContentType(SurfaceMode aMode);
    59   /* Ensures we have the necessary texture object(s) and that they correspond
    60    * to mVisibleRegion.GetBounds(). This creates new texture objects as
    61    * necessary and also copies existing valid texture data if necessary.
    62    */
    63   void UpdateTextures(SurfaceMode aMode);
    65   /* Render the rectangles of mVisibleRegion with D3D9 using the currently
    66    * bound textures, target, shaders, etc.
    67    */
    68   void RenderRegion(const nsIntRegion& aRegion);
    70   /* Have a region of our layer drawn */
    71   void DrawRegion(nsIntRegion &aRegion, SurfaceMode aMode,
    72                   const nsTArray<ReadbackProcessor::Update>& aReadbackUpdates);
    74   /* Create a new texture */
    75   void CreateNewTextures(const gfx::IntSize &aSize, SurfaceMode aMode);
    77   void CopyRegion(IDirect3DTexture9* aSrc, const nsIntPoint &aSrcOffset,
    78                   IDirect3DTexture9* aDest, const nsIntPoint &aDestOffset,
    79                   const nsIntRegion &aCopyRegion, nsIntRegion* aValidRegion);
    80 };
    82 } /* layers */
    83 } /* mozilla */
    84 #endif /* GFX_THEBESLAYERD3D9_H */

mercurial