summaryrefslogtreecommitdiff
path: root/cogl/cogl-spans.c
diff options
context:
space:
mode:
authorRobert Bragg <robert@linux.intel.com>2011-10-23 20:23:15 +0100
committerRobert Bragg <robert@linux.intel.com>2011-11-01 12:03:03 +0000
commit98dc73a8f79df3aa9612c1fbd7762e45f225e872 (patch)
treeab5319b221f880d1e1915df28db47988a93e8a2e /cogl/cogl-spans.c
parent18fb1ffab5880b8b35cbf9a6421d6b8c29010338 (diff)
downloadcogl-98dc73a8f79df3aa9612c1fbd7762e45f225e872.tar.gz
spans: avoid normalize with normalize_factor of 1
if a normalize factor of 1 is passed then we don't need to normalize the starting point to find the closest point equivalent to 0. Reviewed-by: Neil Roberts <neil@linux.intel.com>
Diffstat (limited to 'cogl/cogl-spans.c')
-rw-r--r--cogl/cogl-spans.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/cogl/cogl-spans.c b/cogl/cogl-spans.c
index 618440b5..c7481760 100644
--- a/cogl/cogl-spans.c
+++ b/cogl/cogl-spans.c
@@ -74,8 +74,6 @@ _cogl_span_iter_begin (CoglSpanIter *iter,
float cover_end,
CoglPipelineWrapMode wrap_mode)
{
- float cover_start_normalized;
-
/* XXX: If CLAMP_TO_EDGE needs to be emulated then it needs to be
* done at a higher level than here... */
_COGL_RETURN_IF_FAIL (wrap_mode == COGL_PIPELINE_WRAP_MODE_REPEAT ||
@@ -105,8 +103,13 @@ _cogl_span_iter_begin (CoglSpanIter *iter,
* iteration of any range so we need to relate the start of the range to the
* nearest point equivalent to 0.
*/
- cover_start_normalized = cover_start / normalize_factor;
- iter->origin = floorf (cover_start_normalized) * normalize_factor;
+ if (normalize_factor != 1.0)
+ {
+ float cover_start_normalized = cover_start / normalize_factor;
+ iter->origin = floorf (cover_start_normalized) * normalize_factor;
+ }
+ else
+ iter->origin = floorf (cover_start);
iter->wrap_mode = wrap_mode;