Enlightenment CVS committal

Author  : barbieri
Project : e17
Module  : libs/evas

Dir     : e17/libs/evas/src/modules/engines/software_16


Modified Files:
        evas_soft16_dither_mask.c evas_soft16_image_scaled_sampled.c 
        evas_soft16_image_unscaled.c evas_soft16_scanline_blend.c 


Log Message:
Simplify image alpha usage.

Values are now in 0-32 (inclusive), so we must check for 32 as the
opaque value. Now it's more consistent.

===================================================================
RCS file: 
/cvs/e/e17/libs/evas/src/modules/engines/software_16/evas_soft16_dither_mask.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -3 -r1.4 -r1.5
--- evas_soft16_dither_mask.c   25 Oct 2007 16:17:18 -0000      1.4
+++ evas_soft16_dither_mask.c   25 Oct 2007 18:56:23 -0000      1.5
@@ -142,14 +142,15 @@
 _soft16_convert_from_rgba_pt(const DATA32 *src, DATA16 *dst, DATA8 *alpha,
                             const int x, const int y)
 {
-   DATA8 orig_r, orig_g, orig_b, orig_a;
+   DATA8 orig_r, orig_g, orig_b, orig_a, a;
 
    orig_r = R_VAL(src);
    orig_g = G_VAL(src);
    orig_b = B_VAL(src);
    orig_a = A_VAL(src);
+   a = orig_a >> 3;
 
-   if (orig_a == 255)
+   if (a == 31)
      {
        DATA8 dith5, dith6, dith, r, g, b;
 
@@ -166,23 +167,22 @@
        if (((orig_b - (b << 3)) >= dith5) && (b < 0x1f)) b++;
 
        *dst = (r << 11) | (g << 5) | b;
-       *alpha = 31;
+       *alpha = 32;
      }
-   else if (orig_a == 0)
+   else if (a == 0)
      {
        *dst = 0;
        *alpha = 0;
      }
    else
      {
-       DATA8 r, g, b, a;
+       DATA8 r, g, b;
        r = orig_r >> 3;
        g = orig_g >> 2;
        b = orig_b >> 3;
-       a = (orig_a >> 3) + 1;
 
        *dst = (r << 11) | (g << 5) | b;
-       *alpha = a;
+       *alpha = a + 1;
      }
 }
 
===================================================================
RCS file: 
/cvs/e/e17/libs/evas/src/modules/engines/software_16/evas_soft16_image_scaled_sampled.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -3 -r1.3 -r1.4
--- evas_soft16_image_scaled_sampled.c  10 Oct 2007 19:22:26 -0000      1.3
+++ evas_soft16_image_scaled_sampled.c  25 Oct 2007 18:56:23 -0000      1.4
@@ -234,7 +234,7 @@
 
    dst_itr = dst->pixels + dst_offset;
 
-   if (alpha == 31)
+   if (alpha == 32)
      for (y = 0; y < h; y++, dst_itr += dst->stride)
        {
          DATA16 *d, *s;
@@ -310,7 +310,7 @@
 
    dst_itr = dst->pixels + dst_offset;
 
-   if (alpha == 31)
+   if (alpha == 32)
      for (y = 0; y < h; y++, dst_itr += dst->stride)
        {
          DATA16 *d, *s;
@@ -407,7 +407,7 @@
                              int *offset_x, int *offset_y, DATA8 r, DATA8 g,
                              DATA8 b, DATA8 a)
 {
-   if ((a == r) && (a == (g >> 1)) && (a == b))
+   if ((r == b) && (r == (g >> 1)) && (r == (a - 1)))
       _soft16_image_draw_scaled_mul_alpha
        (src, dst, dc, dst_offset, w, h, offset_x, offset_y, a);
    else
@@ -428,7 +428,8 @@
 
    if (!dc->mul.use)
      {
-       r = b = a = 31;
+       a = 32;
+       r = b = 31;
        g = 63;
        mul_rgb565 = 0xffff;
      }
@@ -445,6 +446,7 @@
        if (r > a) r = a;
        if (g > (a << 1)) g = (a << 1);
        if (b > a) b = a;
+       a++;
 
        mul_rgb565 = (r << 11) || (g << 5) | b;
      }
@@ -460,7 +462,6 @@
                    * src->stride);
 
    dst_offset = cr.x + (cr.y * dst->stride);
-
 
    if (mul_rgb565 == 0xffff)
      _soft16_image_draw_scaled_no_mul
===================================================================
RCS file: 
/cvs/e/e17/libs/evas/src/modules/engines/software_16/evas_soft16_image_unscaled.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -3 -r1.2 -r1.3
--- evas_soft16_image_unscaled.c        10 Oct 2007 19:22:26 -0000      1.2
+++ evas_soft16_image_unscaled.c        25 Oct 2007 18:56:23 -0000      1.3
@@ -149,7 +149,7 @@
    src_itr = src->pixels + src_offset;
    dst_itr = dst->pixels + dst_offset;
 
-   if (a == 31)
+   if (a == 32)
       for (y = 0; y < h; y++)
          {
             _soft16_scanline_blend_solid_solid_mul_color_solid
@@ -185,7 +185,7 @@
    alpha_itr = src->alpha + src_offset;
    dst_itr = dst->pixels + dst_offset;
 
-   if (a == 31)
+   if (a == 32)
       for (y = 0; y < h; y++)
          {
             _soft16_scanline_blend_transp_solid_mul_color_solid
@@ -232,7 +232,7 @@
                                 int width, int height, DATA8 r, DATA8 g,
                                DATA8 b, DATA8 a)
 {
-   if ((a == r) && (a == (g >> 1)) && (a == b))
+   if ((r == b) && (r == (g >> 1)) && (r == (a - 1)))
       _soft16_image_draw_unscaled_mul_alpha(src, dst, dc, src_offset,
                                             dst_offset, width, height, a);
    else
@@ -254,7 +254,8 @@
 
    if (!dc->mul.use)
      {
-       r = b = a = 31;
+       a = 32;
+       r = b = 31;
        g = 63;
        mul_rgb565 = 0xffff;
      }
@@ -271,6 +272,7 @@
        if (r > a) r = a;
        if (g > (a << 1)) g = (a << 1);
        if (b > a) b = a;
+       a++;
 
        mul_rgb565 = (r << 11) || (g << 5) | b;
      }
===================================================================
RCS file: 
/cvs/e/e17/libs/evas/src/modules/engines/software_16/evas_soft16_scanline_blend.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -3 -r1.4 -r1.5
--- evas_soft16_scanline_blend.c        25 Oct 2007 16:17:19 -0000      1.4
+++ evas_soft16_scanline_blend.c        25 Oct 2007 18:56:23 -0000      1.5
@@ -14,7 +14,7 @@
 static inline void
 _soft16_pt_blend_transp_solid(DATA16 *p_dst, DATA16 src, DATA8 alpha)
 {
-   if (alpha == 31) *p_dst = src;
+   if (alpha == 32) *p_dst = src;
    else if (alpha != 0)
      {
         DATA32 a, b;
@@ -359,7 +359,7 @@
    g1 = ((((src >> 5) & 0x3f) * g) >> 6) & 0x3f;
    b1 = (((src & 0x1f) * b) >> 5) & 0x1f;
 
-   if (alpha == 31) *p_dst = (r1 << 11) | (g1 << 5) | b1;
+   if (alpha == 32) *p_dst = (r1 << 11) | (g1 << 5) | b1;
    else
      {
         DATA32 rgb_unpack, d;



-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to