pbos@webrtc.org | adf23a5 | 2013-07-10 14:07:56 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. |
| 3 | * |
| 4 | * Use of this source code is governed by a BSD-style license |
| 5 | * that can be found in the LICENSE file in the root of the source |
| 6 | * tree. An additional intellectual property rights grant can be found |
| 7 | * in the file PATENTS. All contributing project authors may |
| 8 | * be found in the AUTHORS file in the root of the source tree. |
| 9 | */ |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 10 | #ifndef TEST_WIN_D3D_RENDERER_H_ |
| 11 | #define TEST_WIN_D3D_RENDERER_H_ |
pbos@webrtc.org | adf23a5 | 2013-07-10 14:07:56 +0000 | [diff] [blame] | 12 | |
| 13 | #include <Windows.h> |
| 14 | #include <d3d9.h> |
Yves Gerey | 665174f | 2018-06-19 15:03:05 +0200 | [diff] [blame] | 15 | #pragma comment(lib, "d3d9.lib") // located in DirectX SDK |
pbos@webrtc.org | adf23a5 | 2013-07-10 14:07:56 +0000 | [diff] [blame] | 16 | |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 17 | #include "rtc_base/scoped_ref_ptr.h" |
| 18 | #include "test/video_renderer.h" |
pbos@webrtc.org | adf23a5 | 2013-07-10 14:07:56 +0000 | [diff] [blame] | 19 | |
| 20 | namespace webrtc { |
| 21 | namespace test { |
| 22 | |
| 23 | class D3dRenderer : public VideoRenderer { |
| 24 | public: |
Yves Gerey | 665174f | 2018-06-19 15:03:05 +0200 | [diff] [blame] | 25 | static D3dRenderer* Create(const char* window_title, |
| 26 | size_t width, |
pbos@webrtc.org | adf23a5 | 2013-07-10 14:07:56 +0000 | [diff] [blame] | 27 | size_t height); |
| 28 | virtual ~D3dRenderer(); |
| 29 | |
nisse | eb83a1a | 2016-03-21 01:27:56 -0700 | [diff] [blame] | 30 | void OnFrame(const webrtc::VideoFrame& frame) override; |
pbos@webrtc.org | 0d852d5 | 2015-02-09 15:14:36 +0000 | [diff] [blame] | 31 | |
pbos@webrtc.org | adf23a5 | 2013-07-10 14:07:56 +0000 | [diff] [blame] | 32 | private: |
| 33 | D3dRenderer(size_t width, size_t height); |
| 34 | |
Yves Gerey | 665174f | 2018-06-19 15:03:05 +0200 | [diff] [blame] | 35 | static LRESULT WINAPI WindowProc(HWND hwnd, |
| 36 | UINT msg, |
| 37 | WPARAM wparam, |
pbos@webrtc.org | adf23a5 | 2013-07-10 14:07:56 +0000 | [diff] [blame] | 38 | LPARAM lparam); |
| 39 | bool Init(const char* window_title); |
| 40 | void Resize(size_t width, size_t height); |
| 41 | void Destroy(); |
| 42 | |
| 43 | size_t width_, height_; |
| 44 | |
| 45 | HWND hwnd_; |
Peter Boström | 26b0860 | 2015-06-04 15:18:17 +0200 | [diff] [blame] | 46 | rtc::scoped_refptr<IDirect3D9> d3d_; |
| 47 | rtc::scoped_refptr<IDirect3DDevice9> d3d_device_; |
pbos@webrtc.org | adf23a5 | 2013-07-10 14:07:56 +0000 | [diff] [blame] | 48 | |
Peter Boström | 26b0860 | 2015-06-04 15:18:17 +0200 | [diff] [blame] | 49 | rtc::scoped_refptr<IDirect3DTexture9> texture_; |
| 50 | rtc::scoped_refptr<IDirect3DVertexBuffer9> vertex_buffer_; |
pbos@webrtc.org | adf23a5 | 2013-07-10 14:07:56 +0000 | [diff] [blame] | 51 | }; |
| 52 | } // namespace test |
| 53 | } // namespace webrtc |
| 54 | |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 55 | #endif // TEST_WIN_D3D_RENDERER_H_ |