evas map: fix wrong range in anti-aliasing processing. 21/200821/1
authorHermet Park <hermetpark@gmail.com>
Mon, 4 Mar 2019 11:35:31 +0000 (20:35 +0900)
committerHermet Park <hermetpark@gmail.com>
Mon, 4 Mar 2019 12:53:33 +0000 (21:53 +0900)
alpha value must be in 0 - 255.

Change-Id: Id152cdb4cb7b9beec99f949176bd3cb586ab1552

src/lib/evas/common/evas_map_image_aa.c

index 4a741ea..6c829ea 100644 (file)
@@ -12,14 +12,14 @@ calc_irregular_coverage(Line* spans, int eidx, int y, int diagonal,
                        int edge_dist, Eina_Bool reverse)
 {
    if (eidx == 1) reverse = !reverse;
-   int coverage = (256 / (diagonal + 2));
+   int coverage = (255 / (diagonal + 2));
    int tmp;
    for (int ry = 0; ry < (diagonal + 2); ry++)
      {
         tmp = y - ry - edge_dist;
         if (tmp < 0) return;
         spans[tmp].aa_len[eidx] = 1;
-        if (reverse) spans[tmp].aa_cov[eidx] = 256 - (coverage * ry);
+        if (reverse) spans[tmp].aa_cov[eidx] = 255 - (coverage * ry);
         else spans[tmp].aa_cov[eidx] = (coverage * ry);
      }
 }
@@ -28,14 +28,14 @@ static void
 calc_vert_coverage(Line *spans, int eidx, int y, int rewind, Eina_Bool reverse)
 {
    if (eidx == 1) reverse = !reverse;
-   int coverage = (256 / (rewind + 1));
+   int coverage = (255 / (rewind + 1));
    int tmp;
    for (int ry = 1; ry < (rewind + 1); ry++)
      {
         tmp = y - ry;
         if (tmp < 0 ) return;
         spans[tmp].aa_len[eidx] = 1;
-        if (reverse) spans[tmp].aa_cov[eidx] = (256 - (coverage * ry));
+        if (reverse) spans[tmp].aa_cov[eidx] = (255 - (coverage * ry));
         else spans[tmp].aa_cov[eidx] = (coverage * ry);
      }
 }
@@ -46,7 +46,7 @@ calc_horiz_coverage(Line *spans, int eidx, int y, int x, int x2)
    if (spans[y].aa_len[eidx] < abs(x - x2))
      {
         spans[y].aa_len[eidx] = abs(x - x2);
-        spans[y].aa_cov[eidx] = (256 / (spans[y].aa_len[eidx] + 1));
+        spans[y].aa_cov[eidx] = (255 / (spans[y].aa_len[eidx] + 1));
      }
 }
 
@@ -61,7 +61,7 @@ _aa_coverage_apply(Line *line, int ww, int w, DATA32 val, Eina_Bool src_alpha)
    //Right Edge Anti Aliasing
    if (line->aa_len[1] >= ww)
      {
-        return MUL_256(256 - (line->aa_cov[1] * (line->aa_len[1] - ww + 1)),
+        return MUL_256(255 - (line->aa_cov[1] * (line->aa_len[1] - ww + 1)),
                        val);
      }
    //Remove Transparency if src image alpha is off.