[Bf-blender-cvs] [e25ba16] master: OpenGL: call glLineWidth less often

Mike Erwin noreply at git.blender.org
Sat Jan 23 07:04:35 CET 2016


Commit: e25ba162c0b62b19cf367f0f29e29d0c0960978d
Author: Mike Erwin
Date:   Sat Jan 23 00:58:32 2016 -0500
Branches: master
https://developer.blender.org/rBe25ba162c0b62b19cf367f0f29e29d0c0960978d

OpenGL: call glLineWidth less often

Each LINES draw call is now responsible for its own line width. No need
to set it back to its 1.0 default after every draw.

This eliminates half our calls to glLineWidth , similar to last week’s
work on glPointSize.

===================================================================

M	source/blender/blenkernel/intern/DerivedMesh.c
M	source/blender/editors/animation/anim_channels_defines.c
M	source/blender/editors/animation/anim_draw.c
M	source/blender/editors/armature/reeb.c
M	source/blender/editors/gpencil/drawgpencil.c
M	source/blender/editors/interface/interface_draw.c
M	source/blender/editors/interface/interface_icons.c
M	source/blender/editors/interface/interface_panel.c
M	source/blender/editors/mask/mask_draw.c
M	source/blender/editors/mesh/editmesh_knife.c
M	source/blender/editors/screen/screen_edit.c
M	source/blender/editors/sculpt_paint/paint_cursor.c
M	source/blender/editors/sculpt_paint/paint_image.c
M	source/blender/editors/space_clip/clip_draw.c
M	source/blender/editors/space_clip/clip_graph_draw.c
M	source/blender/editors/space_clip/clip_utils.c
M	source/blender/editors/space_graph/graph_draw.c
M	source/blender/editors/space_graph/space_graph.c
M	source/blender/editors/space_node/drawnode.c
M	source/blender/editors/space_node/node_draw.c
M	source/blender/editors/space_view3d/drawarmature.c
M	source/blender/editors/space_view3d/drawobject.c
M	source/blender/editors/space_view3d/view3d_draw.c
M	source/blender/editors/transform/transform.c
M	source/blender/editors/uvedit/uvedit_draw.c

===================================================================

diff --git a/source/blender/blenkernel/intern/DerivedMesh.c b/source/blender/blenkernel/intern/DerivedMesh.c
index 656c403..44765e8 100644
--- a/source/blender/blenkernel/intern/DerivedMesh.c
+++ b/source/blender/blenkernel/intern/DerivedMesh.c
@@ -3697,7 +3697,6 @@ static void navmesh_drawColored(DerivedMesh *dm)
 	//UI_ThemeColor(TH_WIRE);
 	glLineWidth(2.0);
 	dm->drawEdges(dm, 0, 1);
-	glLineWidth(1.0);
 #endif
 
 	/* if (GPU_buffer_legacy(dm) ) */ /* TODO - VBO draw code, not high priority - campbell */
diff --git a/source/blender/editors/animation/anim_channels_defines.c b/source/blender/editors/animation/anim_channels_defines.c
index 6979850..c6a47b9 100644
--- a/source/blender/editors/animation/anim_channels_defines.c
+++ b/source/blender/editors/animation/anim_channels_defines.c
@@ -3716,7 +3716,6 @@ void ANIM_channel_draw(bAnimContext *ac, bAnimListElem *ale, float yminc, float
 			glLineWidth(2.0);
 			fdrawline((float)(offset), yminc,
 			          (float)(v2d->cur.xmax), yminc);
-			glLineWidth(1.0);
 		}
 	}
 
diff --git a/source/blender/editors/animation/anim_draw.c b/source/blender/editors/animation/anim_draw.c
index 76a448a..dbc9c8b 100644
--- a/source/blender/editors/animation/anim_draw.c
+++ b/source/blender/editors/animation/anim_draw.c
@@ -123,9 +123,7 @@ void ANIM_draw_cfra(const bContext *C, View2D *v2d, short flag)
 	glVertex2f(x, v2d->cur.ymin - 500.0f); /* XXX arbitrary... want it go to bottom */
 	glVertex2f(x, v2d->cur.ymax);
 	glEnd();
