Bug 648484, part 9: Make LayerManagerD3D10 a shadow-layer manager and forwarder. r=Bas
authorChris Jones <jones.chris.g@gmail.com>
Tue, 09 Aug 2011 12:38:26 -0700
changeset 75255 5478c7ef7debd7a27657d2a2c1420c21e50f2cdc
parent 75254 26009612781b438135788a0f50a82b0ee74b52d3
child 75256 c83050561980052a41a24386124a30f014d7a776
push idunknown
push userunknown
push dateunknown
reviewersBas
bugs648484
milestone8.0a1
Bug 648484, part 9: Make LayerManagerD3D10 a shadow-layer manager and forwarder. r=Bas
gfx/layers/d3d10/LayerManagerD3D10.cpp
gfx/layers/d3d10/LayerManagerD3D10.h
--- a/gfx/layers/d3d10/LayerManagerD3D10.cpp
+++ b/gfx/layers/d3d10/LayerManagerD3D10.cpp
@@ -353,24 +353,38 @@ LayerManagerD3D10::EndTransaction(DrawTh
 }
 
 already_AddRefed<ThebesLayer>
 LayerManagerD3D10::CreateThebesLayer()
 {
   nsRefPtr<ThebesLayer> layer = new ThebesLayerD3D10(this);
   return layer.forget();
 }
+ 
+already_AddRefed<ShadowThebesLayer>
+LayerManagerD3D10::CreateShadowThebesLayer()
+{
+  nsRefPtr<ShadowThebesLayerD3D10> layer = new ShadowThebesLayerD3D10(this);
+  return layer.forget();
+}
 
 already_AddRefed<ContainerLayer>
 LayerManagerD3D10::CreateContainerLayer()
 {
   nsRefPtr<ContainerLayer> layer = new ContainerLayerD3D10(this);
   return layer.forget();
 }
 
+already_AddRefed<ShadowContainerLayer>
+LayerManagerD3D10::CreateShadowContainerLayer()
+{
+  nsRefPtr<ShadowContainerLayer> layer = new ShadowContainerLayerD3D10(this);
+  return layer.forget();
+}
+
 already_AddRefed<ImageLayer>
 LayerManagerD3D10::CreateImageLayer()
 {
   nsRefPtr<ImageLayer> layer = new ImageLayerD3D10(this);
   return layer.forget();
 }
 
 already_AddRefed<ColorLayer>
--- a/gfx/layers/d3d10/LayerManagerD3D10.h
+++ b/gfx/layers/d3d10/LayerManagerD3D10.h
@@ -70,21 +70,28 @@ struct ShaderConstantRectD3D10
 
   // For easy passing to SetVertexShaderConstantF.
   operator float* () { return &mX; }
 };
 
 extern cairo_user_data_key_t gKeyD3D10Texture;
 
 /*
- * This is the LayerManager used for Direct3D 9. For now this will render on
- * the main thread.
+ * This is the LayerManager used for Direct3D 10. For now this will
+ * render on the main thread.
+ *
+ * For the time being, LayerManagerD3D10 both forwards layers
+ * transactions and receives forwarded transactions.  In the Azure
+ * future, it will only be a ShadowLayerManager.
  */
-class THEBES_API LayerManagerD3D10 : public LayerManager {
+class THEBES_API LayerManagerD3D10 : public ShadowLayerManager,
+                                     public ShadowLayerForwarder {
 public:
+  typedef LayerManager::LayersBackend LayersBackend;
+
   LayerManagerD3D10(nsIWidget *aWidget);
   virtual ~LayerManagerD3D10();
 
   /*
    * Initializes the layer manager, this is when the layer manager will
    * actually access the device and attempt to create the swap chain used
    * to draw to the window. If this method fails the device cannot be used.
    * This function is not threadsafe.
@@ -93,16 +100,22 @@ public:
    */
   bool Initialize();
 
   /*
    * LayerManager implementation.
    */
   virtual void Destroy();
 
+  virtual ShadowLayerForwarder* AsShadowForwarder()
+  { return this; }
+
+  virtual ShadowLayerManager* AsShadowManager()
+  { return this; }
+
   virtual void SetRoot(Layer *aLayer);
 
   virtual void BeginTransaction();
 
   virtual void BeginTransactionWithTarget(gfxContext* aTarget);
 
   virtual bool EndEmptyTransaction();
 
@@ -121,24 +134,32 @@ public:
     MAX_TEXTURE_SIZE = 8192
   };
   virtual bool CanUseCanvasLayerForSize(const gfxIntSize &aSize)
   {
     return aSize <= gfxIntSize(MAX_TEXTURE_SIZE, MAX_TEXTURE_SIZE);
   }
 
   virtual already_AddRefed<ThebesLayer> CreateThebesLayer();
+  virtual already_AddRefed<ShadowThebesLayer> CreateShadowThebesLayer();
 
   virtual already_AddRefed<ContainerLayer> CreateContainerLayer();
+  virtual already_AddRefed<ShadowContainerLayer> CreateShadowContainerLayer();
 
   virtual already_AddRefed<ImageLayer> CreateImageLayer();
+  virtual already_AddRefed<ShadowImageLayer> CreateShadowImageLayer()
+  { return nsnull; }
 
   virtual already_AddRefed<ColorLayer> CreateColorLayer();
+  virtual already_AddRefed<ShadowColorLayer> CreateShadowColorLayer()
+  { return nsnull; }
 
   virtual already_AddRefed<CanvasLayer> CreateCanvasLayer();
+  virtual already_AddRefed<ShadowCanvasLayer> CreateShadowCanvasLayer()
+  { return nsnull; }
 
   virtual already_AddRefed<ReadbackLayer> CreateReadbackLayer();
 
   virtual already_AddRefed<ImageContainer> CreateImageContainer();
 
   virtual already_AddRefed<gfxASurface>
     CreateOptimalSurface(const gfxIntSize &aSize,
                          gfxASurface::gfxImageFormat imageFormat);