[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [47266] branches/soc-2011-tomato/intern/ raskter/raskter.c: minor cleanup
Campbell Barton
ideasman42 at gmail.com
Thu May 31 11:50:50 CEST 2012
Revision: 47266
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=47266
Author: campbellbarton
Date: 2012-05-31 09:50:50 +0000 (Thu, 31 May 2012)
Log Message:
-----------
minor cleanup
Modified Paths:
--------------
branches/soc-2011-tomato/intern/raskter/raskter.c
Modified: branches/soc-2011-tomato/intern/raskter/raskter.c
===================================================================
--- branches/soc-2011-tomato/intern/raskter/raskter.c 2012-05-31 09:46:17 UTC (rev 47265)
+++ branches/soc-2011-tomato/intern/raskter/raskter.c 2012-05-31 09:50:50 UTC (rev 47266)
@@ -388,7 +388,8 @@
return 1;
}
-int PLX_raskterize(float (*base_verts)[2], int num_base_verts, float *buf, int buf_x, int buf_y)
+int PLX_raskterize(float (*base_verts)[2], int num_base_verts,
+ float *buf, int buf_x, int buf_y)
{
int i; /* i: Loop counter. */
struct poly_vert *ply; /* ply: Pointer to a list of integer buffer-space vertex coordinates. */
@@ -718,13 +719,17 @@
}
int PLX_raskterize_feather(float (*base_verts)[2], int num_base_verts, float (*feather_verts)[2], int num_feather_verts,
- float *buf, int buf_x, int buf_y)
+ float *buf, int buf_x, int buf_y)
{
int i; /* i: Loop counter. */
struct poly_vert *ply; /* ply: Pointer to a list of integer buffer-space vertex coordinates. */
struct poly_vert *fe; /* fe: Pointer to a list of integer buffer-space feather vertex coords. */
struct r_fill_context ctx = {0};
+ /* for faster multiply */
+ const float buf_x_f = (float)buf_x;
+ const float buf_y_f = (float)buf_y;
+
/*
* Allocate enough memory for our poly_vert list. It'll be the size of the poly_vert
* data structure multiplied by the number of verts.
@@ -749,12 +754,12 @@
* drawn will be 1.0f in value, there is no anti-aliasing.
*/
for (i = 0; i < num_base_verts; i++) { /* Loop over all verts. */
- ply[i].x = (base_verts[i][0] * buf_x) + 0.5f; /* Range expand normalized X to integer buffer-space X. */
- ply[i].y = (base_verts[i][1] * buf_y) + 0.5f; /* Range expand normalized Y to integer buffer-space Y. */
+ ply[i].x = (int)((base_verts[i][0] * buf_x_f) + 0.5f); /* Range expand normalized X to integer buffer-space X. */
+ ply[i].y = (int)((base_verts[i][1] * buf_y_f) + 0.5f); /* Range expand normalized Y to integer buffer-space Y. */
}
for (i = 0; i < num_feather_verts; i++) { /* Loop over all verts. */
- fe[i].x = (feather_verts[i][0] * buf_x) + 0.5f; /* Range expand normalized X to integer buffer-space X. */
- fe[i].y = (feather_verts[i][1] * buf_y) + 0.5f; /* Range expand normalized Y to integer buffer-space Y. */
+ fe[i].x = (int)((feather_verts[i][0] * buf_x_f) + 0.5f); /* Range expand normalized X to integer buffer-space X. */
+ fe[i].y = (int)((feather_verts[i][1] * buf_y_f) + 0.5f); /* Range expand normalized Y to integer buffer-space Y. */
}
ctx.rb.buf = buf; /* Set the output buffer pointer. */
More information about the Bf-blender-cvs
mailing list