------------------------------------------------------------------------------
| 837 | |
| 838 | //------------------------------------------------------------------------------ |
| 839 | void vtkOpenGLContextDevice2D::DrawLines(float* f, int n, unsigned char* colors, int nc) |
| 840 | { |
| 841 | assert("f must be non-null" && f != nullptr); |
| 842 | assert("n must be greater than 0" && n > 0); |
| 843 | |
| 844 | if (SkipDraw()) |
| 845 | { |
| 846 | return; |
| 847 | } |
| 848 | |
| 849 | if (this->Pen->GetLineType() == vtkPen::NO_PEN) |
| 850 | { |
| 851 | return; |
| 852 | } |
| 853 | |
| 854 | // Skip transparent elements. |
| 855 | if (!colors && this->Pen->GetColorObject().GetAlpha() == 0) |
| 856 | { |
| 857 | return; |
| 858 | } |
| 859 | |
| 860 | vtkOpenGLClearErrorMacro(); |
| 861 | |
| 862 | this->SetLineType(this->Pen->GetLineType()); |
| 863 | |
| 864 | vtkOpenGLHelper* cbo = nullptr; |
| 865 | if (colors) |
| 866 | { |
| 867 | this->ReadyLinesCBOProgram(); |
| 868 | cbo = this->LinesCBO; |
| 869 | } |
| 870 | else |
| 871 | { |
| 872 | this->ReadyLinesBOProgram(); |
| 873 | cbo = this->LinesBO; |
| 874 | if (!cbo->Program) |
| 875 | { |
| 876 | return; |
| 877 | } |
| 878 | cbo->Program->SetUniform4uc("vertexColor", this->Pen->GetColor()); |
| 879 | } |
| 880 | if (!cbo->Program) |
| 881 | { |
| 882 | return; |
| 883 | } |
| 884 | |
| 885 | cbo->Program->SetUniformi("stipple", this->LinePattern); |
| 886 | |
| 887 | this->SetMatrices(cbo->Program); |
| 888 | |
| 889 | // for line stipple we need to compute the scaled |
| 890 | // cumulative linear distance |
| 891 | double* scale = this->ModelMatrix->GetScale(); |
| 892 | std::vector<float> distances; |
| 893 | distances.resize(n * 2); |
| 894 | float totDist = 0.0; |
| 895 | distances[0] = 0.0; |
| 896 | for (int i = 1; i < n; i++) |
nothing calls this directly
no test coverage detected