Remove some references to |cmyk| from fxge/dib.
There are a number of places where a variable once might have contained
either a RGB or a CMYK that no longer can contain CMYK. So remove CMYK
from their names.
- remove a now unused cmyk header while at it.
Change-Id: I785190dd16547e8ca44afacfdb6c5d53d87c9144
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/75610
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
diff --git a/core/fxge/dib/cfx_dibbase.cpp b/core/fxge/dib/cfx_dibbase.cpp
index 0b53c47..a58b84f 100644
--- a/core/fxge/dib/cfx_dibbase.cpp
+++ b/core/fxge/dib/cfx_dibbase.cpp
@@ -15,7 +15,6 @@
#include "core/fxcrt/fx_safe_types.h"
#include "core/fxge/cfx_cliprgn.h"
#include "core/fxge/dib/cfx_bitmapstorer.h"
-#include "core/fxge/dib/cfx_cmyk_to_srgb.h"
#include "core/fxge/dib/cfx_dibitmap.h"
#include "core/fxge/dib/cfx_imagestretcher.h"
#include "core/fxge/dib/cfx_imagetransformer.h"
@@ -188,13 +187,13 @@
}
}
-void ConvertBuffer_RgbOrCmyk2Gray(uint8_t* dest_buf,
- int dest_pitch,
- int width,
- int height,
- const RetainPtr<CFX_DIBBase>& pSrcBitmap,
- int src_left,
- int src_top) {
+void ConvertBuffer_Rgb2Gray(uint8_t* dest_buf,
+ int dest_pitch,
+ int width,
+ int height,
+ const RetainPtr<CFX_DIBBase>& pSrcBitmap,
+ int src_left,
+ int src_top) {
int Bpp = pSrcBitmap->GetBPP() / 8;
for (int row = 0; row < height; ++row) {
uint8_t* dest_scan = dest_buf + row * dest_pitch;
@@ -499,8 +498,8 @@
return true;
case 24:
case 32:
- ConvertBuffer_RgbOrCmyk2Gray(dest_buf, dest_pitch, width, height,
- pSrcBitmap, src_left, src_top);
+ ConvertBuffer_Rgb2Gray(dest_buf, dest_pitch, width, height, pSrcBitmap,
+ src_left, src_top);
return true;
default:
return false;
diff --git a/core/fxge/dib/cfx_dibitmap.cpp b/core/fxge/dib/cfx_dibitmap.cpp
index 37b4887..8bf80a6 100644
--- a/core/fxge/dib/cfx_dibitmap.cpp
+++ b/core/fxge/dib/cfx_dibitmap.cpp
@@ -13,7 +13,6 @@
#include "build/build_config.h"
#include "core/fxcrt/fx_safe_types.h"
#include "core/fxge/cfx_cliprgn.h"
-#include "core/fxge/dib/cfx_cmyk_to_srgb.h"
#include "core/fxge/dib/cfx_scanlinecompositor.h"
#include "third_party/base/check_op.h"
#include "third_party/base/notreached.h"
diff --git a/core/fxge/dib/cfx_imagetransformer.cpp b/core/fxge/dib/cfx_imagetransformer.cpp
index b5b70f7..58e97b6 100644
--- a/core/fxge/dib/cfx_imagetransformer.cpp
+++ b/core/fxge/dib/cfx_imagetransformer.cpp
@@ -500,23 +500,20 @@
uint8_t idx = bilinear_interpol(
cdata.buf, data.row_offset_l, data.row_offset_r, data.src_col_l,
data.src_col_r, data.res_x, data.res_y, 1, 0);
- uint32_t r_bgra_cmyk = argb[idx];
- *reinterpret_cast<uint32_t*>(dest) = r_bgra_cmyk;
+ *reinterpret_cast<uint32_t*>(dest) = argb[idx];
};
DoBilinearLoop(cdata, m_result, m_StretchClip, destBpp, func);
} else if (IsBiCubic()) {
auto func = [&cdata, &argb](const BicubicData& data, uint8_t* dest) {
- uint32_t r_bgra_cmyk = argb[bicubic_interpol(
+ *reinterpret_cast<uint32_t*>(dest) = argb[bicubic_interpol(
cdata.buf, cdata.pitch, data.pos_pixel, data.u_w, data.v_w,
data.res_x, data.res_y, 1, 0)];
- *reinterpret_cast<uint32_t*>(dest) = r_bgra_cmyk;
};
DoBicubicLoop(cdata, m_result, m_StretchClip, destBpp, func);
} else {
auto func = [&cdata, &argb](const DownSampleData& data, uint8_t* dest) {
- uint32_t r_bgra_cmyk =
+ *reinterpret_cast<uint32_t*>(dest) =
argb[cdata.buf[data.src_row * cdata.pitch + data.src_col]];
- *reinterpret_cast<uint32_t*>(dest) = r_bgra_cmyk;
};
DoDownSampleLoop(cdata, m_result, m_StretchClip, destBpp, func);
}
diff --git a/core/fxge/dib/cfx_scanlinecompositor.cpp b/core/fxge/dib/cfx_scanlinecompositor.cpp
index 3ae80ef..47c8880 100644
--- a/core/fxge/dib/cfx_scanlinecompositor.cpp
+++ b/core/fxge/dib/cfx_scanlinecompositor.cpp
@@ -8,7 +8,6 @@
#include <algorithm>
-#include "core/fxge/dib/cfx_cmyk_to_srgb.h"
#include "core/fxge/dib/fx_dib.h"
#include "third_party/base/check.h"
diff --git a/core/fxge/dib/cstretchengine.cpp b/core/fxge/dib/cstretchengine.cpp
index 4649009..5e107cc 100644
--- a/core/fxge/dib/cstretchengine.cpp
+++ b/core/fxge/dib/cstretchengine.cpp
@@ -445,34 +445,34 @@
case TransformMethod::k8BppToManyBpp: {
for (int col = m_DestClip.left; col < m_DestClip.right; ++col) {
PixelWeight* pWeights = m_WeightTable.GetPixelWeight(col);
- int dest_r_y = 0;
- int dest_g_m = 0;
- int dest_b_c = 0;
+ int dest_r = 0;
+ int dest_g = 0;
+ int dest_b = 0;
for (int j = pWeights->m_SrcStart; j <= pWeights->m_SrcEnd; ++j) {
int* pWeight = m_WeightTable.GetValueFromPixelWeight(pWeights, j);
if (!pWeight)
return false;
int pixel_weight = *pWeight;
- unsigned long argb_cmyk = m_pSrcPalette[src_scan[j]];
+ unsigned long argb = m_pSrcPalette[src_scan[j]];
if (m_DestFormat == FXDIB_Format::kRgb) {
- dest_r_y += pixel_weight * static_cast<uint8_t>(argb_cmyk >> 16);
- dest_g_m += pixel_weight * static_cast<uint8_t>(argb_cmyk >> 8);
- dest_b_c += pixel_weight * static_cast<uint8_t>(argb_cmyk);
+ dest_r += pixel_weight * static_cast<uint8_t>(argb >> 16);
+ dest_g += pixel_weight * static_cast<uint8_t>(argb >> 8);
+ dest_b += pixel_weight * static_cast<uint8_t>(argb);
} else {
- dest_b_c += pixel_weight * static_cast<uint8_t>(argb_cmyk >> 24);
- dest_g_m += pixel_weight * static_cast<uint8_t>(argb_cmyk >> 16);
- dest_r_y += pixel_weight * static_cast<uint8_t>(argb_cmyk >> 8);
+ dest_b += pixel_weight * static_cast<uint8_t>(argb >> 24);
+ dest_g += pixel_weight * static_cast<uint8_t>(argb >> 16);
+ dest_r += pixel_weight * static_cast<uint8_t>(argb >> 8);
}
}
if (bicubic) {
- dest_r_y = pdfium::clamp(dest_r_y, 0, kMaxDestValue);
- dest_g_m = pdfium::clamp(dest_g_m, 0, kMaxDestValue);
- dest_b_c = pdfium::clamp(dest_b_c, 0, kMaxDestValue);
+ dest_r = pdfium::clamp(dest_r, 0, kMaxDestValue);
+ dest_g = pdfium::clamp(dest_g, 0, kMaxDestValue);
+ dest_b = pdfium::clamp(dest_b, 0, kMaxDestValue);
}
- *dest_scan++ = static_cast<uint8_t>(dest_b_c >> 16);
- *dest_scan++ = static_cast<uint8_t>(dest_g_m >> 16);
- *dest_scan++ = static_cast<uint8_t>(dest_r_y >> 16);
+ *dest_scan++ = static_cast<uint8_t>(dest_b >> 16);
+ *dest_scan++ = static_cast<uint8_t>(dest_g >> 16);
+ *dest_scan++ = static_cast<uint8_t>(dest_r >> 16);
}
break;
}
@@ -480,9 +480,9 @@
for (int col = m_DestClip.left; col < m_DestClip.right; ++col) {
PixelWeight* pWeights = m_WeightTable.GetPixelWeight(col);
int dest_a = 0;
- int dest_r_y = 0;
- int dest_g_m = 0;
- int dest_b_c = 0;
+ int dest_r = 0;
+ int dest_g = 0;
+ int dest_b = 0;
for (int j = pWeights->m_SrcStart; j <= pWeights->m_SrcEnd; ++j) {
int* pWeight = m_WeightTable.GetValueFromPixelWeight(pWeights, j);
if (!pWeight)
@@ -490,21 +490,21 @@
int pixel_weight = *pWeight;
pixel_weight = pixel_weight * src_scan_mask[j] / 255;
- unsigned long argb_cmyk = m_pSrcPalette[src_scan[j]];
- dest_b_c += pixel_weight * static_cast<uint8_t>(argb_cmyk >> 24);
- dest_g_m += pixel_weight * static_cast<uint8_t>(argb_cmyk >> 16);
- dest_r_y += pixel_weight * static_cast<uint8_t>(argb_cmyk >> 8);
+ unsigned long argb = m_pSrcPalette[src_scan[j]];
+ dest_b += pixel_weight * static_cast<uint8_t>(argb >> 24);
+ dest_g += pixel_weight * static_cast<uint8_t>(argb >> 16);
+ dest_r += pixel_weight * static_cast<uint8_t>(argb >> 8);
dest_a += pixel_weight;
}
if (bicubic) {
- dest_b_c = pdfium::clamp(dest_b_c, 0, kMaxDestValue);
- dest_g_m = pdfium::clamp(dest_g_m, 0, kMaxDestValue);
- dest_r_y = pdfium::clamp(dest_r_y, 0, kMaxDestValue);
+ dest_b = pdfium::clamp(dest_b, 0, kMaxDestValue);
+ dest_g = pdfium::clamp(dest_g, 0, kMaxDestValue);
+ dest_r = pdfium::clamp(dest_r, 0, kMaxDestValue);
dest_a = pdfium::clamp(dest_a, 0, 65536);
}
- *dest_scan++ = static_cast<uint8_t>(dest_b_c >> 16);
- *dest_scan++ = static_cast<uint8_t>(dest_g_m >> 16);
- *dest_scan++ = static_cast<uint8_t>(dest_r_y >> 16);
+ *dest_scan++ = static_cast<uint8_t>(dest_b >> 16);
+ *dest_scan++ = static_cast<uint8_t>(dest_g >> 16);
+ *dest_scan++ = static_cast<uint8_t>(dest_r >> 16);
*dest_scan_mask++ = static_cast<uint8_t>((dest_a * 255) >> 16);
}
break;
@@ -512,9 +512,9 @@
case TransformMethod::kManyBpptoManyBpp: {
for (int col = m_DestClip.left; col < m_DestClip.right; ++col) {
PixelWeight* pWeights = m_WeightTable.GetPixelWeight(col);
- int dest_r_y = 0;
- int dest_g_m = 0;
- int dest_b_c = 0;
+ int dest_r = 0;
+ int dest_g = 0;
+ int dest_b = 0;
for (int j = pWeights->m_SrcStart; j <= pWeights->m_SrcEnd; ++j) {
int* pWeight = m_WeightTable.GetValueFromPixelWeight(pWeights, j);
if (!pWeight)
@@ -522,18 +522,18 @@
int pixel_weight = *pWeight;
const uint8_t* src_pixel = src_scan + j * Bpp;
- dest_b_c += pixel_weight * (*src_pixel++);
- dest_g_m += pixel_weight * (*src_pixel++);
- dest_r_y += pixel_weight * (*src_pixel);
+ dest_b += pixel_weight * (*src_pixel++);
+ dest_g += pixel_weight * (*src_pixel++);
+ dest_r += pixel_weight * (*src_pixel);
}
if (bicubic) {
- dest_b_c = pdfium::clamp(dest_b_c, 0, kMaxDestValue);
- dest_g_m = pdfium::clamp(dest_g_m, 0, kMaxDestValue);
- dest_r_y = pdfium::clamp(dest_r_y, 0, kMaxDestValue);
+ dest_b = pdfium::clamp(dest_b, 0, kMaxDestValue);
+ dest_g = pdfium::clamp(dest_g, 0, kMaxDestValue);
+ dest_r = pdfium::clamp(dest_r, 0, kMaxDestValue);
}
- *dest_scan++ = static_cast<uint8_t>((dest_b_c) >> 16);
- *dest_scan++ = static_cast<uint8_t>((dest_g_m) >> 16);
- *dest_scan++ = static_cast<uint8_t>((dest_r_y) >> 16);
+ *dest_scan++ = static_cast<uint8_t>(dest_b >> 16);
+ *dest_scan++ = static_cast<uint8_t>(dest_g >> 16);
+ *dest_scan++ = static_cast<uint8_t>(dest_r >> 16);
dest_scan += Bpp - 3;
}
break;
@@ -542,9 +542,9 @@
for (int col = m_DestClip.left; col < m_DestClip.right; ++col) {
PixelWeight* pWeights = m_WeightTable.GetPixelWeight(col);
int dest_a = 0;
- int dest_r_y = 0;
- int dest_g_m = 0;
- int dest_b_c = 0;
+ int dest_r = 0;
+ int dest_g = 0;
+ int dest_b = 0;
for (int j = pWeights->m_SrcStart; j <= pWeights->m_SrcEnd; ++j) {
int* pWeight = m_WeightTable.GetValueFromPixelWeight(pWeights, j);
if (!pWeight)
@@ -557,20 +557,20 @@
} else {
pixel_weight = pixel_weight * src_scan_mask[j] / 255;
}
- dest_b_c += pixel_weight * (*src_pixel++);
- dest_g_m += pixel_weight * (*src_pixel++);
- dest_r_y += pixel_weight * (*src_pixel);
+ dest_b += pixel_weight * (*src_pixel++);
+ dest_g += pixel_weight * (*src_pixel++);
+ dest_r += pixel_weight * (*src_pixel);
dest_a += pixel_weight;
}
if (bicubic) {
- dest_r_y = pdfium::clamp(dest_r_y, 0, kMaxDestValue);
- dest_g_m = pdfium::clamp(dest_g_m, 0, kMaxDestValue);
- dest_b_c = pdfium::clamp(dest_b_c, 0, kMaxDestValue);
+ dest_r = pdfium::clamp(dest_r, 0, kMaxDestValue);
+ dest_g = pdfium::clamp(dest_g, 0, kMaxDestValue);
+ dest_b = pdfium::clamp(dest_b, 0, kMaxDestValue);
dest_a = pdfium::clamp(dest_a, 0, 65536);
}
- *dest_scan++ = static_cast<uint8_t>((dest_b_c) >> 16);
- *dest_scan++ = static_cast<uint8_t>((dest_g_m) >> 16);
- *dest_scan++ = static_cast<uint8_t>((dest_r_y) >> 16);
+ *dest_scan++ = static_cast<uint8_t>(dest_b >> 16);
+ *dest_scan++ = static_cast<uint8_t>(dest_g >> 16);
+ *dest_scan++ = static_cast<uint8_t>(dest_r >> 16);
if (m_DestFormat == FXDIB_Format::kArgb)
*dest_scan = static_cast<uint8_t>((dest_a * 255) >> 16);
if (dest_scan_mask)
@@ -662,9 +662,9 @@
for (int col = m_DestClip.left; col < m_DestClip.right; ++col) {
unsigned char* src_scan =
m_InterBuf.data() + (col - m_DestClip.left) * DestBpp;
- int dest_r_y = 0;
- int dest_g_m = 0;
- int dest_b_c = 0;
+ int dest_r = 0;
+ int dest_g = 0;
+ int dest_b = 0;
for (int j = pWeights->m_SrcStart; j <= pWeights->m_SrcEnd; ++j) {
int* pWeight = table.GetValueFromPixelWeight(pWeights, j);
if (!pWeight)
@@ -673,18 +673,18 @@
int pixel_weight = *pWeight;
const uint8_t* src_pixel =
src_scan + (j - m_SrcClip.top) * m_InterPitch;
- dest_b_c += pixel_weight * (*src_pixel++);
- dest_g_m += pixel_weight * (*src_pixel++);
- dest_r_y += pixel_weight * (*src_pixel);
+ dest_b += pixel_weight * (*src_pixel++);
+ dest_g += pixel_weight * (*src_pixel++);
+ dest_r += pixel_weight * (*src_pixel);
}
if (bicubic) {
- dest_r_y = pdfium::clamp(dest_r_y, 0, kMaxDestValue);
- dest_g_m = pdfium::clamp(dest_g_m, 0, kMaxDestValue);
- dest_b_c = pdfium::clamp(dest_b_c, 0, kMaxDestValue);
+ dest_r = pdfium::clamp(dest_r, 0, kMaxDestValue);
+ dest_g = pdfium::clamp(dest_g, 0, kMaxDestValue);
+ dest_b = pdfium::clamp(dest_b, 0, kMaxDestValue);
}
- dest_scan[0] = static_cast<uint8_t>((dest_b_c) >> 16);
- dest_scan[1] = static_cast<uint8_t>((dest_g_m) >> 16);
- dest_scan[2] = static_cast<uint8_t>((dest_r_y) >> 16);
+ dest_scan[0] = static_cast<uint8_t>(dest_b >> 16);
+ dest_scan[1] = static_cast<uint8_t>(dest_g >> 16);
+ dest_scan[2] = static_cast<uint8_t>(dest_r >> 16);
dest_scan += DestBpp;
}
break;
@@ -698,9 +698,9 @@
if (m_DestFormat != FXDIB_Format::kArgb)
src_scan_mask = m_ExtraAlphaBuf.data() + (col - m_DestClip.left);
int dest_a = 0;
- int dest_r_y = 0;
- int dest_g_m = 0;
- int dest_b_c = 0;
+ int dest_r = 0;
+ int dest_g = 0;
+ int dest_b = 0;
for (int j = pWeights->m_SrcStart; j <= pWeights->m_SrcEnd; ++j) {
int* pWeight = table.GetValueFromPixelWeight(pWeights, j);
if (!pWeight)
@@ -712,24 +712,24 @@
int mask_v = 255;
if (src_scan_mask)
mask_v = src_scan_mask[(j - m_SrcClip.top) * m_ExtraMaskPitch];
- dest_b_c += pixel_weight * (*src_pixel++);
- dest_g_m += pixel_weight * (*src_pixel++);
- dest_r_y += pixel_weight * (*src_pixel);
+ dest_b += pixel_weight * (*src_pixel++);
+ dest_g += pixel_weight * (*src_pixel++);
+ dest_r += pixel_weight * (*src_pixel);
if (m_DestFormat == FXDIB_Format::kArgb)
dest_a += pixel_weight * (*(src_pixel + 1));
else
dest_a += pixel_weight * mask_v;
}
if (bicubic) {
- dest_r_y = pdfium::clamp(dest_r_y, 0, kMaxDestValue);
- dest_g_m = pdfium::clamp(dest_g_m, 0, kMaxDestValue);
- dest_b_c = pdfium::clamp(dest_b_c, 0, kMaxDestValue);
+ dest_r = pdfium::clamp(dest_r, 0, kMaxDestValue);
+ dest_g = pdfium::clamp(dest_g, 0, kMaxDestValue);
+ dest_b = pdfium::clamp(dest_b, 0, kMaxDestValue);
dest_a = pdfium::clamp(dest_a, 0, kMaxDestValue);
}
if (dest_a) {
- int r = static_cast<uint32_t>(dest_r_y) * 255 / dest_a;
- int g = static_cast<uint32_t>(dest_g_m) * 255 / dest_a;
- int b = static_cast<uint32_t>(dest_b_c) * 255 / dest_a;
+ int r = static_cast<uint32_t>(dest_r) * 255 / dest_a;
+ int g = static_cast<uint32_t>(dest_g) * 255 / dest_a;
+ int b = static_cast<uint32_t>(dest_b) * 255 / dest_a;
dest_scan[0] = pdfium::clamp(b, 0, 255);
dest_scan[1] = pdfium::clamp(g, 0, 255);
dest_scan[2] = pdfium::clamp(r, 0, 255);