Index: core/fxge/dib/fx_dib_composite.cpp |
diff --git a/core/fxge/dib/fx_dib_composite.cpp b/core/fxge/dib/fx_dib_composite.cpp |
index 282b93d6daa76e4a58125bb375f640ac7550bd85..e08624d2d8562bc5fce7d507cf8746a8f8044631 100644 |
--- a/core/fxge/dib/fx_dib_composite.cpp |
+++ b/core/fxge/dib/fx_dib_composite.cpp |
@@ -2512,11 +2512,11 @@ void CompositeRow_ByteMask2Argb(uint8_t* dest_scan, |
int alpha_ratio = src_alpha * 255 / dest_alpha; |
if (blend_type >= FXDIB_BLEND_NONSEPARABLE) { |
int blended_colors[3]; |
- uint8_t src_scan[3]; |
- src_scan[0] = src_b; |
- src_scan[1] = src_g; |
- src_scan[2] = src_r; |
- RGB_Blend(blend_type, src_scan, dest_scan, blended_colors); |
+ uint8_t scan[3]; |
+ scan[0] = src_b; |
+ scan[1] = src_g; |
+ scan[2] = src_r; |
+ RGB_Blend(blend_type, scan, dest_scan, blended_colors); |
*dest_scan = |
FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[0], alpha_ratio); |
dest_scan++; |
@@ -2583,11 +2583,11 @@ void CompositeRow_ByteMask2Rgba(uint8_t* dest_scan, |
int alpha_ratio = src_alpha * 255 / dest_alpha; |
if (blend_type >= FXDIB_BLEND_NONSEPARABLE) { |
int blended_colors[3]; |
- uint8_t src_scan[3]; |
- src_scan[0] = src_b; |
- src_scan[1] = src_g; |
- src_scan[2] = src_r; |
- RGB_Blend(blend_type, src_scan, dest_scan, blended_colors); |
+ uint8_t scan[3]; |
+ scan[0] = src_b; |
+ scan[1] = src_g; |
+ scan[2] = src_r; |
+ RGB_Blend(blend_type, scan, dest_scan, blended_colors); |
*dest_scan = |
FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[0], alpha_ratio); |
dest_scan++; |
@@ -2644,11 +2644,11 @@ void CompositeRow_ByteMask2Rgb(uint8_t* dest_scan, |
} |
if (blend_type >= FXDIB_BLEND_NONSEPARABLE) { |
int blended_colors[3]; |
- uint8_t src_scan[3]; |
- src_scan[0] = src_b; |
- src_scan[1] = src_g; |
- src_scan[2] = src_r; |
- RGB_Blend(blend_type, src_scan, dest_scan, blended_colors); |
+ uint8_t scan[3]; |
+ scan[0] = src_b; |
+ scan[1] = src_g; |
+ scan[2] = src_r; |
+ RGB_Blend(blend_type, scan, dest_scan, blended_colors); |
*dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[0], src_alpha); |
dest_scan++; |
*dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[1], src_alpha); |
@@ -2791,11 +2791,11 @@ void CompositeRow_BitMask2Argb(uint8_t* dest_scan, |
int alpha_ratio = src_alpha * 255 / dest_alpha; |
if (blend_type >= FXDIB_BLEND_NONSEPARABLE) { |
int blended_colors[3]; |
- uint8_t src_scan[3]; |
- src_scan[0] = src_b; |
- src_scan[1] = src_g; |
- src_scan[2] = src_r; |
- RGB_Blend(blend_type, src_scan, dest_scan, blended_colors); |
+ uint8_t scan[3]; |
+ scan[0] = src_b; |
+ scan[1] = src_g; |
+ scan[2] = src_r; |
+ RGB_Blend(blend_type, scan, dest_scan, blended_colors); |
*dest_scan = |
FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[0], alpha_ratio); |
dest_scan++; |
@@ -2866,11 +2866,11 @@ void CompositeRow_BitMask2Rgb(uint8_t* dest_scan, |
} |
if (blend_type >= FXDIB_BLEND_NONSEPARABLE) { |
int blended_colors[3]; |
- uint8_t src_scan[3]; |
- src_scan[0] = src_b; |
- src_scan[1] = src_g; |
- src_scan[2] = src_r; |
- RGB_Blend(blend_type, src_scan, dest_scan, blended_colors); |
+ uint8_t scan[3]; |
+ scan[0] = src_b; |
+ scan[1] = src_g; |
+ scan[2] = src_r; |
+ RGB_Blend(blend_type, scan, dest_scan, blended_colors); |
*dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[0], src_alpha); |
dest_scan++; |
*dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[1], src_alpha); |
@@ -3584,15 +3584,12 @@ void CompositeRow_ByteMask2Argb_RgbByteOrder(uint8_t* dest_scan, |
int alpha_ratio = src_alpha * 255 / dest_alpha; |
if (blend_type >= FXDIB_BLEND_NONSEPARABLE) { |
int blended_colors[3]; |
- uint8_t src_scan[3]; |
- uint8_t dest_scan_o[3]; |
- src_scan[0] = src_b; |
- src_scan[1] = src_g; |
- src_scan[2] = src_r; |
- dest_scan_o[0] = dest_scan[2]; |
- dest_scan_o[1] = dest_scan[1]; |
- dest_scan_o[2] = dest_scan[0]; |
- RGB_Blend(blend_type, src_scan, dest_scan_o, blended_colors); |
+ uint8_t scan[3]; |
+ scan[0] = src_b; |
+ scan[1] = src_g; |
+ scan[2] = src_r; |
+ uint8_t dest_scan_o[3] = {dest_scan[2], dest_scan[1], dest_scan[0]}; |
Tom Sepez
2016/06/01 22:49:21
nit: can we be consistent about initializer syntax
Wei Li
2016/06/01 23:40:13
Sure, since src_{b,g,r} are of int type, it may no
|
+ RGB_Blend(blend_type, scan, dest_scan_o, blended_colors); |
dest_scan[2] = |
FXDIB_ALPHA_MERGE(dest_scan[2], blended_colors[0], alpha_ratio); |
dest_scan[1] = |
@@ -3641,15 +3638,12 @@ void CompositeRow_ByteMask2Rgb_RgbByteOrder(uint8_t* dest_scan, |
} |
if (blend_type >= FXDIB_BLEND_NONSEPARABLE) { |
int blended_colors[3]; |
- uint8_t src_scan[3]; |
- uint8_t dest_scan_o[3]; |
- src_scan[0] = src_b; |
- src_scan[1] = src_g; |
- src_scan[2] = src_r; |
- dest_scan_o[0] = dest_scan[2]; |
- dest_scan_o[1] = dest_scan[1]; |
- dest_scan_o[2] = dest_scan[0]; |
- RGB_Blend(blend_type, src_scan, dest_scan_o, blended_colors); |
+ uint8_t scan[3]; |
+ scan[0] = src_b; |
+ scan[1] = src_g; |
+ scan[2] = src_r; |
+ uint8_t dest_scan_o[3] = {dest_scan[2], dest_scan[1], dest_scan[0]}; |
+ RGB_Blend(blend_type, scan, dest_scan_o, blended_colors); |
dest_scan[2] = |
FXDIB_ALPHA_MERGE(dest_scan[2], blended_colors[0], src_alpha); |
dest_scan[1] = |
@@ -3715,15 +3709,12 @@ void CompositeRow_BitMask2Argb_RgbByteOrder(uint8_t* dest_scan, |
int alpha_ratio = src_alpha * 255 / dest_alpha; |
if (blend_type >= FXDIB_BLEND_NONSEPARABLE) { |
int blended_colors[3]; |
- uint8_t src_scan[3]; |
- uint8_t dest_scan_o[3]; |
- src_scan[0] = src_b; |
- src_scan[1] = src_g; |
- src_scan[2] = src_r; |
- dest_scan_o[0] = dest_scan[2]; |
- dest_scan_o[1] = dest_scan[1]; |
- dest_scan_o[2] = dest_scan[0]; |
- RGB_Blend(blend_type, src_scan, dest_scan_o, blended_colors); |
+ uint8_t scan[3]; |
+ scan[0] = src_b; |
+ scan[1] = src_g; |
+ scan[2] = src_r; |
+ uint8_t dest_scan_o[3] = {dest_scan[2], dest_scan[1], dest_scan[0]}; |
+ RGB_Blend(blend_type, scan, dest_scan_o, blended_colors); |
dest_scan[2] = |
FXDIB_ALPHA_MERGE(dest_scan[2], blended_colors[0], alpha_ratio); |
dest_scan[1] = |
@@ -3788,15 +3779,12 @@ void CompositeRow_BitMask2Rgb_RgbByteOrder(uint8_t* dest_scan, |
} |
if (blend_type >= FXDIB_BLEND_NONSEPARABLE) { |
int blended_colors[3]; |
- uint8_t src_scan[3]; |
- uint8_t dest_scan_o[3]; |
- src_scan[0] = src_b; |
- src_scan[1] = src_g; |
- src_scan[2] = src_r; |
- dest_scan_o[0] = dest_scan[2]; |
- dest_scan_o[1] = dest_scan[1]; |
- dest_scan_o[2] = dest_scan[0]; |
- RGB_Blend(blend_type, src_scan, dest_scan_o, blended_colors); |
+ uint8_t scan[3]; |
+ scan[0] = src_b; |
+ scan[1] = src_g; |
+ scan[2] = src_r; |
+ uint8_t dest_scan_o[3] = {dest_scan[2], dest_scan[1], dest_scan[0]}; |
+ RGB_Blend(blend_type, scan, dest_scan_o, blended_colors); |
dest_scan[2] = |
FXDIB_ALPHA_MERGE(dest_scan[2], blended_colors[0], src_alpha); |
dest_scan[1] = |
@@ -4710,7 +4698,7 @@ FX_BOOL CFX_DIBitmap::CompositeRect(int left, |
ASSERT(!IsCmykImage() && (uint8_t)(alpha_flag >> 8) == 0); |
int left_shift = rect.left % 8; |
int right_shift = rect.right % 8; |
- int width = rect.right / 8 - rect.left / 8; |
+ int new_width = rect.right / 8 - rect.left / 8; |
int index = 0; |
if (m_pPalette) { |
for (int i = 0; i < 2; i++) { |
@@ -4726,8 +4714,8 @@ FX_BOOL CFX_DIBitmap::CompositeRect(int left, |
uint8_t* dest_scan_top_r = (uint8_t*)GetScanline(row) + rect.right / 8; |
uint8_t left_flag = *dest_scan_top & (255 << (8 - left_shift)); |
uint8_t right_flag = *dest_scan_top_r & (255 >> right_shift); |
- if (width) { |
- FXSYS_memset(dest_scan_top + 1, index ? 255 : 0, width - 1); |
+ if (new_width) { |
+ FXSYS_memset(dest_scan_top + 1, index ? 255 : 0, new_width - 1); |
if (!index) { |
*dest_scan_top &= left_flag; |
*dest_scan_top_r &= right_flag; |