Bug 798931: Push clip layers to the correct render targets. r=roc
authorBas Schouten <bschouten@mozilla.com>
Mon, 08 Oct 2012 12:17:17 +0200
changeset 113262 c28cc500c23935d0bb587a7ba2d5c4cc9f26e278
parent 113261 8b78045e153624f66ace247eef2723e742efe86e
child 113263 5c59fd005fb897b33cceaad689eb6fa28765ff77
push id2248
push userakeybl@mozilla.com
push dateMon, 08 Oct 2012 19:23:44 +0000
treeherdermozilla-aurora@118a3b748323 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersroc
bugs798931
milestone18.0a1
Bug 798931: Push clip layers to the correct render targets. r=roc
gfx/2d/DrawTargetD2D.cpp
gfx/2d/DrawTargetD2D.h
--- a/gfx/2d/DrawTargetD2D.cpp
+++ b/gfx/2d/DrawTargetD2D.cpp
@@ -988,17 +988,17 @@ DrawTargetD2D::PushClip(const Path *aPat
   mPushedClips.push_back(clip);
 
   // The transform of clips is relative to the world matrix, since we use the total
   // transform for the clips, make the world matrix identity.
   mRT->SetTransform(D2D1::IdentityMatrix());
   mTransformDirty = true;
 
   if (mClipsArePushed) {
-    PushD2DLayer(pathD2D->mGeometry, clip.mLayer, clip.mTransform);
+    PushD2DLayer(mRT, pathD2D->mGeometry, clip.mLayer, clip.mTransform);
   }
 }
 
 void
 DrawTargetD2D::PushClipRect(const Rect &aRect)
 {
   mCurrentClipMaskTexture = nullptr;
   mCurrentClippedGeometry = nullptr;
@@ -1812,17 +1812,17 @@ DrawTargetD2D::PopAllClips()
 }
 
 void
 DrawTargetD2D::PushClipsToRT(ID2D1RenderTarget *aRT)
 {
   for (std::vector<PushedClip>::iterator iter = mPushedClips.begin();
         iter != mPushedClips.end(); iter++) {
     if (iter->mLayer) {
-      PushD2DLayer(iter->mPath->mGeometry, iter->mLayer, iter->mTransform);
+      PushD2DLayer(aRT, iter->mPath->mGeometry, iter->mLayer, iter->mTransform);
     } else {
       aRT->PushAxisAlignedClip(iter->mBounds, iter->mIsPixelAligned ? D2D1_ANTIALIAS_MODE_ALIASED : D2D1_ANTIALIAS_MODE_PER_PRIMITIVE);
     }
   }
 }
 
 void
 DrawTargetD2D::PopClipsFromRT(ID2D1RenderTarget *aRT)
@@ -2696,31 +2696,31 @@ DrawTargetD2D::SetScissorToRect(IntRect 
     rect.left = rect.top = INT32_MIN;
     rect.right = rect.bottom = INT32_MAX;
   }
 
   mDevice->RSSetScissorRects(1, &rect);
 }
 
 void
-DrawTargetD2D::PushD2DLayer(ID2D1Geometry *aGeometry, ID2D1Layer *aLayer, const D2D1_MATRIX_3X2_F &aTransform)
+DrawTargetD2D::PushD2DLayer(ID2D1RenderTarget *aRT, ID2D1Geometry *aGeometry, ID2D1Layer *aLayer, const D2D1_MATRIX_3X2_F &aTransform)
 {
   D2D1_LAYER_OPTIONS options = D2D1_LAYER_OPTIONS_NONE;
   D2D1_LAYER_OPTIONS1 options1 =  D2D1_LAYER_OPTIONS1_NONE;
 
   if (mFormat == FORMAT_B8G8R8X8) {
     options = D2D1_LAYER_OPTIONS_INITIALIZE_FOR_CLEARTYPE;
     options1 = D2D1_LAYER_OPTIONS1_IGNORE_ALPHA | D2D1_LAYER_OPTIONS1_INITIALIZE_FROM_BACKGROUND;
   }
 
 	RefPtr<ID2D1DeviceContext> dc;
-	HRESULT hr = mRT->QueryInterface(IID_ID2D1DeviceContext, (void**)((ID2D1DeviceContext**)byRef(dc)));
+	HRESULT hr = aRT->QueryInterface(IID_ID2D1DeviceContext, (void**)((ID2D1DeviceContext**)byRef(dc)));
 
 	if (FAILED(hr)) {
-	    mRT->PushLayer(D2D1::LayerParameters(D2D1::InfiniteRect(), aGeometry,
+	    aRT->PushLayer(D2D1::LayerParameters(D2D1::InfiniteRect(), aGeometry,
 				                                   D2D1_ANTIALIAS_MODE_PER_PRIMITIVE, aTransform,
 				                                   1.0, nullptr, options),
 				             aLayer);
 	} else {
 	    dc->PushLayer(D2D1::LayerParameters1(D2D1::InfiniteRect(), aGeometry,
 				                                   D2D1_ANTIALIAS_MODE_PER_PRIMITIVE, aTransform,
 				                                   1.0, nullptr, options1),
 				            aLayer);
--- a/gfx/2d/DrawTargetD2D.h
+++ b/gfx/2d/DrawTargetD2D.h
@@ -206,17 +206,17 @@ private:
 
   void SetupEffectForRadialGradient(const RadialGradientPattern *aPattern);
   void SetupStateForRendering();
 
   // Set the scissor rect to a certain IntRects, resets the scissor rect to
   // surface bounds when NULL is specified.
   void SetScissorToRect(IntRect *aRect);
 
-  void PushD2DLayer(ID2D1Geometry *aGeometry, ID2D1Layer *aLayer, const D2D1_MATRIX_3X2_F &aTransform);
+  void PushD2DLayer(ID2D1RenderTarget *aRT, ID2D1Geometry *aGeometry, ID2D1Layer *aLayer, const D2D1_MATRIX_3X2_F &aTransform);
 
   static const uint32_t test = 4;
 
   IntSize mSize;
 
   RefPtr<ID3D10Device1> mDevice;
   RefPtr<ID3D10Texture2D> mTexture;
   RefPtr<ID3D10Texture2D> mCurrentClipMaskTexture;