Bug 1066142: Respect AntiAlias mode in Direct2D 1.1 backend. r=jrmuizel
authorBas Schouten <bschouten@mozilla.com>
Sun, 14 Sep 2014 23:51:32 +0200
changeset 205261 08734616a1399e4a32df9fa227a33481501a5b6a
parent 205260 cab3c0ac23b00dc6de1e4f625a807684e0c3f32a
child 205262 f6925492fe3a73f5b3b58555b43ea0023cc5aaff
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
reviewersjrmuizel
bugs1066142
milestone35.0a1
Bug 1066142: Respect AntiAlias mode in Direct2D 1.1 backend. r=jrmuizel
gfx/2d/DrawTargetD2D1.cpp
--- a/gfx/2d/DrawTargetD2D1.cpp
+++ b/gfx/2d/DrawTargetD2D1.cpp
@@ -325,30 +325,34 @@ DrawTargetD2D1::CopySurface(SourceSurfac
 
 void
 DrawTargetD2D1::FillRect(const Rect &aRect,
                          const Pattern &aPattern,
                          const DrawOptions &aOptions)
 {
   PrepareForDrawing(aOptions.mCompositionOp, aPattern);
 
+  mDC->SetAntialiasMode(D2DAAMode(aOptions.mAntialiasMode));
+
   RefPtr<ID2D1Brush> brush = CreateBrushForPattern(aPattern, aOptions.mAlpha);
   mDC->FillRectangle(D2DRect(aRect), brush);
 
   FinalizeDrawing(aOptions.mCompositionOp, aPattern);
 }
 
 void
 DrawTargetD2D1::StrokeRect(const Rect &aRect,
                            const Pattern &aPattern,
                            const StrokeOptions &aStrokeOptions,
                            const DrawOptions &aOptions)
 {
   PrepareForDrawing(aOptions.mCompositionOp, aPattern);
 
+  mDC->SetAntialiasMode(D2DAAMode(aOptions.mAntialiasMode));
+
   RefPtr<ID2D1Brush> brush = CreateBrushForPattern(aPattern, aOptions.mAlpha);
   RefPtr<ID2D1StrokeStyle> strokeStyle = CreateStrokeStyleForOptions(aStrokeOptions);
 
   mDC->DrawRectangle(D2DRect(aRect), brush, aStrokeOptions.mLineWidth, strokeStyle);
 
   FinalizeDrawing(aOptions.mCompositionOp, aPattern);
 }
 
@@ -356,16 +360,18 @@ void
 DrawTargetD2D1::StrokeLine(const Point &aStart,
                            const Point &aEnd,
                            const Pattern &aPattern,
                            const StrokeOptions &aStrokeOptions,
                            const DrawOptions &aOptions)
 {
   PrepareForDrawing(aOptions.mCompositionOp, aPattern);
 
+  mDC->SetAntialiasMode(D2DAAMode(aOptions.mAntialiasMode));
+
   RefPtr<ID2D1Brush> brush = CreateBrushForPattern(aPattern, aOptions.mAlpha);
   RefPtr<ID2D1StrokeStyle> strokeStyle = CreateStrokeStyleForOptions(aStrokeOptions);
 
   mDC->DrawLine(D2DPoint(aStart), D2DPoint(aEnd), brush, aStrokeOptions.mLineWidth, strokeStyle);
 
   FinalizeDrawing(aOptions.mCompositionOp, aPattern);
 }
 
@@ -378,16 +384,18 @@ DrawTargetD2D1::Stroke(const Path *aPath
   if (aPath->GetBackendType() != BackendType::DIRECT2D) {
     gfxDebug() << *this << ": Ignoring drawing call for incompatible path.";
     return;
   }
   const PathD2D *d2dPath = static_cast<const PathD2D*>(aPath);
 
   PrepareForDrawing(aOptions.mCompositionOp, aPattern);
 
+  mDC->SetAntialiasMode(D2DAAMode(aOptions.mAntialiasMode));
+
   RefPtr<ID2D1Brush> brush = CreateBrushForPattern(aPattern, aOptions.mAlpha);
   RefPtr<ID2D1StrokeStyle> strokeStyle = CreateStrokeStyleForOptions(aStrokeOptions);
 
   mDC->DrawGeometry(d2dPath->mGeometry, brush, aStrokeOptions.mLineWidth, strokeStyle);
 
   FinalizeDrawing(aOptions.mCompositionOp, aPattern);
 }
 
@@ -399,16 +407,18 @@ DrawTargetD2D1::Fill(const Path *aPath,
   if (aPath->GetBackendType() != BackendType::DIRECT2D) {
     gfxDebug() << *this << ": Ignoring drawing call for incompatible path.";
     return;
   }
   const PathD2D *d2dPath = static_cast<const PathD2D*>(aPath);
 
   PrepareForDrawing(aOptions.mCompositionOp, aPattern);
 
+  mDC->SetAntialiasMode(D2DAAMode(aOptions.mAntialiasMode));
+
   RefPtr<ID2D1Brush> brush = CreateBrushForPattern(aPattern, aOptions.mAlpha);
 
   mDC->FillGeometry(d2dPath->mGeometry, brush);
 
   FinalizeDrawing(aOptions.mCompositionOp, aPattern);
 }
 
 void