mirror of
https://github.com/snltty/linker.git
synced 2025-11-02 13:34:09 +08:00
第一版本
This commit is contained in:
@@ -16,16 +16,17 @@ export default {
|
||||
},
|
||||
|
||||
lastInput: 0,
|
||||
captureTime: 0,
|
||||
fps: 0,
|
||||
fpsTimes: 0,
|
||||
drawFps(canvas, ctx) {
|
||||
ctx.lineWidth = 5;
|
||||
ctx.font = 'bold 60px Arial';
|
||||
ctx.fillStyle = 'rgba(0,0,0,0.5)';
|
||||
ctx.fillText(`FPS : ${this.fps} 、LT : ${this.lastInput}ms`, 50, 70);
|
||||
ctx.fillText(`FPS : ${this.fps} 、${this.captureTime}ms、LT : ${this.lastInput}ms`, 50, 70);
|
||||
ctx.lineWidth = 2;
|
||||
ctx.strokeStyle = '#fff';
|
||||
ctx.strokeText(`FPS : ${this.fps} 、LT : ${this.lastInput}ms`, 50, 70);
|
||||
ctx.strokeText(`FPS : ${this.fps} 、${this.captureTime}ms 、LT : ${this.lastInput}ms`, 50, 70);
|
||||
},
|
||||
|
||||
rectangles: [],
|
||||
@@ -306,7 +307,6 @@ export default {
|
||||
for (let j in item) {
|
||||
try {
|
||||
if (item[j] && item[j].draw) {
|
||||
|
||||
item[j].draw(item.infoCanvas, item.infoCtx);
|
||||
}
|
||||
} catch (e) {
|
||||
@@ -366,7 +366,7 @@ export default {
|
||||
reportInterval(times) {
|
||||
if (this.reported) {
|
||||
this.reported = false;
|
||||
// const fn = times < 2 ? this.updateFull() : this.updateRegion();
|
||||
//const fn = times < 2 ? this.updateFull() : this.updateRegion();
|
||||
const fn = this.updateFull();
|
||||
fn.then(() => {
|
||||
this.reported = true;
|
||||
@@ -390,5 +390,6 @@ export default {
|
||||
if (!report.Screen) return;
|
||||
|
||||
item.Screen.lastInput = report.Screen.LT || 0;
|
||||
item.Screen.captureTime = report.Screen.CT || 0;
|
||||
}
|
||||
}
|
||||
@@ -114,7 +114,7 @@ export default {
|
||||
// background-color: #fff;
|
||||
box-shadow: 0 0 4px rgba(0, 0, 0, 0.05);
|
||||
width: 100%;
|
||||
margin: 0 auto 1rem auto;
|
||||
margin: 0 auto .6rem auto;
|
||||
position: relative;
|
||||
transition: 0.3s;
|
||||
background-color: rgba(255, 255, 255, 0.5);
|
||||
|
||||
@@ -23,7 +23,7 @@ namespace cmonitor.server.client.reports.screen
|
||||
|
||||
public struct Scale
|
||||
{
|
||||
public Scale(int x, int y,float scale)
|
||||
public Scale(int x, int y, float scale)
|
||||
{
|
||||
X = x;
|
||||
Y = y;
|
||||
@@ -55,6 +55,7 @@ namespace cmonitor.server.client.reports.screen
|
||||
Y = y;
|
||||
Width = width;
|
||||
Height = height;
|
||||
Remove = false;
|
||||
}
|
||||
public int X { get; set; }
|
||||
public int Y { get; set; }
|
||||
@@ -62,9 +63,14 @@ namespace cmonitor.server.client.reports.screen
|
||||
public int Height { get; set; }
|
||||
public bool Remove { get; set; }
|
||||
|
||||
public readonly bool IntersectsWith(Rectangle rect) =>
|
||||
(rect.X < X + Width) && (X < rect.X + rect.Width) &&
|
||||
(rect.Y < Y + Height) && (Y < rect.Y + rect.Height);
|
||||
public readonly bool IntersectsWith(Rectangle rect) => IntersectsWithX(rect) && IntersectsWithY(rect);
|
||||
public readonly bool IntersectsWithX(Rectangle rect) => (rect.X < X + Width) && (X < rect.X + rect.Width);
|
||||
public readonly bool IntersectsWithY(Rectangle rect) => (rect.Y < Y + Height) && (Y < rect.Y + rect.Height);
|
||||
|
||||
public readonly bool NearWith(Rectangle rect, int dist) => (NearWithX(rect, dist) && IntersectsWithY(rect)) || (NearWithY(rect, dist) && IntersectsWithX(rect));
|
||||
public readonly bool NearWithX(Rectangle rect, int dist) => Math.Min(Math.Abs(X + Width - rect.X), Math.Abs(rect.X + rect.Width - X)) <= dist;
|
||||
public readonly bool NearWithY(Rectangle rect, int dist) => Math.Min(Math.Abs(Y + Height - rect.Y), Math.Abs(rect.Y + rect.Height - Y)) <= dist;
|
||||
|
||||
|
||||
public readonly Rectangle Union(Rectangle b)
|
||||
{
|
||||
@@ -86,7 +92,7 @@ namespace cmonitor.server.client.reports.screen
|
||||
for (int j = i + 1; j < rects.Length; j++)
|
||||
{
|
||||
if (rects[j].Remove) continue;
|
||||
if (rects[i].IntersectsWith(rects[j]))
|
||||
if (rects[i].IntersectsWith(rects[j]) || rects[i].NearWith(rects[j], 5))
|
||||
{
|
||||
rects[i] = rects[i].Union(rects[j]);
|
||||
rects[j].Remove = true;
|
||||
@@ -105,6 +111,7 @@ namespace cmonitor.server.client.reports.screen
|
||||
index++;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -345,9 +345,8 @@ namespace cmonitor.server.client.reports.screen
|
||||
if (screenReportFullType == ScreenReportFullType.Full && fullImageMemory.Length > 0)
|
||||
{
|
||||
frame.FullImage = fullImageMemory;
|
||||
return frame;
|
||||
}
|
||||
return null;
|
||||
return frame;
|
||||
}
|
||||
|
||||
try
|
||||
@@ -514,7 +513,7 @@ namespace cmonitor.server.client.reports.screen
|
||||
bool success = RetrieveFrame();
|
||||
if (success == false)
|
||||
{
|
||||
return null;
|
||||
return frame;
|
||||
}
|
||||
|
||||
try
|
||||
|
||||
@@ -16,6 +16,7 @@ namespace cmonitor.server.client.reports.screen
|
||||
|
||||
private ScreenReportInfo report = new ScreenReportInfo();
|
||||
private uint lastInput;
|
||||
private uint captureTime;
|
||||
private readonly DxgiDesktop dxgiDesktop;
|
||||
private readonly GdiDesktop gdiDesktop;
|
||||
|
||||
@@ -39,6 +40,7 @@ namespace cmonitor.server.client.reports.screen
|
||||
if (report.LT < lastInput || report.LT - lastInput > 1000)
|
||||
{
|
||||
lastInput = report.LT;
|
||||
captureTime = report.CT;
|
||||
return report;
|
||||
}
|
||||
return null;
|
||||
@@ -105,22 +107,20 @@ namespace cmonitor.server.client.reports.screen
|
||||
private async Task SendScreenCapture()
|
||||
{
|
||||
DesktopFrame frame = null;
|
||||
if (gdiDesktop.IsClip()/*|| gdiDesktop.IsLockScreen()*/)
|
||||
long ticks = DateTime.UtcNow.Ticks;
|
||||
if (gdiDesktop.IsClip())
|
||||
{
|
||||
frame = gdiDesktop.GetLatestFrame(config.ScreenScale);
|
||||
}
|
||||
else if (screenReportType == ScreenReportType.Full)
|
||||
{
|
||||
//var sw = new Stopwatch();
|
||||
//sw.Start();
|
||||
frame = dxgiDesktop.GetLatestFullFrame(screenReportFullType,config.ScreenScale);
|
||||
//sw.Stop();
|
||||
//Console.WriteLine(sw.ElapsedMilliseconds);
|
||||
frame = dxgiDesktop.GetLatestFullFrame(screenReportFullType, config.ScreenScale);
|
||||
}
|
||||
else if (screenReportType == ScreenReportType.Region)
|
||||
{
|
||||
frame = dxgiDesktop.GetLatestRegionFrame(config.ScreenScale);
|
||||
}
|
||||
report.CT = (uint)((DateTime.UtcNow.Ticks - ticks) / TimeSpan.TicksPerMillisecond);
|
||||
|
||||
if (frame != null)
|
||||
{
|
||||
@@ -155,6 +155,7 @@ namespace cmonitor.server.client.reports.screen
|
||||
|
||||
public sealed class ScreenReportInfo
|
||||
{
|
||||
public uint CT { get; set; }
|
||||
public uint LT { get; set; }
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because one or more lines are too long
1
cmonitor/web/css/603.9a4741e8.css
Normal file
1
cmonitor/web/css/603.9a4741e8.css
Normal file
File diff suppressed because one or more lines are too long
@@ -1 +1 @@
|
||||
<!doctype html><html lang=""><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,minimum-scale=1,user-scalable=0"><link rel="icon" href="/favicon.ico"><title>cmonitor.web</title><script defer="defer" src="/js/chunk-vendors.9b0dc62c.js"></script><script defer="defer" src="/js/app.cb663f8a.js"></script><link href="/css/chunk-vendors.faad7142.css" rel="stylesheet"><link href="/css/app.9c6b579f.css" rel="stylesheet"></head><body><noscript><strong>We're sorry but cmonitor.web doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"></div></body></html>
|
||||
<!doctype html><html lang=""><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,minimum-scale=1,user-scalable=0"><link rel="icon" href="/favicon.ico"><title>cmonitor.web</title><script defer="defer" src="/js/chunk-vendors.9b0dc62c.js"></script><script defer="defer" src="/js/app.eda51872.js"></script><link href="/css/chunk-vendors.faad7142.css" rel="stylesheet"><link href="/css/app.9c6b579f.css" rel="stylesheet"></head><body><noscript><strong>We're sorry but cmonitor.web doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"></div></body></html>
|
||||
File diff suppressed because one or more lines are too long
1
cmonitor/web/js/603.5de5f65a.js
Normal file
1
cmonitor/web/js/603.5de5f65a.js
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user