blob: cf2319edc449350f28fed507015aecc9d0e31be3 [file] [log] [blame]
pbos@webrtc.orgadf23a52013-07-10 14:07:56 +00001/*
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 */
Peter Boström7623ce42015-12-09 12:13:30 +010010#ifndef WEBRTC_TEST_WIN_D3D_RENDERER_H_
11#define WEBRTC_TEST_WIN_D3D_RENDERER_H_
pbos@webrtc.orgadf23a52013-07-10 14:07:56 +000012
13#include <Windows.h>
14#include <d3d9.h>
andresp@webrtc.orgab071da2014-09-18 08:58:15 +000015#pragma comment(lib, "d3d9.lib") // located in DirectX SDK
pbos@webrtc.orgadf23a52013-07-10 14:07:56 +000016
Peter Boström26b08602015-06-04 15:18:17 +020017#include "webrtc/base/scoped_ref_ptr.h"
pbos@webrtc.org16e03b72013-10-28 16:32:01 +000018#include "webrtc/test/video_renderer.h"
pbos@webrtc.orgadf23a52013-07-10 14:07:56 +000019#include "webrtc/typedefs.h"
pbos@webrtc.orgadf23a52013-07-10 14:07:56 +000020
21namespace webrtc {
22namespace test {
23
24class D3dRenderer : public VideoRenderer {
25 public:
26 static D3dRenderer* Create(const char* window_title, size_t width,
27 size_t height);
28 virtual ~D3dRenderer();
29
Miguel Casas-Sanchez47650702015-05-29 17:21:40 -070030 void RenderFrame(const webrtc::VideoFrame& frame, int delta) override;
kjellander@webrtc.org14665ff2015-03-04 12:58:35 +000031 bool IsTextureSupported() const override { return false; }
pbos@webrtc.org0d852d52015-02-09 15:14:36 +000032
pbos@webrtc.orgadf23a52013-07-10 14:07:56 +000033 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_;
Peter Boström26b08602015-06-04 15:18:17 +020045 rtc::scoped_refptr<IDirect3D9> d3d_;
46 rtc::scoped_refptr<IDirect3DDevice9> d3d_device_;
pbos@webrtc.orgadf23a52013-07-10 14:07:56 +000047
Peter Boström26b08602015-06-04 15:18:17 +020048 rtc::scoped_refptr<IDirect3DTexture9> texture_;
49 rtc::scoped_refptr<IDirect3DVertexBuffer9> vertex_buffer_;
pbos@webrtc.orgadf23a52013-07-10 14:07:56 +000050};
51} // namespace test
52} // namespace webrtc
53
Peter Boström7623ce42015-12-09 12:13:30 +010054#endif // WEBRTC_TEST_WIN_D3D_RENDERER_H_