Skip to content
This repository has been archived by the owner on Jul 13, 2024. It is now read-only.

Support for SIMATIC HMI TP1500 Comfort #126

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions RemoteViewing/Vnc/VncClient.Framebuffer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,10 @@ private bool HandleFramebufferUpdate()
{
var r = this.c.ReceiveRectangle();
int x = r.X, y = r.Y, w = r.Width, h = r.Height;
VncStream.SanityCheck(w > 0 && w < 0x8000);
VncStream.SanityCheck(h > 0 && h < 0x8000);

// we could receive 0,0 on an update rectangle with a "pseudo-encoding"
VncStream.SanityCheck(w >= 0 && w < 0x8000);
VncStream.SanityCheck(h >= 0 && h < 0x8000);

int fbW = this.Framebuffer.Width, fbH = this.Framebuffer.Height, bpp = this.Framebuffer.PixelFormat.BytesPerPixel;
var inRange = w <= fbW && h <= fbH && x <= fbW - w && y <= fbH - h;
Expand Down Expand Up @@ -263,6 +265,10 @@ private bool HandleFramebufferUpdate()
this.Framebuffer = new VncFramebuffer(this.Framebuffer.Name, w, h, this.Framebuffer.PixelFormat);
continue; // Don't call OnFramebufferChanged for this one.

case VncEncoding.PseudoCursor:
// client requesting the Cursor pseudo-encoding
continue;

default:
VncStream.Require(
false,
Expand Down
8 changes: 7 additions & 1 deletion RemoteViewing/Vnc/VncPixelFormat.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public VncPixelFormat(
throw new ArgumentOutOfRangeException(nameof(bitsPerPixel));
}

if (bitDepth != 6 && bitDepth != 24)
if (bitDepth != 6 && bitDepth != 24 && bitDepth != 32)
{
throw new ArgumentOutOfRangeException(nameof(bitDepth));
}
Expand Down Expand Up @@ -474,6 +474,12 @@ internal static VncPixelFormat Decode(byte[] buffer, int offset)
var greenShift = buffer[offset + 11];
var blueShift = buffer[offset + 12];

// treat 32 bit depth as 24 bits
if (depth == 32)
{
depth = 24;
}

return new VncPixelFormat(
bitsPerPixel,
depth,
Expand Down