michael@0: /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- michael@0: * vim: sw=2 ts=8 et : michael@0: */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #include michael@0: #include michael@0: michael@0: #include "mozilla/gfx/Point.h" michael@0: #include "mozilla/layers/LayerManagerComposite.h" michael@0: #include "mozilla/layers/PLayerTransaction.h" michael@0: #include "ShadowLayers.h" michael@0: michael@0: using namespace mozilla::gl; michael@0: michael@0: namespace mozilla { michael@0: namespace layers { michael@0: michael@0: michael@0: /*static*/ void michael@0: ShadowLayerForwarder::PlatformSyncBeforeUpdate() michael@0: { michael@0: } michael@0: michael@0: /*static*/ bool michael@0: LayerManagerComposite::SupportsDirectTexturing() michael@0: { michael@0: return true; michael@0: } michael@0: michael@0: /*static*/ void michael@0: LayerManagerComposite::PlatformSyncBeforeReplyUpdate() michael@0: { michael@0: } michael@0: michael@0: bool michael@0: GetDescriptor(ID3D10Texture2D* aTexture, SurfaceDescriptorD3D10* aDescr) michael@0: { michael@0: NS_ABORT_IF_FALSE(aTexture && aDescr, "Params must be nonnull"); michael@0: michael@0: HRESULT hr; michael@0: IDXGIResource* dr = nullptr; michael@0: hr = aTexture->QueryInterface(__uuidof(IDXGIResource), (void**)&dr); michael@0: if (!SUCCEEDED(hr) || !dr) michael@0: return false; michael@0: michael@0: hr = dr->GetSharedHandle(reinterpret_cast(&aDescr->handle())); michael@0: return !!SUCCEEDED(hr); michael@0: } michael@0: michael@0: already_AddRefed michael@0: OpenForeign(ID3D10Device* aDevice, const SurfaceDescriptorD3D10& aDescr) michael@0: { michael@0: HRESULT hr; michael@0: ID3D10Texture2D* tex = nullptr; michael@0: hr = aDevice->OpenSharedResource(reinterpret_cast(aDescr.handle()), michael@0: __uuidof(ID3D10Texture2D), michael@0: (void**)&tex); michael@0: if (!SUCCEEDED(hr) || !tex) michael@0: return nullptr; michael@0: michael@0: return nsRefPtr(tex).forget(); michael@0: } michael@0: michael@0: } // namespace layers michael@0: } // namespace mozilla