------------------------------------------------------------------------------
| 846 | |
| 847 | //------------------------------------------------------------------------------ |
| 848 | int vtkTextActor::UpdateRectangle(vtkViewport* viewport) |
| 849 | { |
| 850 | if (this->TextProperty->GetMTime() > this->ScaledTextProperty->GetMTime() || |
| 851 | this->GetMTime() > this->BuildTime) |
| 852 | { |
| 853 | this->ComputeScaledFont(viewport); |
| 854 | } |
| 855 | |
| 856 | vtkWindow* win = viewport->GetVTKWindow(); |
| 857 | if (!win) |
| 858 | { |
| 859 | vtkErrorMacro(<< "No render window available: cannot determine DPI."); |
| 860 | return 0; |
| 861 | } |
| 862 | |
| 863 | // check if we need to render the string |
| 864 | if (this->ScaledTextProperty->GetMTime() > this->BuildTime || !this->InputRendered || |
| 865 | this->GetMTime() > this->BuildTime || this->RenderedDPI != win->GetDPI()) |
| 866 | { |
| 867 | if (!this->RenderImage(this->ScaledTextProperty, viewport)) |
| 868 | { |
| 869 | vtkErrorMacro(<< "Failed rendering text to buffer"); |
| 870 | return 0; |
| 871 | } |
| 872 | |
| 873 | // Check if we need to create a new rectangle. |
| 874 | // Need to check if angle has changed. |
| 875 | // justification and line offset are handled in ComputeRectangle |
| 876 | this->ComputeRectangle(viewport); |
| 877 | |
| 878 | this->ImageData->Modified(); |
| 879 | this->Texture->SetInputData(this->ImageData); |
| 880 | this->Texture->Modified(); |
| 881 | this->InputRendered = true; |
| 882 | this->RenderedDPI = win->GetDPI(); |
| 883 | this->BuildTime.Modified(); |
| 884 | } |
| 885 | return 1; |
| 886 | } |
| 887 | |
| 888 | //------------------------------------------------------------------------------ |
| 889 | void vtkTextActor::SpecifiedToDisplay(double* pos, vtkViewport* vport, int specified) |
no test coverage detected