Bug 933019, part 5 - Remove code for handling Thebes backed gfxContext from various files under gfx/thebes/. r=Bas
authorJonathan Watt <jwatt@jwatt.org>
Thu, 10 Jul 2014 10:58:07 +0100
changeset 193370 44f182e38e823e4c0594932ae02f26c6ba99fba1
parent 193369 a3f97f0f4ed4f3d04b431680a533616071304aca
child 193371 ac38dea88f944a78361f68cefce579af6c7bc0e6
push id27117
push userryanvm@gmail.com
push dateThu, 10 Jul 2014 22:23:14 +0000
treeherdermozilla-central@e1a037c085d1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersBas
bugs933019
milestone33.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 933019, part 5 - Remove code for handling Thebes backed gfxContext from various files under gfx/thebes/. r=Bas
gfx/thebes/gfxQuartzNativeDrawing.cpp
gfx/thebes/gfxWindowsNativeDrawing.cpp
gfx/thebes/gfxWindowsPlatform.h
gfx/thebes/gfxXlibNativeRenderer.cpp
--- a/gfx/thebes/gfxQuartzNativeDrawing.cpp
+++ b/gfx/thebes/gfxQuartzNativeDrawing.cpp
@@ -22,23 +22,16 @@ gfxQuartzNativeDrawing::gfxQuartzNativeD
   mNativeRect.RoundOut();
 }
 
 CGContextRef
 gfxQuartzNativeDrawing::BeginNativeDrawing()
 {
   NS_ASSERTION(!mCGContext, "BeginNativeDrawing called when drawing already in progress");
 
-  if (mContext->IsCairo()) {
-    // We're past that now. Any callers that still supply a Cairo context
-    // don't deserve native theming.
-    NS_WARNING("gfxQuartzNativeDrawing being used with a gfxContext that is not backed by a DrawTarget");
-    return nullptr;
-  }
-
   DrawTarget *dt = mContext->GetDrawTarget();
   if (dt->GetBackendType() != BackendType::COREGRAPHICS || dt->IsDualDrawTarget()) {
     IntSize backingSize(NSToIntFloor(mNativeRect.width * mBackingScale),
                         NSToIntFloor(mNativeRect.height * mBackingScale));
 
     if (backingSize.IsEmpty()) {
       return nullptr;
     }
@@ -57,17 +50,16 @@ gfxQuartzNativeDrawing::BeginNativeDrawi
   MOZ_ASSERT(mCGContext);
   return mCGContext;
 }
 
 void
 gfxQuartzNativeDrawing::EndNativeDrawing()
 {
   NS_ASSERTION(mCGContext, "EndNativeDrawing called without BeginNativeDrawing");
-  MOZ_ASSERT(!mContext->IsCairo(), "BeginNativeDrawing succeeded with cairo context?");
 
   mBorrowedContext.Finish();
   if (mDrawTarget) {
     DrawTarget *dest = mContext->GetDrawTarget();
     RefPtr<SourceSurface> source = mDrawTarget->Snapshot();
 
     IntSize backingSize(NSToIntFloor(mNativeRect.width * mBackingScale),
                         NSToIntFloor(mNativeRect.height * mBackingScale));
--- a/gfx/thebes/gfxWindowsNativeDrawing.cpp
+++ b/gfx/thebes/gfxWindowsNativeDrawing.cpp
@@ -178,19 +178,18 @@ gfxWindowsNativeDrawing::BeginNativeDraw
         NS_ERROR("Bogus render state!");
         return nullptr;
     }
 }
 
 bool
 gfxWindowsNativeDrawing::IsDoublePass()
 {
-    if (!mContext->IsCairo() &&
-        (mContext->GetDrawTarget()->GetBackendType() != mozilla::gfx::BackendType::CAIRO ||
-         mContext->GetDrawTarget()->IsDualDrawTarget())) {
+    if (mContext->GetDrawTarget()->GetBackendType() != mozilla::gfx::BackendType::CAIRO ||
+        mContext->GetDrawTarget()->IsDualDrawTarget()) {
       return true;
     }
 
     nsRefPtr<gfxASurface> surf = mContext->CurrentSurface(&mDeviceOffset.x, &mDeviceOffset.y);
     if (!surf || surf->CairoStatus())
         return false;
     if (surf->GetType() != gfxSurfaceType::Win32 &&
         surf->GetType() != gfxSurfaceType::Win32Printing) {
--- a/gfx/thebes/gfxWindowsPlatform.h
+++ b/gfx/thebes/gfxWindowsPlatform.h
@@ -55,17 +55,16 @@ struct IDXGIAdapter1;
 class nsIMemoryReporter;
 
 // Utility to get a Windows HDC from a thebes context,
 // used by both GDI and Uniscribe font shapers
 struct DCFromContext {
     DCFromContext(gfxContext *aContext) {
         dc = nullptr;
         nsRefPtr<gfxASurface> aSurface = aContext->CurrentSurface();
-        NS_ASSERTION(aSurface || !aContext->IsCairo(), "DCFromContext: null surface");
         if (aSurface &&
             (aSurface->GetType() == gfxSurfaceType::Win32 ||
              aSurface->GetType() == gfxSurfaceType::Win32Printing))
         {
             dc = static_cast<gfxWindowsSurface*>(aSurface.get())->GetDC();
             needsRelease = false;
             SaveDC(dc);
             cairo_scaled_font_t* scaled =
--- a/gfx/thebes/gfxXlibNativeRenderer.cpp
+++ b/gfx/thebes/gfxXlibNativeRenderer.cpp
@@ -135,20 +135,16 @@ FINISH:
  * Try the direct path.
  * @return True if we took the direct path
  */
 bool
 gfxXlibNativeRenderer::DrawDirect(gfxContext *ctx, nsIntSize size,
                                   uint32_t flags,
                                   Screen *screen, Visual *visual)
 {
-    if (ctx->IsCairo()) {
-        return DrawCairo(ctx->GetCairo(), size, flags, screen, visual);
-    }
-
     // We need to actually borrow the context because we want to read out the
     // clip rectangles.
     BorrowedCairoContext borrowed(ctx->GetDrawTarget());
     if (!borrowed.mCairo) {
       return false;
     }
 
     bool direct = DrawCairo(borrowed.mCairo, size, flags, screen, visual);
@@ -524,29 +520,21 @@ gfxXlibNativeRenderer::Draw(gfxContext* 
                          int32_t(clipExtents.Y()),
                          int32_t(clipExtents.Width()),
                          int32_t(clipExtents.Height()));
     drawingRect.IntersectRect(drawingRect, intExtents);
 
     gfxPoint offset(drawingRect.x, drawingRect.y);
 
     DrawingMethod method;
-    cairo_surface_t* cairoTarget = nullptr;
-    DrawTarget* drawTarget = nullptr;
-    gfxPoint deviceTranslation;
-    if (ctx->IsCairo()) {
-        cairoTarget = cairo_get_group_target(ctx->GetCairo());
-        deviceTranslation = ctx->CurrentMatrix().GetTranslation();
-    } else {
-        drawTarget = ctx->GetDrawTarget();
-        Matrix dtTransform = drawTarget->GetTransform();
-        deviceTranslation = gfxPoint(dtTransform._31, dtTransform._32);
-        cairoTarget = static_cast<cairo_surface_t*>
+    DrawTarget* drawTarget = ctx->GetDrawTarget();
+    Matrix dtTransform = drawTarget->GetTransform();
+    gfxPoint deviceTranslation = gfxPoint(dtTransform._31, dtTransform._32);
+    cairo_surface_t* cairoTarget = static_cast<cairo_surface_t*>
             (drawTarget->GetNativeSurface(NativeSurfaceType::CAIRO_SURFACE));
-    }
 
     cairo_surface_t* tempXlibSurface =
         CreateTempXlibSurface(cairoTarget, drawTarget, size,
                               canDrawOverBackground, flags, screen, visual,
                               &method);
     if (!tempXlibSurface)
         return;