From 5fae3040ce423551beb31ae55945d905424effe6 Mon Sep 17 00:00:00 2001 From: Jeff Muizelaar Date: Thu, 1 Jun 2017 16:56:49 -0400 Subject: [PATCH] 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 | 14 +++++--------- gfx/thebes/gfxPlatformGtk.cpp | 24 +++++++++--------------- 2 files changed, 14 insertions(+), 24 deletions(-) diff --git a/gfx/thebes/gfxPlatform.cpp b/gfx/thebes/gfxPlatform.cpp index eec2b0631347..7c88fccb1a9f 100644 --- a/gfx/thebes/gfxPlatform.cpp +++ b/gfx/thebes/gfxPlatform.cpp @@ -2436,15 +2436,11 @@ already_AddRefed 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 diff --git a/gfx/thebes/gfxPlatformGtk.cpp b/gfx/thebes/gfxPlatformGtk.cpp index c0d98e3a0382..efa5ac154989 100644 --- a/gfx/thebes/gfxPlatformGtk.cpp +++ b/gfx/thebes/gfxPlatformGtk.cpp @@ -595,21 +595,15 @@ gfxPlatformGtk::GetGdkDrawable(cairo_surface_t *target) already_AddRefed 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(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(aFont); + return Factory::CreateScaledFontForFontconfigFont( + fcFont->GetCairoScaledFont(), + fcFont->GetPattern(), + fcFont->GetUnscaledFont(), + fcFont->GetAdjustedSize()); + } + return GetScaledFontForFontWithCairoSkia(aTarget, aFont); } #ifdef GL_PROVIDER_GLX