diff options
Diffstat (limited to 'core/fxge')
-rw-r--r-- | core/fxge/agg/fx_agg_driver.cpp | 10 | ||||
-rw-r--r-- | core/fxge/cfx_renderdevice.cpp | 2 | ||||
-rw-r--r-- | core/fxge/dib/cfx_dibitmap.cpp | 8 | ||||
-rw-r--r-- | core/fxge/dib/cfx_dibsource.cpp | 2 | ||||
-rw-r--r-- | core/fxge/dib/cfx_imagetransformer.cpp | 4 | ||||
-rw-r--r-- | core/fxge/dib/cfx_scanlinecompositor.cpp | 36 | ||||
-rw-r--r-- | core/fxge/dib/fx_dib_main.cpp | 4 | ||||
-rw-r--r-- | core/fxge/fx_dib.h | 2 | ||||
-rw-r--r-- | core/fxge/skia/fx_skia_device.cpp | 12 |
9 files changed, 39 insertions, 41 deletions
diff --git a/core/fxge/agg/fx_agg_driver.cpp b/core/fxge/agg/fx_agg_driver.cpp index ab6ee49c7e..a19868f764 100644 --- a/core/fxge/agg/fx_agg_driver.cpp +++ b/core/fxge/agg/fx_agg_driver.cpp @@ -109,7 +109,7 @@ void RgbByteOrderCompositeRect(const RetainPtr<CFX_DIBitmap>& pBitmap, uint8_t back_alpha = dest_scan[3]; if (back_alpha == 0) { FXARGB_SETRGBORDERDIB(dest_scan, - FXARGB_MAKE(src_alpha, src_r, src_g, src_b)); + ArgbEncode(src_alpha, src_r, src_g, src_b)); dest_scan += 4; continue; } @@ -169,8 +169,8 @@ void RgbByteOrderTransferBitmap(const RetainPtr<CFX_DIBitmap>& pBitmap, src_left * Bpp; if (Bpp == 4) { for (int col = 0; col < width; col++) { - FXARGB_SETDIB(dest_scan, FXARGB_MAKE(src_scan[3], src_scan[0], - src_scan[1], src_scan[2])); + FXARGB_SETDIB(dest_scan, ArgbEncode(src_scan[3], src_scan[0], + src_scan[1], src_scan[2])); dest_scan += 4; src_scan += 4; } @@ -213,7 +213,7 @@ void RgbByteOrderTransferBitmap(const RetainPtr<CFX_DIBitmap>& pBitmap, src_left * 3; for (int col = 0; col < width; col++) { FXARGB_SETDIB(dest_scan, - FXARGB_MAKE(0xff, src_scan[0], src_scan[1], src_scan[2])); + ArgbEncode(0xff, src_scan[0], src_scan[1], src_scan[2])); dest_scan += 4; src_scan += 3; } @@ -230,7 +230,7 @@ void RgbByteOrderTransferBitmap(const RetainPtr<CFX_DIBitmap>& pBitmap, src_left * 4; for (int col = 0; col < width; col++) { FXARGB_SETDIB(dest_scan, - FXARGB_MAKE(0xff, src_scan[0], src_scan[1], src_scan[2])); + ArgbEncode(0xff, src_scan[0], src_scan[1], src_scan[2])); src_scan += 4; dest_scan += 4; } diff --git a/core/fxge/cfx_renderdevice.cpp b/core/fxge/cfx_renderdevice.cpp index 826f14dfa7..aed1bff94e 100644 --- a/core/fxge/cfx_renderdevice.cpp +++ b/core/fxge/cfx_renderdevice.cpp @@ -148,7 +148,7 @@ void NormalizeArgb(int src_value, int src_alpha) { uint8_t back_alpha = dest[3]; if (back_alpha == 0) - FXARGB_SETDIB(dest, FXARGB_MAKE(src_alpha, r, g, b)); + FXARGB_SETDIB(dest, ArgbEncode(src_alpha, r, g, b)); else if (src_alpha != 0) ApplyDestAlpha(back_alpha, src_alpha, r, g, b, dest); } diff --git a/core/fxge/dib/cfx_dibitmap.cpp b/core/fxge/dib/cfx_dibitmap.cpp index 15e821cf11..f17ca52095 100644 --- a/core/fxge/dib/cfx_dibitmap.cpp +++ b/core/fxge/dib/cfx_dibitmap.cpp @@ -738,8 +738,8 @@ void CFX_DIBitmap::ConvertBGRColorScale(uint32_t forecolor, FXARGB_G(m_pPalette.get()[i]), FXARGB_B(m_pPalette.get()[i])); m_pPalette.get()[i] = - FXARGB_MAKE(0xff, br + (fr - br) * gray / 255, - bg + (fg - bg) * gray / 255, bb + (fb - bb) * gray / 255); + ArgbEncode(0xff, br + (fr - br) * gray / 255, + bg + (fg - bg) * gray / 255, bb + (fb - bb) * gray / 255); } return; } @@ -1153,8 +1153,8 @@ bool CFX_DIBitmap::CompositeRect(int left, for (int col = 0; col < width; col++) { uint8_t back_alpha = dest_scan[3]; if (back_alpha == 0) { - FXARGB_SETDIB(dest_scan, FXARGB_MAKE(src_alpha, color_p[2], - color_p[1], color_p[0])); + FXARGB_SETDIB(dest_scan, ArgbEncode(src_alpha, color_p[2], + color_p[1], color_p[0])); dest_scan += 4; continue; } diff --git a/core/fxge/dib/cfx_dibsource.cpp b/core/fxge/dib/cfx_dibsource.cpp index f140a5e838..757547783d 100644 --- a/core/fxge/dib/cfx_dibsource.cpp +++ b/core/fxge/dib/cfx_dibsource.cpp @@ -302,7 +302,7 @@ void ConvertBuffer_Plt2PltRgb8(uint8_t* dest_buf, std::tie(r, g, b) = AdobeCMYK_to_sRGB1( FXSYS_GetCValue(src_plt[i]), FXSYS_GetMValue(src_plt[i]), FXSYS_GetYValue(src_plt[i]), FXSYS_GetKValue(src_plt[i])); - dst_plt[i] = FXARGB_MAKE(0xff, r, g, b); + dst_plt[i] = ArgbEncode(0xff, r, g, b); } } else { memcpy(dst_plt, src_plt, plt_size * 4); diff --git a/core/fxge/dib/cfx_imagetransformer.cpp b/core/fxge/dib/cfx_imagetransformer.cpp index 68867b5560..9cd5cea10e 100644 --- a/core/fxge/dib/cfx_imagetransformer.cpp +++ b/core/fxge/dib/cfx_imagetransformer.cpp @@ -132,7 +132,7 @@ void WriteColorResult(std::function<uint8_t(int offset)> func, uint32_t* dest32 = reinterpret_cast<uint32_t*>(dest); if (bHasAlpha) { if (format == FXDIB_Argb) { - *dest32 = FXARGB_TODIB(FXARGB_MAKE(func(3), red_y, green_m, blue_c)); + *dest32 = FXARGB_TODIB(ArgbEncode(func(3), red_y, green_m, blue_c)); } else if (format == FXDIB_Rgba) { dest[0] = blue_c; dest[1] = green_m; @@ -146,7 +146,7 @@ void WriteColorResult(std::function<uint8_t(int offset)> func, if (format == FXDIB_Cmyka) { *dest32 = FXCMYK_TODIB(CmykEncode(blue_c, green_m, red_y, func(3))); } else { - *dest32 = FXARGB_TODIB(FXARGB_MAKE(kOpaqueAlpha, red_y, green_m, blue_c)); + *dest32 = FXARGB_TODIB(ArgbEncode(kOpaqueAlpha, red_y, green_m, blue_c)); } } diff --git a/core/fxge/dib/cfx_scanlinecompositor.cpp b/core/fxge/dib/cfx_scanlinecompositor.cpp index ae27ee0246..948dd59838 100644 --- a/core/fxge/dib/cfx_scanlinecompositor.cpp +++ b/core/fxge/dib/cfx_scanlinecompositor.cpp @@ -394,8 +394,8 @@ void CompositeRow_Argb2Argb(uint8_t* dest_scan, if (!has_src) ++src_scan; } else { - FXARGB_SETDIB(dest_scan, FXARGB_MAKE((src_alpha << 24), src_scan[2], - src_scan[1], *src_scan)); + FXARGB_SETDIB(dest_scan, ArgbEncode((src_alpha << 24), src_scan[2], + src_scan[1], *src_scan)); } if (!has_dest) { dest_scan += dest_offset; @@ -464,8 +464,8 @@ void CompositeRow_Rgb2Argb_Blend_NoClip(uint8_t* dest_scan, if (src_Bpp == 4) { FXARGB_SETDIB(dest_scan, 0xff000000 | FXARGB_GETDIB(src_scan)); } else { - FXARGB_SETDIB(dest_scan, FXARGB_MAKE(0xff, src_scan[2], src_scan[1], - src_scan[0])); + FXARGB_SETDIB(dest_scan, ArgbEncode(0xff, src_scan[2], src_scan[1], + src_scan[0])); } dest_scan += 4; } @@ -637,7 +637,7 @@ void CompositeRow_Rgb2Argb_NoBlend_NoClip(uint8_t* dest_scan, FXARGB_SETDIB(dest_scan, 0xff000000 | FXARGB_GETDIB(src_scan)); } else { FXARGB_SETDIB(dest_scan, - FXARGB_MAKE(0xff, src_scan[2], src_scan[1], src_scan[0])); + ArgbEncode(0xff, src_scan[2], src_scan[1], src_scan[0])); } dest_scan += 4; src_scan += src_Bpp; @@ -1322,10 +1322,10 @@ void CompositeRow_8bppRgb2Argb_NoBlend(uint8_t* dest_scan, if (back_alpha == 0) { if (clip_scan) { int src_alpha = clip_scan[col] * (*src_alpha_scan) / 255; - FXARGB_SETDIB(dest_scan, FXARGB_MAKE(src_alpha, src_r, src_g, src_b)); + FXARGB_SETDIB(dest_scan, ArgbEncode(src_alpha, src_r, src_g, src_b)); } else { FXARGB_SETDIB(dest_scan, - FXARGB_MAKE(*src_alpha_scan, src_r, src_g, src_b)); + ArgbEncode(*src_alpha_scan, src_r, src_g, src_b)); } dest_scan += 4; src_alpha_scan++; @@ -1511,7 +1511,7 @@ void CompositeRow_ByteMask2Argb(uint8_t* dest_scan, } uint8_t back_alpha = dest_scan[3]; if (back_alpha == 0) { - FXARGB_SETDIB(dest_scan, FXARGB_MAKE(src_alpha, src_r, src_g, src_b)); + FXARGB_SETDIB(dest_scan, ArgbEncode(src_alpha, src_r, src_g, src_b)); dest_scan += 4; continue; } @@ -1769,7 +1769,7 @@ void CompositeRow_BitMask2Argb(uint8_t* dest_scan, int blend_type, const uint8_t* clip_scan) { if (blend_type == FXDIB_BLEND_NORMAL && !clip_scan && mask_alpha == 255) { - FX_ARGB argb = FXARGB_MAKE(0xff, src_r, src_g, src_b); + FX_ARGB argb = ArgbEncode(0xff, src_r, src_g, src_b); for (int col = 0; col < pixel_count; col++) { if (src_scan[(src_left + col) / 8] & (1 << (7 - (src_left + col) % 8))) { FXARGB_SETDIB(dest_scan, argb); @@ -1791,7 +1791,7 @@ void CompositeRow_BitMask2Argb(uint8_t* dest_scan, } uint8_t back_alpha = dest_scan[3]; if (back_alpha == 0) { - FXARGB_SETDIB(dest_scan, FXARGB_MAKE(src_alpha, src_r, src_g, src_b)); + FXARGB_SETDIB(dest_scan, ArgbEncode(src_alpha, src_r, src_g, src_b)); dest_scan += 4; continue; } @@ -2072,8 +2072,8 @@ void CompositeRow_Rgb2Argb_Blend_NoClip_RgbByteOrder(uint8_t* dest_scan, if (src_Bpp == 4) { FXARGB_SETRGBORDERDIB(dest_scan, 0xff000000 | FXARGB_GETDIB(src_scan)); } else { - FXARGB_SETRGBORDERDIB(dest_scan, FXARGB_MAKE(0xff, src_scan[2], - src_scan[1], src_scan[0])); + FXARGB_SETRGBORDERDIB( + dest_scan, ArgbEncode(0xff, src_scan[2], src_scan[1], src_scan[0])); } dest_scan += 4; src_scan += src_Bpp; @@ -2151,7 +2151,7 @@ void CompositeRow_Rgb2Argb_NoBlend_NoClip_RgbByteOrder(uint8_t* dest_scan, FXARGB_SETRGBORDERDIB(dest_scan, 0xff000000 | FXARGB_GETDIB(src_scan)); } else { FXARGB_SETRGBORDERDIB( - dest_scan, FXARGB_MAKE(0xff, src_scan[2], src_scan[1], src_scan[0])); + dest_scan, ArgbEncode(0xff, src_scan[2], src_scan[1], src_scan[0])); } dest_scan += 4; src_scan += src_Bpp; @@ -2578,7 +2578,7 @@ void CompositeRow_ByteMask2Argb_RgbByteOrder(uint8_t* dest_scan, uint8_t back_alpha = dest_scan[3]; if (back_alpha == 0) { FXARGB_SETRGBORDERDIB(dest_scan, - FXARGB_MAKE(src_alpha, src_r, src_g, src_b)); + ArgbEncode(src_alpha, src_r, src_g, src_b)); dest_scan += 4; continue; } @@ -2682,7 +2682,7 @@ void CompositeRow_BitMask2Argb_RgbByteOrder(uint8_t* dest_scan, int blend_type, const uint8_t* clip_scan) { if (blend_type == FXDIB_BLEND_NORMAL && !clip_scan && mask_alpha == 255) { - FX_ARGB argb = FXARGB_MAKE(0xff, src_r, src_g, src_b); + FX_ARGB argb = ArgbEncode(0xff, src_r, src_g, src_b); for (int col = 0; col < pixel_count; col++) { if (src_scan[(src_left + col) / 8] & (1 << (7 - (src_left + col) % 8))) { FXARGB_SETRGBORDERDIB(dest_scan, argb); @@ -2705,7 +2705,7 @@ void CompositeRow_BitMask2Argb_RgbByteOrder(uint8_t* dest_scan, uint8_t back_alpha = dest_scan[3]; if (back_alpha == 0) { FXARGB_SETRGBORDERDIB(dest_scan, - FXARGB_MAKE(src_alpha, src_r, src_g, src_b)); + ArgbEncode(src_alpha, src_r, src_g, src_b)); dest_scan += 4; continue; } @@ -2950,7 +2950,7 @@ void CFX_ScanlineCompositor::InitSourcePalette(FXDIB_Format src_format, std::tie(r, g, b) = AdobeCMYK_to_sRGB1(FXSYS_GetCValue(cmyk), FXSYS_GetMValue(cmyk), FXSYS_GetYValue(cmyk), FXSYS_GetKValue(cmyk)); - pPalette[i] = FXARGB_MAKE(0xff, r, g, b); + pPalette[i] = ArgbEncode(0xff, r, g, b); } } return; @@ -2985,7 +2985,7 @@ void CFX_ScanlineCompositor::InitSourcePalette(FXDIB_Format src_format, std::tie(r, g, b) = AdobeCMYK_to_sRGB1(FXSYS_GetCValue(cmyk), FXSYS_GetMValue(cmyk), FXSYS_GetYValue(cmyk), FXSYS_GetKValue(cmyk)); - pPalette[i] = FXARGB_MAKE(0xff, r, g, b); + pPalette[i] = ArgbEncode(0xff, r, g, b); } } } diff --git a/core/fxge/dib/fx_dib_main.cpp b/core/fxge/dib/fx_dib_main.cpp index e2e2213e8f..2fd3cc05e5 100644 --- a/core/fxge/dib/fx_dib_main.cpp +++ b/core/fxge/dib/fx_dib_main.cpp @@ -93,8 +93,8 @@ FX_COLORREF ArgbToColorRef(FX_ARGB argb) { } FX_ARGB AlphaAndColorRefToArgb(int a, FX_COLORREF colorref) { - return FXARGB_MAKE(a, FXSYS_GetRValue(colorref), FXSYS_GetGValue(colorref), - FXSYS_GetBValue(colorref)); + return ArgbEncode(a, FXSYS_GetRValue(colorref), FXSYS_GetGValue(colorref), + FXSYS_GetBValue(colorref)); } FX_ARGB StringToFXARGB(const WideStringView& wsValue) { diff --git a/core/fxge/fx_dib.h b/core/fxge/fx_dib.h index 57e844b946..3475e5c4bd 100644 --- a/core/fxge/fx_dib.h +++ b/core/fxge/fx_dib.h @@ -128,8 +128,6 @@ FX_ARGB StringToFXARGB(const WideStringView& view); #define FXARGB_R(argb) ((uint8_t)((argb) >> 16)) #define FXARGB_G(argb) ((uint8_t)((argb) >> 8)) #define FXARGB_B(argb) ((uint8_t)(argb)) -#define FXARGB_MAKE(a, r, g, b) \ - (((uint32_t)(a) << 24) | ((r) << 16) | ((g) << 8) | (b)) #define FXARGB_MUL_ALPHA(argb, alpha) \ (((((argb) >> 24) * (alpha) / 255) << 24) | ((argb)&0xffffff)) diff --git a/core/fxge/skia/fx_skia_device.cpp b/core/fxge/skia/fx_skia_device.cpp index c68fd57798..0329eac104 100644 --- a/core/fxge/skia/fx_skia_device.cpp +++ b/core/fxge/skia/fx_skia_device.cpp @@ -84,8 +84,8 @@ void RgbByteOrderTransferBitmap(const RetainPtr<CFX_DIBitmap>& pBitmap, (uint8_t*)pSrcBitmap->GetScanline(src_top + row) + src_left * Bpp; if (Bpp == 4) { for (int col = 0; col < width; col++) { - FXARGB_SETDIB(dest_scan, FXARGB_MAKE(src_scan[3], src_scan[0], - src_scan[1], src_scan[2])); + FXARGB_SETDIB(dest_scan, ArgbEncode(src_scan[3], src_scan[0], + src_scan[1], src_scan[2])); dest_scan += 4; src_scan += 4; } @@ -128,8 +128,8 @@ void RgbByteOrderTransferBitmap(const RetainPtr<CFX_DIBitmap>& pBitmap, uint8_t* src_scan = (uint8_t*)pSrcBitmap->GetScanline(src_top + row) + src_left * 3; for (int col = 0; col < width; col++) { - FXARGB_SETDIB(dest_scan, FXARGB_MAKE(0xff, src_scan[0], src_scan[1], - src_scan[2])); + FXARGB_SETDIB(dest_scan, ArgbEncode(0xff, src_scan[0], src_scan[1], + src_scan[2])); dest_scan += 4; src_scan += 3; } @@ -141,8 +141,8 @@ void RgbByteOrderTransferBitmap(const RetainPtr<CFX_DIBitmap>& pBitmap, uint8_t* src_scan = (uint8_t*)(pSrcBitmap->GetScanline(src_top + row) + src_left * 4); for (int col = 0; col < width; col++) { - FXARGB_SETDIB(dest_scan, FXARGB_MAKE(0xff, src_scan[0], src_scan[1], - src_scan[2])); + FXARGB_SETDIB(dest_scan, ArgbEncode(0xff, src_scan[0], src_scan[1], + src_scan[2])); src_scan += 4; dest_scan += 4; } |