blob: e8b06926171f912e1dc580896a6f9016522c2fc9 [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 */
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>
15
16#include "webrtc/system_wrappers/interface/scoped_refptr.h"
pbos@webrtc.org16e03b72013-10-28 16:32:01 +000017#include "webrtc/test/video_renderer.h"
pbos@webrtc.orgadf23a52013-07-10 14:07:56 +000018#include "webrtc/typedefs.h"
pbos@webrtc.orgadf23a52013-07-10 14:07:56 +000019
20namespace webrtc {
21namespace test {
22
23class D3dRenderer : public VideoRenderer {
24 public:
25 static D3dRenderer* Create(const char* window_title, size_t width,
26 size_t height);
27 virtual ~D3dRenderer();
28
29 virtual void RenderFrame(const webrtc::I420VideoFrame& frame, int delta)
30 OVERRIDE;
31 private:
32 D3dRenderer(size_t width, size_t height);
33
34 static LRESULT WINAPI WindowProc(HWND hwnd, UINT msg, WPARAM wparam,
35 LPARAM lparam);
36 bool Init(const char* window_title);
37 void Resize(size_t width, size_t height);
38 void Destroy();
39
40 size_t width_, height_;
41
42 HWND hwnd_;
43 scoped_refptr<IDirect3D9> d3d_;
44 scoped_refptr<IDirect3DDevice9> d3d_device_;
45
46 scoped_refptr<IDirect3DTexture9> texture_;
47 scoped_refptr<IDirect3DVertexBuffer9> vertex_buffer_;
48};
49} // namespace test
50} // namespace webrtc
51
52#endif // WEBRTC_VIDEO_ENGINE_TEST_COMMON_WIN_D3D_RENDERER_H_