[Bf-blender-cvs] [fd47202] master: GPencil: Picky whitespace cleanup
julianeisel
noreply at git.blender.org
Fri Dec 26 20:01:42 CET 2014
Commit: fd4720204399e16032574159699d5a26a250e6d5
Author: julianeisel
Date: Fri Dec 26 20:00:52 2014 +0100
Branches: master
https://developer.blender.org/rBfd4720204399e16032574159699d5a26a250e6d5
GPencil: Picky whitespace cleanup
===================================================================
M source/blender/editors/gpencil/drawgpencil.c
M source/blender/editors/gpencil/editaction_gpencil.c
M source/blender/editors/gpencil/gpencil_edit.c
M source/blender/editors/gpencil/gpencil_intern.h
M source/blender/editors/gpencil/gpencil_ops.c
M source/blender/editors/gpencil/gpencil_paint.c
M source/blender/editors/gpencil/gpencil_undo.c
===================================================================
diff --git a/source/blender/editors/gpencil/drawgpencil.c b/source/blender/editors/gpencil/drawgpencil.c
index 4af41a5..174e7b6 100644
--- a/source/blender/editors/gpencil/drawgpencil.c
+++ b/source/blender/editors/gpencil/drawgpencil.c
@@ -27,6 +27,7 @@
* \ingroup edgpencil
*/
+
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
@@ -92,15 +93,15 @@ static void gp_draw_stroke_buffer(tGPspoint *points, int totpoints, short thickn
{
tGPspoint *pt;
int i;
-
+
/* error checking */
if ((points == NULL) || (totpoints <= 0))
return;
-
+
/* check if buffer can be drawn */
if (dflag & (GP_DRAWDATA_ONLY3D | GP_DRAWDATA_ONLYV2D))
return;
-
+
/* if drawing a single point, draw it larger */
if (totpoints == 1) {
/* draw point */
@@ -113,7 +114,7 @@ static void gp_draw_stroke_buffer(tGPspoint *points, int totpoints, short thickn
}
else {
float oldpressure = points[0].pressure;
-
+
/* draw stroke curve */
if (G.debug & G_DEBUG) setlinestyle(2);
@@ -128,13 +129,13 @@ static void gp_draw_stroke_buffer(tGPspoint *points, int totpoints, short thickn
glEnd();
glLineWidth(pt->pressure * thickness);
glBegin(GL_LINE_STRIP);
-
+
/* need to roll-back one point to ensure that there are no gaps in the stroke */
if (i != 0) glVertex2iv(&(pt - 1)->x);
/* now the point we want... */
glVertex2iv(&pt->x);
-
+
oldpressure = pt->pressure;
}
else
@@ -144,7 +145,7 @@ static void gp_draw_stroke_buffer(tGPspoint *points, int totpoints, short thickn
/* reset for predictable OpenGL context */
glLineWidth(1.0f);
-
+
if (G.debug & G_DEBUG) setlinestyle(0);
}
}
@@ -161,14 +162,14 @@ static void gp_calc_2d_stroke_xy(bGPDspoint *pt, short sflag, int offsx, int off
else if (sflag & GP_STROKE_2DIMAGE) {
const float x = (float)((pt->x * winx) + offsx);
const float y = (float)((pt->y * winy) + offsy);
-
+
r_co[0] = x;
r_co[1] = y;
}
else {
const float x = (float)(pt->x / 100 * winx) + offsx;
const float y = (float)(pt->y / 100 * winy) + offsy;
-
+
r_co[0] = x;
r_co[1] = y;
}
@@ -184,39 +185,39 @@ static void gp_draw_stroke_volumetric_buffer(tGPspoint *points, int totpoints, s
{
GLUquadricObj *qobj = gluNewQuadric();
float modelview[4][4];
-
+
tGPspoint *pt;
int i;
-
+
/* error checking */
if ((points == NULL) || (totpoints <= 0))
return;
-
+
/* check if buffer can be drawn */
if (dflag & (GP_DRAWDATA_ONLY3D | GP_DRAWDATA_ONLYV2D))
return;
-
+
/* get basic matrix - should be camera space (i.e "identity") */
glGetFloatv(GL_MODELVIEW_MATRIX, (float *)modelview);
-
+
/* draw points */
glPushMatrix();
-
+
for (i = 0, pt = points; i < totpoints; i++, pt++) {
/* set the transformed position */
// TODO: scale should change based on zoom level, which requires proper translation mult too!
modelview[3][0] = pt->x;
modelview[3][1] = pt->y;
-
+
glLoadMatrixf((float *)modelview);
-
+
/* draw the disk using the current state... */
gluDisk(qobj, 0.0, pt->pressure * thickness, 32, 1);
-
-
+
+
modelview[3][0] = modelview[3][1] = 0.0f;
}
-
+
glPopMatrix();
gluDeleteQuadric(qobj);
}
@@ -230,10 +231,10 @@ static void gp_draw_stroke_volumetric_2d(bGPDspoint *points, int totpoints, shor
float modelview[4][4];
float baseloc[3];
float scalefac = 1.0f;
-
+
bGPDspoint *pt;
int i;
-
+
/* HACK: We need a scale factor for the drawing in the image editor,
* which seems to use 1 unit as it's maximum size, whereas everything
@@ -242,30 +243,30 @@ static void gp_draw_stroke_volumetric_2d(bGPDspoint *points, int totpoints, shor
if ((dflag & GP_DRAWDATA_IEDITHACK) && (dflag & GP_DRAWDATA_ONLYV2D)) {
scalefac = 0.001f;
}
-
+
/* get basic matrix */
glGetFloatv(GL_MODELVIEW_MATRIX, (float *)modelview);
copy_v3_v3(baseloc, modelview[3]);
-
+
/* draw points */
glPushMatrix();
-
+
for (i = 0, pt = points; i < totpoints; i++, pt++) {
/* set the transformed position */
float co[2];
-
+
gp_calc_2d_stroke_xy(pt, sflag, offsx, offsy, winx, winy, co);
translate_m4(modelview, co[0], co[1], 0.0f);
-
+
glLoadMatrixf((float *)modelview);
-
+
/* draw the disk using the current state... */
gluDisk(qobj, 0.0, pt->pressure * thickness * scalefac, 32, 1);
-
+
/* restore matrix */
copy_v3_v3(modelview[3], baseloc);
}
-
+
glPopMatrix();
gluDeleteQuadric(qobj);
}
@@ -275,48 +276,48 @@ static void gp_draw_stroke_volumetric_3d(bGPDspoint *points, int totpoints, shor
short UNUSED(dflag), short UNUSED(sflag))
{
GLUquadricObj *qobj = gluNewQuadric();
-
+
float base_modelview[4][4], modelview[4][4];
float base_loc[3];
-
+
bGPDspoint *pt;
int i;
-
+
/* Get the basic modelview matrix we use for performing calculations */
glGetFloatv(GL_MODELVIEW_MATRIX, (float *)base_modelview);
copy_v3_v3(base_loc, base_modelview[3]);
-
+
/* Create the basic view-aligned billboard matrix we're going to actually draw qobj with:
- * - We need to knock out the rotation so that we are
+ * - We need to knock out the rotation so that we are
* simply left with a camera-facing billboard
* - The scale factors here are chosen so that the thickness
* is relatively reasonable. Otherwise, it gets far too
* large!
*/
scale_m4_fl(modelview, 0.1f);
-
+
/* draw each point as a disk... */
glPushMatrix();
-
+
for (i = 0, pt = points; i < totpoints && pt; i++, pt++) {
/* apply translation to base_modelview, so that the translated point is put in the right place */
translate_m4(base_modelview, pt->x, pt->y, pt->z);
-
+
/* copy the translation component to the billboard matrix we're going to use,
* then reset the base matrix to the original values so that we can do the same
* for the next point without accumulation/pollution effects
*/
copy_v3_v3(modelview[3], base_modelview[3]); /* copy offset value */
copy_v3_v3(base_modelview[3], base_loc); /* restore */
-
+
/* apply our billboard matrix for drawing... */
glLoadMatrixf((float *)modelview);
-
+
/* draw the disk using the current state... */
gluDisk(qobj, 0.0, pt->pressure * thickness, 32, 1);
}
-
+
glPopMatrix();
gluDeleteQuadric(qobj);
}
@@ -331,28 +332,28 @@ static void gp_draw_stroke_fill(bGPDspoint *points, int totpoints, short UNUSED(
{
bGPDspoint *pt;
int i;
-
+
BLI_assert(totpoints >= 3);
-
- /* As an initial implementation, we use the OpenGL filled polygon drawing
+
+ /* As an initial implementation, we use the OpenGL filled polygon drawing
* here since it's the easiest option to implement for this case. It does
* come with limitations (notably for concave shapes), though it shouldn't
* be much of an issue in most cases.
*/
glBegin(GL_POLYGON);
-
+
for (i = 0, pt = points; i < totpoints; i++, pt++) {
if (sflag & GP_STROKE_3DSPACE) {
glVertex3fv(&pt->x);
}
else {
float co[2];
-
+
gp_calc_2d_stroke_xy(pt, sflag, offsx, offsy, winx, winy, co);
glVertex2fv(co);
}
}
-
+
glEnd();
}
@@ -370,10 +371,10 @@ static void gp_draw_stroke_point(bGPDspoint *points, short thickness, short dfla
}
else {
float co[2];
-
+
/* get coordinates of point */
gp_calc_2d_stroke_xy(points, sflag, offsx, offsy, winx, winy, co);
-
+
/* if thickness is less than GP_DRAWTHICKNESS_SPECIAL, simple dot looks ok
* - also mandatory in if Image Editor 'image-based' dot
*/
@@ -386,15 +387,15 @@ static void gp_draw_stroke_point(bGPDspoint *points, short thickness, short dfla
}
else {
/* draw filled circle as is done in circf (but without the matrix push/pops which screwed things up) */
- GLUquadricObj *qobj = gluNewQuadric();
-
- gluQuadricDrawStyle(qobj, GLU_FILL);
-
+ GLUquadricObj *qobj = gluNewQuadric();
+
+ gluQuadricDrawStyle(qobj, GLU_FILL);
+
/* need to translate drawing position, but must reset after too! */
glTranslatef(co[0], co[1], 0.0);
- gluDisk(qobj, 0.0, thickness, 32, 1);
+ gluDisk(qobj, 0.0, thickness, 32, 1);
glTranslatef(-co[0], -co[1], 0.0);
-
+
gluDeleteQuadric(qobj);
}
}
@@ -406,7 +407,7 @@ static void gp_draw_stroke_3d(bGPDspoint *points, int totpoints, short thickness
bGPDspoint *pt;
float curpressure = points[0].pressure;
int i;
-
+
/* draw stroke curve */
glLineWidth(curpressure * thickness);
glBegin(GL_LINE_STRIP);
@@ -420,10 +421,10 @@ static void gp_draw_stroke_3d(bGPDspoint *points, int totpoints, short thickness
curpressure = pt->pressure;
glLineWidth(curpressure * thickness);
glBegin(GL_LINE_STRIP);
-
+
/* need to roll-back one point to ensure that there are no gaps in the stroke */
if (i != 0) glVertex3fv(&(pt - 1)->x);
-
+
/* now the point we want... */
glVertex3fv(&pt->x);
}
@@ -432,7 +433,7 @@ static void gp_draw_stroke_3d(bGPDspoint *points, int totpoints, short thickness
}
}
glEnd();
-
+
/* draw debug points of curve on top? */
/* XXX: for now, we represent "selected" strokes in the same way as debug, which isn't used anymore */
if (debug) {
@@ -451,14 +452,13 @@ static void gp_draw_stroke_2d(bGPDspoint *points, int totpoints, short thickness
{
/* otherwise thickness is twice that of the 3D view */
float thickness = (float)thickness_s * 0.5f;
-
+
/* strokes in Image Editor need a scale factor, since units there are not pixels! */
float scalefac = 1.0f;
if ((dflag & GP_DRAWDATA_IEDITHACK) && (dflag & GP_DRAWDATA_ONLYV2D)) {
scalefac = 0.001f;
}
-
-
+
/* tessellation code - draw stroke as series of connected quads with connection
* edges rotated to minimize shrinking artifacts, and rounded endcaps
*/
@@ -466,58 +466,58 @@ static void gp_draw_stroke_2d(bGPDspoint *points, int totpoints, short thickness
bGPDspoint *pt1, *pt2;
float pm[2];
int i;
-
+
glShadeModel(GL_FLAT);
glBegin(GL_QUADS);
-
+
for (i = 0, pt1 = points, pt2 = points + 1; i < (totpoints - 1); i++, pt1++, pt2++) {
float s0[2], s1[2]; /* segment 'center' points */
float t0[2], t1[2]; /* tessellated coordinates *
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list