Bug 648484, part 7: Implement a very basic shadow container layer for D3D10, only enough to support the upcoming WindowLayer. r=Bas
authorChris Jones <jones.chris.g@gmail.com>
Tue, 09 Aug 2011 12:38:26 -0700
changeset 74137 ea0cb7ad5364693a48bababa19a8dd163273b2fc
parent 74136 5a136975b5bcfbeeb76e4d8d11b484bc8a853b1b
child 74138 26009612781b438135788a0f50a82b0ee74b52d3
push id2
push userbsmedberg@mozilla.com
push dateFri, 19 Aug 2011 14:38:13 +0000
reviewersBas
bugs648484
milestone8.0a1
Bug 648484, part 7: Implement a very basic shadow container layer for D3D10, only enough to support the upcoming WindowLayer. r=Bas
gfx/layers/d3d10/ContainerLayerD3D10.cpp
gfx/layers/d3d10/ContainerLayerD3D10.h
gfx/layers/d3d10/LayerManagerD3D10.h
--- a/gfx/layers/d3d10/ContainerLayerD3D10.cpp
+++ b/gfx/layers/d3d10/ContainerLayerD3D10.cpp
@@ -1,9 +1,9 @@
-/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
  * ***** BEGIN LICENSE BLOCK *****
  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
  *
  * The contents of this file are subject to the Mozilla Public License Version
  * 1.1 (the "License"); you may not use this file except in compliance with
  * the License. You may obtain a copy of the License at
  * http://www.mozilla.org/MPL/
  *
@@ -370,10 +370,60 @@ ContainerLayerD3D10::Validate()
       static_cast<ThebesLayerD3D10*>(layer)->Validate(&readback);
     } else {
       static_cast<LayerD3D10*>(layer->ImplData())->Validate();
     }
     layer = layer->GetNextSibling();
   }
 }
 
+ShadowContainerLayerD3D10::ShadowContainerLayerD3D10(LayerManagerD3D10 *aManager) 
+  : ShadowContainerLayer(aManager, NULL)
+  , LayerD3D10(aManager)
+{
+  mImplData = static_cast<LayerD3D10*>(this);
+}
+
+ShadowContainerLayerD3D10::~ShadowContainerLayerD3D10() {}
+
+void
+ShadowContainerLayerD3D10::InsertAfter(Layer* aChild, Layer* aAfter)
+{
+  mFirstChild = aChild;
+}
+
+void
+ShadowContainerLayerD3D10::RemoveChild(Layer* aChild)
+{
+
+}
+
+void
+ShadowContainerLayerD3D10::ComputeEffectiveTransforms(const gfx3DMatrix& aTransformToSurface)
+{
+  DefaultComputeEffectiveTransforms(aTransformToSurface);
+}
+
+LayerD3D10*
+ShadowContainerLayerD3D10::GetFirstChildD3D10()
+{
+  return static_cast<LayerD3D10*>(mFirstChild->ImplData());
+}
+
+void
+ShadowContainerLayerD3D10::RenderLayer()
+{
+  LayerD3D10* layerToRender = GetFirstChildD3D10();
+  layerToRender->RenderLayer();
+}
+
+void
+ShadowContainerLayerD3D10::Validate()
+{
+}
+ 
+void
+ShadowContainerLayerD3D10::LayerManagerDestroyed()
+{
+}
+
 } /* layers */
 } /* mozilla */
--- a/gfx/layers/d3d10/ContainerLayerD3D10.h
+++ b/gfx/layers/d3d10/ContainerLayerD3D10.h
@@ -1,9 +1,9 @@
-/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
  * ***** BEGIN LICENSE BLOCK *****
  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
  *
  * The contents of this file are subject to the Mozilla Public License Version
  * 1.1 (the "License"); you may not use this file except in compliance with
  * the License. You may obtain a copy of the License at
  * http://www.mozilla.org/MPL/
  *
@@ -68,12 +68,39 @@ public:
   virtual void LayerManagerDestroyed();
 
   virtual void ComputeEffectiveTransforms(const gfx3DMatrix& aTransformToSurface)
   {
     DefaultComputeEffectiveTransforms(aTransformToSurface);
   }
 };
 
+// This is a bare-bones implementation of a container layer, only
+// enough to contain a shadow "window texture".  This impl doesn't
+// honor the transform/cliprect/etc. when rendering.
+class ShadowContainerLayerD3D10 : public ShadowContainerLayer,
+                                  public LayerD3D10
+{
+public:
+  ShadowContainerLayerD3D10(LayerManagerD3D10 *aManager);
+  ~ShadowContainerLayerD3D10();
+
+  void InsertAfter(Layer* aChild, Layer* aAfter);
+
+  void RemoveChild(Layer* aChild);
+
+  virtual void ComputeEffectiveTransforms(const gfx3DMatrix& aTransformToSurface);
+
+  /* LayerD3D10 implementation */
+  virtual LayerD3D10 *GetFirstChildD3D10();
+  virtual Layer* GetLayer() { return this; }
+  virtual void RenderLayer();
+  virtual void Validate();
+  virtual void LayerManagerDestroyed();
+
+private:
+    
+};
+
 } /* layers */
 } /* mozilla */
 
 #endif /* GFX_CONTAINERLAYERD3D10_H */
--- a/gfx/layers/d3d10/LayerManagerD3D10.h
+++ b/gfx/layers/d3d10/LayerManagerD3D10.h
@@ -33,16 +33,17 @@
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 #ifndef GFX_LAYERMANAGERD3D10_H
 #define GFX_LAYERMANAGERD3D10_H
 
+#include "mozilla/layers/ShadowLayers.h"
 #include "Layers.h"
 
 #include <windows.h>
 #include <d3d10_1.h>
 
 #include "gfxContext.h"
 #include "nsIWidget.h"