-	
-	glLineWidth(1.0);
-	
+
 	/* Draw current frame number in a little box */
 	if (flag & DRAWCFRA_SHOW_NUMBOX) {
 		UI_view2d_view_orthoSpecial(CTX_wm_region(C), v2d, 1);
diff --git a/source/blender/editors/armature/reeb.c b/source/blender/editors/armature/reeb.c
index 2d58689..661a8e1 100644
--- a/source/blender/editors/armature/reeb.c
+++ b/source/blender/editors/armature/reeb.c
@@ -3430,8 +3430,6 @@ void REEB_draw()
 		}
 	}
 	glEnable(GL_DEPTH_TEST);
-	
-	glLineWidth(1.0);
 }
 
 #endif
diff --git a/source/blender/editors/gpencil/drawgpencil.c b/source/blender/editors/gpencil/drawgpencil.c
index d5c7c52..66d8628 100644
--- a/source/blender/editors/gpencil/drawgpencil.c
+++ b/source/blender/editors/gpencil/drawgpencil.c
@@ -145,9 +145,6 @@ static void gp_draw_stroke_buffer(tGPspoint *points, int totpoints, short thickn
 				glVertex2iv(&pt->x);
 		}
 		glEnd();
-		
-		/* reset for predictable OpenGL context */
-		glLineWidth(1.0f);
 
 		if (G.debug & G_DEBUG) setlinestyle(0);
 	}
@@ -1122,7 +1119,6 @@ static void gp_draw_data(bGPdata *gpd, int offsx, int offsy, int winx, int winy,
 	glDisable(GL_LINE_SMOOTH); // smooth lines
 	
 	/* restore initial gl conditions */
-	glLineWidth(1.0);
 	glColor4f(0, 0, 0, 1);
 }
 
diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c
index f044c70..2603902 100644
--- a/source/blender/editors/interface/interface_draw.c
+++ b/source/blender/editors/interface/interface_draw.c
@@ -528,8 +528,6 @@ static void histogram_draw_one(
 			glVertex2f(x2, y + (data[i] * h));
 		}
 		glEnd();
-
-		glLineWidth(1.0);
 	}
 	else {
 		/* under the curve */
@@ -1631,7 +1629,7 @@ void ui_draw_but_NODESOCKET(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol
 	glEnd();
 	
 	glColor4ub(0, 0, 0, 150);
-	
+	glLineWidth(1);
 	glEnable(GL_LINE_SMOOTH);
 	glBegin(GL_LINE_LOOP);
 	for (int a = 0; a < 16; a++)
diff --git a/source/blender/editors/interface/interface_icons.c b/source/blender/editors/interface/interface_icons.c
index 8e6558c..da0e145 100644
--- a/source/blender/editors/interface/interface_icons.c
+++ b/source/blender/editors/interface/interface_icons.c
@@ -274,8 +274,6 @@ static void vicon_x_draw(int x, int y, int w, int h, float alpha)
 	glVertex2i(x + w, y);
 	glVertex2i(x, y + h);
 	glEnd();
-
-	glLineWidth(1.0);
 	
 	glDisable(GL_LINE_SMOOTH);
 }
@@ -443,7 +441,6 @@ static void vicon_move_up_draw(int x, int y, int w, int h, float UNUSED(alpha))
 	glVertex2i(x + w / 2 + d * 2, y + h / 2 + d);
 	glEnd();
 
-	glLineWidth(1.0);
 	glDisable(GL_LINE_SMOOTH);
 }
 
@@ -461,7 +458,6 @@ static void vicon_move_down_draw(int x, int y, int w, int h, float UNUSED(alpha)
 	glVertex2i(x + w / 2 + d * 2, y + h / 2 + d);
 	glEnd();
 
-	glLineWidth(1.0);
 	glDisable(GL_LINE_SMOOTH);
 }
 
diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c
index f5dc85c..f59f11c 100644
--- a/source/blender/editors/interface/interface_panel.c
+++ b/source/blender/editors/interface/interface_panel.c
@@ -452,8 +452,6 @@ static void ui_draw_anti_x(float x1, float y1, float x2, float y2)
 	fdrawline(x1, y1, x2, y2);
 	fdrawline(x1, y2, x2, y1);
 	
-	glLineWidth(1.0);
-	
 	glDisable(GL_LINE_SMOOTH);
 	glDisable(GL_BLEND);
 	
diff --git a/source/blender/editors/mask/mask_draw.c b/source/blender/editors/mask/mask_draw.c
index 74af0aa..9a8382b 100644
--- a/source/blender/editors/mask/mask_draw.c
+++ b/source/blender/editors/mask/mask_draw.c
@@ -197,7 +197,6 @@ static void draw_single_handle(const MaskLayer *mask_layer, const MaskSplinePoin
 		glVertex2fv(point_pos);
 		glVertex2fv(handle_pos);
 		glEnd();
-		glLineWidth(1);
 	}
 
 	switch (handle_type) {
@@ -213,6 +212,7 @@ static void draw_single_handle(const MaskLayer *mask_layer, const MaskSplinePoin
 			break;
 	}
 
+	glLineWidth(1);
 	glBegin(GL_LINES);
 	glVertex2fv(point_pos);
 	glVertex2fv(handle_pos);
diff --git a/source/blender/editors/mesh/editmesh_knife.c b/source/blender/editors/mesh/editmesh_knife.c
index 89d3cf7..b606eb0 100644
--- a/source/blender/editors/mesh/editmesh_knife.c
+++ b/source/blender/editors/mesh/editmesh_knife.c
@@ -1050,8 +1050,6 @@ static void knifetool_draw(const bContext *C, ARegion *UNUSED(ar), void *arg)
 		glVertex3fv(kcd->prev.cage);
 		glVertex3fv(kcd->curr.cage);
 		glEnd();
-
-		glLineWidth(1.0);
 	}
 
 	if (kcd->prev.vert) {
@@ -1080,8 +1078,6 @@ static void knifetool_draw(const bContext *C, ARegion *UNUSED(ar), void *arg)
 		glVertex3fv(kcd->curr.edge->v1->cageco);
 		glVertex3fv(kcd->curr.edge->v2->cageco);
 		glEnd();
-
-		glLineWidth(1.0);
 	}
 	else if (kcd->curr.vert) {
 		glColor3ubv(kcd->colors.point);
@@ -1151,7 +1147,6 @@ static void knifetool_draw(const bContext *C, ARegion *UNUSED(ar), void *arg)
 		}
 
 		glEnd();
-		glLineWidth(1.0);
 	}
 
 	if (kcd->totkvert > 0) {
diff --git a/source/blender/editors/screen/screen_edit.c b/source/blender/editors/screen/screen_edit.c
index 461cdb2..8e969e0 100644
--- a/source/blender/editors/screen/screen_edit.c
+++ b/source/blender/editors/screen/screen_edit.c
@@ -1045,11 +1045,11 @@ static void drawscredge_area(ScrArea *sa, int sizex, int sizey, int center)
 			glColor3ub(0x50, 0x50, 0x50);
 			glLineWidth((2.0f * U.pixelsize) - 1);
 			drawscredge_area_draw(sizex, sizey, x1, y1, x2, y2, 0);
-			glLineWidth(1.0f);
 		}
 	}
 	else {
 		glColor3ub(0, 0, 0);
+		glLineWidth(1);
 		drawscredge_area_draw(sizex, sizey, x1, y1, x2, y2, 0);
 	}
 }
diff --git a/source/blender/editors/sculpt_paint/paint_cursor.c b/source/blender/editors/sculpt_paint/paint_cursor.c
index aad9df1..2f4dc54 100644
--- a/source/blender/editors/sculpt_paint/paint_cursor.c
+++ b/source/blender/editors/sculpt_paint/paint_cursor.c
@@ -932,8 +932,6 @@ static void paint_draw_curve_cursor(Brush *brush)
 		draw_rect_point(&cp->bez.vec[0][0], 8.0, cp->bez.f1 || cp->bez.f2);
 		draw_rect_point(&cp->bez.vec[2][0], 8.0, cp->bez.f3 || cp->bez.f2);
 
