Commit 247e3e88 authored by Cory Quammen's avatar Cory Quammen Committed by Kitware Robot

Merge topic 'bug-15787-empty-corner-annotation'

707fac6f Fix bug 15787 : empty vtkCornerAnnotation text renders incorrectly
Acked-by: Kitware Robot's avatarKitware Robot <kwrobot@kitware.com>
Reviewed-by: Cory Quammen's avatarCory Quammen <cory.quammen@kitware.com>
Merge-request: !794
parents a465073d 707fac6f
......@@ -4,6 +4,7 @@ vtk_add_test_cxx(${vtk-module}CxxTests tests
TestCaptionActor2D.cxx
TestConvexHull2D.cxx,NO_VALID
TestCornerAnnotation.cxx
TestEmptyCornerAnnotation.cxx
TestCubeAxes2DMode.cxx
TestCubeAxes3.cxx
TestCubeAxesWithGridLines.cxx
......
/*=========================================================================
Program: Visualization Toolkit
Module: TestCornerAnnotation.cxx
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved.
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
#include "vtkSmartPointer.h"
#include "vtkRenderer.h"
#include "vtkRenderWindow.h"
#include "vtkRenderWindowInteractor.h"
#include "vtkTextProperty.h"
#include "vtkActor.h"
#include "vtkCornerAnnotation.h"
#include "vtkRegressionTestImage.h"
int TestEmptyCornerAnnotation( int argc, char * argv [] )
{
// Visualize
vtkSmartPointer<vtkRenderer> renderer = vtkSmartPointer<vtkRenderer>::New();
vtkSmartPointer<vtkRenderWindow> renderWindow = vtkSmartPointer<vtkRenderWindow>::New();
renderWindow->AddRenderer(renderer);
vtkSmartPointer<vtkRenderWindowInteractor> renderWindowInteractor =
vtkSmartPointer<vtkRenderWindowInteractor>::New();
renderWindowInteractor->SetRenderWindow(renderWindow);
renderer->SetBackground(0.5, 0.5, 0.5);
// Annotate the image with window/level and mouse over pixel information
vtkSmartPointer<vtkCornerAnnotation> cornerAnnotation =
vtkSmartPointer<vtkCornerAnnotation>::New();
cornerAnnotation->SetLinearFontScaleFactor( 2 );
cornerAnnotation->SetNonlinearFontScaleFactor( 1 );
cornerAnnotation->SetMaximumFontSize( 20 );
cornerAnnotation->SetText( 0, "normal text" );
cornerAnnotation->SetText( 1, "1234567890" );
cornerAnnotation->SetText( 2, "~`!@#$%^&*()_-+=" );
cornerAnnotation->SetText( 3, "text to remove" );
cornerAnnotation->GetTextProperty()->SetColor( 1,0,0);
renderer->AddViewProp(cornerAnnotation);
renderWindow->Render();
// This should empty the annotation #3 and not display a black or white box
cornerAnnotation->SetText( 3, "" );
renderWindow->Render();
int retVal = vtkRegressionTestImage(renderWindow);
if (retVal == vtkRegressionTester::DO_INTERACTOR)
{
renderWindowInteractor->Start();
}
return !retVal;
}
......@@ -367,7 +367,7 @@ void vtkTextMapper::RenderOverlay(vtkViewport *viewport, vtkActor2D *actor)
vtkDebugMacro(<<"RenderOverlay called");
vtkRenderer *ren = NULL;
if (this->Input && this->Input[0])
if (this->Input)
{
vtkWindow *win = viewport->GetVTKWindow();
if (!win)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment