DoLabel() static private method

static private DoLabel ( float x, float y, string text, float alignment ) : void
x float
y float
text string
alignment float
return void
Exemplo n.º 1
0
 private void DrawGridStacked(Rect r, ChartData cdata)
 {
     if (cdata.grid == null || cdata.gridLabels == null)
     {
         return;
     }
     GL.Begin(1);
     GL.Color(new Color(1f, 1f, 1f, 0.2f));
     for (int index = 0; index < cdata.grid.Length; ++index)
     {
         float y = (float)((double)r.y + (double)r.height - (double)cdata.grid[index] * (double)cdata.scale[0] * (double)r.height);
         if ((double)y > (double)r.y)
         {
             GL.Vertex3(r.x + 80f, y, 0.0f);
             GL.Vertex3(r.x + r.width, y, 0.0f);
         }
     }
     GL.End();
     for (int index = 0; index < cdata.grid.Length; ++index)
     {
         float num = (float)((double)r.y + (double)r.height - (double)cdata.grid[index] * (double)cdata.scale[0] * (double)r.height);
         if ((double)num > (double)r.y)
         {
             Chart.DoLabel(r.x + 5f, num - 8f, cdata.gridLabels[index], 0.0f);
         }
     }
 }
Exemplo n.º 2
0
 private void DrawGridStacked(Rect r, ChartData cdata)
 {
     if (Event.current.type == EventType.Repaint && cdata.grid != null && cdata.gridLabels != null)
     {
         GL.Begin(1);
         GL.Color(new Color(1f, 1f, 1f, 0.2f));
         for (int i = 0; i < cdata.grid.Length; i++)
         {
             float num = r.y + r.height - cdata.grid[i] * cdata.scale[0] * r.height;
             if (num > r.y)
             {
                 GL.Vertex3(r.x + 80f, num, 0f);
                 GL.Vertex3(r.x + r.width, num, 0f);
             }
         }
         GL.End();
         for (int j = 0; j < cdata.grid.Length; j++)
         {
             float num2 = r.y + r.height - cdata.grid[j] * cdata.scale[0] * r.height;
             if (num2 > r.y)
             {
                 Chart.DoLabel(r.x + 5f, num2 - 8f, cdata.gridLabels[j], 0f);
             }
         }
     }
 }
Exemplo n.º 3
0
        private void DrawGrid(Rect r, int threadCount, float frameTime)
        {
            float num = 16.66667f;

            HandleUtility.ApplyWireMaterial();
            GL.Begin(1);
            GL.Color(new Color(1f, 1f, 1f, 0.2f));
            float num3;

            for (float num2 = num; num2 <= frameTime; num2 += num)
            {
                num3 = this.m_TimeArea.TimeToPixel(num2, r);
                GL.Vertex3(num3, r.y, 0f);
                GL.Vertex3(num3, r.y + r.height, 0f);
            }
            GL.Color(new Color(1f, 1f, 1f, 0.8f));
            num3 = this.m_TimeArea.TimeToPixel(0f, r);
            GL.Vertex3(num3, r.y, 0f);
            GL.Vertex3(num3, r.y + r.height, 0f);
            num3 = this.m_TimeArea.TimeToPixel(frameTime, r);
            GL.Vertex3(num3, r.y, 0f);
            GL.Vertex3(num3, r.y + r.height, 0f);
            GL.End();
            GUI.color = new Color(1f, 1f, 1f, 0.4f);
            for (float num2 = 0f; num2 <= frameTime; num2 += num)
            {
                num3 = this.m_TimeArea.TimeToPixel(num2, r);
                Chart.DoLabel(num3 + 2f, r.yMax - 12f, string.Format("{0:f1}ms", num2), 0f);
            }
            GUI.color = new Color(1f, 1f, 1f, 1f);
            num3      = this.m_TimeArea.TimeToPixel(frameTime, r);
            Chart.DoLabel(num3 + 2f, r.yMax - 12f, string.Format("{0:f1}ms ({1:f0}FPS)", frameTime, 1000f / frameTime), 0f);
        }
