Enlightenment CVS committal

Author  : cedric
Project : e17
Module  : libs/evas

Dir     : e17/libs/evas/src/modules/loaders/svg


Modified Files:
        evas_image_load_svg.c 


Log Message:
        * Make RGBA_IMAGE_HAS_ALPHA and RGBA_IMAGE_ALPHA_SPARSE part of
        Image_Entry flag structure. This fix a bug with 16 bpp software engine.

        * Change image loader module API to take any Image_Entry. Same goes
        for evas_common_image_premul and evas_common_image_set_alpha_sparse.

        * Use new eet API: eet_data_image_read_to_surface.


===================================================================
RCS file: /cvs/e/e17/libs/evas/src/modules/loaders/svg/evas_image_load_svg.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -3 -r1.14 -r1.15
--- evas_image_load_svg.c       12 Apr 2008 00:32:29 -0000      1.14
+++ evas_image_load_svg.c       3 Jun 2008 09:09:39 -0000       1.15
@@ -4,8 +4,8 @@
 #include <librsvg/rsvg.h>
 #include <librsvg/rsvg-cairo.h>
 
-int evas_image_load_file_head_svg(RGBA_Image *im, const char *file, const char 
*key);
-int evas_image_load_file_data_svg(RGBA_Image *im, const char *file, const char 
*key);
+int evas_image_load_file_head_svg(Image_Entry *ie, const char *file, const 
char *key);
+int evas_image_load_file_data_svg(Image_Entry *ie, const char *file, const 
char *key);
 
 Evas_Image_Load_Func evas_image_load_svg_func =
 {
@@ -36,7 +36,7 @@
 }
 
 int
-evas_image_load_file_head_svg(RGBA_Image *im, const char *file, const char 
*key)
+evas_image_load_file_head_svg(Image_Entry *ie, const char *file, const char 
*key)
 {
    char               cwd[PATH_MAX], pcwd[PATH_MAX], *p;
    
@@ -93,36 +93,36 @@
        chdir(pcwd);
        return 0;
      }
-   if (im->cache_entry.load_opts.scale_down_by > 1)
+   if (ie->load_opts.scale_down_by > 1)
      {
-       w /= im->cache_entry.load_opts.scale_down_by;
-       h /= im->cache_entry.load_opts.scale_down_by;
+       w /= ie->load_opts.scale_down_by;
+       h /= ie->load_opts.scale_down_by;
      }
-   else if (im->cache_entry.load_opts.dpi > 0.0)
+   else if (ie->load_opts.dpi > 0.0)
      {
-       w = (w * im->cache_entry.load_opts.dpi) / 90.0;
-       h = (h * im->cache_entry.load_opts.dpi) / 90.0;
+       w = (w * ie->load_opts.dpi) / 90.0;
+       h = (h * ie->load_opts.dpi) / 90.0;
      }
-   else if ((im->cache_entry.load_opts.w > 0) &&
-           (im->cache_entry.load_opts.h > 0))
+   else if ((ie->load_opts.w > 0) &&
+           (ie->load_opts.h > 0))
      {
        int w2, h2;
        
-       w2 = im->cache_entry.load_opts.w;
-       h2 = (im->cache_entry.load_opts.w * h) / w;
-       if (h2 > im->cache_entry.load_opts.h)
+       w2 = ie->load_opts.w;
+       h2 = (ie->load_opts.w * h) / w;
+       if (h2 > ie->load_opts.h)
          {
-            h2 = im->cache_entry.load_opts.h;
-            w2 = (im->cache_entry.load_opts.h * w) / h;
+            h2 = ie->load_opts.h;
+            w2 = (ie->load_opts.h * w) / h;
          }
        w = w2;
        h = h2;
      }
    if (w < 1) w = 1;
    if (h < 1) h = 1;
-   im->cache_entry.w = w;
-   im->cache_entry.h = h;
-   im->flags |= RGBA_IMAGE_HAS_ALPHA;
+   ie->w = w;
+   ie->h = h;
+   ie->flags.alpha = 1;
 //   rsvg_handle_close(rsvg, NULL);
    g_object_unref(rsvg);
 //   rsvg_handle_free(rsvg);
