Bug 648484, part 9: Make LayerManagerD3D10 a shadow-layer manager and forwarder. r=Bas
authorChris Jones <jones.chris.g@gmail.com>
Wed, 06 Jul 2011 13:29:27 -0400
changeset 72439 89f79fd3a359b6d3ec36c528c9dd545bf7c99268
parent 72438 c235c547e2335df171365ed36396008dc2075182
child 72440 e1380db9f06997360d35c7f3925164f541612363
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();
 
@@ -112,24 +125,32 @@ public:
   };
 
   virtual void EndTransaction(DrawThebesLayerCallback aCallback,
                               void* aCallbackData);
 
   const CallbackInfo &GetCallbackInfo() { return mCurrentCallbackInfo; }
 
   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);