kwo pushed a commit to branch master.

http://git.enlightenment.org/legacy/imlib2.git/commit/?id=4350b08dfea7cc877d3148491477722369fe0093

commit 4350b08dfea7cc877d3148491477722369fe0093
Author: Kim Woelders <k...@woelders.dk>
Date:   Sun Oct 19 06:55:02 2014 +0200

    BMP loader: Simplify pixel fetch.
    
    No need to go though elaborate API call (imlib_image_query_pixel()).
---
 src/modules/loaders/loader_bmp.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/modules/loaders/loader_bmp.c b/src/modules/loaders/loader_bmp.c
index 76419c4..5b9730b 100644
--- a/src/modules/loaders/loader_bmp.c
+++ b/src/modules/loaders/loader_bmp.c
@@ -863,8 +863,8 @@ char
 save(ImlibImage * im, ImlibProgressFunction progress, char 
progress_granularity)
 {
    FILE               *f;
-   Imlib_Color         pixel_color;
    int                 i, j, pad;
+   DATA32              pixel;
 
    if (!im->data)
       return 0;
@@ -899,10 +899,10 @@ save(ImlibImage * im, ImlibProgressFunction progress, 
char progress_granularity)
      {
         for (j = 0; j < im->w; j++)
           {
-             imlib_image_query_pixel(j, im->h - i - 1, &pixel_color);
-             WriteleByte(f, pixel_color.blue);
-             WriteleByte(f, pixel_color.green);
-             WriteleByte(f, pixel_color.red);
+             pixel = im->data[im->w * (im->h - i - 1) + j];
+             WriteleByte(f, pixel & 0xff);
+             WriteleByte(f, (pixel >> 8) & 0xff);
+             WriteleByte(f, (pixel >> 16) & 0xff);
           }
         for (j = 0; j < pad; j++)
            WriteleByte(f, 0);

-- 


Reply via email to