Bug 1369490. Remove some backend type checks that aren't needed. r=lsalzman
authorJeff Muizelaar <jmuizelaar@mozilla.com>
Thu, 01 Jun 2017 16:56:49 -0400
changeset 410027 40b3da698ff5f463f4374b7178943124f1851512
parent 410026 fedb93c6e6f7355facca060e96ee97f7f46f3f87
child 410028 130dc8355e27d6161af44fb2e0e65212f75bd730
push id7391
push usermtabara@mozilla.com
push dateMon, 12 Jun 2017 13:08:53 +0000
treeherdermozilla-beta@2191d7f87e2e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerslsalzman
bugs1369490
milestone55.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 1369490. Remove some backend type checks that aren't needed. r=lsalzman This checks won't work with the forthcoming recording backend and don't seem to really be accomplishing anything.
gfx/thebes/gfxPlatform.cpp
gfx/thebes/gfxPlatformGtk.cpp
--- a/gfx/thebes/gfxPlatform.cpp
+++ b/gfx/thebes/gfxPlatform.cpp
@@ -2431,25 +2431,21 @@ gfxPlatform::DisableBufferRotation()
 
   sBufferRotationCheckPref = false;
 }
 
 already_AddRefed<ScaledFont>
 gfxPlatform::GetScaledFontForFontWithCairoSkia(DrawTarget* aTarget, gfxFont* aFont)
 {
     NativeFont nativeFont;
-    if (aTarget->GetBackendType() == BackendType::CAIRO || aTarget->GetBackendType() == BackendType::SKIA) {
-        nativeFont.mType = NativeFontType::CAIRO_FONT_FACE;
-        nativeFont.mFont = aFont->GetCairoScaledFont();
-        return Factory::CreateScaledFontForNativeFont(nativeFont,
-                                                      aFont->GetUnscaledFont(),
-                                                      aFont->GetAdjustedSize());
-    }
-
-    return nullptr;
+    nativeFont.mType = NativeFontType::CAIRO_FONT_FACE;
+    nativeFont.mFont = aFont->GetCairoScaledFont();
+    return Factory::CreateScaledFontForNativeFont(nativeFont,
+                                                  aFont->GetUnscaledFont(),
+                                                  aFont->GetAdjustedSize());
 }
 
 /* static */ bool
 gfxPlatform::UsesOffMainThreadCompositing()
 {
   if (XRE_GetProcessType() == GeckoProcessType_GPU) {
     return true;
   }
--- a/gfx/thebes/gfxPlatformGtk.cpp
+++ b/gfx/thebes/gfxPlatformGtk.cpp
@@ -590,31 +590,25 @@ gfxPlatformGtk::GetGdkDrawable(cairo_sur
 
     return nullptr;
 }
 #endif
 
 already_AddRefed<ScaledFont>
 gfxPlatformGtk::GetScaledFontForFont(DrawTarget* aTarget, gfxFont *aFont)
 {
-    switch (aTarget->GetBackendType()) {
-    case BackendType::CAIRO:
-    case BackendType::SKIA:
-        if (aFont->GetType() == gfxFont::FONT_TYPE_FONTCONFIG) {
-            gfxFontconfigFontBase* fcFont = static_cast<gfxFontconfigFontBase*>(aFont);
-            return Factory::CreateScaledFontForFontconfigFont(
-                    fcFont->GetCairoScaledFont(),
-                    fcFont->GetPattern(),
-                    fcFont->GetUnscaledFont(),
-                    fcFont->GetAdjustedSize());
-        }
-        MOZ_FALLTHROUGH;
-    default:
-        return GetScaledFontForFontWithCairoSkia(aTarget, aFont);
-    }
+  if (aFont->GetType() == gfxFont::FONT_TYPE_FONTCONFIG) {
+      gfxFontconfigFontBase* fcFont = static_cast<gfxFontconfigFontBase*>(aFont);
+      return Factory::CreateScaledFontForFontconfigFont(
+              fcFont->GetCairoScaledFont(),
+              fcFont->GetPattern(),
+              fcFont->GetUnscaledFont(),
+              fcFont->GetAdjustedSize());
+  }
+  return GetScaledFontForFontWithCairoSkia(aTarget, aFont);
 }
 
 #ifdef GL_PROVIDER_GLX
 
 class GLXVsyncSource final : public VsyncSource
 {
 public:
   GLXVsyncSource()