Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Erwin <significant.bit@gmail.com>2016-01-22 10:44:33 +0300
committerMike Erwin <significant.bit@gmail.com>2016-01-22 10:52:12 +0300
commit1d88773b1f2e905773069a2d39617dd350683547 (patch)
treea37e43a0d556da409c034eaeaa4509a5a8e3836f /source/blender/editors/interface/interface_draw.c
parent8c596e08e7b787782c91578ffd46c6ec8e409023 (diff)
OpenGL: cleanup
- LINE_STRIP to LINES when only drawing one - group state changes for easier reading - general cleanup
Diffstat (limited to 'source/blender/editors/interface/interface_draw.c')
-rw-r--r--source/blender/editors/interface/interface_draw.c20
1 files changed, 7 insertions, 13 deletions
diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c
index b70048617c5..f044c70f569 100644
--- a/source/blender/editors/interface/interface_draw.c
+++ b/source/blender/editors/interface/interface_draw.c
@@ -514,30 +514,25 @@ static void histogram_draw_one(
float r, float g, float b, float alpha,
float x, float y, float w, float h, const float *data, int res, const bool is_line)
{
- if (is_line) {
- glLineWidth(1.5);
- glBlendFunc(GL_SRC_ALPHA, GL_ONE);
- glColor4f(r, g, b, alpha);
+ glEnable(GL_LINE_SMOOTH);
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE);
+ glColor4f(r, g, b, alpha);
+ if (is_line) {
/* curve outline */
+ glLineWidth(1.5);
- glBlendFunc(GL_SRC_ALPHA, GL_ONE);
- glEnable(GL_LINE_SMOOTH);
glBegin(GL_LINE_STRIP);
for (int i = 0; i < res; i++) {
float x2 = x + i * (w / (float)res);
glVertex2f(x2, y + (data[i] * h));
}
glEnd();
- glDisable(GL_LINE_SMOOTH);
glLineWidth(1.0);
}
else {
/* under the curve */
- glBlendFunc(GL_SRC_ALPHA, GL_ONE);
- glColor4f(r, g, b, alpha);
-
glShadeModel(GL_FLAT);
glBegin(GL_TRIANGLE_STRIP);
glVertex2f(x, y);
@@ -553,15 +548,15 @@ static void histogram_draw_one(
glColor4f(0.f, 0.f, 0.f, 0.25f);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
- glEnable(GL_LINE_SMOOTH);
glBegin(GL_LINE_STRIP);
for (int i = 0; i < res; i++) {
float x2 = x + i * (w / (float)res);
glVertex2f(x2, y + (data[i] * h));
}
glEnd();
- glDisable(GL_LINE_SMOOTH);
}
+
+ glDisable(GL_LINE_SMOOTH);
}
#define HISTOGRAM_TOT_GRID_LINES 4
@@ -1644,7 +1639,6 @@ void ui_draw_but_NODESOCKET(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol
glEnd();
glDisable(GL_LINE_SMOOTH);
glDisable(GL_BLEND);
- glLineWidth(1.0f);
/* restore scissortest */
glScissor(scissor[0], scissor[1], scissor[2], scissor[3]);