Magpie/Runtime/FrameSourceBase.h
刘旭 6de6d1aee1 refactor: 将捕获模式分为两类:屏幕捕获和窗口捕获
尽量不直接使用 GetCaptureMode,而是将捕获模式的特性实现为公共方法
2021-12-29 14:15:07 +08:00

38 lines
749 B
C++

#pragma once
#include "pch.h"
class FrameSourceBase {
public:
FrameSourceBase() {}
virtual ~FrameSourceBase() {}
// 不可复制,不可移动
FrameSourceBase(const FrameSourceBase&) = delete;
FrameSourceBase(FrameSourceBase&&) = delete;
virtual bool Initialize() = 0;
virtual ComPtr<ID3D11Texture2D> GetOutput() = 0;
enum class UpdateState {
NewFrame,
NoUpdate,
Waiting,
Error
};
virtual UpdateState Update() = 0;
virtual bool HasRoundCornerInWin11() = 0;
virtual bool IsScreenCapture() = 0;
protected:
static bool _GetWindowDpiScale(HWND hWnd, float& dpiScale);
static bool _GetDpiAwareWindowClientOffset(HWND hWnd, POINT& clientOffset);
static bool _CenterWindowIfNecessary(HWND hWnd, const RECT& rcWork);
};