From 6399880e31f51410de460f1f5d0b50e7e562c0b6 Mon Sep 17 00:00:00 2001 From: "dbaron%fas.harvard.edu" Date: Sun, 7 Jan 2001 14:37:37 +0000 Subject: [PATCH] Fix nsImageXlib.cpp to compile again and pull calls to xlib_get_shift_from_mask out of loop (as suggested by tor). r=blizzard@mozilla.org sr=tor@cs.brown.edu b=64518 --- gfx/src/xlib/nsImageXlib.cpp | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/gfx/src/xlib/nsImageXlib.cpp b/gfx/src/xlib/nsImageXlib.cpp index e96f1d725278..ce0c4531ed80 100644 --- a/gfx/src/xlib/nsImageXlib.cpp +++ b/gfx/src/xlib/nsImageXlib.cpp @@ -430,6 +430,10 @@ nsImageXlib::DrawComposited16(PRBool isLSB, PRBool flipBytes, unsigned *blueScale = (xlib_get_prec_from_mask(visual->blue_mask) == 5) ? scaled5 : scaled6; + unsigned long redShift = xlib_get_shift_from_mask(visual->red_mask); + unsigned long greenShift = xlib_get_shift_from_mask(visual->green_mask); + unsigned long blueShift = xlib_get_shift_from_mask(visual->blue_mask); + for (unsigned y=0; ydata +y*ximage->bytes_per_line; @@ -448,13 +452,13 @@ nsImageXlib::DrawComposited16(PRBool isLSB, PRBool flipBytes, pix = *((short *)baseRow); unsigned alpha = *alphaRow; MOZ_BLEND(targetRow[0], - redScale[(pix&visual->red_mask)>>visual->red_shift], + redScale[(pix&visual->red_mask) >> redShift], imageRow[0], alpha); MOZ_BLEND(targetRow[1], - greenScale[(pix&visual->green_mask)>>visual->green_shift], + greenScale[(pix&visual->green_mask) >> greenShift], imageRow[1], alpha); MOZ_BLEND(targetRow[2], - blueScale[(pix&visual->blue_mask)>>visual->blue_shift], + blueScale[(pix&visual->blue_mask) >> blueShift], imageRow[2], alpha); } } @@ -523,6 +527,10 @@ nsImageXlib::DrawCompositedGeneral(PRBool isLSB, PRBool flipBytes, greenFill = 0xff>>xlib_get_prec_from_mask(visual->green_mask); blueFill = 0xff>>xlib_get_prec_from_mask(visual->blue_mask); + unsigned long redShift = xlib_get_shift_from_mask(visual->red_mask); + unsigned long greenShift = xlib_get_shift_from_mask(visual->green_mask); + unsigned long blueShift = xlib_get_shift_from_mask(visual->blue_mask); + for (int row=0; rowheight; row++) { unsigned char *ptr = (unsigned char *)ximage->data + row*ximage->bytes_per_line; @@ -560,14 +568,11 @@ nsImageXlib::DrawCompositedGeneral(PRBool isLSB, PRBool flipBytes, } *target++ = - redFill|((pix&visual->red_mask) >> - xlib_get_shift_from_mask(visual->red_mask))<red_mask) >> redShift)<green_mask) >> - xlib_get_shift_from_mask(visual->green_mask))<green_mask) >> greenShift)<blue_mask) >> - xlib_get_shift_from_mask(visual->blue_mask))<blue_mask) >> blueShift)<