d3d_renderer.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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 TEST_WIN_D3D_RENDERER_H_
  11. #define TEST_WIN_D3D_RENDERER_H_
  12. #include <Windows.h>
  13. #include <d3d9.h>
  14. #pragma comment(lib, "d3d9.lib") // located in DirectX SDK
  15. #include "api/scoped_refptr.h"
  16. #include "test/video_renderer.h"
  17. namespace webrtc {
  18. namespace test {
  19. class D3dRenderer : public VideoRenderer {
  20. public:
  21. static D3dRenderer* Create(const char* window_title,
  22. size_t width,
  23. size_t height);
  24. virtual ~D3dRenderer();
  25. void OnFrame(const webrtc::VideoFrame& frame) override;
  26. private:
  27. D3dRenderer(size_t width, size_t height);
  28. static LRESULT WINAPI WindowProc(HWND hwnd,
  29. UINT msg,
  30. WPARAM wparam,
  31. LPARAM lparam);
  32. bool Init(const char* window_title);
  33. void Resize(size_t width, size_t height);
  34. void Destroy();
  35. size_t width_, height_;
  36. HWND hwnd_;
  37. rtc::scoped_refptr<IDirect3D9> d3d_;
  38. rtc::scoped_refptr<IDirect3DDevice9> d3d_device_;
  39. rtc::scoped_refptr<IDirect3DTexture9> texture_;
  40. rtc::scoped_refptr<IDirect3DVertexBuffer9> vertex_buffer_;
  41. };
  42. } // namespace test
  43. } // namespace webrtc
  44. #endif // TEST_WIN_D3D_RENDERER_H_