summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorHermet Park <hermetpark@gmail.com>2019-03-04 20:35:31 +0900
committerHermet Park <hermetpark@gmail.com>2019-03-04 20:35:31 +0900
commit057db36423a60f56bc911d3000dfba631e64484a (patch)
treea36c5eaba8804d034fbb170efa87d8f2b4ef511f /src
parentedbce35967942c12545c30f211465736c2cc7624 (diff)
evas map: fix wrong range in anti-aliasing processing.
alpha value must be in 0 - 255.
Diffstat (limited to 'src')
-rw-r--r--src/lib/evas/common/evas_map_image_aa.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/lib/evas/common/evas_map_image_aa.c b/src/lib/evas/common/evas_map_image_aa.c
index 4a741ea3ca..6c829eac17 100644
--- a/src/lib/evas/common/evas_map_image_aa.c
+++ b/src/lib/evas/common/evas_map_image_aa.c
@@ -12,14 +12,14 @@ calc_irregular_coverage(Line* spans, int eidx, int y, int diagonal,
12 int edge_dist, Eina_Bool reverse) 12 int edge_dist, Eina_Bool reverse)
13{ 13{
14 if (eidx == 1) reverse = !reverse; 14 if (eidx == 1) reverse = !reverse;
15 int coverage = (256 / (diagonal + 2)); 15 int coverage = (255 / (diagonal + 2));
16 int tmp; 16 int tmp;
17 for (int ry = 0; ry < (diagonal + 2); ry++) 17 for (int ry = 0; ry < (diagonal + 2); ry++)
18 { 18 {
19 tmp = y - ry - edge_dist; 19 tmp = y - ry - edge_dist;
20 if (tmp < 0) return; 20 if (tmp < 0) return;
21 spans[tmp].aa_len[eidx] = 1; 21 spans[tmp].aa_len[eidx] = 1;
22 if (reverse) spans[tmp].aa_cov[eidx] = 256 - (coverage * ry); 22 if (reverse) spans[tmp].aa_cov[eidx] = 255 - (coverage * ry);
23 else spans[tmp].aa_cov[eidx] = (coverage * ry); 23 else spans[tmp].aa_cov[eidx] = (coverage * ry);
24 } 24 }
25} 25}
@@ -28,14 +28,14 @@ static void
28calc_vert_coverage(Line *spans, int eidx, int y, int rewind, Eina_Bool reverse) 28calc_vert_coverage(Line *spans, int eidx, int y, int rewind, Eina_Bool reverse)
29{ 29{
30 if (eidx == 1) reverse = !reverse; 30 if (eidx == 1) reverse = !reverse;
31 int coverage = (256 / (rewind + 1)); 31 int coverage = (255 / (rewind + 1));
32 int tmp; 32 int tmp;
33 for (int ry = 1; ry < (rewind + 1); ry++) 33 for (int ry = 1; ry < (rewind + 1); ry++)
34 { 34 {
35 tmp = y - ry; 35 tmp = y - ry;
36 if (tmp < 0 ) return; 36 if (tmp < 0 ) return;
37 spans[tmp].aa_len[eidx] = 1; 37 spans[tmp].aa_len[eidx] = 1;
38 if (reverse) spans[tmp].aa_cov[eidx] = (256 - (coverage * ry)); 38 if (reverse) spans[tmp].aa_cov[eidx] = (255 - (coverage * ry));
39 else spans[tmp].aa_cov[eidx] = (coverage * ry); 39 else spans[tmp].aa_cov[eidx] = (coverage * ry);
40 } 40 }
41} 41}
@@ -46,7 +46,7 @@ calc_horiz_coverage(Line *spans, int eidx, int y, int x, int x2)
46 if (spans[y].aa_len[eidx] < abs(x - x2)) 46 if (spans[y].aa_len[eidx] < abs(x - x2))
47 { 47 {
48 spans[y].aa_len[eidx] = abs(x - x2); 48 spans[y].aa_len[eidx] = abs(x - x2);
49 spans[y].aa_cov[eidx] = (256 / (spans[y].aa_len[eidx] + 1)); 49 spans[y].aa_cov[eidx] = (255 / (spans[y].aa_len[eidx] + 1));
50 } 50 }
51} 51}
52 52
@@ -61,7 +61,7 @@ _aa_coverage_apply(Line *line, int ww, int w, DATA32 val, Eina_Bool src_alpha)
61 //Right Edge Anti Aliasing 61 //Right Edge Anti Aliasing
62 if (line->aa_len[1] >= ww) 62 if (line->aa_len[1] >= ww)
63 { 63 {
64 return MUL_256(256 - (line->aa_cov[1] * (line->aa_len[1] - ww + 1)), 64 return MUL_256(255 - (line->aa_cov[1] * (line->aa_len[1] - ww + 1)),
65 val); 65 val);
66 } 66 }
67 //Remove Transparency if src image alpha is off. 67 //Remove Transparency if src image alpha is off.