[gimp] app: Improve math of unaccelerated OperationNormalMode
- From: Daniel Sabo <daniels src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: Improve math of unaccelerated OperationNormalMode
- Date: Tue, 8 Mar 2016 00:28:20 +0000 (UTC)
commit 39a417d4762924f036b9be8e16d792e90f75b4e8
Author: Daniel Sabo <DanielSabo gmail com>
Date: Mon Jan 11 01:59:12 2016 -0800
app: Improve math of unaccelerated OperationNormalMode
Hopefully no one is stuck on a CPU old enough to need this, but if
they are the ratio based math is noticeably faster.
app/operations/gimpoperationnormalmode.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/app/operations/gimpoperationnormalmode.c b/app/operations/gimpoperationnormalmode.c
index baf3b0b..fa44cc3 100644
--- a/app/operations/gimpoperationnormalmode.c
+++ b/app/operations/gimpoperationnormalmode.c
@@ -202,13 +202,13 @@ gimp_operation_normal_mode_process_pixels_core (gfloat *in,
if (out[ALPHA])
{
- gfloat in_weight = in[ALPHA] * (1.0f - aux_alpha);
- gfloat recip_out_alpha = 1.0f / out[ALPHA];
+ gfloat aux_weight = aux_alpha / out[ALPHA];
+ gfloat in_weight = 1.0f - aux_weight;
gint b;
for (b = RED; b < ALPHA; b++)
{
- out[b] = (aux[b] * aux_alpha + in[b] * in_weight) * recip_out_alpha;
+ out[b] = aux[b] * aux_weight + in[b] * in_weight;
}
}
else
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]