[gegl] boxfilter: bail early if all pixels contributing are transparent
- From: Øyvind Kolås <ok src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gegl] boxfilter: bail early if all pixels contributing are transparent
- Date: Thu, 15 Oct 2015 15:23:29 +0000 (UTC)
commit b0bf192509a818fa67e44e013ccbf49f8c4ed9d0
Author: Øyvind Kolås <pippin gimp org>
Date: Thu Oct 15 17:19:17 2015 +0200
boxfilter: bail early if all pixels contributing are transparent
gegl/gegl-algorithms-boxfilter.inc | 15 ++++++++++++++-
1 files changed, 14 insertions(+), 1 deletions(-)
---
diff --git a/gegl/gegl-algorithms-boxfilter.inc b/gegl/gegl-algorithms-boxfilter.inc
index 6522635..4c79ee1 100644
--- a/gegl/gegl-algorithms-boxfilter.inc
+++ b/gegl/gegl-algorithms-boxfilter.inc
@@ -59,6 +59,19 @@ BOXFILTER_FUNCNAME (guchar *dest_buf,
src[0] -= 4;
src[3] -= 4;
src[6] -= 4;
+
+ if (src[0][3] == 0 && /* XXX: it would be even better to not call this at all for the abyss...
*/
+ src[1][3] == 0 &&
+ src[2][3] == 0 &&
+ src[3][3] == 0 &&
+ src[4][3] == 0 &&
+ src[5][3] == 0 &&
+ src[6][3] == 0 &&
+ src[7][3] == 0)
+ {
+ dst[0] = dst[1] = dst[2] = dst[3] = 0;
+ }
+ else
{
const gfloat lt = left_weight[x] * top_weight;
const gfloat lm = left_weight[x] * middle_weight;
@@ -69,6 +82,7 @@ BOXFILTER_FUNCNAME (guchar *dest_buf,
const gfloat rt = right_weight[x] * top_weight;
const gfloat rm = right_weight[x] * middle_weight;
const gfloat rb = right_weight[x] * bottom_weight;
+
dst[0] = BOXFILTER_ROUND(
src[0][0] * lt + src[3][0] * lm + src[6][0] * lb +
src[1][0] * ct + src[4][0] * cm + src[7][0] * cb +
@@ -225,6 +239,5 @@ BOXFILTER_FUNCNAME (guchar *dest_buf,
}
break;
}
-
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]