summaryrefslogtreecommitdiff
path: root/core/fxge
diff options
context:
space:
mode:
Diffstat (limited to 'core/fxge')
-rw-r--r--core/fxge/agg/fx_agg_driver.cpp2
-rw-r--r--core/fxge/dib/fx_dib_convert.cpp568
-rw-r--r--core/fxge/dib/fx_dib_main.cpp35
-rw-r--r--core/fxge/ge/fx_ge_text.cpp40
-rw-r--r--core/fxge/include/fx_dib.h25
-rw-r--r--core/fxge/include/fx_font.h5
-rw-r--r--core/fxge/skia/fx_skia_device.cpp18
-rw-r--r--core/fxge/win32/fx_win32_device.cpp38
-rw-r--r--core/fxge/win32/fx_win32_print.cpp12
-rw-r--r--core/fxge/win32/win32_int.h10
10 files changed, 245 insertions, 508 deletions
diff --git a/core/fxge/agg/fx_agg_driver.cpp b/core/fxge/agg/fx_agg_driver.cpp
index 814cf0ec26..2b04b42d19 100644
--- a/core/fxge/agg/fx_agg_driver.cpp
+++ b/core/fxge/agg/fx_agg_driver.cpp
@@ -1639,7 +1639,7 @@ FX_BOOL CFX_AggDeviceDriver::GetDIBits(CFX_DIBitmap* pBitmap,
pBack, left, top);
} else {
bRet = pBitmap->TransferBitmap(0, 0, rect.Width(), rect.Height(), pBack,
- left, top, nullptr);
+ left, top);
}
delete pBack;
return bRet;
diff --git a/core/fxge/dib/fx_dib_convert.cpp b/core/fxge/dib/fx_dib_convert.cpp
index a1e6bb3e18..a9986138a1 100644
--- a/core/fxge/dib/fx_dib_convert.cpp
+++ b/core/fxge/dib/fx_dib_convert.cpp
@@ -174,49 +174,33 @@ FX_BOOL ConvertBuffer_1bppPlt2Gray(uint8_t* dest_buf,
int height,
const CFX_DIBSource* pSrcBitmap,
int src_left,
- int src_top,
- void* pIccTransform) {
+ int src_top) {
uint32_t* src_plt = pSrcBitmap->GetPalette();
uint8_t gray[2];
- if (pIccTransform) {
- uint32_t plt[2];
- if (pSrcBitmap->IsCmykImage()) {
- plt[0] = FXCMYK_TODIB(src_plt[0]);
- plt[1] = FXCMYK_TODIB(src_plt[1]);
- } else {
- uint8_t* bgr_ptr = (uint8_t*)plt;
- bgr_ptr[0] = FXARGB_B(src_plt[0]);
- bgr_ptr[1] = FXARGB_G(src_plt[0]);
- bgr_ptr[2] = FXARGB_R(src_plt[0]);
- bgr_ptr[3] = FXARGB_B(src_plt[1]);
- bgr_ptr[4] = FXARGB_G(src_plt[1]);
- bgr_ptr[5] = FXARGB_R(src_plt[1]);
- }
- CCodec_IccModule* pIccModule =
- CFX_GEModule::Get()->GetCodecModule()->GetIccModule();
- pIccModule->TranslateScanline(pIccTransform, gray, (const uint8_t*)plt, 2);
+ uint8_t reset_r;
+ uint8_t reset_g;
+ uint8_t reset_b;
+ uint8_t set_r;
+ uint8_t set_g;
+ uint8_t set_b;
+ if (pSrcBitmap->IsCmykImage()) {
+ AdobeCMYK_to_sRGB1(FXSYS_GetCValue(src_plt[0]), FXSYS_GetMValue(src_plt[0]),
+ FXSYS_GetYValue(src_plt[0]), FXSYS_GetKValue(src_plt[0]),
+ reset_r, reset_g, reset_b);
+ AdobeCMYK_to_sRGB1(FXSYS_GetCValue(src_plt[1]), FXSYS_GetMValue(src_plt[1]),
+ FXSYS_GetYValue(src_plt[1]), FXSYS_GetKValue(src_plt[1]),
+ set_r, set_g, set_b);
} else {
- uint8_t reset_r, reset_g, reset_b, set_r, set_g, set_b;
- if (pSrcBitmap->IsCmykImage()) {
- AdobeCMYK_to_sRGB1(
- FXSYS_GetCValue(src_plt[0]), FXSYS_GetMValue(src_plt[0]),
- FXSYS_GetYValue(src_plt[0]), FXSYS_GetKValue(src_plt[0]), reset_r,
- reset_g, reset_b);
- AdobeCMYK_to_sRGB1(FXSYS_GetCValue(src_plt[1]),
- FXSYS_GetMValue(src_plt[1]),
- FXSYS_GetYValue(src_plt[1]),
- FXSYS_GetKValue(src_plt[1]), set_r, set_g, set_b);
- } else {
- reset_r = FXARGB_R(src_plt[0]);
- reset_g = FXARGB_G(src_plt[0]);
- reset_b = FXARGB_B(src_plt[0]);
- set_r = FXARGB_R(src_plt[1]);
- set_g = FXARGB_G(src_plt[1]);
- set_b = FXARGB_B(src_plt[1]);
- }
- gray[0] = FXRGB2GRAY(reset_r, reset_g, reset_b);
- gray[1] = FXRGB2GRAY(set_r, set_g, set_b);
- }
+ reset_r = FXARGB_R(src_plt[0]);
+ reset_g = FXARGB_G(src_plt[0]);
+ reset_b = FXARGB_B(src_plt[0]);
+ set_r = FXARGB_R(src_plt[1]);
+ set_g = FXARGB_G(src_plt[1]);
+ set_b = FXARGB_B(src_plt[1]);
+ }
+ gray[0] = FXRGB2GRAY(reset_r, reset_g, reset_b);
+ gray[1] = FXRGB2GRAY(set_r, set_g, set_b);
+
for (int row = 0; row < height; row++) {
uint8_t* dest_scan = dest_buf + row * dest_pitch;
FXSYS_memset(dest_scan, gray[0], width);
@@ -230,50 +214,33 @@ FX_BOOL ConvertBuffer_1bppPlt2Gray(uint8_t* dest_buf,
}
return TRUE;
}
+
FX_BOOL ConvertBuffer_8bppPlt2Gray(uint8_t* dest_buf,
int dest_pitch,
int width,
int height,
const CFX_DIBSource* pSrcBitmap,
int src_left,
- int src_top,
- void* pIccTransform) {
+ int src_top) {
uint32_t* src_plt = pSrcBitmap->GetPalette();
uint8_t gray[256];
- if (pIccTransform) {
- uint32_t plt[256];
- if (pSrcBitmap->IsCmykImage()) {
- for (int i = 0; i < 256; i++) {
- plt[i] = FXCMYK_TODIB(src_plt[i]);
- }
- } else {
- uint8_t* bgr_ptr = (uint8_t*)plt;
- for (int i = 0; i < 256; i++) {
- *bgr_ptr++ = FXARGB_B(src_plt[i]);
- *bgr_ptr++ = FXARGB_G(src_plt[i]);
- *bgr_ptr++ = FXARGB_R(src_plt[i]);
- }
+ if (pSrcBitmap->IsCmykImage()) {
+ uint8_t r;
+ uint8_t g;
+ uint8_t b;
+ for (size_t i = 0; i < FX_ArraySize(gray); i++) {
+ AdobeCMYK_to_sRGB1(
+ FXSYS_GetCValue(src_plt[i]), FXSYS_GetMValue(src_plt[i]),
+ FXSYS_GetYValue(src_plt[i]), FXSYS_GetKValue(src_plt[i]), r, g, b);
+ gray[i] = FXRGB2GRAY(r, g, b);
}
- CCodec_IccModule* pIccModule =
- CFX_GEModule::Get()->GetCodecModule()->GetIccModule();
- pIccModule->TranslateScanline(pIccTransform, gray, (const uint8_t*)plt,
- 256);
} else {
- if (pSrcBitmap->IsCmykImage()) {
- uint8_t r, g, b;
- for (int i = 0; i < 256; i++) {
- AdobeCMYK_to_sRGB1(
- FXSYS_GetCValue(src_plt[i]), FXSYS_GetMValue(src_plt[i]),
- FXSYS_GetYValue(src_plt[i]), FXSYS_GetKValue(src_plt[i]), r, g, b);
- gray[i] = FXRGB2GRAY(r, g, b);
- }
- } else {
- for (int i = 0; i < 256; i++) {
- gray[i] = FXRGB2GRAY(FXARGB_R(src_plt[i]), FXARGB_G(src_plt[i]),
- FXARGB_B(src_plt[i]));
- }
+ for (size_t i = 0; i < FX_ArraySize(gray); i++) {
+ gray[i] = FXRGB2GRAY(FXARGB_R(src_plt[i]), FXARGB_G(src_plt[i]),
+ FXARGB_B(src_plt[i]));
}
}
+
for (int row = 0; row < height; row++) {
uint8_t* dest_scan = dest_buf + row * dest_pitch;
const uint8_t* src_scan = pSrcBitmap->GetScanline(src_top + row) + src_left;
@@ -283,75 +250,51 @@ FX_BOOL ConvertBuffer_8bppPlt2Gray(uint8_t* dest_buf,
}
return TRUE;
}
+
FX_BOOL ConvertBuffer_RgbOrCmyk2Gray(uint8_t* dest_buf,
int dest_pitch,
int width,
int height,
const CFX_DIBSource* pSrcBitmap,
int src_left,
- int src_top,
- void* pIccTransform) {
+ int src_top) {
int Bpp = pSrcBitmap->GetBPP() / 8;
- if (pIccTransform) {
- CCodec_IccModule* pIccModule =
- CFX_GEModule::Get()->GetCodecModule()->GetIccModule();
- if (Bpp == 3 || pSrcBitmap->IsCmykImage()) {
- for (int row = 0; row < height; row++) {
- uint8_t* dest_scan = dest_buf + row * dest_pitch;
- const uint8_t* src_scan =
- pSrcBitmap->GetScanline(src_top + row) + src_left * Bpp;
- pIccModule->TranslateScanline(pIccTransform, dest_scan, src_scan,
- width);
- }
- } else {
- for (int row = 0; row < height; row++) {
- uint8_t* dest_scan = dest_buf + row * dest_pitch;
- const uint8_t* src_scan =
- pSrcBitmap->GetScanline(src_top + row) + src_left * 4;
- for (int col = 0; col < width; col++) {
- pIccModule->TranslateScanline(pIccTransform, dest_scan, src_scan, 1);
- dest_scan++;
- src_scan += 4;
- }
+ if (pSrcBitmap->IsCmykImage()) {
+ for (int row = 0; row < height; row++) {
+ uint8_t* dest_scan = dest_buf + row * dest_pitch;
+ const uint8_t* src_scan =
+ pSrcBitmap->GetScanline(src_top + row) + src_left * 4;
+ for (int col = 0; col < width; col++) {
+ uint8_t r, g, b;
+ AdobeCMYK_to_sRGB1(FXSYS_GetCValue((uint32_t)src_scan[0]),
+ FXSYS_GetMValue((uint32_t)src_scan[1]),
+ FXSYS_GetYValue((uint32_t)src_scan[2]),
+ FXSYS_GetKValue((uint32_t)src_scan[3]), r, g, b);
+ *dest_scan++ = FXRGB2GRAY(r, g, b);
+ src_scan += 4;
}
}
} else {
- if (pSrcBitmap->IsCmykImage()) {
- for (int row = 0; row < height; row++) {
- uint8_t* dest_scan = dest_buf + row * dest_pitch;
- const uint8_t* src_scan =
- pSrcBitmap->GetScanline(src_top + row) + src_left * 4;
- for (int col = 0; col < width; col++) {
- uint8_t r, g, b;
- AdobeCMYK_to_sRGB1(FXSYS_GetCValue((uint32_t)src_scan[0]),
- FXSYS_GetMValue((uint32_t)src_scan[1]),
- FXSYS_GetYValue((uint32_t)src_scan[2]),
- FXSYS_GetKValue((uint32_t)src_scan[3]), r, g, b);
- *dest_scan++ = FXRGB2GRAY(r, g, b);
- src_scan += 4;
- }
- }
- } else {
- for (int row = 0; row < height; row++) {
- uint8_t* dest_scan = dest_buf + row * dest_pitch;
- const uint8_t* src_scan =
- pSrcBitmap->GetScanline(src_top + row) + src_left * Bpp;
- for (int col = 0; col < width; col++) {
- *dest_scan++ = FXRGB2GRAY(src_scan[2], src_scan[1], src_scan[0]);
- src_scan += Bpp;
- }
+ for (int row = 0; row < height; row++) {
+ uint8_t* dest_scan = dest_buf + row * dest_pitch;
+ const uint8_t* src_scan =
+ pSrcBitmap->GetScanline(src_top + row) + src_left * Bpp;
+ for (int col = 0; col < width; col++) {
+ *dest_scan++ = FXRGB2GRAY(src_scan[2], src_scan[1], src_scan[0]);
+ src_scan += Bpp;
}
}
}
return TRUE;
}
-inline void ConvertBuffer_IndexCopy(uint8_t* dest_buf,
- int dest_pitch,
- int width,
- int height,
- const CFX_DIBSource* pSrcBitmap,
- int src_left,
- int src_top) {
+
+void ConvertBuffer_IndexCopy(uint8_t* dest_buf,
+ int dest_pitch,
+ int width,
+ int height,
+ const CFX_DIBSource* pSrcBitmap,
+ int src_left,
+ int src_top) {
if (pSrcBitmap->GetBPP() == 1) {
for (int row = 0; row < height; row++) {
uint8_t* dest_scan = dest_buf + row * dest_pitch;
@@ -373,6 +316,7 @@ inline void ConvertBuffer_IndexCopy(uint8_t* dest_buf,
}
}
}
+
FX_BOOL ConvertBuffer_Plt2PltRgb8(uint8_t* dest_buf,
int dest_pitch,
int width,
@@ -380,58 +324,35 @@ FX_BOOL ConvertBuffer_Plt2PltRgb8(uint8_t* dest_buf,
const CFX_DIBSource* pSrcBitmap,
int src_left,
int src_top,
- uint32_t* dst_plt,
- void* pIccTransform) {
+ uint32_t* dst_plt) {
ConvertBuffer_IndexCopy(dest_buf, dest_pitch, width, height, pSrcBitmap,
src_left, src_top);
uint32_t* src_plt = pSrcBitmap->GetPalette();
int plt_size = pSrcBitmap->GetPaletteSize();
- if (pIccTransform) {
- uint32_t plt[256];
- uint8_t* bgr_ptr = (uint8_t*)plt;
- if (pSrcBitmap->IsCmykImage()) {
- for (int i = 0; i < plt_size; i++) {
- plt[i] = FXCMYK_TODIB(src_plt[i]);
- }
- } else {
- for (int i = 0; i < plt_size; i++) {
- *bgr_ptr++ = FXARGB_B(src_plt[i]);
- *bgr_ptr++ = FXARGB_G(src_plt[i]);
- *bgr_ptr++ = FXARGB_R(src_plt[i]);
- }
- bgr_ptr = (uint8_t*)plt;
- }
- CCodec_IccModule* pIccModule =
- CFX_GEModule::Get()->GetCodecModule()->GetIccModule();
- pIccModule->TranslateScanline(pIccTransform, (uint8_t*)plt,
- (const uint8_t*)plt, plt_size);
+ if (pSrcBitmap->IsCmykImage()) {
for (int i = 0; i < plt_size; i++) {
- dst_plt[i] = FXARGB_MAKE(0xff, bgr_ptr[2], bgr_ptr[1], bgr_ptr[0]);
- bgr_ptr += 3;
+ uint8_t r;
+ uint8_t g;
+ uint8_t b;
+ AdobeCMYK_to_sRGB1(
+ FXSYS_GetCValue(src_plt[i]), FXSYS_GetMValue(src_plt[i]),
+ FXSYS_GetYValue(src_plt[i]), FXSYS_GetKValue(src_plt[i]), r, g, b);
+ dst_plt[i] = FXARGB_MAKE(0xff, r, g, b);
}
} else {
- if (pSrcBitmap->IsCmykImage()) {
- for (int i = 0; i < plt_size; i++) {
- uint8_t 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]), r, g, b);
- dst_plt[i] = FXARGB_MAKE(0xff, r, g, b);
- }
- } else {
- FXSYS_memcpy(dst_plt, src_plt, plt_size * 4);
- }
+ FXSYS_memcpy(dst_plt, src_plt, plt_size * 4);
}
return TRUE;
}
-FX_BOOL ConvertBuffer_Rgb2PltRgb8_NoTransform(uint8_t* dest_buf,
- int dest_pitch,
- int width,
- int height,
- const CFX_DIBSource* pSrcBitmap,
- int src_left,
- int src_top,
- uint32_t* dst_plt) {
+
+FX_BOOL ConvertBuffer_Rgb2PltRgb8(uint8_t* dest_buf,
+ int dest_pitch,
+ int width,
+ int height,
+ const CFX_DIBSource* pSrcBitmap,
+ int src_left,
+ int src_top,
+ uint32_t* dst_plt) {
int bpp = pSrcBitmap->GetBPP() / 8;
CFX_Palette palette;
palette.BuildPalette(pSrcBitmap);
@@ -485,31 +406,7 @@ FX_BOOL ConvertBuffer_Rgb2PltRgb8_NoTransform(uint8_t* dest_buf,
FXSYS_memcpy(dst_plt, pPalette, sizeof(uint32_t) * 256);
return TRUE;
}
-FX_BOOL ConvertBuffer_Rgb2PltRgb8(uint8_t* dest_buf,
- int dest_pitch,
- int width,
- int height,
- const CFX_DIBSource* pSrcBitmap,
- int src_left,
- int src_top,
- uint32_t* dst_plt,
- void* pIccTransform) {
- FX_BOOL ret = ConvertBuffer_Rgb2PltRgb8_NoTransform(
- dest_buf, dest_pitch, width, height, pSrcBitmap, src_left, src_top,
- dst_plt);
- if (ret && pIccTransform) {
- CCodec_IccModule* pIccModule =
- CFX_GEModule::Get()->GetCodecModule()->GetIccModule();
- for (int i = 0; i < 256; i++) {
- FX_ARGB* plt = dst_plt + i;
- FX_ARGB plt_entry = FXARGB_TODIB(*plt);
- pIccModule->TranslateScanline(pIccTransform, (uint8_t*)&plt_entry,
- (const uint8_t*)&plt_entry, 1);
- *plt = FXARGB_TODIB(plt_entry);
- }
- }
- return ret;
-}
+
FX_BOOL ConvertBuffer_1bppMask2Rgb(FXDIB_Format dst_format,
uint8_t* dest_buf,
int dest_pitch,
@@ -540,6 +437,7 @@ FX_BOOL ConvertBuffer_1bppMask2Rgb(FXDIB_Format dst_format,
}
return TRUE;
}
+
FX_BOOL ConvertBuffer_8bppMask2Rgb(FXDIB_Format dst_format,
uint8_t* dest_buf,
int dest_pitch,
@@ -563,6 +461,7 @@ FX_BOOL ConvertBuffer_8bppMask2Rgb(FXDIB_Format dst_format,
}
return TRUE;
}
+
FX_BOOL ConvertBuffer_1bppPlt2Rgb(FXDIB_Format dst_format,
uint8_t* dest_buf,
int dest_pitch,
@@ -570,8 +469,7 @@ FX_BOOL ConvertBuffer_1bppPlt2Rgb(FXDIB_Format dst_format,
int height,
const CFX_DIBSource* pSrcBitmap,
int src_left,
- int src_top,
- void* pIccTransform) {
+ int src_top) {
int comps = (dst_format & 0xff) / 8;
uint32_t* src_plt = pSrcBitmap->GetPalette();
uint32_t plt[2];
@@ -587,23 +485,16 @@ FX_BOOL ConvertBuffer_1bppPlt2Rgb(FXDIB_Format dst_format,
bgr_ptr[4] = FXARGB_G(src_plt[1]);
bgr_ptr[5] = FXARGB_R(src_plt[1]);
}
- if (pIccTransform) {
- CCodec_IccModule* pIccModule =
- CFX_GEModule::Get()->GetCodecModule()->GetIccModule();
- pIccModule->TranslateScanline(pIccTransform, (uint8_t*)plt,
- (const uint8_t*)plt, 2);
- } else {
- if (pSrcBitmap->IsCmykImage()) {
- AdobeCMYK_to_sRGB1(
- FXSYS_GetCValue(src_plt[0]), FXSYS_GetMValue(src_plt[0]),
- FXSYS_GetYValue(src_plt[0]), FXSYS_GetKValue(src_plt[0]), bgr_ptr[2],
- bgr_ptr[1], bgr_ptr[0]);
- AdobeCMYK_to_sRGB1(
- FXSYS_GetCValue(src_plt[1]), FXSYS_GetMValue(src_plt[1]),
- FXSYS_GetYValue(src_plt[1]), FXSYS_GetKValue(src_plt[1]), bgr_ptr[5],
- bgr_ptr[4], bgr_ptr[3]);
- }
+
+ if (pSrcBitmap->IsCmykImage()) {
+ AdobeCMYK_to_sRGB1(FXSYS_GetCValue(src_plt[0]), FXSYS_GetMValue(src_plt[0]),
+ FXSYS_GetYValue(src_plt[0]), FXSYS_GetKValue(src_plt[0]),
+ bgr_ptr[2], bgr_ptr[1], bgr_ptr[0]);
+ AdobeCMYK_to_sRGB1(FXSYS_GetCValue(src_plt[1]), FXSYS_GetMValue(src_plt[1]),
+ FXSYS_GetYValue(src_plt[1]), FXSYS_GetKValue(src_plt[1]),
+ bgr_ptr[5], bgr_ptr[4], bgr_ptr[3]);
}
+
for (int row = 0; row < height; row++) {
uint8_t* dest_scan = dest_buf + row * dest_pitch;
const uint8_t* src_scan = pSrcBitmap->GetScanline(src_top + row);
@@ -622,6 +513,7 @@ FX_BOOL ConvertBuffer_1bppPlt2Rgb(FXDIB_Format dst_format,
}
return TRUE;
}
+
FX_BOOL ConvertBuffer_8bppPlt2Rgb(FXDIB_Format dst_format,
uint8_t* dest_buf,
int dest_pitch,
@@ -629,8 +521,7 @@ FX_BOOL ConvertBuffer_8bppPlt2Rgb(FXDIB_Format dst_format,
int height,
const CFX_DIBSource* pSrcBitmap,
int src_left,
- int src_top,
- void* pIccTransform) {
+ int src_top) {
int comps = (dst_format & 0xff) / 8;
uint32_t* src_plt = pSrcBitmap->GetPalette();
uint32_t plt[256];
@@ -643,28 +534,18 @@ FX_BOOL ConvertBuffer_8bppPlt2Rgb(FXDIB_Format dst_format,
}
bgr_ptr = (uint8_t*)plt;
}
- if (pIccTransform) {
- if (pSrcBitmap->IsCmykImage()) {
- for (int i = 0; i < 256; i++) {
- plt[i] = FXCMYK_TODIB(src_plt[i]);
- }
- }
- CCodec_IccModule* pIccModule =
- CFX_GEModule::Get()->GetCodecModule()->GetIccModule();
- pIccModule->TranslateScanline(pIccTransform, (uint8_t*)plt,
- (const uint8_t*)plt, 256);
- } else {
- if (pSrcBitmap->IsCmykImage()) {
- for (int i = 0; i < 256; i++) {
- AdobeCMYK_to_sRGB1(
- FXSYS_GetCValue(src_plt[i]), FXSYS_GetMValue(src_plt[i]),
- FXSYS_GetYValue(src_plt[i]), FXSYS_GetKValue(src_plt[i]),
- bgr_ptr[2], bgr_ptr[1], bgr_ptr[0]);
- bgr_ptr += 3;
- }
- bgr_ptr = (uint8_t*)plt;
+
+ if (pSrcBitmap->IsCmykImage()) {
+ for (int i = 0; i < 256; i++) {
+ AdobeCMYK_to_sRGB1(
+ FXSYS_GetCValue(src_plt[i]), FXSYS_GetMValue(src_plt[i]),
+ FXSYS_GetYValue(src_plt[i]), FXSYS_GetKValue(src_plt[i]), bgr_ptr[2],
+ bgr_ptr[1], bgr_ptr[0]);
+ bgr_ptr += 3;
}
+ bgr_ptr = (uint8_t*)plt;
}
+
for (int row = 0; row < height; row++) {
uint8_t* dest_scan = dest_buf + row * dest_pitch;
const uint8_t* src_scan = pSrcBitmap->GetScanline(src_top + row) + src_left;
@@ -678,41 +559,30 @@ FX_BOOL ConvertBuffer_8bppPlt2Rgb(FXDIB_Format dst_format,
}
return TRUE;
}
+
FX_BOOL ConvertBuffer_24bppRgb2Rgb24(uint8_t* dest_buf,
int dest_pitch,
int width,
int height,
const CFX_DIBSource* pSrcBitmap,
int src_left,
- int src_top,
- void* pIccTransform) {
- if (pIccTransform) {
- CCodec_IccModule* pIccModule =
- CFX_GEModule::Get()->GetCodecModule()->GetIccModule();
- for (int row = 0; row < height; row++) {
- uint8_t* dest_scan = dest_buf + row * dest_pitch;
- const uint8_t* src_scan =
- pSrcBitmap->GetScanline(src_top + row) + src_left * 3;
- pIccModule->TranslateScanline(pIccTransform, dest_scan, src_scan, width);
- }
- } else {
- for (int row = 0; row < height; row++) {
- uint8_t* dest_scan = dest_buf + row * dest_pitch;
- const uint8_t* src_scan =
- pSrcBitmap->GetScanline(src_top + row) + src_left * 3;
- FXSYS_memcpy(dest_scan, src_scan, width * 3);
- }
+ int src_top) {
+ for (int row = 0; row < height; row++) {
+ uint8_t* dest_scan = dest_buf + row * dest_pitch;
+ const uint8_t* src_scan =
+ pSrcBitmap->GetScanline(src_top + row) + src_left * 3;
+ FXSYS_memcpy(dest_scan, src_scan, width * 3);
}
return TRUE;
}
+
FX_BOOL ConvertBuffer_32bppRgb2Rgb24(uint8_t* dest_buf,
int dest_pitch,
int width,
int height,
const CFX_DIBSource* pSrcBitmap,
int src_left,
- int src_top,
- void* pIccTransform) {
+ int src_top) {
for (int row = 0; row < height; row++) {
uint8_t* dest_scan = dest_buf + row * dest_pitch;
const uint8_t* src_scan =
@@ -724,90 +594,53 @@ FX_BOOL ConvertBuffer_32bppRgb2Rgb24(uint8_t* dest_buf,
src_scan++;
}
}
- if (pIccTransform) {
- CCodec_IccModule* pIccModule =
- CFX_GEModule::Get()->GetCodecModule()->GetIccModule();
- for (int row = 0; row < height; row++) {
- uint8_t* dest_scan = dest_buf + row * dest_pitch;
- pIccModule->TranslateScanline(pIccTransform, dest_scan, dest_scan, width);
- }
- }
return TRUE;
}
+
FX_BOOL ConvertBuffer_Rgb2Rgb32(uint8_t* dest_buf,
int dest_pitch,
int width,
int height,
const CFX_DIBSource* pSrcBitmap,
int src_left,
- int src_top,
- void* pIccTransform) {
+ int src_top) {
int comps = pSrcBitmap->GetBPP() / 8;
- if (pIccTransform) {
- CCodec_IccModule* pIccModule =
- CFX_GEModule::Get()->GetCodecModule()->GetIccModule();
- for (int row = 0; row < height; row++) {
- uint8_t* dest_scan = dest_buf + row * dest_pitch;
- const uint8_t* src_scan =
- pSrcBitmap->GetScanline(src_top + row) + src_left * comps;
- for (int col = 0; col < width; col++) {
- pIccModule->TranslateScanline(pIccTransform, dest_scan, src_scan, 1);
- dest_scan += 4;
- src_scan += comps;
- }
- }
- } else {
- for (int row = 0; row < height; row++) {
- uint8_t* dest_scan = dest_buf + row * dest_pitch;
- const uint8_t* src_scan =
- pSrcBitmap->GetScanline(src_top + row) + src_left * comps;
- for (int col = 0; col < width; col++) {
- *dest_scan++ = *src_scan++;
- *dest_scan++ = *src_scan++;
- *dest_scan++ = *src_scan++;
- dest_scan++;
- src_scan += comps - 3;
- }
+ for (int row = 0; row < height; row++) {
+ uint8_t* dest_scan = dest_buf + row * dest_pitch;
+ const uint8_t* src_scan =
+ pSrcBitmap->GetScanline(src_top + row) + src_left * comps;
+ for (int col = 0; col < width; col++) {
+ *dest_scan++ = *src_scan++;
+ *dest_scan++ = *src_scan++;
+ *dest_scan++ = *src_scan++;
+ dest_scan++;
+ src_scan += comps - 3;
}
}
return TRUE;
}
+
FX_BOOL ConvertBuffer_32bppCmyk2Rgb32(uint8_t* dest_buf,
int dest_pitch,
int width,
int height,
const CFX_DIBSource* pSrcBitmap,
int src_left,
- int src_top,
- void* pIccTransform) {
- if (pIccTransform) {
- CCodec_IccModule* pIccModule =
- CFX_GEModule::Get()->GetCodecModule()->GetIccModule();
- for (int row = 0; row < height; row++) {
- uint8_t* dest_scan = dest_buf + row * dest_pitch;
- const uint8_t* src_scan =
- pSrcBitmap->GetScanline(src_top + row) + src_left * 4;
- for (int col = 0; col < width; col++) {
- pIccModule->TranslateScanline(pIccTransform, dest_scan, src_scan, 1);
- dest_scan += 4;
- src_scan += 4;
- }
- }
- } else {
- for (int row = 0; row < height; row++) {
- uint8_t* dest_scan = dest_buf + row * dest_pitch;
- const uint8_t* src_scan =
- pSrcBitmap->GetScanline(src_top + row) + src_left * 4;
- for (int col = 0; col < width; col++) {
- AdobeCMYK_to_sRGB1(src_scan[0], src_scan[1], src_scan[2], src_scan[3],
- dest_scan[2], dest_scan[1], dest_scan[0]);
- dest_scan += 4;
- src_scan += 4;
- }
+ int src_top) {
+ for (int row = 0; row < height; row++) {
+ uint8_t* dest_scan = dest_buf + row * dest_pitch;
+ const uint8_t* src_scan =
+ pSrcBitmap->GetScanline(src_top + row) + src_left * 4;
+ for (int col = 0; col < width; col++) {
+ AdobeCMYK_to_sRGB1(src_scan[0], src_scan[1], src_scan[2], src_scan[3],
+ dest_scan[2], dest_scan[1], dest_scan[0]);
+ dest_scan += 4;
+ src_scan += 4;
}
}
return TRUE;
}
+
FX_BOOL ConvertBuffer(FXDIB_Format dest_format,
uint8_t* dest_buf,
int dest_pitch,
@@ -816,13 +649,8 @@ FX_BOOL ConvertBuffer(FXDIB_Format dest_format,
const CFX_DIBSource* pSrcBitmap,
int src_left,
int src_top,
- uint32_t*& d_pal,
- void* pIccTransform) {
+ uint32_t*& d_pal) {
FXDIB_Format src_format = pSrcBitmap->GetFormat();
- if (!CFX_GEModule::Get()->GetCodecModule() ||
- !CFX_GEModule::Get()->GetCodecModule()->GetIccModule()) {
- pIccTransform = nullptr;
- }
switch (dest_format) {
case FXDIB_Invalid:
case FXDIB_1bppCmyk:
@@ -834,8 +662,7 @@ FX_BOOL ConvertBuffer(FXDIB_Format dest_format,
if ((src_format & 0xff) == 1) {
if (pSrcBitmap->GetPalette()) {
return ConvertBuffer_1bppPlt2Gray(dest_buf, dest_pitch, width, height,
- pSrcBitmap, src_left, src_top,
- pIccTransform);
+ pSrcBitmap, src_left, src_top);
}
return ConvertBuffer_1bppMask2Gray(dest_buf, dest_pitch, width, height,
pSrcBitmap, src_left, src_top);
@@ -843,16 +670,14 @@ FX_BOOL ConvertBuffer(FXDIB_Format dest_format,
if ((src_format & 0xff) == 8) {
if (pSrcBitmap->GetPalette()) {
return ConvertBuffer_8bppPlt2Gray(dest_buf, dest_pitch, width, height,
- pSrcBitmap, src_left, src_top,
- pIccTransform);
+ pSrcBitmap, src_left, src_top);
}
return ConvertBuffer_8bppMask2Gray(dest_buf, dest_pitch, width, height,
pSrcBitmap, src_left, src_top);
}
if ((src_format & 0xff) >= 24) {
return ConvertBuffer_RgbOrCmyk2Gray(dest_buf, dest_pitch, width, height,
- pSrcBitmap, src_left, src_top,
- pIccTransform);
+ pSrcBitmap, src_left, src_top);
}
return FALSE;
}
@@ -860,20 +685,17 @@ FX_BOOL ConvertBuffer(FXDIB_Format dest_format,
case FXDIB_8bppRgba: {
if ((src_format & 0xff) == 8 && !pSrcBitmap->GetPalette()) {
return ConvertBuffer(FXDIB_8bppMask, dest_buf, dest_pitch, width,
- height, pSrcBitmap, src_left, src_top, d_pal,
- pIccTransform);
+ height, pSrcBitmap, src_left, src_top, d_pal);
}
d_pal = FX_Alloc(uint32_t, 256);
if (((src_format & 0xff) == 1 || (src_format & 0xff) == 8) &&
pSrcBitmap->GetPalette()) {
return ConvertBuffer_Plt2PltRgb8(dest_buf, dest_pitch, width, height,
- pSrcBitmap, src_left, src_top, d_pal,
- pIccTransform);
+ pSrcBitmap, src_left, src_top, d_pal);
}
if ((src_format & 0xff) >= 24) {
return ConvertBuffer_Rgb2PltRgb8(dest_buf, dest_pitch, width, height,
- pSrcBitmap, src_left, src_top, d_pal,
- pIccTransform);
+ pSrcBitmap, src_left, src_top, d_pal);
}
return FALSE;
}
@@ -883,7 +705,7 @@ FX_BOOL ConvertBuffer(FXDIB_Format dest_format,
if (pSrcBitmap->GetPalette()) {
return ConvertBuffer_1bppPlt2Rgb(dest_format, dest_buf, dest_pitch,
width, height, pSrcBitmap, src_left,
- src_top, pIccTransform);
+ src_top);
}
return ConvertBuffer_1bppMask2Rgb(dest_format, dest_buf, dest_pitch,
width, height, pSrcBitmap, src_left,
@@ -893,7 +715,7 @@ FX_BOOL ConvertBuffer(FXDIB_Format dest_format,
if (pSrcBitmap->GetPalette()) {
return ConvertBuffer_8bppPlt2Rgb(dest_format, dest_buf, dest_pitch,
width, height, pSrcBitmap, src_left,
- src_top, pIccTransform);
+ src_top);
}
return ConvertBuffer_8bppMask2Rgb(dest_format, dest_buf, dest_pitch,
width, height, pSrcBitmap, src_left,
@@ -901,13 +723,11 @@ FX_BOOL ConvertBuffer(FXDIB_Format dest_format,
}
if ((src_format & 0xff) == 24) {
return ConvertBuffer_24bppRgb2Rgb24(dest_buf, dest_pitch, width, height,
- pSrcBitmap, src_left, src_top,
- pIccTransform);
+ pSrcBitmap, src_left, src_top);
}
if ((src_format & 0xff) == 32) {
return ConvertBuffer_32bppRgb2Rgb24(dest_buf, dest_pitch, width, height,
- pSrcBitmap, src_left, src_top,
- pIccTransform);
+ pSrcBitmap, src_left, src_top);
}
return FALSE;
}
@@ -917,7 +737,7 @@ FX_BOOL ConvertBuffer(FXDIB_Format dest_format,
if (pSrcBitmap->GetPalette()) {
return ConvertBuffer_1bppPlt2Rgb(dest_format, dest_buf, dest_pitch,
width, height, pSrcBitmap, src_left,
- src_top, pIccTransform);
+ src_top);
}
return ConvertBuffer_1bppMask2Rgb(dest_format, dest_buf, dest_pitch,
width, height, pSrcBitmap, src_left,
@@ -927,7 +747,7 @@ FX_BOOL ConvertBuffer(FXDIB_Format dest_format,
if (pSrcBitmap->GetPalette()) {
return ConvertBuffer_8bppPlt2Rgb(dest_format, dest_buf, dest_pitch,
width, height, pSrcBitmap, src_left,
- src_top, pIccTransform);
+ src_top);
}
return ConvertBuffer_8bppMask2Rgb(dest_format, dest_buf, dest_pitch,
width, height, pSrcBitmap, src_left,
@@ -937,11 +757,10 @@ FX_BOOL ConvertBuffer(FXDIB_Format dest_format,
if (src_format & 0x0400) {
return ConvertBuffer_32bppCmyk2Rgb32(dest_buf, dest_pitch, width,
height, pSrcBitmap, src_left,
- src_top, pIccTransform);
+ src_top);
}
return ConvertBuffer_Rgb2Rgb32(dest_buf, dest_pitch, width, height,
- pSrcBitmap, src_left, src_top,
- pIccTransform);
+ pSrcBitmap, src_left, src_top);
}
return FALSE;
}
@@ -949,37 +768,23 @@ FX_BOOL ConvertBuffer(FXDIB_Format dest_format,
return FALSE;
}
}
-CFX_DIBitmap* CFX_DIBSource::CloneConvert(FXDIB_Format dest_format,
- const FX_RECT* pClip,
- void* pIccTransform) const {
- if (dest_format == GetFormat() && !pIccTransform) {
- return Clone(pClip);
- }
- if (pClip) {
- CFX_DIBitmap* pClone = Clone(pClip);
- if (!pClone) {
- return nullptr;
- }
- if (!pClone->ConvertFormat(dest_format, pIccTransform)) {
- delete pClone;
- return nullptr;
- }
- return pClone;
- }
- CFX_DIBitmap* pClone = new CFX_DIBitmap;
- if (!pClone->Create(m_Width, m_Height, dest_format)) {
- delete pClone;
+
+CFX_DIBitmap* CFX_DIBSource::CloneConvert(FXDIB_Format dest_format) const {
+ if (dest_format == GetFormat())
+ return Clone(nullptr);
+
+ std::unique_ptr<CFX_DIBitmap> pClone(new CFX_DIBitmap);
+ if (!pClone->Create(m_Width, m_Height, dest_format))
return nullptr;
- }
- FX_BOOL ret = TRUE;
+
CFX_DIBitmap* pSrcAlpha = nullptr;
if (HasAlpha()) {
pSrcAlpha = (GetFormat() == FXDIB_Argb) ? GetAlphaMask() : m_pAlphaMask;
- if (!pSrcAlpha) {
- delete pClone;
+ if (!pSrcAlpha)
return nullptr;
- }
}
+
+ FX_BOOL ret = TRUE;
if (dest_format & 0x0200) {
if (dest_format == FXDIB_Argb) {
ret = pSrcAlpha ? pClone->LoadChannel(FXDIB_Alpha, pSrcAlpha, FXDIB_Alpha)
@@ -992,38 +797,33 @@ CFX_DIBitmap* CFX_DIBSource::CloneConvert(FXDIB_Format dest_format,
delete pSrcAlpha;
pSrcAlpha = nullptr;
}
- if (!ret) {
- delete pClone;
+ if (!ret)
return nullptr;
- }
+
uint32_t* pal_8bpp = nullptr;
- ret = ConvertBuffer(dest_format, pClone->GetBuffer(), pClone->GetPitch(),
- m_Width, m_Height, this, 0, 0, pal_8bpp, pIccTransform);
- if (!ret) {
+ if (!ConvertBuffer(dest_format, pClone->GetBuffer(), pClone->GetPitch(),
+ m_Width, m_Height, this, 0, 0, pal_8bpp)) {
FX_Free(pal_8bpp);
- delete pClone;
return nullptr;
}
if (pal_8bpp) {
pClone->CopyPalette(pal_8bpp);
FX_Free(pal_8bpp);
- pal_8bpp = nullptr;
}
- return pClone;
+ return pClone.release();
}
-FX_BOOL CFX_DIBitmap::ConvertFormat(FXDIB_Format dest_format,
- void* pIccTransform) {
+
+FX_BOOL CFX_DIBitmap::ConvertFormat(FXDIB_Format dest_format) {
FXDIB_Format src_format = GetFormat();
- if (dest_format == src_format && !pIccTransform) {
+ if (dest_format == src_format)
return TRUE;
- }
+
if (dest_format == FXDIB_8bppMask && src_format == FXDIB_8bppRgb &&
!m_pPalette) {
m_AlphaFlag = 1;
return TRUE;
}
- if (dest_format == FXDIB_Argb && src_format == FXDIB_Rgb32 &&
- !pIccTransform) {
+ if (dest_format == FXDIB_Argb && src_format == FXDIB_Rgb32) {
m_AlphaFlag = 2;
for (int row = 0; row < m_Height; row++) {
uint8_t* scanline = m_pBuffer + row * m_Pitch + 3;
@@ -1076,7 +876,7 @@ FX_BOOL CFX_DIBitmap::ConvertFormat(FXDIB_Format dest_format,
FX_BOOL ret = FALSE;
uint32_t* pal_8bpp = nullptr;
ret = ConvertBuffer(dest_format, dest_buf, dest_pitch, m_Width, m_Height,
- this, 0, 0, pal_8bpp, pIccTransform);
+ this, 0, 0, pal_8bpp);
if (!ret) {
FX_Free(pal_8bpp);
if (pAlphaMask != m_pAlphaMask) {
diff --git a/core/fxge/dib/fx_dib_main.cpp b/core/fxge/dib/fx_dib_main.cpp
index f4ea49b58f..bda5ee5303 100644
--- a/core/fxge/dib/fx_dib_main.cpp
+++ b/core/fxge/dib/fx_dib_main.cpp
@@ -12,16 +12,6 @@
#include "core/fxge/dib/dib_int.h"
#include "core/fxge/include/fx_ge.h"
-FX_BOOL ConvertBuffer(FXDIB_Format dest_format,
- uint8_t* dest_buf,
- int dest_pitch,
- int width,
- int height,
- const CFX_DIBSource* pSrcBitmap,
- int src_left,
- int src_top,
- uint32_t*& pal,
- void* pIccTransform);
void CmykDecode(uint32_t cmyk, int& c, int& m, int& y, int& k) {
c = FXSYS_GetCValue(cmyk);
m = FXSYS_GetMValue(cmyk);
@@ -398,25 +388,25 @@ void CFX_DIBSource::GetOverlapRect(int& dest_left,
width = dest_rect.right - dest_rect.left;
height = dest_rect.bottom - dest_rect.top;
}
+
FX_BOOL CFX_DIBitmap::TransferBitmap(int dest_left,
int dest_top,
int width,
int height,
const CFX_DIBSource* pSrcBitmap,
int src_left,
- int src_top,
- void* pIccTransform) {
- if (!m_pBuffer) {
+ int src_top) {
+ if (!m_pBuffer)
return FALSE;
- }
+
GetOverlapRect(dest_left, dest_top, width, height, pSrcBitmap->GetWidth(),
pSrcBitmap->GetHeight(), src_left, src_top, nullptr);
- if (width == 0 || height == 0) {
+ if (width == 0 || height == 0)
return TRUE;
- }
+
FXDIB_Format dest_format = GetFormat();
FXDIB_Format src_format = pSrcBitmap->GetFormat();
- if (dest_format == src_format && !pIccTransform) {
+ if (dest_format == src_format) {
if (GetBPP() == 1) {
for (int row = 0; row < height; row++) {
uint8_t* dest_scan = m_pBuffer + (dest_top + row) * m_Pitch;
@@ -443,22 +433,23 @@ FX_BOOL CFX_DIBitmap::TransferBitmap(int dest_left,
}
}
} else {
- if (m_pPalette) {
+ if (m_pPalette)
return FALSE;
- }
- if (m_bpp == 8) {
+
+ if (m_bpp == 8)
dest_format = FXDIB_8bppMask;
- }
+
uint8_t* dest_buf =
m_pBuffer + dest_top * m_Pitch + dest_left * GetBPP() / 8;
uint32_t* d_plt = nullptr;
if (!ConvertBuffer(dest_format, dest_buf, m_Pitch, width, height,
- pSrcBitmap, src_left, src_top, d_plt, pIccTransform)) {
+ pSrcBitmap, src_left, src_top, d_plt)) {
return FALSE;
}
}
return TRUE;
}
+
FX_BOOL CFX_DIBitmap::TransferMask(int dest_left,
int dest_top,
int width,
diff --git a/core/fxge/ge/fx_ge_text.cpp b/core/fxge/ge/fx_ge_text.cpp
index f09e44eefb..1a0c14e0db 100644
--- a/core/fxge/ge/fx_ge_text.cpp
+++ b/core/fxge/ge/fx_ge_text.cpp
@@ -365,41 +365,6 @@ bool ShouldDrawDeviceText(const CFX_Font* pFont, uint32_t text_flags) {
} // namespace
-void Color2Argb(FX_ARGB& argb,
- uint32_t color,
- int alpha_flag,
- void* pIccTransform) {
- if (!pIccTransform && !FXGETFLAG_COLORTYPE(alpha_flag)) {
- argb = color;
- return;
- }
- if (!CFX_GEModule::Get()->GetCodecModule() ||
- !CFX_GEModule::Get()->GetCodecModule()->GetIccModule()) {
- pIccTransform = nullptr;
- }
- uint8_t bgra[4];
- if (pIccTransform) {
- CCodec_IccModule* pIccModule =
- CFX_GEModule::Get()->GetCodecModule()->GetIccModule();
- color = FXGETFLAG_COLORTYPE(alpha_flag) ? FXCMYK_TODIB(color)
- : FXARGB_TODIB(color);
- pIccModule->TranslateScanline(pIccTransform, bgra, (const uint8_t*)&color,
- 1);
- bgra[3] = FXGETFLAG_COLORTYPE(alpha_flag)
- ? (alpha_flag >> 24) ? FXGETFLAG_ALPHA_FILL(alpha_flag)
- : FXGETFLAG_ALPHA_STROKE(alpha_flag)
- : FXARGB_A(color);
- argb = FXARGB_MAKE(bgra[3], bgra[2], bgra[1], bgra[0]);
- return;
- }
- AdobeCMYK_to_sRGB1(FXSYS_GetCValue(color), FXSYS_GetMValue(color),
- FXSYS_GetYValue(color), FXSYS_GetKValue(color), bgra[2],
- bgra[1], bgra[0]);
- bgra[3] = (alpha_flag >> 24) ? FXGETFLAG_ALPHA_FILL(alpha_flag)
- : FXGETFLAG_ALPHA_STROKE(alpha_flag);
- argb = FXARGB_MAKE(bgra[3], bgra[2], bgra[1], bgra[0]);
-}
-
FX_RECT FXGE_GetGlyphsBBox(const std::vector<FXTEXT_GLYPHPOS>& glyphs,
int anti_alias,
FX_FLOAT retinaScaleX,
@@ -613,10 +578,9 @@ FX_BOOL CFX_RenderDevice::DrawNormalText(int nChars,
int r = 0;
int g = 0;
int b = 0;
- if (anti_alias == FXFT_RENDER_MODE_LCD) {
- Color2Argb(fill_color, fill_color, (1 << 24), nullptr);
+ if (anti_alias == FXFT_RENDER_MODE_LCD)
ArgbDecode(fill_color, a, r, g, b);
- }
+
for (const FXTEXT_GLYPHPOS& glyph : glyphs) {
if (!glyph.m_pGlyph)
continue;
diff --git a/core/fxge/include/fx_dib.h b/core/fxge/include/fx_dib.h
index b1108076a4..5a31722a82 100644
--- a/core/fxge/include/fx_dib.h
+++ b/core/fxge/include/fx_dib.h
@@ -29,6 +29,7 @@ enum FXDIB_Format {
FXDIB_Cmyk = 0x420,
FXDIB_Cmyka = 0x620,
};
+
enum FXDIB_Channel {
FXDIB_Red = 1,
FXDIB_Green,
@@ -39,6 +40,7 @@ enum FXDIB_Channel {
FXDIB_Black,
FXDIB_Alpha
};
+
#define FXDIB_DOWNSAMPLE 0x04
#define FXDIB_INTERPOL 0x20
#define FXDIB_BICUBIC_INTERPOL 0x80
@@ -153,7 +155,16 @@ FX_ARGB ArgbEncode(int a, FX_COLORREF rgb);
((uint8_t)(argb)) << 16 | ((uint8_t)(argb >> 24) << 24))
#define FXGETFLAG_COLORTYPE(flag) (uint8_t)((flag) >> 8)
#define FXGETFLAG_ALPHA_FILL(flag) (uint8_t)(flag)
-#define FXGETFLAG_ALPHA_STROKE(flag) (uint8_t)((flag) >> 16)
+
+FX_BOOL ConvertBuffer(FXDIB_Format dest_format,
+ uint8_t* dest_buf,
+ int dest_pitch,
+ int width,
+ int height,
+ const CFX_DIBSource* pSrcBitmap,
+ int src_left,
+ int src_top,
+ uint32_t*& pal);
class CFX_DIBSource {
public:
@@ -204,9 +215,7 @@ class CFX_DIBSource {
void CopyPalette(const uint32_t* pSrcPal, uint32_t size = 256);
CFX_DIBitmap* Clone(const FX_RECT* pClip = nullptr) const;
- CFX_DIBitmap* CloneConvert(FXDIB_Format format,
- const FX_RECT* pClip = nullptr,
- void* pIccTransform = nullptr) const;
+ CFX_DIBitmap* CloneConvert(FXDIB_Format format) const;
CFX_DIBitmap* StretchTo(int dest_width,
int dest_height,
@@ -283,7 +292,7 @@ class CFX_DIBitmap : public CFX_DIBSource {
void TakeOver(CFX_DIBitmap* pSrcBitmap);
- FX_BOOL ConvertFormat(FXDIB_Format format, void* pIccTransform = nullptr);
+ FX_BOOL ConvertFormat(FXDIB_Format format);
void Clear(uint32_t color);
@@ -307,8 +316,7 @@ class CFX_DIBitmap : public CFX_DIBSource {
int height,
const CFX_DIBSource* pSrcBitmap,
int src_left,
- int src_top,
- void* pIccTransform = nullptr);
+ int src_top);
FX_BOOL CompositeBitmap(int dest_left,
int dest_top,
@@ -366,8 +374,7 @@ class CFX_DIBitmap : public CFX_DIBSource {
class CFX_DIBExtractor {
public:
- CFX_DIBExtractor(const CFX_DIBSource* pSrc);
-
+ explicit CFX_DIBExtractor(const CFX_DIBSource* pSrc);
~CFX_DIBExtractor();
operator CFX_DIBitmap*() { return m_pBitmap; }
diff --git a/core/fxge/include/fx_font.h b/core/fxge/include/fx_font.h
index f99d4a8af9..8c9bdb92c4 100644
--- a/core/fxge/include/fx_font.h
+++ b/core/fxge/include/fx_font.h
@@ -567,11 +567,6 @@ struct FXTEXT_GLYPHPOS {
FX_FLOAT m_fOriginY;
};
-void Color2Argb(FX_ARGB& argb,
- uint32_t color,
- int alpha_flag,
- void* pIccTransform);
-
FX_RECT FXGE_GetGlyphsBBox(const std::vector<FXTEXT_GLYPHPOS>& glyphs,
int anti_alias,
FX_FLOAT retinaScaleX = 1.0f,
diff --git a/core/fxge/skia/fx_skia_device.cpp b/core/fxge/skia/fx_skia_device.cpp
index ad7bd2d291..4b69d2fee6 100644
--- a/core/fxge/skia/fx_skia_device.cpp
+++ b/core/fxge/skia/fx_skia_device.cpp
@@ -938,32 +938,30 @@ FX_BOOL CFX_SkiaDeviceDriver::GetDIBits(CFX_DIBitmap* pBitmap,
FX_RECT rect(left, top, left + pBitmap->GetWidth(),
top + pBitmap->GetHeight());
- CFX_DIBitmap* pBack;
+ std::unique_ptr<CFX_DIBitmap> pBack;
if (m_pOriDevice) {
- pBack = m_pOriDevice->Clone(&rect);
+ pBack.reset(m_pOriDevice->Clone(&rect));
if (!pBack)
return TRUE;
pBack->CompositeBitmap(0, 0, pBack->GetWidth(), pBack->GetHeight(),
m_pBitmap, 0, 0);
} else {
- pBack = m_pBitmap->Clone(&rect);
+ pBack.reset(m_pBitmap->Clone(&rect));
if (!pBack)
return TRUE;
}
- FX_BOOL bRet = TRUE;
left = std::min(left, 0);
top = std::min(top, 0);
if (m_bRgbByteOrder) {
RgbByteOrderTransferBitmap(pBitmap, 0, 0, rect.Width(), rect.Height(),
- pBack, left, top);
- } else {
- bRet = pBitmap->TransferBitmap(0, 0, rect.Width(), rect.Height(), pBack,
- left, top, nullptr);
+ pBack.get(), left, top);
+ return TRUE;
}
- delete pBack;
- return bRet;
+
+ return pBitmap->TransferBitmap(0, 0, rect.Width(), rect.Height(), pBack.get(),
+ left, top);
}
CFX_DIBitmap* CFX_SkiaDeviceDriver::GetBackDrop() {
diff --git a/core/fxge/win32/fx_win32_device.cpp b/core/fxge/win32/fx_win32_device.cpp
index 9087478837..0b08bba8df 100644
--- a/core/fxge/win32/fx_win32_device.cpp
+++ b/core/fxge/win32/fx_win32_device.cpp
@@ -784,17 +784,14 @@ void CGdiDeviceDriver::RestoreState(bool bKeepSaved) {
FX_BOOL CGdiDeviceDriver::GDI_SetDIBits(CFX_DIBitmap* pBitmap1,
const FX_RECT* pSrcRect,
int left,
- int top,
- void* pIccTransform) {
+ int top) {
if (m_DeviceClass == FXDC_PRINTER) {
std::unique_ptr<CFX_DIBitmap> pBitmap(pBitmap1->FlipImage(FALSE, TRUE));
if (!pBitmap)
return FALSE;
- if ((pBitmap->IsCmykImage() || pIccTransform) &&
- !pBitmap->ConvertFormat(FXDIB_Rgb, pIccTransform)) {
+ if (pBitmap->IsCmykImage() && !pBitmap->ConvertFormat(FXDIB_Rgb))
return FALSE;
- }
int width = pSrcRect->Width(), height = pSrcRect->Height();
LPBYTE pBuffer = pBitmap->GetBuffer();
@@ -809,8 +806,8 @@ FX_BOOL CGdiDeviceDriver::GDI_SetDIBits(CFX_DIBitmap* pBitmap1,
DIB_RGB_COLORS, SRCCOPY);
} else {
CFX_DIBitmap* pBitmap = pBitmap1;
- if (pBitmap->IsCmykImage() || pIccTransform) {
- pBitmap = pBitmap->CloneConvert(FXDIB_Rgb, nullptr, pIccTransform);
+ if (pBitmap->IsCmykImage()) {
+ pBitmap = pBitmap->CloneConvert(FXDIB_Rgb);
if (!pBitmap)
return FALSE;
}
@@ -833,16 +830,14 @@ FX_BOOL CGdiDeviceDriver::GDI_StretchDIBits(CFX_DIBitmap* pBitmap1,
int dest_top,
int dest_width,
int dest_height,
- uint32_t flags,
- void* pIccTransform) {
+ uint32_t flags) {
CFX_DIBitmap* pBitmap = pBitmap1;
if (!pBitmap || dest_width == 0 || dest_height == 0)
return FALSE;
- if ((pBitmap->IsCmykImage() || pIccTransform) &&
- !pBitmap->ConvertFormat(FXDIB_Rgb, pIccTransform)) {
+ if (pBitmap->IsCmykImage() && !pBitmap->ConvertFormat(FXDIB_Rgb))
return FALSE;
- }
+
CFX_ByteString info = CFX_WindowsDIB::GetBitmapInfo(pBitmap);
if ((int64_t)abs(dest_width) * abs(dest_height) <
(int64_t)pBitmap1->GetWidth() * pBitmap1->GetHeight() * 4 ||
@@ -866,9 +861,8 @@ FX_BOOL CGdiDeviceDriver::GDI_StretchDIBits(CFX_DIBitmap* pBitmap1,
pToStrechBitmap->GetBuffer(),
(BITMAPINFO*)toStrechBitmapInfo.c_str(), DIB_RGB_COLORS,
SRCCOPY);
- if (del) {
+ if (del)
delete pToStrechBitmap;
- }
return TRUE;
}
@@ -878,14 +872,11 @@ FX_BOOL CGdiDeviceDriver::GDI_StretchBitMask(CFX_DIBitmap* pBitmap1,
int dest_width,
int dest_height,
uint32_t bitmap_color,
- uint32_t flags,
- int alpha_flag,
- void* pIccTransform) {
+ uint32_t flags) {
CFX_DIBitmap* pBitmap = pBitmap1;
if (!pBitmap || dest_width == 0 || dest_height == 0)
return FALSE;
- Color2Argb(bitmap_color, bitmap_color, alpha_flag | (1 << 24), pIccTransform);
int width = pBitmap->GetWidth(), height = pBitmap->GetHeight();
struct {
BITMAPINFOHEADER bmiHeader;
@@ -999,8 +990,6 @@ FX_BOOL CGdiDeviceDriver::DrawPath(const CFX_PathData* pPathData,
if (blend_type != FXDIB_BLEND_NORMAL)
return FALSE;
- Color2Argb(fill_color, fill_color, 1 << 24, nullptr);
- Color2Argb(stroke_color, stroke_color, 0, nullptr);
CWin32Platform* pPlatform =
(CWin32Platform*)CFX_GEModule::Get()->GetPlatformData();
if (!(pGraphState || stroke_color == 0) &&
@@ -1101,7 +1090,6 @@ FX_BOOL CGdiDeviceDriver::FillRectWithBlend(const FX_RECT* pRect,
if (blend_type != FXDIB_BLEND_NORMAL)
return FALSE;
- Color2Argb(fill_color, fill_color, 1 << 24, nullptr);
int alpha;
FX_COLORREF rgb;
ArgbDecode(fill_color, alpha, rgb);
@@ -1158,7 +1146,6 @@ FX_BOOL CGdiDeviceDriver::DrawCosmeticLine(FX_FLOAT x1,
if (blend_type != FXDIB_BLEND_NORMAL)
return FALSE;
- Color2Argb(color, color, 1 << 24, nullptr);
int a;
FX_COLORREF rgb;
ArgbDecode(color, a, rgb);
@@ -1210,8 +1197,7 @@ FX_BOOL CGdiDisplayDriver::GetDIBits(CFX_DIBitmap* pBitmap, int left, int top) {
bmi.bmiHeader.biBitCount = 24;
::GetDIBits(hDCMemory, hbmp, 0, height, bitmap.GetBuffer(), &bmi,
DIB_RGB_COLORS);
- ret =
- pBitmap->TransferBitmap(0, 0, width, height, &bitmap, 0, 0, nullptr);
+ ret = pBitmap->TransferBitmap(0, 0, width, height, &bitmap, 0, 0);
} else {
ret = FALSE;
}
@@ -1270,7 +1256,7 @@ FX_BOOL CGdiDisplayDriver::SetDIBits(const CFX_DIBSource* pSource,
CFX_DIBitmap* pBitmap = temp;
if (!pBitmap)
return FALSE;
- return GDI_SetDIBits(pBitmap, pSrcRect, left, top, nullptr);
+ return GDI_SetDIBits(pBitmap, pSrcRect, left, top);
}
FX_BOOL CGdiDisplayDriver::UseFoxitStretchEngine(const CFX_DIBSource* pSource,
@@ -1364,7 +1350,7 @@ FX_BOOL CGdiDisplayDriver::StretchDIBits(const CFX_DIBSource* pSource,
if (!pBitmap)
return FALSE;
return GDI_StretchDIBits(pBitmap, dest_left, dest_top, dest_width,
- dest_height, flags, nullptr);
+ dest_height, flags);
}
FX_BOOL CGdiDisplayDriver::StartDIBits(const CFX_DIBSource* pBitmap,
diff --git a/core/fxge/win32/fx_win32_print.cpp b/core/fxge/win32/fx_win32_print.cpp
index 02569edc38..aef6062e73 100644
--- a/core/fxge/win32/fx_win32_print.cpp
+++ b/core/fxge/win32/fx_win32_print.cpp
@@ -55,7 +55,7 @@ FX_BOOL CGdiPrinterDriver::SetDIBits(const CFX_DIBSource* pSource,
if (!pBitmap)
return FALSE;
- return GDI_SetDIBits(pBitmap, pSrcRect, left, top, nullptr);
+ return GDI_SetDIBits(pBitmap, pSrcRect, left, top);
}
FX_BOOL CGdiPrinterDriver::StretchDIBits(const CFX_DIBSource* pSource,
@@ -84,8 +84,8 @@ FX_BOOL CGdiPrinterDriver::StretchDIBits(const CFX_DIBSource* pSource,
dest_top += dest_height;
return GDI_StretchBitMask(pFlipped.get(), dest_left, dest_top,
- abs(dest_width), abs(dest_height), color, flags,
- 0, nullptr);
+ abs(dest_width), abs(dest_height), color,
+ flags);
}
CFX_DIBExtractor temp(pSource);
@@ -93,7 +93,7 @@ FX_BOOL CGdiPrinterDriver::StretchDIBits(const CFX_DIBSource* pSource,
if (!pBitmap)
return FALSE;
return GDI_StretchBitMask(pBitmap, dest_left, dest_top, dest_width,
- dest_height, color, flags, 0, nullptr);
+ dest_height, color, flags);
}
if (pSource->HasAlpha())
@@ -111,7 +111,7 @@ FX_BOOL CGdiPrinterDriver::StretchDIBits(const CFX_DIBSource* pSource,
dest_top += dest_height;
return GDI_StretchDIBits(pFlipped.get(), dest_left, dest_top,
- abs(dest_width), abs(dest_height), flags, nullptr);
+ abs(dest_width), abs(dest_height), flags);
}
CFX_DIBExtractor temp(pSource);
@@ -119,7 +119,7 @@ FX_BOOL CGdiPrinterDriver::StretchDIBits(const CFX_DIBSource* pSource,
if (!pBitmap)
return FALSE;
return GDI_StretchDIBits(pBitmap, dest_left, dest_top, dest_width,
- dest_height, flags, nullptr);
+ dest_height, flags);
}
FX_BOOL CGdiPrinterDriver::StartDIBits(const CFX_DIBSource* pSource,
diff --git a/core/fxge/win32/win32_int.h b/core/fxge/win32/win32_int.h
index 9744324008..e844f5cf24 100644
--- a/core/fxge/win32/win32_int.h
+++ b/core/fxge/win32/win32_int.h
@@ -148,24 +148,20 @@ class CGdiDeviceDriver : public IFX_RenderDeviceDriver {
FX_BOOL GDI_SetDIBits(CFX_DIBitmap* pBitmap,
const FX_RECT* pSrcRect,
int left,
- int top,
- void* pIccTransform);
+ int top);
FX_BOOL GDI_StretchDIBits(CFX_DIBitmap* pBitmap,
int dest_left,
int dest_top,
int dest_width,
int dest_height,
- uint32_t flags,
- void* pIccTransform);
+ uint32_t flags);
FX_BOOL GDI_StretchBitMask(CFX_DIBitmap* pBitmap,
int dest_left,
int dest_top,
int dest_width,
int dest_height,
uint32_t bitmap_color,
- uint32_t flags,
- int alpha_flag,
- void* pIccTransform);
+ uint32_t flags);
HDC m_hDC;
int m_Width;