Exemplo n.º 4
0
 private void DrawGridStacked(Rect r, ChartViewData cdata)
 {
     if (Event.current.type == EventType.Repaint && cdata.grid != null && cdata.gridLabels != null)
     {
         GL.Begin(1);
         GL.Color(new Color(1f, 1f, 1f, 0.2f));
         float num  = (cdata.series[0].rangeAxis.sqrMagnitude != 0f) ? (1f / (cdata.series[0].rangeAxis.y - cdata.series[0].rangeAxis.x) * r.height) : 0f;
         float num2 = r.y + r.height;
         for (int i = 0; i < cdata.grid.Length; i++)
         {
             float num3 = num2 - (cdata.grid[i] - cdata.series[0].rangeAxis.x) * num;
             if (num3 > r.y)
             {
                 GL.Vertex3(r.x + 80f, num3, 0f);
                 GL.Vertex3(r.x + r.width, num3, 0f);
             }
         }
         GL.End();
         for (int j = 0; j < cdata.grid.Length; j++)
         {
             float num4 = num2 - (cdata.grid[j] - cdata.series[0].rangeAxis.x) * num;
             if (num4 > r.y)
             {
                 Chart.DoLabel(r.x + 5f, num4 - 8f, cdata.gridLabels[j], 0f);
             }
         }
     }
 }
Exemplo n.º 5
0
        private void DrawLabelsStacked(int selectedFrame, ChartData cdata, Rect r)
        {
            if (cdata.selectedLabels == null)
            {
                return;
            }
            int numberOfFrames = cdata.NumberOfFrames;

            if (selectedFrame < cdata.firstSelectableFrame || selectedFrame >= cdata.firstFrame + numberOfFrames)
            {
                return;
            }
            selectedFrame -= cdata.firstFrame;
            float num  = r.width / (float)numberOfFrames;
            float num2 = r.x + num * (float)selectedFrame;
            float num3 = cdata.scale[0] * r.height;

            float[] array  = new float[cdata.charts.Length];
            float[] array2 = new float[array.Length];
            float   num4   = 0f;

            for (int i = 0; i < cdata.charts.Length; i++)
            {
                array[i]  = -1f;
                array2[i] = 0f;
                int num5 = cdata.chartOrder[i];
                if (cdata.charts[num5].enabled)
                {
                    float num6 = cdata.charts[num5].data[selectedFrame];
                    if (num6 != -1f)
                    {
                        float num7 = (!cdata.hasOverlay) ? num6 : cdata.charts[num5].overlayData[selectedFrame];
                        if (num7 * num3 > 5f)
                        {
                            array[i]  = (num4 + num7 * 0.5f) * num3;
                            array2[i] = Chart.GetLabelHeight(cdata.selectedLabels[num5]);
                        }
                        num4 += num6;
                    }
                }
            }
            Chart.CorrectLabelPositions(array, array2, r.height);
            for (int j = 0; j < cdata.charts.Length; j++)
            {
                if (array2[j] > 0f)
                {
                    int   num8  = cdata.chartOrder[j];
                    Color color = cdata.charts[num8].color;
                    GUI.contentColor = color * 0.8f + Color.white * 0.2f;
                    float alignment = (float)(((num8 & 1) != 0) ? 0 : -1);
                    float num9      = ((num8 & 1) != 0) ? (num + 1f) : -1f;
                    Chart.DoLabel(num2 + num9, r.y + r.height - array[j] - 8f, cdata.selectedLabels[num8], alignment);
                }
            }
            GUI.contentColor = Color.white;
        }
