summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2014-02-19 15:57:49 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2014-02-20 13:27:42 +0900
commit538d078cf007bd62f6a20ad3f8b0cacc11720e54 (patch)
tree4d0d0c303714f8307928eb07924a5b3f105464cc /src
parent8a694314a46982846666d949e437f0cbe2fbb396 (diff)
Evas filters: Fix curve filter with RGBA
The curve filter did not respect premultiplied values in RGBA images. Unfortunately, the fastest solution is to unpremul and re-premul everytime...
Diffstat (limited to 'src')
-rw-r--r--src/lib/evas/filters/evas_filter_curve.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/src/lib/evas/filters/evas_filter_curve.c b/src/lib/evas/filters/evas_filter_curve.c
index a88dbc8e84..179dbce379 100644
--- a/src/lib/evas/filters/evas_filter_curve.c
+++ b/src/lib/evas/filters/evas_filter_curve.c
@@ -41,12 +41,17 @@ _filter_curve_cpu_rgba(Evas_Filter_Command *cmd)
41 return EINA_FALSE; 41 return EINA_FALSE;
42 } 42 }
43 43
44 if (src != dst)
45 memcpy(dst, src, len * sizeof(DATA32));
46 evas_data_argb_unpremul(dst, len);
47
44 // One channel (R, G or B) 48 // One channel (R, G or B)
45 if (offset >= 0) 49 if (offset >= 0)
46 { 50 {
47 for (k = len; k; k--, dst++, src++) 51 for (k = len, s = src, d = dst; k; k--, d++, s++)
48 C_VAL(dst) = curve[C_VAL(src)]; 52 C_VAL(d) = curve[C_VAL(s)];
49 return EINA_TRUE; 53
54 goto premul;
50 } 55 }
51 56
52 // All RGB channels 57 // All RGB channels
@@ -61,7 +66,8 @@ _filter_curve_cpu_rgba(Evas_Filter_Command *cmd)
61 for (k = len, s = src, d = dst; k; k--, d++, s++) 66 for (k = len, s = src, d = dst; k; k--, d++, s++)
62 C_VAL(d) = curve[C_VAL(s)]; 67 C_VAL(d) = curve[C_VAL(s)];
63 } 68 }
64 return EINA_TRUE; 69
70 goto premul;
65 } 71 }
66 72
67 // Alpha 73 // Alpha
@@ -71,13 +77,11 @@ _filter_curve_cpu_rgba(Evas_Filter_Command *cmd)
71 offset = 0; 77 offset = 0;
72#endif 78#endif
73 79
74 if (src != dst)
75 memcpy(dst, src, len * sizeof(DATA32));
76 evas_data_argb_unpremul(dst, len);
77 for (k = len, d = dst; k; k--, d++, src++) 80 for (k = len, d = dst; k; k--, d++, src++)
78 C_VAL(d) = curve[C_VAL(src)]; 81 C_VAL(d) = curve[C_VAL(src)];
79 evas_data_argb_premul(dst, len);
80 82
83premul:
84 evas_data_argb_premul(dst, len);
81 return EINA_TRUE; 85 return EINA_TRUE;
82} 86}
83 87