Server sends COMMAND_SCREEN_PREVIEW_REQ when user double-clicks an active (non-Locked/Inactive) host that advertises CLIENT_CAP_SCREEN_PREVIEW. Client BitBlts primary screen, encodes to JPEG via GDI+ and replies. The existing STATIC tooltip is replaced with a self-drawn CPreviewTipWnd showing the thumbnail above the host info text, with wide-character rendering so the popup also works on non-Chinese servers. - Quality tiers reuse QualityProfile pattern: PreviewProfile + 6 levels driven by GetTargetQualityLevel (FRP-aware), with 4K/ultrawide auto upscale on Ultra/High tiers up to min(screenWidth/4, 1280). - Client limits to 1 in-flight capture via atomic counter to defend against flood/DoS; Send2Server is already mutex-serialized. - Server validates responses by reqId only (single in-flight tip); 4s arrival timeout marks "preview unavailable" without blocking the text fallback path. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
17 lines
726 B
C++
17 lines
726 B
C++
// ScreenPreview.h
|
||
// 屏幕预览:抓主屏 → 等比缩放 → JPEG 编码,供 COMMAND_SCREEN_PREVIEW_REQ 响应使用。
|
||
#pragma once
|
||
|
||
#include <vector>
|
||
|
||
// 抓取主屏并编码成 JPEG。
|
||
// maxWidth 服务端期望的宽度;客户端按源屏宽度等比缩放,不会强制放大
|
||
// quality JPEG 质量 1..100(建议 40..85)
|
||
// out 编码后的 JPEG 字节流
|
||
// outWidth 实际编码图宽
|
||
// outHeight 实际编码图高
|
||
// 返回 0 表示成功;非 0 见 ScreenPreviewStatus(枚举在 commands.h)
|
||
int CaptureAndEncodePreview(int maxWidth, int quality,
|
||
std::vector<unsigned char>& out,
|
||
int& outWidth, int& outHeight);
|