From 74f6d26a4ad6c95b7db6dea2871f81d48ce9c1dd Mon Sep 17 00:00:00 2001 From: Jesse Allen Date: Sat, 29 Dec 2007 15:03:42 -0700 Subject: [PATCH] dibdrv: Pass color by value, not pointer --- dlls/winedib.drv/dib_render.c | 9 +++------ dlls/winedib.drv/dib_render.h | 24 ++++++++++++------------ 2 files changed, 15 insertions(+), 18 deletions(-) diff --git a/dlls/winedib.drv/dib_render.c b/dlls/winedib.drv/dib_render.c index b0e172c90b7..813b6c7062b 100644 --- a/dlls/winedib.drv/dib_render.c +++ b/dlls/winedib.drv/dib_render.c @@ -232,8 +232,7 @@ void DIB16_MoveXY( DIBDRVBITMAP *bmp, INT x, INT y ) void DIB16_ReadColor( DIBDRVBITMAP *bmp, BYTE *r, BYTE *g, BYTE *b ) { - WORD *p = bmp->addr; - DIB16_Decode( bmp, p, r, g, b ); + DIB16_Decode( bmp, *(WORD*)bmp->addr, r, g, b ); } void DIB16_SelectColor( DIBDRVBITMAP *bmp, COLORREF c ) @@ -274,8 +273,7 @@ void DIB24_MoveXY( DIBDRVBITMAP *bmp, INT x, INT y ) void DIB24_ReadColor( DIBDRVBITMAP *bmp, BYTE *r, BYTE *g, BYTE *b ) { - RGBTRIPLE *p = bmp->addr; - DIB24_Decode( bmp, p, r, g, b ); + DIB24_Decode( bmp, *(RGBTRIPLE*)bmp->addr, r, g, b ); } void DIB24_SelectColor( DIBDRVBITMAP *bmp, COLORREF c ) @@ -318,8 +316,7 @@ void DIB32_MoveXY( DIBDRVBITMAP *bmp, INT x, INT y ) void DIB32_ReadColor( DIBDRVBITMAP *bmp, BYTE *r, BYTE *g, BYTE *b ) { - DWORD *p = bmp->addr; - DIB32_Decode( bmp, p, r, g, b ); + DIB32_Decode( bmp, *(DWORD*)bmp->addr, r, g, b ); } void DIB32_SelectColor( DIBDRVBITMAP *bmp, COLORREF c ) diff --git a/dlls/winedib.drv/dib_render.h b/dlls/winedib.drv/dib_render.h index ea85df18208..7b609a3c3d8 100644 --- a/dlls/winedib.drv/dib_render.h +++ b/dlls/winedib.drv/dib_render.h @@ -40,11 +40,11 @@ static inline WORD DIB16_Encode(DIBDRVBITMAP *bmp, BYTE r, BYTE g, BYTE b) (b >> bmp->bf_shift[2]) << bmp->bf_pos[2]; } -static inline void DIB16_Decode(DIBDRVBITMAP *bmp, WORD *p, BYTE *r, BYTE *g, BYTE *b) +static inline void DIB16_Decode(DIBDRVBITMAP *bmp, WORD c, BYTE *r, BYTE *g, BYTE *b) { - *r = (*p & bmp->bitfields[0]) >> bmp->bf_pos[0] << bmp->bf_shift[0]; - *g = (*p & bmp->bitfields[1]) >> bmp->bf_pos[1] << bmp->bf_shift[1]; - *b = (*p & bmp->bitfields[2]) >> bmp->bf_pos[2] << bmp->bf_shift[2]; + *r = (c & bmp->bitfields[0]) >> bmp->bf_pos[0] << bmp->bf_shift[0]; + *g = (c & bmp->bitfields[1]) >> bmp->bf_pos[1] << bmp->bf_shift[1]; + *b = (c & bmp->bitfields[2]) >> bmp->bf_pos[2] << bmp->bf_shift[2]; if (bmp->bf_size[0] < 8) *r |= *r >> bmp->bf_size[0]; if (bmp->bf_size[1] < 8) *g |= *g >> bmp->bf_size[1]; if (bmp->bf_size[2] < 8) *b |= *b >> bmp->bf_size[2]; @@ -59,11 +59,11 @@ static inline RGBTRIPLE DIB24_Encode(DIBDRVBITMAP *bmp, BYTE r, BYTE g, BYTE b) return c; } -static inline void DIB24_Decode(DIBDRVBITMAP *bmp, RGBTRIPLE *p, BYTE *r, BYTE *g, BYTE *b) +static inline void DIB24_Decode(DIBDRVBITMAP *bmp, RGBTRIPLE c, BYTE *r, BYTE *g, BYTE *b) { - *r = p->rgbtRed; - *g = p->rgbtGreen; - *b = p->rgbtBlue; + *r = c.rgbtRed; + *g = c.rgbtGreen; + *b = c.rgbtBlue; } static inline DWORD DIB32_Encode(DIBDRVBITMAP *bmp, BYTE r, BYTE g, BYTE b) @@ -73,11 +73,11 @@ static inline DWORD DIB32_Encode(DIBDRVBITMAP *bmp, BYTE r, BYTE g, BYTE b) (b >> bmp->bf_shift[2]) << bmp->bf_pos[2]; } -static inline void DIB32_Decode(DIBDRVBITMAP *bmp, DWORD *p, BYTE *r, BYTE *g, BYTE *b) +static inline void DIB32_Decode(DIBDRVBITMAP *bmp, DWORD c, BYTE *r, BYTE *g, BYTE *b) { - *r = (*p & bmp->bitfields[0]) >> bmp->bf_pos[0] << bmp->bf_shift[0]; - *g = (*p & bmp->bitfields[1]) >> bmp->bf_pos[1] << bmp->bf_shift[1]; - *b = (*p & bmp->bitfields[2]) >> bmp->bf_pos[2] << bmp->bf_shift[2]; + *r = (c & bmp->bitfields[0]) >> bmp->bf_pos[0] << bmp->bf_shift[0]; + *g = (c & bmp->bitfields[1]) >> bmp->bf_pos[1] << bmp->bf_shift[1]; + *b = (c & bmp->bitfields[2]) >> bmp->bf_pos[2] << bmp->bf_shift[2]; if (bmp->bf_size[0] < 8) *r |= *r >> bmp->bf_size[0]; if (bmp->bf_size[1] < 8) *g |= *g >> bmp->bf_size[1]; if (bmp->bf_size[2] < 8) *b |= *b >> bmp->bf_size[2]; -- 2.11.4.GIT