[Bf-blender-cvs] [002b2066ac3] blender2.8: Remove cpack

Campbell Barton noreply at git.blender.org
Thu May 4 12:58:22 CEST 2017


Commit: 002b2066ac312d34f2d5e3a8031db140c3008f0a
Author: Campbell Barton
Date:   Thu May 4 20:50:03 2017 +1000
Branches: blender2.8
https://developer.blender.org/rB002b2066ac312d34f2d5e3a8031db140c3008f0a

Remove cpack

Places where it's removed are already replaced by newer logic.

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

M	source/blender/blenlib/intern/math_color.c
M	source/blender/editors/include/BIF_gl.h
M	source/blender/editors/screen/glutil.c
M	source/blender/editors/space_view3d/drawobject.c
M	source/blender/gpu/intern/gpu_immediate_util.c
M	source/blender/windowmanager/intern/wm_playanim.c

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

diff --git a/source/blender/blenlib/intern/math_color.c b/source/blender/blenlib/intern/math_color.c
index 6d7d24c79c3..cb39134af45 100644
--- a/source/blender/blenlib/intern/math_color.c
+++ b/source/blender/blenlib/intern/math_color.c
@@ -359,8 +359,10 @@ void xyz_to_rgb(float xc, float yc, float zc, float *r, float *g, float *b, int
 	}
 }
 
-/* we define a 'cpack' here as a (3 byte color code) number that can be expressed like 0xFFAA66 or so.
- * for that reason it is sensitive for endianness... with this function it works correctly
+/**
+ * We define a 'cpack' here as a (3 byte color code) number that can be expressed like 0xFFAA66 or so.
+ * for that reason it is sensitive for endianness... with this function it works correctly.
+ * \see #imm_cpack
  */
 
 unsigned int hsv_to_cpack(float h, float s, float v)
diff --git a/source/blender/editors/include/BIF_gl.h b/source/blender/editors/include/BIF_gl.h
index 3db9cc8c953..f91e7d42bca 100644
--- a/source/blender/editors/include/BIF_gl.h
+++ b/source/blender/editors/include/BIF_gl.h
@@ -36,18 +36,6 @@
 #include "GPU_glew.h"
 #include "BLI_utildefines.h"
 
-/*
- * these should be phased out. cpack should be replaced in
- * code with calls to glColor3ub. - zr
- */
-/* 
- *
- * This define converts a numerical value to the equivalent 24-bit
- * color, while not being endian-sensitive. On little-endians, this
- * is the same as doing a 'naive' indexing, on big-endian, it is not!
- * */
-void cpack(unsigned int x);
-
 /* hacking pointsize and linewidth */
 #if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L)
 #  define glPointSize(f)  glPointSize(U.pixelsize * _Generic((f), double: (float)(f), default: (f)))
diff --git a/source/blender/editors/screen/glutil.c b/source/blender/editors/screen/glutil.c
index 43f77a7d5b5..8bf269f74fa 100644
--- a/source/blender/editors/screen/glutil.c
+++ b/source/blender/editors/screen/glutil.c
@@ -677,14 +677,6 @@ void glaDrawImBuf_glsl_ctx(const bContext *C, ImBuf *ibuf, float x, float y, int
 	glaDrawImBuf_glsl_ctx_clipping(C, ibuf, x, y, zoomfilter, 0.0f, 0.0f, 0.0f, 0.0f, zoom_x, zoom_y);
 }
 
-void cpack(unsigned int x)
-{
-	/* DEPRECATED: use imm_cpack */
-	glColor3ub(( (x)        & 0xFF),
-	           (((x) >>  8) & 0xFF),
-	           (((x) >> 16) & 0xFF));
-}
-
 /* don't move to GPU_immediate_util.h because this uses user-prefs
  * and isn't very low level */
 void immDrawBorderCorners(unsigned int pos, const rcti *border, float zoomx, float zoomy)
diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c
index d5363540dcf..254a48fccbb 100644
--- a/source/blender/editors/space_view3d/drawobject.c
+++ b/source/blender/editors/space_view3d/drawobject.c
@@ -7441,7 +7441,7 @@ static void draw_editfont(Scene *scene, SceneLayer *sl, View3D *v3d, RegionView3
 	draw_editfont_textcurs(rv3d, ef->textcurs);
 
 	if (cu->flag & CU_FAST) {
-		cpack(0xFFFFFF);
+		imm_cpack(0xFFFFFF);
 		set_inverted_drawing(1);
 		drawDispList(scene, sl, v3d, rv3d, base, OB_WIRE, dflag, ob_wire_col);
 		set_inverted_drawing(0);
@@ -8524,7 +8524,6 @@ void draw_object(Scene *scene, SceneLayer *sl, ARegion *ar, View3D *v3d, Base *b
 	Object *ob = base->object;
 	Curve *cu;
 	RegionView3D *rv3d = ar->regiondata;
-	unsigned int col = 0;
 	unsigned char _ob_wire_col[4];            /* dont initialize this */
 	const unsigned char *ob_wire_col = NULL;  /* dont initialize this, use NULL crashes as a way to find invalid use */
 	bool zbufoff = false, is_paint = false, empty_object = false;
@@ -8890,12 +8889,6 @@ afterdraw:
 	{
 		ParticleSystem *psys;
 
-		if ((dflag & DRAW_CONSTCOLOR) == 0) {
-			/* for visibility, also while wpaint */
-			if (col || (base->flag & BASE_SELECTED)) {
-				cpack(0xFFFFFF);
-			}
-		}
 		//glDepthMask(GL_FALSE);
 
 		gpuLoadMatrix(rv3d->viewmat);
@@ -8918,7 +8911,6 @@ afterdraw:
 		gpuMultMatrix(ob->obmat);
 		
 		//glDepthMask(GL_TRUE);
-		if (col) cpack(col);
 	}
 
 	/* draw edit particles last so that they can draw over child particles */
@@ -9474,8 +9466,6 @@ static void bbs_mesh_solid__drawCenter(void *userData, int index, const float ce
 static void bbs_mesh_solid_EM(BMEditMesh *em, Scene *scene, View3D *v3d,
                               Object *ob, DerivedMesh *dm, bool use_faceselect)
 {
-	cpack(0);
-
 	if (use_faceselect) {
 		dm->drawMappedFaces(dm, bbs_mesh_solid__setSolidDrawOptions, NULL, NULL, em->bm, DM_DRAW_SKIP_HIDDEN | DM_DRAW_SELECT_USE_EDITMODE);
 
diff --git a/source/blender/gpu/intern/gpu_immediate_util.c b/source/blender/gpu/intern/gpu_immediate_util.c
index 152f1f3dd98..40da4cf091b 100644
--- a/source/blender/gpu/intern/gpu_immediate_util.c
+++ b/source/blender/gpu/intern/gpu_immediate_util.c
@@ -34,12 +34,16 @@
 #include "GPU_matrix.h"
 
 /**
-* Pack color into 3 bytes
-*
-* \Note BGR format (i.e. 0xBBGGRR)...
-*
-* \param x color.
-*/
+ * Pack color into 3 bytes
+ *
+ * This define converts a numerical value to the equivalent 24-bit
+ * color, while not being endian-sensitive. On little-endians, this
+ * is the same as doing a 'naive' indexing, on big-endian, it is not!
+ *
+ * \note BGR format (i.e. 0xBBGGRR)...
+ *
+ * \param x color.
+ */
 void imm_cpack(unsigned int x)
 {
 	immUniformColor3ub(((x) & 0xFF),
diff --git a/source/blender/windowmanager/intern/wm_playanim.c b/source/blender/windowmanager/intern/wm_playanim.c
index 373e0bf10ad..434c6414c01 100644
--- a/source/blender/windowmanager/intern/wm_playanim.c
+++ b/source/blender/windowmanager/intern/wm_playanim.c
@@ -342,7 +342,6 @@ static void playanim_toscreen(PlayState *ps, PlayAnimPict *picture, struct ImBuf
 		int sizex, sizey;
 		float fsizex_inv, fsizey_inv;
 		char str[32 + FILE_MAX];
-		cpack(-1);
 		BLI_snprintf(str, sizeof(str), "%s | %.2f frames/s", picture->name, fstep / swaptime);
 
 		playanim_window_get_size(&sizex, &sizey);




More information about the Bf-blender-cvs mailing list