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 
11 #ifndef MODULES_DESKTOP_CAPTURE_DESKTOP_FRAME_WIN_H_
12 #define MODULES_DESKTOP_CAPTURE_DESKTOP_FRAME_WIN_H_
13 
14 #include <windows.h>
15 
16 #include <memory>
17 
18 #include "modules/desktop_capture/desktop_frame.h"
19 #include "rtc_base/constructor_magic.h"
20 
21 namespace webrtc {
22 
23 // DesktopFrame implementation used by screen and window captures on Windows.
24 // Frame data is stored in a GDI bitmap.
25 class DesktopFrameWin : public DesktopFrame {
26  public:
27   ~DesktopFrameWin() override;
28 
29   static std::unique_ptr<DesktopFrameWin>
30   Create(DesktopSize size, SharedMemoryFactory* shared_memory_factory, HDC hdc);
31 
bitmap()32   HBITMAP bitmap() { return bitmap_; }
33 
34  private:
35   DesktopFrameWin(DesktopSize size,
36                   int stride,
37                   uint8_t* data,
38                   std::unique_ptr<SharedMemory> shared_memory,
39                   HBITMAP bitmap);
40 
41   HBITMAP bitmap_;
42   std::unique_ptr<SharedMemory> owned_shared_memory_;
43 
44   RTC_DISALLOW_COPY_AND_ASSIGN(DesktopFrameWin);
45 };
46 
47 }  // namespace webrtc
48 
49 #endif  // MODULES_DESKTOP_CAPTURE_DESKTOP_FRAME_WIN_H_
50