-		glLineWidth(1.0);
-
 		glDisable(GL_BLEND);
 		glDisable(GL_LINE_SMOOTH);
 		glDisableClientState(GL_VERTEX_ARRAY);
diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c
index 49e5e26..7f1a421 100644
--- a/source/blender/editors/sculpt_paint/paint_image.c
+++ b/source/blender/editors/sculpt_paint/paint_image.c
@@ -727,7 +727,6 @@ static void gradient_draw_line(bContext *UNUSED(C), int x, int y, void *customda
 		glLineWidth(2.0);
 		glColor4ub(255, 255, 255, 255);
 		sdrawline(x, y, pop->startmouse[0], pop->startmouse[1]);
-		glLineWidth(1.0);
 
 		glDisable(GL_BLEND);
 		glDisable(GL_LINE_SMOOTH);
diff --git a/source/blender/editors/space_clip/clip_draw.c b/source/blender/editors/space_clip/clip_draw.c
index a4dc71d..6542a4d 100644
--- a/source/blender/editors/space_clip/clip_draw.c
+++ b/source/blender/editors/space_clip/clip_draw.c
@@ -439,7 +439,6 @@ static void draw_track_path(SpaceClip *sc, MovieClip *UNUSED(clip), MovieTrackin
 		for (i = a; i < b; i++)
 			glVertex2f(path[i][0], path[i][1]);
 		glEnd();
-		glLineWidth(1.0f);
 	}
 
 	UI_ThemeColor(TH_PATH_BEFORE);
@@ -459,6 +458,8 @@ static void draw_track_path(SpaceClip *sc, MovieClip *UNUSED(clip), MovieTrackin
 
 	UI_ThemeColor(TH_PATH_BEFORE);
 
+	glLineWidth(1);
+
 	glBegin(GL_LINE_STRIP);
 	for (i = a; i < b; i++) {
 		if (i == count + 1)
@@ -515,7 +516,6 @@ static void draw_marker_outline(SpaceClip *sc, MovieTrackingTrack *track, MovieT
 			glVertex2f(pos[0], pos[1] + px[1] * 2);
 			glVertex2f(pos[0], pos[1] + px[1] * 8);
 			glEnd();
-			if (!tiny) glLineWidth(1.0f);
 		}
 	}
 
@@ -543,9 +543,6 @@ static void draw_marker_outline(SpaceClip *sc, MovieTrackingTrack *track, MovieT
 		glEnd();
 	}
 	glPopMatrix();
-
-	if (!tiny)
-		glLineWidth(1.0f);
 }
 
 static void track_colors(MovieTrackingTrack *track, int act, float col[3], float scol[3])
@@ -886,9 +883,6 @@ static void draw_marker_slide_zones(SpaceClip *sc, MovieTrackingTrack *track, Mo
 	}
 
 	glPopMatrix();
-
-	if (outline)
-		glLineWidth(1.0f);
 }
 
 static void draw_marker_texts(SpaceClip *sc, MovieTrackingTrack *track, MovieTrackingMarker *marker,
@@ -1192,9 +1186,6 @@ static void draw_plane_marker_ex(SpaceClip *sc, Scene *scene, MovieTrackingPlane
 
 		if (stipple)
 			glDisable(GL_LINE_STIPPLE);
-		
-		if (thick)
-			glLineWidth(1.0f);
 	}
 
 	/* Draw sliders. */
@@ -1663,8 +1654,6 @@ static void draw_distortion(SpaceClip *sc, ARegion *ar, MovieClip *clip,
 
 			layer = layer->next;
 		}
-
-		glLineWidth(1.0f);
 	}
 
 	glPopMatrix();
diff --git a/source/blender/editors/space_clip/clip_graph_draw.c b/source/blender/editors/space_clip/clip_graph_draw.c
index 2c3b8ac..424d25d 100644
--- a/source/blender/editors/space_clip/clip_graph_draw.c
+++ b/source

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list