From 87f9baa6b7fed6da8118812bd7d8656b6e972add Mon Sep 17 00:00:00 2001 From: Dan Lipsa <dan.lipsa@kitware.com> Date: Mon, 12 Sep 2016 16:47:18 -0400 Subject: [PATCH] Shift quad position with one pixel to fix multiLineText test. --- Rendering/Core/vtkTextMapper.cxx | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/Rendering/Core/vtkTextMapper.cxx b/Rendering/Core/vtkTextMapper.cxx index ff358355fd2..bb5b2b7fe7b 100644 --- a/Rendering/Core/vtkTextMapper.cxx +++ b/Rendering/Core/vtkTextMapper.cxx @@ -505,17 +505,19 @@ void vtkTextMapper::UpdateQuad(vtkActor2D *actor, int dpi) text_bbox[0] = 0; text_bbox[2] = 0; } - + // adjust the quad so that the anchor point and a point with the same + // coordinates fall on the same pixel. + double shiftPixel = 1; double x = static_cast<double>(text_bbox[0]); double y = static_cast<double>(text_bbox[2]); double w = static_cast<double>(this->TextDims[0]); double h = static_cast<double>(this->TextDims[1]); this->Points->Reset(); - this->Points->InsertNextPoint(x, y, 0.); - this->Points->InsertNextPoint(x, y + h, 0.); - this->Points->InsertNextPoint(x + w, y + h, 0.); - this->Points->InsertNextPoint(x + w, y, 0.); + this->Points->InsertNextPoint(x - shiftPixel, y - shiftPixel, 0.); + this->Points->InsertNextPoint(x - shiftPixel, y + h - shiftPixel, 0.); + this->Points->InsertNextPoint(x + w - shiftPixel, y + h - shiftPixel, 0.); + this->Points->InsertNextPoint(x + w - shiftPixel, y - shiftPixel, 0.); this->CoordsTime.Modified(); } } -- GitLab