From bb11899d711a1590b31bd427b0d51ebd7675292a Mon Sep 17 00:00:00 2001 From: "Krom, Robertus" Date: Tue, 25 Feb 2020 08:26:27 +0100 Subject: [PATCH] Fixed compile error from previous commit --- GreenshotPlugin/Core/Capture.cs | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/GreenshotPlugin/Core/Capture.cs b/GreenshotPlugin/Core/Capture.cs index d4674ce70..dbdbca21c 100644 --- a/GreenshotPlugin/Core/Capture.cs +++ b/GreenshotPlugin/Core/Capture.cs @@ -2,6 +2,7 @@ using System; using System.Collections.Generic; using System.Drawing; using System.Drawing.Imaging; +using System.Linq; using GreenshotPlugin.Interfaces; using GreenshotPlugin.Interfaces.Ocr; using log4net; @@ -178,9 +179,17 @@ namespace GreenshotPlugin.Core // Offset the OCR information CaptureDetails.OcrInformation?.Offset(-cropRectangle.Location.X, -cropRectangle.Location.Y); - var offsetted - CaptureDetails.QrResult.ResultPoints[0]; - var resultPoint = new ResultPoint(); + // Offset the Qr information + var oldQrResult = CaptureDetails.QrResult; + if (oldQrResult != null) + { + CaptureDetails.OcrInformation?.Offset(-cropRectangle.Location.X, -cropRectangle.Location.Y); + var offsetPoints = CaptureDetails.QrResult.ResultPoints + .Select(p => new ResultPoint(p.X - cropRectangle.Location.X, p.Y - cropRectangle.Location.Y)).ToArray(); + + var newQqResult = new Result(oldQrResult.Text, oldQrResult.RawBytes, offsetPoints, oldQrResult.BarcodeFormat); + CaptureDetails.QrResult = newQqResult; + } // Remove invisible elements var visibleElements = new List();