dxgi_texture_mapping.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. /*
  2. * Copyright (c) 2016 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 MODULES_DESKTOP_CAPTURE_WIN_DXGI_TEXTURE_MAPPING_H_
  11. #define MODULES_DESKTOP_CAPTURE_WIN_DXGI_TEXTURE_MAPPING_H_
  12. #include <d3d11.h>
  13. #include <dxgi1_2.h>
  14. #include "modules/desktop_capture/desktop_geometry.h"
  15. #include "modules/desktop_capture/desktop_region.h"
  16. #include "modules/desktop_capture/win/dxgi_texture.h"
  17. namespace webrtc {
  18. // A DxgiTexture which directly maps bitmap from IDXGIResource. This class is
  19. // used when DXGI_OUTDUPL_DESC.DesktopImageInSystemMemory is true. (This usually
  20. // means the video card shares main memory with CPU, instead of having its own
  21. // individual memory.)
  22. class DxgiTextureMapping : public DxgiTexture {
  23. public:
  24. // Creates a DxgiTextureMapping instance. Caller must maintain the lifetime
  25. // of input |duplication| to make sure it outlives this instance.
  26. explicit DxgiTextureMapping(IDXGIOutputDuplication* duplication);
  27. ~DxgiTextureMapping() override;
  28. protected:
  29. bool CopyFromTexture(const DXGI_OUTDUPL_FRAME_INFO& frame_info,
  30. ID3D11Texture2D* texture) override;
  31. bool DoRelease() override;
  32. private:
  33. IDXGIOutputDuplication* const duplication_;
  34. };
  35. } // namespace webrtc
  36. #endif // MODULES_DESKTOP_CAPTURE_WIN_DXGI_TEXTURE_MAPPING_H_