summaryrefslogtreecommitdiffstats
path: root/win8/metro_driver/direct3d_helper.h
diff options
context:
space:
mode:
authorscottmg@google.com <scottmg@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2012-10-01 21:25:12 +0000
committerscottmg@google.com <scottmg@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2012-10-01 21:25:12 +0000
commit56deedeafb9d4880280e33a4d35e769a4c119cf2 (patch)
tree54fc3c6b34e33dc4ade1c11c3355d39e52b1563c /win8/metro_driver/direct3d_helper.h
parent9d68072cff1c7d2e94ea2d35026f5cdd0736a3de (diff)
downloadchromium_src-56deedeafb9d4880280e33a4d35e769a4c119cf2.zip
chromium_src-56deedeafb9d4880280e33a4d35e769a4c119cf2.tar.gz
chromium_src-56deedeafb9d4880280e33a4d35e769a4c119cf2.tar.bz2
Listen in the browser for a connection from a metro viewer process.
Render to the surface it provides to us. BUG=151718 Review URL: https://codereview.chromium.org/10984007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@159559 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'win8/metro_driver/direct3d_helper.h')
-rw-r--r--win8/metro_driver/direct3d_helper.h44
1 files changed, 44 insertions, 0 deletions
diff --git a/win8/metro_driver/direct3d_helper.h b/win8/metro_driver/direct3d_helper.h
new file mode 100644
index 0000000..a5547ba
--- /dev/null
+++ b/win8/metro_driver/direct3d_helper.h
@@ -0,0 +1,44 @@
+// Copyright 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef WIN8_METRO_DRIVER_DIRECT3D_HELPER_
+#define WIN8_METRO_DRIVER_DIRECT3D_HELPER_
+
+#include "base/basictypes.h"
+
+#include <windows.ui.core.h>
+#include <windows.foundation.h>
+#include <d3d11_1.h>
+
+namespace metro_driver {
+
+// We need to initalize a Direct3D device and swapchain so that the browser
+// can Present to our HWND. This class takes care of creating and keeping the
+// swapchain up to date.
+class Direct3DHelper {
+ public:
+ Direct3DHelper();
+ ~Direct3DHelper();
+
+ void Initialize(winui::Core::ICoreWindow* window);
+
+ private:
+ void CreateDeviceResources();
+ void CreateWindowSizeDependentResources();
+
+ winui::Core::ICoreWindow* window_;
+
+ mswr::ComPtr<ID3D11Device1> d3d_device_;
+ mswr::ComPtr<ID3D11DeviceContext1> d3d_context_;
+ mswr::ComPtr<IDXGISwapChain1> swap_chain_;
+ D3D_FEATURE_LEVEL feature_level_;
+
+ ABI::Windows::Foundation::Rect window_bounds_;
+
+ DISALLOW_COPY_AND_ASSIGN(Direct3DHelper);
+};
+
+} // namespace metro_driver
+
+#endif // WIN8_METRO_DRIVER_DIRECT3D_HELPER_