Exemplo n.º 6
0
        private void DrawLabelsStacked(int selectedFrame, ChartData cdata, Rect r)
        {
            if (cdata.selectedLabels == null)
            {
                return;
            }
            int numberOfFrames = cdata.NumberOfFrames;

            if (selectedFrame < cdata.firstSelectableFrame || selectedFrame >= cdata.firstFrame + numberOfFrames)
            {
                return;
            }
            selectedFrame -= cdata.firstFrame;
            float num1 = r.width / (float)numberOfFrames;
            float num2 = r.x + num1 * (float)selectedFrame;
            float num3 = cdata.scale[0] * r.height;

            float[] ypositions = new float[cdata.charts.Length];
            float[] heights    = new float[ypositions.Length];
            float   num4       = 0.0f;

            for (int index1 = 0; index1 < cdata.charts.Length; ++index1)
            {
                ypositions[index1] = -1f;
                heights[index1]    = 0.0f;
                int index2 = cdata.chartOrder[index1];
                if (cdata.charts[index2].enabled)
                {
                    float num5 = cdata.charts[index2].data[selectedFrame];
                    if ((double)num5 != -1.0)
                    {
                        float num6 = !cdata.hasOverlay ? num5 : cdata.charts[index2].overlayData[selectedFrame];
                        if ((double)num6 * (double)num3 > 5.0)
                        {
                            ypositions[index1] = (num4 + num6 * 0.5f) * num3;
                            heights[index1]    = Chart.GetLabelHeight(cdata.selectedLabels[index2]);
                        }
                        num4 += num5;
                    }
                }
            }
            Chart.CorrectLabelPositions(ypositions, heights, r.height);
            for (int index1 = 0; index1 < cdata.charts.Length; ++index1)
            {
                if ((double)heights[index1] > 0.0)
                {
                    int index2 = cdata.chartOrder[index1];
                    GUI.contentColor = cdata.charts[index2].color * 0.8f + Color.white * 0.2f;
                    float alignment = (index2 & 1) != 0 ? 0.0f : -1f;
                    float num5      = (index2 & 1) != 0 ? num1 + 1f : -1f;
                    Chart.DoLabel(num2 + num5, (float)((double)r.y + (double)r.height - (double)ypositions[index1] - 8.0), cdata.selectedLabels[index2], alignment);
                }
            }
            GUI.contentColor = Color.white;
        }
Exemplo n.º 7
0
 private void DrawRangeSelectionOverlay(Rect rect)
 {
     if (this.m_RangeSelection.active)
     {
         float num  = this.m_TimeArea.TimeToPixel(this.m_RangeSelection.startTime, rect);
         float num2 = this.m_TimeArea.TimeToPixel(this.m_RangeSelection.endTime, rect);
         if (num <= rect.xMax && num2 >= rect.xMin)
         {
             Rect rect2 = Rect.MinMaxRect(Mathf.Max(rect.xMin, num), rect.yMin, Mathf.Min(rect.xMax, num2), rect.yMax);
             EditorGUI.DrawRect(rect2, ProfilerTimelineGUI.styles.rangeSelectionColor);
             string text = string.Format("{0}ms", this.m_RangeSelection.duration.ToString("N3"));
             Chart.DoLabel(num + (num2 - num) / 2f, rect.yMin + 3f, text, -0.5f);
         }
     }
 }
Exemplo n.º 8
0
        private void DrawLabelsLine(int selectedFrame, ChartData cdata, Rect r)
        {
            if (cdata.selectedLabels == null)
            {
                return;
            }
            int numberOfFrames = cdata.NumberOfFrames;

            if (selectedFrame < cdata.firstSelectableFrame || selectedFrame >= cdata.firstFrame + numberOfFrames)
            {
                return;
            }
            selectedFrame -= cdata.firstFrame;
            float[] array  = new float[cdata.charts.Length];
            float[] array2 = new float[array.Length];
            for (int i = 0; i < cdata.charts.Length; i++)
            {
                array[i]  = -1f;
                array2[i] = 0f;
                float num = cdata.charts[i].data[selectedFrame];
                if (num != -1f)
                {
                    array[i]  = num * cdata.scale[i] * r.height;
                    array2[i] = Chart.GetLabelHeight(cdata.selectedLabels[i]);
                }
            }
            Chart.CorrectLabelPositions(array, array2, r.height);
            float num2 = r.width / (float)numberOfFrames;
            float num3 = r.x + num2 * (float)selectedFrame;

            for (int j = 0; j < cdata.charts.Length; j++)
            {
                if (array2[j] > 0f)
                {
                    Color color = cdata.charts[j].color;
                    GUI.contentColor = (color + Color.white) * 0.5f;
                    float alignment = (float)(((j & 1) != 0) ? 0 : -1);
                    float num4      = ((j & 1) != 0) ? (num2 + 1f) : -1f;
                    Chart.DoLabel(num3 + num4, r.y + r.height - array[j] - 8f, cdata.selectedLabels[j], alignment);
                }
            }
            GUI.contentColor = Color.white;
        }
