Bug 1247775 - Part 2: Remove Direct2D 1.0 code from Thebes. r=dvander

MozReview-Commit-ID: EC8yhkvvood
This commit is contained in:
Bas Schouten 2016-02-12 02:05:35 +01:00
parent e760a0577f
commit 5cdd856dfa
8 changed files with 44 additions and 260 deletions

View File

@ -19,7 +19,6 @@ struct DeviceInitData
bool useD3D11WARP;
bool useD3D11ImageBridge;
bool d3d11TextureSharingWorks;
bool useD2D;
bool useD2D1;
DxgiAdapterDesc adapter;
};

View File

@ -594,7 +594,7 @@ RepeatOrStretchSurface(DrawTarget& aDT, SourceSurface* aSurface,
if ((!aDT.GetTransform().IsRectilinear() &&
aDT.GetBackendType() != BackendType::CAIRO) ||
(aDT.GetBackendType() == BackendType::DIRECT2D)) {
(aDT.GetBackendType() == BackendType::DIRECT2D1_1)) {
// Use stretching if possible, since it leads to less seams when the
// destination is transformed. However, don't do this if we're using cairo,
// because if cairo is using pixman it won't render anything for large

View File

@ -242,8 +242,6 @@ private:
DECL_GFX_PREF(Once, "gfx.direct2d.disabled", Direct2DDisabled, bool, false);
DECL_GFX_PREF(Once, "gfx.direct2d.force-enabled", Direct2DForceEnabled, bool, false);
DECL_GFX_PREF(Live, "gfx.direct2d.use1_1", Direct2DUse1_1, bool, false);
DECL_GFX_PREF(Live, "gfx.direct2d.allow1_0", Direct2DAllow1_0, bool, false);
DECL_GFX_PREF(Live, "gfx.draw-color-bars", CompositorDrawColorBars, bool, false);
DECL_GFX_PREF(Once, "gfx.e10s.hide-plugins-for-scroll", HidePluginsForScroll, bool, true);
DECL_GFX_PREF(Once, "gfx.font_rendering.directwrite.force-enabled", DirectWriteFontRenderingForceEnabled, bool, false);

View File

@ -422,8 +422,7 @@ CreateSamplingRestrictedDrawable(gfxDrawable* aDrawable,
js::ProfileEntry::Category::GRAPHICS);
DrawTarget* destDrawTarget = aContext->GetDrawTarget();
if ((destDrawTarget->GetBackendType() == BackendType::DIRECT2D1_1) ||
(destDrawTarget->GetBackendType() == BackendType::DIRECT2D)) {
if (destDrawTarget->GetBackendType() == BackendType::DIRECT2D1_1) {
return nullptr;
}

View File

@ -43,12 +43,10 @@
#include "WinUtils.h"
#ifdef CAIRO_HAS_DWRITE_FONT
#include "gfxDWriteFontList.h"
#include "gfxDWriteFonts.h"
#include "gfxDWriteCommon.h"
#include <dwrite.h>
#endif
#include "gfxTextRun.h"
#include "gfxUserFontSet.h"
@ -57,13 +55,11 @@
#include <string>
#ifdef CAIRO_HAS_D2D_SURFACE
#include <d3d10_1.h>
#include "mozilla/gfx/2D.h"
#include "nsMemory.h"
#endif
#include <d3d11.h>
@ -114,14 +110,11 @@ DCFromDrawTarget::DCFromDrawTarget(DrawTarget& aDrawTarget)
}
}
#ifdef CAIRO_HAS_D2D_SURFACE
static const char *kFeatureLevelPref =
"gfx.direct3d.last_used_feature_level_idx";
static const int kSupportedFeatureLevels[] =
{ D3D10_FEATURE_LEVEL_10_1, D3D10_FEATURE_LEVEL_10_0 };
#endif
class GfxD2DVramReporter final : public nsIMemoryReporter
{
@ -166,16 +159,16 @@ NS_IMPL_ISUPPORTS(GfxD2DVramReporter, nsIMemoryReporter)
class GPUAdapterReporter final : public nsIMemoryReporter
{
// Callers must Release the DXGIAdapter after use or risk mem-leak
static bool GetDXGIAdapter(IDXGIAdapter **DXGIAdapter)
static bool GetDXGIAdapter(IDXGIAdapter **aDXGIAdapter)
{
ID3D10Device1 *D2D10Device;
IDXGIDevice *DXGIDevice;
ID3D11Device *d3d11Device;
IDXGIDevice *dxgiDevice;
bool result = false;
if ((D2D10Device = mozilla::gfx::Factory::GetDirect3D10Device())) {
if (D2D10Device->QueryInterface(__uuidof(IDXGIDevice), (void **)&DXGIDevice) == S_OK) {
result = (DXGIDevice->GetAdapter(DXGIAdapter) == S_OK);
DXGIDevice->Release();
if ((d3d11Device = mozilla::gfx::Factory::GetDirect3D11Device())) {
if (d3d11Device->QueryInterface(__uuidof(IDXGIDevice), (void **)&dxgiDevice) == S_OK) {
result = (dxgiDevice->GetAdapter(aDXGIAdapter) == S_OK);
dxgiDevice->Release();
}
}
@ -376,7 +369,6 @@ gfxWindowsPlatform::gfxWindowsPlatform()
, mCompositorD3D11TextureSharingWorks(false)
, mAcceleration(FeatureStatus::Unused)
, mD3D11Status(FeatureStatus::Unused)
, mD2DStatus(FeatureStatus::Unused)
, mD2D1Status(FeatureStatus::Unused)
{
mUseClearTypeForDownloadableFonts = UNINITIALIZED_VALUE;
@ -411,7 +403,6 @@ gfxWindowsPlatform::gfxWindowsPlatform()
gfxWindowsPlatform::~gfxWindowsPlatform()
{
mDeviceManager = nullptr;
mD3D10Device = nullptr;
mD3D11Device = nullptr;
mD3D11ContentDevice = nullptr;
mD3D11ImageBridgeDevice = nullptr;
@ -489,9 +480,7 @@ gfxWindowsPlatform::HandleDeviceReset()
// Remove devices and adapters.
ResetD3D11Devices();
mD3D10Device = nullptr;
mAdapter = nullptr;
Factory::SetDirect3D10Device(nullptr);
// Reset local state. Note: we leave feature status variables as-is. They
// will be recomputed by InitializeDevices().
@ -519,17 +508,11 @@ gfxWindowsPlatform::UpdateBackendPrefs()
uint32_t canvasMask = BackendTypeBit(SOFTWARE_BACKEND);
uint32_t contentMask = BackendTypeBit(SOFTWARE_BACKEND);
BackendType defaultBackend = SOFTWARE_BACKEND;
if (GetD2DStatus() == FeatureStatus::Available) {
if (GetD2D1Status() == FeatureStatus::Available) {
mRenderMode = RENDER_DIRECT2D;
canvasMask |= BackendTypeBit(BackendType::DIRECT2D);
contentMask |= BackendTypeBit(BackendType::DIRECT2D);
if (GetD2D1Status() == FeatureStatus::Available) {
contentMask |= BackendTypeBit(BackendType::DIRECT2D1_1);
canvasMask |= BackendTypeBit(BackendType::DIRECT2D1_1);
defaultBackend = BackendType::DIRECT2D1_1;
} else {
defaultBackend = BackendType::DIRECT2D;
}
contentMask |= BackendTypeBit(BackendType::DIRECT2D1_1);
canvasMask |= BackendTypeBit(BackendType::DIRECT2D1_1);
defaultBackend = BackendType::DIRECT2D1_1;
} else {
mRenderMode = RENDER_GDI;
canvasMask |= BackendTypeBit(BackendType::SKIA);
@ -571,129 +554,11 @@ gfxWindowsPlatform::GetContentBackendFor(mozilla::layers::LayersBackend aLayers)
return SOFTWARE_BACKEND;
}
#ifdef CAIRO_HAS_D2D_SURFACE
HRESULT
gfxWindowsPlatform::CreateDevice(RefPtr<IDXGIAdapter1> &adapter1,
int featureLevelIndex)
{
nsModuleHandle d3d10module(LoadLibrarySystem32(L"d3d10_1.dll"));
if (!d3d10module)
return E_FAIL;
decltype(D3D10CreateDevice1)* createD3DDevice =
(decltype(D3D10CreateDevice1)*) GetProcAddress(d3d10module, "D3D10CreateDevice1");
if (!createD3DDevice)
return E_FAIL;
ID3D10Device1* device = nullptr;
HRESULT hr =
createD3DDevice(adapter1, D3D10_DRIVER_TYPE_HARDWARE, nullptr,
#ifdef DEBUG
// This isn't set because of bug 1078411
// D3D10_CREATE_DEVICE_DEBUG |
#endif
D3D10_CREATE_DEVICE_BGRA_SUPPORT |
D3D10_CREATE_DEVICE_PREVENT_INTERNAL_THREADING_OPTIMIZATIONS,
static_cast<D3D10_FEATURE_LEVEL1>(kSupportedFeatureLevels[featureLevelIndex]),
D3D10_1_SDK_VERSION, &device);
// If we fail here, the DirectX version or video card probably
// changed. We previously could use 10.1 but now we can't
// anymore. Revert back to doing a 10.0 check first before
// the 10.1 check.
if (device) {
mD3D10Device = device;
// Leak the module while the D3D 10 device is being used.
d3d10module.disown();
// Setup a pref for future launch optimizaitons when in main process.
if (XRE_IsParentProcess()) {
Preferences::SetInt(kFeatureLevelPref, featureLevelIndex);
}
}
return device ? S_OK : hr;
}
#endif
void
gfxWindowsPlatform::VerifyD2DDevice(bool aAttemptForce)
{
if ((!Factory::SupportsD2D1() || !gfxPrefs::Direct2DUse1_1()) && !gfxPrefs::Direct2DAllow1_0()) {
return;
}
#ifdef CAIRO_HAS_D2D_SURFACE
if (mD3D10Device) {
if (SUCCEEDED(mD3D10Device->GetDeviceRemovedReason())) {
return;
}
mD3D10Device = nullptr;
// Surface cache needs to be invalidated since it may contain vector
// images rendered with our old, broken D2D device.
SurfaceCache::DiscardAll();
}
mozilla::ScopedGfxFeatureReporter reporter("D2D", aAttemptForce);
int supportedFeatureLevelsCount = ArrayLength(kSupportedFeatureLevels);
RefPtr<IDXGIAdapter1> adapter1 = GetDXGIAdapter();
if (!adapter1) {
// Unable to create adapter, abort acceleration.
return;
}
// It takes a lot of time (5-10% of startup time or ~100ms) to do both
// a createD3DDevice on D3D10_FEATURE_LEVEL_10_0. We therefore store
// the last used feature level to go direct to that.
int featureLevelIndex = Preferences::GetInt(kFeatureLevelPref, 0);
if (featureLevelIndex >= supportedFeatureLevelsCount || featureLevelIndex < 0)
featureLevelIndex = 0;
// Start with the last used feature level, and move to lower DX versions
// until we find one that works.
HRESULT hr = E_FAIL;
for (int i = featureLevelIndex; i < supportedFeatureLevelsCount; i++) {
hr = CreateDevice(adapter1, i);
// If it succeeded we found the first available feature level
if (SUCCEEDED(hr))
break;
}
// If we succeeded in creating a device, try for a newer device
// that we haven't tried yet.
if (SUCCEEDED(hr)) {
for (int i = featureLevelIndex - 1; i >= 0; i--) {
hr = CreateDevice(adapter1, i);
// If it failed then we don't have new hardware
if (FAILED(hr)) {
break;
}
}
}
if (mD3D10Device) {
reporter.SetSuccessful();
mozilla::gfx::Factory::SetDirect3D10Device(mD3D10Device);
}
ScopedGfxFeatureReporter reporter1_1("D2D1.1V");
if (Factory::SupportsD2D1()) {
reporter1_1.SetSuccessful();
}
#endif
}
gfxPlatformFontList*
gfxWindowsPlatform::CreatePlatformFontList()
{
gfxPlatformFontList *pfl;
#ifdef CAIRO_HAS_DWRITE_FONT
// bug 630201 - older pre-RTM versions of Direct2D/DirectWrite cause odd
// crashers so blacklist them altogether
if (IsNotWin7PreRTM() && GetDWriteFactory()) {
@ -707,7 +572,7 @@ gfxWindowsPlatform::CreatePlatformFontList()
gfxPlatformFontList::Shutdown();
DisableD2D();
}
#endif
pfl = new gfxGDIFontList();
if (NS_SUCCEEDED(pfl->InitFontList())) {
@ -727,10 +592,8 @@ gfxWindowsPlatform::CreatePlatformFontList()
void
gfxWindowsPlatform::DisableD2D()
{
mD2DStatus = FeatureStatus::Failed;
mD2D1Status = FeatureStatus::Failed;
Factory::SetDirect3D11Device(nullptr);
Factory::SetDirect3D10Device(nullptr);
UpdateBackendPrefs();
}
@ -1178,12 +1041,6 @@ gfxWindowsPlatform::DidRenderingDeviceReset(DeviceResetReason* aResetReason)
return true;
}
}
if (GetD3D10Device()) {
HRESULT hr = GetD3D10Device()->GetDeviceRemovedReason();
if (IsDeviceReset(hr, aResetReason)) {
return true;
}
}
if (XRE_IsParentProcess() && gfxPrefs::DeviceResetForTesting()) {
TestDeviceReset((DeviceResetReason)gfxPrefs::DeviceResetForTesting());
if (aResetReason) {
@ -1447,7 +1304,6 @@ gfxWindowsPlatform::FontsPrefsChanged(const char *aPref)
void
gfxWindowsPlatform::SetupClearTypeParams()
{
#if CAIRO_HAS_DWRITE_FONT
if (GetDWriteFactory()) {
// any missing prefs will default to invalid (-1) and be ignored;
// out-of-range values will also be ignored
@ -1555,7 +1411,6 @@ gfxWindowsPlatform::SetupClearTypeParams()
dwriteGeometry, DWRITE_RENDERING_MODE_CLEARTYPE_GDI_CLASSIC,
getter_AddRefs(mRenderingParams[TEXT_RENDERING_GDI_CLASSIC]));
}
#endif
}
void
@ -2417,7 +2272,7 @@ gfxWindowsPlatform::InitializeDevices()
// Usually we want D2D in order to use DWrite, but if the users have it
// forced, we'll let them have it, as unsupported configuration.
if (gfxPrefs::DirectWriteFontRenderingForceEnabled() &&
IsFeatureStatusFailure(mD2DStatus) &&
IsFeatureStatusFailure(mD2D1Status) &&
!mDWriteFactory) {
gfxCriticalNote << "Attempting DWrite without D2D support";
InitDWriteSupport();
@ -2583,17 +2438,11 @@ IsD2DBlacklisted()
// not change after a TDR (like the OS version), we could find a driver change
// that runs us into the blacklist.
FeatureStatus
gfxWindowsPlatform::CheckD2DSupport()
gfxWindowsPlatform::CheckD2D1Support()
{
// Don't revive D2D support after a failure.
if (IsFeatureStatusFailure(mD2DStatus)) {
return mD2DStatus;
}
if (XRE_IsContentProcess()) {
return GetParentDevicePrefs().useD2D()
? FeatureStatus::Available
: FeatureStatus::Blocked;
// Don't revive D2D1 support after a failure.
if (IsFeatureStatusFailure(mD2D1Status)) {
return mD2D1Status;
}
if (!gfxPrefs::Direct2DForceEnabled() && IsD2DBlacklisted()) {
@ -2617,70 +2466,38 @@ gfxWindowsPlatform::CheckD2DSupport()
if (mIsWARP && !gfxPrefs::LayersD3D11ForceWARP()) {
return FeatureStatus::Blocked;
}
if (!Factory::SupportsD2D1()) {
return FeatureStatus::Unavailable;
}
if (XRE_IsContentProcess()) {
return GetParentDevicePrefs().useD2D1()
? FeatureStatus::Available
: FeatureStatus::Blocked;
}
return FeatureStatus::Available;
}
void
gfxWindowsPlatform::InitializeD2D()
{
mD2DStatus = CheckD2DSupport();
if (IsFeatureStatusFailure(mD2DStatus)) {
ScopedGfxFeatureReporter d2d1_1("D2D1.1");
mD2D1Status = CheckD2D1Support();
if (IsFeatureStatusFailure(mD2D1Status)) {
return;
}
if (!mCompositorD3D11TextureSharingWorks) {
mD2DStatus = FeatureStatus::Failed;
mD2D1Status = FeatureStatus::Failed;
return;
}
// Using Direct2D depends on DWrite support.
if (!mDWriteFactory && !InitDWriteSupport()) {
mD2DStatus = FeatureStatus::Failed;
return;
}
// Initialize D2D 1.1.
InitializeD2D1();
// Initialize D2D 1.0.
VerifyD2DDevice(gfxPrefs::Direct2DForceEnabled());
if (!mD3D10Device) {
mDWriteFactory = nullptr;
mD2DStatus = FeatureStatus::Failed;
return;
}
mD2DStatus = FeatureStatus::Available;
}
FeatureStatus
gfxWindowsPlatform::CheckD2D1Support()
{
// Don't revive D2D1 support after a failure.
if (IsFeatureStatusFailure(mD2D1Status)) {
return mD2D1Status;
}
if (!Factory::SupportsD2D1()) {
return FeatureStatus::Unavailable;
}
if (XRE_IsContentProcess()) {
return GetParentDevicePrefs().useD2D1()
? FeatureStatus::Available
: FeatureStatus::Blocked;
}
if (!gfxPrefs::Direct2DUse1_1()) {
return FeatureStatus::Disabled;
}
return FeatureStatus::Available;
}
void
gfxWindowsPlatform::InitializeD2D1()
{
ScopedGfxFeatureReporter d2d1_1("D2D1.1");
mD2D1Status = CheckD2D1Support();
if (IsFeatureStatusFailure(mD2D1Status)) {
mD2D1Status = FeatureStatus::Failed;
return;
}
@ -2693,6 +2510,8 @@ gfxWindowsPlatform::InitializeD2D1()
Factory::SetDirect3D11Device(mD3D11ContentDevice);
d2d1_1.SetSuccessful();
mD2D1Status = FeatureStatus::Available;
}
bool
@ -3051,15 +2870,6 @@ gfxWindowsPlatform::GetD3D11Status() const
return mD3D11Status;
}
FeatureStatus
gfxWindowsPlatform::GetD2DStatus() const
{
if (GetD3D11Status() != FeatureStatus::Available) {
return FeatureStatus::Unavailable;
}
return mD2DStatus;
}
FeatureStatus
gfxWindowsPlatform::GetD2D1Status() const
{
@ -3096,7 +2906,6 @@ gfxWindowsPlatform::GetDeviceInitData(DeviceInitData* aOut)
aOut->useD3D11ImageBridge() = !!mD3D11ImageBridgeDevice;
aOut->d3d11TextureSharingWorks() = mCompositorD3D11TextureSharingWorks;
aOut->useD3D11WARP() = mIsWARP;
aOut->useD2D() = (GetD2DStatus() == FeatureStatus::Available);
aOut->useD2D1() = (GetD2D1Status() == FeatureStatus::Available);
if (mD3D11Device) {

View File

@ -17,9 +17,7 @@
#include "gfxFontUtils.h"
#include "gfxWindowsSurface.h"
#include "gfxFont.h"
#ifdef CAIRO_HAS_DWRITE_FONT
#include "gfxDWriteFonts.h"
#endif
#include "gfxPlatform.h"
#include "gfxTelemetry.h"
#include "gfxTypes.h"
@ -33,9 +31,7 @@
#include <windows.h>
#include <objbase.h>
#ifdef CAIRO_HAS_D2D_SURFACE
#include <dxgi.h>
#endif
// This header is available in the June 2010 SDK and in the Win8 SDK
#include <d3dcommon.h>
@ -163,10 +159,6 @@ public:
*/
void VerifyD2DDevice(bool aAttemptForce);
#ifdef CAIRO_HAS_D2D_SURFACE
HRESULT CreateDevice(RefPtr<IDXGIAdapter1> &adapter1, int featureLevelIndex);
#endif
nsresult GetFontList(nsIAtom *aLangGroup,
const nsACString& aGenericFamily,
nsTArray<nsString>& aListOfFonts) override;
@ -230,20 +222,16 @@ public:
void SetupClearTypeParams();
#ifdef CAIRO_HAS_DWRITE_FONT
IDWriteFactory *GetDWriteFactory() { return mDWriteFactory; }
inline bool DWriteEnabled() { return !!mDWriteFactory; }
inline DWRITE_MEASURING_MODE DWriteMeasuringMode() { return mMeasuringMode; }
IDWriteRenderingParams *GetRenderingParams(TextRenderingMode aRenderMode)
{ return mRenderingParams[aRenderMode]; }
#else
inline bool DWriteEnabled() { return false; }
#endif
void OnDeviceManagerDestroy(mozilla::layers::DeviceManagerD3D9* aDeviceManager);
mozilla::layers::DeviceManagerD3D9* GetD3D9DeviceManager();
IDirect3DDevice9* GetD3D9Device();
ID3D10Device1 *GetD3D10Device() { return mD3D10Device; }
ID3D11Device *GetD3D11Device();
ID3D11Device *GetD3D11ContentDevice();
ID3D11Device* GetD3D11DeviceForCurrentThread();
@ -281,7 +269,6 @@ public:
// initialization has not been attempted, this returns
// FeatureStatus::Unused.
mozilla::gfx::FeatureStatus GetD3D11Status() const;
mozilla::gfx::FeatureStatus GetD2DStatus() const;
mozilla::gfx::FeatureStatus GetD2D1Status() const;
unsigned GetD3D11Version();
@ -319,14 +306,12 @@ private:
void InitializeDevices();
void InitializeD3D11();
void InitializeD2D();
void InitializeD2D1();
bool InitDWriteSupport();
void DisableD2D();
mozilla::gfx::FeatureStatus CheckAccelerationSupport();
mozilla::gfx::FeatureStatus CheckD3D11Support(bool* aCanUseHardware);
mozilla::gfx::FeatureStatus CheckD2DSupport();
mozilla::gfx::FeatureStatus CheckD2D1Support();
mozilla::gfx::FeatureStatus AttemptD3D11DeviceCreation();
@ -352,14 +337,12 @@ private:
IDXGIAdapter1 *GetDXGIAdapter();
bool IsDeviceReset(HRESULT hr, DeviceResetReason* aReason);
#ifdef CAIRO_HAS_DWRITE_FONT
RefPtr<IDWriteFactory> mDWriteFactory;
RefPtr<IDWriteRenderingParams> mRenderingParams[TEXT_RENDERING_COUNT];
DWRITE_MEASURING_MODE mMeasuringMode;
#endif
RefPtr<IDXGIAdapter1> mAdapter;
RefPtr<mozilla::layers::DeviceManagerD3D9> mDeviceManager;
RefPtr<ID3D10Device1> mD3D10Device;
RefPtr<ID3D11Device> mD3D11Device;
RefPtr<ID3D11Device> mD3D11ContentDevice;
RefPtr<ID3D11Device> mD3D11ImageBridgeDevice;
@ -374,7 +357,6 @@ private:
// accessors instead.
mozilla::gfx::FeatureStatus mAcceleration;
mozilla::gfx::FeatureStatus mD3D11Status;
mozilla::gfx::FeatureStatus mD2DStatus;
mozilla::gfx::FeatureStatus mD2D1Status;
nsTArray<D3D_FEATURE_LEVEL> mFeatureLevels;

View File

@ -713,8 +713,8 @@ pref("gfx.font_rendering.opentype_svg.enabled", true);
#ifdef XP_WIN
// comma separated list of backends to use in order of preference
// e.g., pref("gfx.canvas.azure.backends", "direct2d,skia,cairo");
pref("gfx.canvas.azure.backends", "direct2d1.1,direct2d,skia,cairo");
pref("gfx.content.azure.backends", "direct2d1.1,direct2d,cairo");
pref("gfx.canvas.azure.backends", "direct2d1.1,skia,cairo");
pref("gfx.content.azure.backends", "direct2d1.1,cairo");
#else
#ifdef XP_MACOSX
pref("gfx.content.azure.backends", "cg");
@ -4447,7 +4447,6 @@ pref("gfx.content.use-native-pushlayer", true);
// Whether to disable the automatic detection and use of direct2d.
pref("gfx.direct2d.disabled", false);
pref("gfx.direct2d.use1_1", true);
// Whether to attempt to enable Direct2D regardless of automatic detection or
// blacklisting

View File

@ -1272,14 +1272,12 @@ GfxInfo::DescribeFeatures(JSContext* aCx, JS::Handle<JSObject*> aObj)
JS_SetProperty(aCx, obj, "blacklisted", val);
}
gfx::FeatureStatus d2d = platform->GetD2DStatus();
gfx::FeatureStatus d2d = platform->GetD2D1Status();
if (!InitFeatureObject(aCx, aObj, "d2d", d2d, &obj)) {
return;
}
{
const char* version = "1.0";
if (platform->GetD2D1Status() == gfx::FeatureStatus::Available)
version = "1.1";
const char* version = "1.1";
JS::Rooted<JSString*> str(aCx, JS_NewStringCopyZ(aCx, version));
JS::Rooted<JS::Value> val(aCx, JS::StringValue(str));
JS_SetProperty(aCx, obj, "version", val);