From fccc60d8897642ef5c39176b8c872b63fe819ae2 Mon Sep 17 00:00:00 2001
From: xcd <834800634@qq.com>
Date: 星期五, 20 十一月 2020 10:44:57 +0800
Subject: [PATCH] gocator添加int4类型数据,暂时注释

---
 src/Bro.Device.Gocator/GocatorDriver.cs |   22 ++++++++++++++++++++++
 1 files changed, 22 insertions(+), 0 deletions(-)

diff --git a/src/Bro.Device.Gocator/GocatorDriver.cs b/src/Bro.Device.Gocator/GocatorDriver.cs
index 15f801a..0d22a6f 100644
--- a/src/Bro.Device.Gocator/GocatorDriver.cs
+++ b/src/Bro.Device.Gocator/GocatorDriver.cs
@@ -90,9 +90,12 @@
                             long bufferSize = width * height;
                             IntPtr bufferPointer = surfaceMsg.Data;
 
+
                             float zoomFactor = (float)((double)surfaceMsg.YResolution / (double)surfaceMsg.XResolution);
                             int zoomHeight = (int)(zoomFactor * height);
+
                             IntPtr zoomPtr = Marshal.AllocHGlobal(zoomHeight * (int)width * 2);
+                            //IntPtr zoomPtr = Marshal.AllocHGlobal(zoomHeight * (int)width * 4);
 
                             //娌℃湁鎻掑�硷紝榛樿0
                             //Parallel.For(0, height, h =>
@@ -108,14 +111,33 @@
                                 CopyMemory((IntPtr)((long)zoomPtr + width * 2 * h), (IntPtr)((long)bufferPointer + width * 2 * originHeightIndex), width * 2);
                             });
 
+                            ////浣跨敤涓婁竴琛屽師鏈夋暟鎹�
+                            //Parallel.For(0, zoomHeight, h =>
+                            //{
+                            //    int originHeightIndex = (int)Math.Floor((double)height * h / (double)zoomHeight);
+
+                            //    byte[] rowBuffer = new byte[width * 4];
+                            //    Parallel.For(0, width, w =>
+                            //    {
+                            //        rowBuffer[w * 4 + 2] = Marshal.ReadByte(bufferPointer, (int)(width * 2 * originHeightIndex + w * 2));
+                            //        rowBuffer[w * 4 + 3] = Marshal.ReadByte(bufferPointer, (int)(width * 2 * originHeightIndex + w * 2 + 1));
+                            //    });
+
+                            //    Marshal.Copy(rowBuffer, 0, (IntPtr)((long)zoomPtr + width * 2 * h), rowBuffer.Length);
+                            //});
+
                             if (imgSet != null)
                             {
                                 imgSet.HImage = new HImage();
                                 imgSet.HImage.GenImage1("uint2", (int)width, zoomHeight, zoomPtr);
 
+                                //imgSet.HImage.GenImage1("int4", (int)width, zoomHeight, zoomPtr);
+
                                 imgSet.HImage_2 = new HImage();
                                 imgSet.HImage_2.GenImage1("uint2", (int)width, zoomHeight, zoomPtr);
 
+                                //imgSet.HImage_2.GenImage1("int4", (int)width, zoomHeight, zoomPtr);
+
                                 LaserScanParam para = new LaserScanParam()
                                 {
                                     Resolution_X = surfaceMsg.XResolution,

--
Gitblit v1.8.0