@@ -132,8 +132,9 @@
 
 /** FIXME: All evas loaders need to be tightened up **/
 int
-evas_image_load_file_data_svg(RGBA_Image *im, const char *file, const char 
*key)
+evas_image_load_file_data_svg(Image_Entry *ie, const char *file, const char 
*key)
 {
+   DATA32             *pixels;
    char               cwd[PATH_MAX], pcwd[PATH_MAX], *p;
    RsvgHandle         *rsvg;
    RsvgDimensionData   dim;
@@ -190,36 +191,37 @@
        chdir(pcwd);
        return 0;
      }
-   if (im->cache_entry.load_opts.scale_down_by > 1)
+   if (ie->load_opts.scale_down_by > 1)
      {
-       w /= im->cache_entry.load_opts.scale_down_by;
-       h /= im->cache_entry.load_opts.scale_down_by;
+       w /= ie->load_opts.scale_down_by;
+       h /= ie->load_opts.scale_down_by;
      }
-   else if (im->cache_entry.load_opts.dpi > 0.0)
+   else if (ie->load_opts.dpi > 0.0)
      {
-       w = (w * im->cache_entry.load_opts.dpi) / 90.0;
-       h = (h * im->cache_entry.load_opts.dpi) / 90.0;
+       w = (w * ie->load_opts.dpi) / 90.0;
+       h = (h * ie->load_opts.dpi) / 90.0;
      }
-   else if ((im->cache_entry.load_opts.w > 0) &&
-           (im->cache_entry.load_opts.h > 0))
+   else if ((ie->load_opts.w > 0) &&
+           (ie->load_opts.h > 0))
      {
        int w2, h2;
        
-       w2 = im->cache_entry.load_opts.w;
-       h2 = (im->cache_entry.load_opts.w * h) / w;
-       if (h2 > im->cache_entry.load_opts.h)
+       w2 = ie->load_opts.w;
+       h2 = (ie->load_opts.w * h) / w;
+       if (h2 > ie->load_opts.h)
          {
-            h2 = im->cache_entry.load_opts.h;
-            w2 = (im->cache_entry.load_opts.h * w) / h;
+            h2 = ie->load_opts.h;
+            w2 = (ie->load_opts.h * w) / h;
          }
        w = w2;
        h = h2;
      }
    if (w < 1) w = 1;
    if (h < 1) h = 1;
-   im->flags |= RGBA_IMAGE_HAS_ALPHA;
-   evas_cache_image_surface_alloc(&im->cache_entry, w, h);
-   if (!im->image.data)
+   ie->flags.alpha = 1;
+   evas_cache_image_surface_alloc(ie, w, h);
+   pixels = evas_cache_image_pixels(ie);
+   if (!pixels)
      {
 //     rsvg_handle_close(rsvg, NULL);
        g_object_unref(rsvg);
@@ -228,9 +230,9 @@
        return 0;
      }
 
-   memset(im->image.data, 0, w * h * sizeof(DATA32));
+   memset(pixels, 0, w * h * sizeof(DATA32));
    
-   surface = cairo_image_surface_create_for_data((unsigned char 
*)im->image.data, CAIRO_FORMAT_ARGB32,
+   surface = cairo_image_surface_create_for_data((unsigned char *)pixels, 
CAIRO_FORMAT_ARGB32,
                                                 w, h, w * sizeof(DATA32));
    if (!surface)
      {
@@ -252,8 +254,8 @@
      }
    
    cairo_scale(cr, 
-              (double)im->cache_entry.w / dim.em, 
-              (double)im->cache_entry.h / dim.ex);
+              (double)ie->w / dim.em, 
+              (double)ie->h / dim.ex);
    rsvg_handle_render_cairo(rsvg, cr);
    cairo_surface_destroy(surface);
    /* need to check if this is required... */
@@ -262,7 +264,7 @@
    g_object_unref(rsvg);
 //   rsvg_handle_free(rsvg);
    chdir(pcwd);
-   evas_common_image_set_alpha_sparse(im);
+   evas_common_image_set_alpha_sparse(ie);
    return 1;
 }
 



-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to