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 | */ |
| 10 | #ifndef WEBRTC_VIDEO_ENGINE_TEST_COMMON_WIN_D3D_RENDERER_H_ |
| 11 | #define WEBRTC_VIDEO_ENGINE_TEST_COMMON_WIN_D3D_RENDERER_H_ |
| 12 | |
| 13 | #include <Windows.h> |
| 14 | #include <d3d9.h> |
andresp@webrtc.org | ab071da | 2014-09-18 08:58:15 +0000 | [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 | |
| 17 | #include "webrtc/system_wrappers/interface/scoped_refptr.h" |
pbos@webrtc.org | 16e03b7 | 2013-10-28 16:32:01 +0000 | [diff] [blame] | 18 | #include "webrtc/test/video_renderer.h" |
pbos@webrtc.org | adf23a5 | 2013-07-10 14:07:56 +0000 | [diff] [blame] | 19 | #include "webrtc/typedefs.h" |
pbos@webrtc.org | adf23a5 | 2013-07-10 14:07:56 +0000 | [diff] [blame] | 20 | |
| 21 | namespace webrtc { |
| 22 | namespace test { |
| 23 | |
| 24 | class D3dRenderer : public VideoRenderer { |
| 25 | public: |
| 26 | static D3dRenderer* Create(const char* window_title, size_t width, |
| 27 | size_t height); |
| 28 | virtual ~D3dRenderer(); |
| 29 | |
kjellander@webrtc.org | 14665ff | 2015-03-04 12:58:35 +0000 | [diff] [blame^] | 30 | void RenderFrame(const webrtc::I420VideoFrame& frame, int delta) override; |
| 31 | bool IsTextureSupported() const override { return false; } |
pbos@webrtc.org | 0d852d5 | 2015-02-09 15:14:36 +0000 | [diff] [blame] | 32 | |
pbos@webrtc.org | adf23a5 | 2013-07-10 14:07:56 +0000 | [diff] [blame] | 33 | private: |
| 34 | D3dRenderer(size_t width, size_t height); |
| 35 | |
| 36 | static LRESULT WINAPI WindowProc(HWND hwnd, UINT msg, WPARAM wparam, |
| 37 | LPARAM lparam); |
| 38 | bool Init(const char* window_title); |
| 39 | void Resize(size_t width, size_t height); |
| 40 | void Destroy(); |
| 41 | |
| 42 | size_t width_, height_; |
| 43 | |
| 44 | HWND hwnd_; |
| 45 | scoped_refptr<IDirect3D9> d3d_; |
| 46 | scoped_refptr<IDirect3DDevice9> d3d_device_; |
| 47 | |
| 48 | scoped_refptr<IDirect3DTexture9> texture_; |
| 49 | scoped_refptr<IDirect3DVertexBuffer9> vertex_buffer_; |
| 50 | }; |
| 51 | } // namespace test |
| 52 | } // namespace webrtc |
| 53 | |
| 54 | #endif // WEBRTC_VIDEO_ENGINE_TEST_COMMON_WIN_D3D_RENDERER_H_ |