Exemplo n.º 9
0
        private void DrawLabelsLine(int selectedFrame, ChartData cdata, Rect r)
        {
            if (cdata.selectedLabels == null)
            {
                return;
            }
            int numberOfFrames = cdata.NumberOfFrames;

            if (selectedFrame < cdata.firstSelectableFrame || selectedFrame >= cdata.firstFrame + numberOfFrames)
            {
                return;
            }
            selectedFrame -= cdata.firstFrame;
            float[] ypositions = new float[cdata.charts.Length];
            float[] heights    = new float[ypositions.Length];
            for (int index = 0; index < cdata.charts.Length; ++index)
            {
                ypositions[index] = -1f;
                heights[index]    = 0.0f;
                float num = cdata.charts[index].data[selectedFrame];
                if ((double)num != -1.0)
                {
                    ypositions[index] = num * cdata.scale[index] * r.height;
                    heights[index]    = Chart.GetLabelHeight(cdata.selectedLabels[index]);
                }
            }
            Chart.CorrectLabelPositions(ypositions, heights, r.height);
            float num1 = r.width / (float)numberOfFrames;
            float num2 = r.x + num1 * (float)selectedFrame;

            for (int index = 0; index < cdata.charts.Length; ++index)
            {
                if ((double)heights[index] > 0.0)
                {
                    GUI.contentColor = (cdata.charts[index].color + Color.white) * 0.5f;
                    float alignment = (index & 1) != 0 ? 0.0f : -1f;
                    float num3      = (index & 1) != 0 ? num1 + 1f : -1f;
                    Chart.DoLabel(num2 + num3, (float)((double)r.y + (double)r.height - (double)ypositions[index] - 8.0), cdata.selectedLabels[index], alignment);
                }
            }
            GUI.contentColor = Color.white;
        }
Exemplo n.º 10
0
        private void DrawGrid(Rect r, int threadCount, float frameTime)
        {
            float num = 16.66667f;

            HandleUtility.ApplyWireMaterial();
            GL.Begin(1);
            GL.Color(new Color(1f, 1f, 1f, 0.2f));
            float time1 = num;

            while ((double)time1 <= (double)frameTime)
            {
                float pixel = this.m_TimeArea.TimeToPixel(time1, r);
                GL.Vertex3(pixel, r.y, 0.0f);
                GL.Vertex3(pixel, r.y + r.height, 0.0f);
                time1 += num;
            }
            GL.Color(new Color(1f, 1f, 1f, 0.8f));
            float pixel1 = this.m_TimeArea.TimeToPixel(0.0f, r);

            GL.Vertex3(pixel1, r.y, 0.0f);
            GL.Vertex3(pixel1, r.y + r.height, 0.0f);
            float pixel2 = this.m_TimeArea.TimeToPixel(frameTime, r);

            GL.Vertex3(pixel2, r.y, 0.0f);
            GL.Vertex3(pixel2, r.y + r.height, 0.0f);
            GL.End();
            GUI.color = new Color(1f, 1f, 1f, 0.4f);
            float time2 = 0.0f;

            while ((double)time2 <= (double)frameTime)
            {
                Chart.DoLabel(this.m_TimeArea.TimeToPixel(time2, r) + 2f, r.yMax - 12f, string.Format("{0:f1}ms", (object)time2), 0.0f);
                time2 += num;
            }
            GUI.color = new Color(1f, 1f, 1f, 1f);
            float time3 = frameTime;

            Chart.DoLabel(this.m_TimeArea.TimeToPixel(time3, r) + 2f, r.yMax - 12f, string.Format("{0:f1}ms ({1:f0}FPS)", (object)time3, (object)(float)(1000.0 / (double)time3)), 0.0f);
        }
Exemplo n.º 11
0
        void DrawRangeSelectionOverlay(Rect rect)
        {
            if (!m_RangeSelection.active)
            {
                return;
            }

            var startPixel = m_TimeArea.TimeToPixel(m_RangeSelection.startTime, rect);
            var endPixel   = m_TimeArea.TimeToPixel(m_RangeSelection.endTime, rect);

            if (startPixel > rect.xMax || endPixel < rect.xMin)
            {
                return;
            }

            var selectionRect = Rect.MinMaxRect(Mathf.Max(rect.xMin, startPixel), rect.yMin, Mathf.Min(rect.xMax, endPixel), rect.yMax);

            EditorGUI.DrawRect(selectionRect, styles.rangeSelectionColor);

            // Duration label
            var labelText = string.Format(k_TickFormatMilliseconds, m_RangeSelection.duration.ToString("N3"));

            Chart.DoLabel(startPixel + (endPixel - startPixel) / 2, rect.yMin + 3, labelText, -0.5f);
        }