gfx/layers/ipc/ShadowLayerUtilsD3D10.cpp

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/gfx/layers/ipc/ShadowLayerUtilsD3D10.cpp	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,68 @@
     1.4 +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
     1.5 + * vim: sw=2 ts=8 et :
     1.6 + */
     1.7 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.8 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.9 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
    1.10 +
    1.11 +#include <d3d10_1.h>
    1.12 +#include <dxgi.h>
    1.13 +
    1.14 +#include "mozilla/gfx/Point.h"
    1.15 +#include "mozilla/layers/LayerManagerComposite.h"
    1.16 +#include "mozilla/layers/PLayerTransaction.h"
    1.17 +#include "ShadowLayers.h"
    1.18 +
    1.19 +using namespace mozilla::gl;
    1.20 +
    1.21 +namespace mozilla {
    1.22 +namespace layers {
    1.23 +
    1.24 +
    1.25 +/*static*/ void
    1.26 +ShadowLayerForwarder::PlatformSyncBeforeUpdate()
    1.27 +{
    1.28 +}
    1.29 +
    1.30 +/*static*/ bool
    1.31 +LayerManagerComposite::SupportsDirectTexturing()
    1.32 +{
    1.33 +  return true;
    1.34 +}
    1.35 +
    1.36 +/*static*/ void
    1.37 +LayerManagerComposite::PlatformSyncBeforeReplyUpdate()
    1.38 +{
    1.39 +}
    1.40 +
    1.41 +bool
    1.42 +GetDescriptor(ID3D10Texture2D* aTexture, SurfaceDescriptorD3D10* aDescr)
    1.43 +{
    1.44 +  NS_ABORT_IF_FALSE(aTexture && aDescr, "Params must be nonnull");
    1.45 +
    1.46 +  HRESULT hr;
    1.47 +  IDXGIResource* dr = nullptr;
    1.48 +  hr = aTexture->QueryInterface(__uuidof(IDXGIResource), (void**)&dr);
    1.49 +  if (!SUCCEEDED(hr) || !dr)
    1.50 +    return false;
    1.51 +
    1.52 +  hr = dr->GetSharedHandle(reinterpret_cast<HANDLE*>(&aDescr->handle()));
    1.53 +  return !!SUCCEEDED(hr);
    1.54 +}
    1.55 +
    1.56 +already_AddRefed<ID3D10Texture2D>
    1.57 +OpenForeign(ID3D10Device* aDevice, const SurfaceDescriptorD3D10& aDescr)
    1.58 +{
    1.59 +  HRESULT hr;
    1.60 +  ID3D10Texture2D* tex = nullptr;
    1.61 +  hr = aDevice->OpenSharedResource(reinterpret_cast<HANDLE>(aDescr.handle()),
    1.62 +                                   __uuidof(ID3D10Texture2D),
    1.63 +                                   (void**)&tex);
    1.64 +  if (!SUCCEEDED(hr) || !tex)
    1.65 +    return nullptr;
    1.66 +
    1.67 +  return nsRefPtr<ID3D10Texture2D>(tex).forget();
    1.68 +}
    1.69 +
    1.70 +} // namespace layers
    1.71 +} // namespace mozilla

mercurial