From 024d8acf0d75a91179b6ec1245da53e2836e500a Mon Sep 17 00:00:00 2001 From: Jeff Muizelaar Date: Mon, 16 Aug 2010 09:15:03 +0200 Subject: [PATCH] Bug 587395: Expose whether DWrite is enabled through nsIGfxInfo. r=joedrew --- gfx/thebes/gfxWindowsPlatform.h | 3 +++ widget/public/nsIGfxInfo.idl | 3 +++ widget/src/windows/GfxInfo.cpp | 6 ++++++ 3 files changed, 12 insertions(+) diff --git a/gfx/thebes/gfxWindowsPlatform.h b/gfx/thebes/gfxWindowsPlatform.h index 9b8d6230de3..364c05524a4 100644 --- a/gfx/thebes/gfxWindowsPlatform.h +++ b/gfx/thebes/gfxWindowsPlatform.h @@ -213,6 +213,9 @@ public: #ifdef CAIRO_HAS_DWRITE_FONT IDWriteFactory *GetDWriteFactory() { return mDWriteFactory; } + inline PRBool DWriteEnabled() { return !!mDWriteFactory; } +#else + inline PRBool DWriteEnabled() { return PR_FALSE; } #endif #ifdef CAIRO_HAS_D2D_SURFACE cairo_device_t *GetD2DDevice() { return mD2DDevice; } diff --git a/widget/public/nsIGfxInfo.idl b/widget/public/nsIGfxInfo.idl index e2dc9b9812e..74eebf2bda6 100644 --- a/widget/public/nsIGfxInfo.idl +++ b/widget/public/nsIGfxInfo.idl @@ -38,9 +38,12 @@ #include "nsISupports.idl" +/* NOTE: this interface is completely undesigned, not stable and likely to change */ + [scriptable, uuid(5C05E5B7-0FCC-4070-BF6B-58BC33ECA427)] interface nsIGfxInfo : nsISupports { readonly attribute boolean D2DEnabled; + readonly attribute boolean DWriteEnabled; }; diff --git a/widget/src/windows/GfxInfo.cpp b/widget/src/windows/GfxInfo.cpp index 2bc2bd064c0..c5aefd8aeca 100644 --- a/widget/src/windows/GfxInfo.cpp +++ b/widget/src/windows/GfxInfo.cpp @@ -47,3 +47,9 @@ nsresult GfxInfo::GetD2DEnabled(PRBool *aEnabled) *aEnabled = gfxWindowsPlatform::GetPlatform()->GetRenderMode() == gfxWindowsPlatform::RENDER_DIRECT2D; return NS_OK; } + +nsresult GfxInfo::GetDWriteEnabled(PRBool *aEnabled) +{ + *aEnabled = gfxWindowsPlatform::GetPlatform()->DWriteEnabled(); + return NS_OK; +}