Rename FXDIB_Format enum values to better match public values
- Change kRgb to kBgr to match FPDFBitmap_BGR
- Change kRgb32 to kBgrx to match FPDFBitmap_BGRX
- Change kArgb to kBgra to match FPDFBitmap_BGRA
- Change kArgbPremul to kBgraPremul to match kBgra
Change-Id: If1e6e788e93fd9d8c767fa3f36f61ecebaa977a1
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/123476
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Tom Sepez <tsepez@google.com>
Commit-Queue: Lei Zhang <thestig@chromium.org>
diff --git a/core/fpdfapi/page/cpdf_dib.cpp b/core/fpdfapi/page/cpdf_dib.cpp
index 905db01..ac4eeb6 100644
--- a/core/fpdfapi/page/cpdf_dib.cpp
+++ b/core/fpdfapi/page/cpdf_dib.cpp
@@ -269,7 +269,7 @@
} else if (bpp <= 8) {
SetFormat(FXDIB_Format::k8bppRgb);
} else {
- SetFormat(FXDIB_Format::kRgb);
+ SetFormat(FXDIB_Format::kBgr);
}
}
@@ -281,8 +281,8 @@
LoadPalette();
if (m_bColorKey) {
// TODO(crbug.com/355676038): Consider adding support for
- // `FXDIB_Format::kArgbPremul`
- SetFormat(FXDIB_Format::kArgb);
+ // `FXDIB_Format::kBgraPremul`
+ SetFormat(FXDIB_Format::kBgra);
pitch = fxge::CalculatePitch32(GetBPP(), GetWidth());
if (!pitch.has_value())
return false;
@@ -726,15 +726,15 @@
if (action == JpxDecodeAction::kUseGray) {
format = FXDIB_Format::k8bppRgb;
} else if (action == JpxDecodeAction::kUseRgb && image_info.channels == 3) {
- format = FXDIB_Format::kRgb;
+ format = FXDIB_Format::kBgr;
} else if (action == JpxDecodeAction::kUseRgb && image_info.channels == 4) {
- format = FXDIB_Format::kRgb32;
+ format = FXDIB_Format::kBgrx;
} else if (action == JpxDecodeAction::kConvertArgbToRgb) {
CHECK_GE(image_info.channels, 4);
- format = FXDIB_Format::kRgb32;
+ format = FXDIB_Format::kBgrx;
} else {
image_info.width = (image_info.width * image_info.channels + 2) / 3;
- format = FXDIB_Format::kRgb;
+ format = FXDIB_Format::kBgr;
}
auto result_bitmap = pdfium::MakeRetain<CFX_DIBitmap>();
@@ -751,7 +751,7 @@
DCHECK_EQ(3u, m_nComponents);
auto rgb_bitmap = pdfium::MakeRetain<CFX_DIBitmap>();
if (!rgb_bitmap->Create(image_info.width, image_info.height,
- FXDIB_Format::kRgb)) {
+ FXDIB_Format::kBgr)) {
return nullptr;
}
if (m_pDict->GetIntegerFor("SMaskInData") == 1) {
diff --git a/core/fpdfapi/page/cpdf_transferfuncdib.cpp b/core/fpdfapi/page/cpdf_transferfuncdib.cpp
index ffa310c..40fafe8 100644
--- a/core/fpdfapi/page/cpdf_transferfuncdib.cpp
+++ b/core/fpdfapi/page/cpdf_transferfuncdib.cpp
@@ -58,8 +58,8 @@
if (src_->IsAlphaFormat()) {
// TODO(crbug.com/355676038): Consider adding support for
- // `FXDIB_Format::kArgbPremul`
- return FXDIB_Format::kArgb;
+ // `FXDIB_Format::kBgraPremul`
+ return FXDIB_Format::kBgra;
}
return CFX_DIBBase::kPlatformRGBFormat;
@@ -119,7 +119,7 @@
}
break;
}
- case FXDIB_Format::kRgb: {
+ case FXDIB_Format::kBgr: {
auto src =
fxcrt::reinterpret_span<const FX_BGR_STRUCT<uint8_t>>(src_span);
auto dest = fxcrt::reinterpret_span<kPlatformRGBStruct>(scanline_span);
@@ -130,7 +130,7 @@
}
break;
}
- case FXDIB_Format::kRgb32: {
+ case FXDIB_Format::kBgrx: {
auto src =
fxcrt::reinterpret_span<const FX_BGRA_STRUCT<uint8_t>>(src_span);
auto dest = fxcrt::reinterpret_span<kPlatformRGBStruct>(scanline_span);
@@ -141,7 +141,7 @@
}
break;
}
- case FXDIB_Format::kArgb: {
+ case FXDIB_Format::kBgra: {
auto src =
fxcrt::reinterpret_span<const FX_BGRA_STRUCT<uint8_t>>(src_span);
auto dest =
@@ -157,9 +157,9 @@
break;
}
#if defined(PDF_USE_SKIA)
- case FXDIB_Format::kArgbPremul: {
+ case FXDIB_Format::kBgraPremul: {
// TODO(crbug.com/355676038): Consider adding support for
- // `FXDIB_Format::kArgbPremul`
+ // `FXDIB_Format::kBgraPremul`
NOTREACHED_NORETURN();
}
#endif
diff --git a/core/fpdfapi/render/cpdf_devicebuffer.cpp b/core/fpdfapi/render/cpdf_devicebuffer.cpp
index 6cb8676..719d30a 100644
--- a/core/fpdfapi/render/cpdf_devicebuffer.cpp
+++ b/core/fpdfapi/render/cpdf_devicebuffer.cpp
@@ -78,9 +78,9 @@
FX_RECT bitmap_rect =
m_Matrix.TransformRect(CFX_FloatRect(m_Rect)).GetOuterRect();
// TODO(crbug.com/355630557): Consider adding support for
- // `FXDIB_Format::kArgbPremul`
+ // `FXDIB_Format::kBgraPremul`
if (!m_pBitmap->Create(bitmap_rect.Width(), bitmap_rect.Height(),
- FXDIB_Format::kArgb)) {
+ FXDIB_Format::kBgra)) {
return nullptr;
}
return m_pBitmap;
diff --git a/core/fpdfapi/render/cpdf_imagerenderer.cpp b/core/fpdfapi/render/cpdf_imagerenderer.cpp
index e26c860..4f02056 100644
--- a/core/fpdfapi/render/cpdf_imagerenderer.cpp
+++ b/core/fpdfapi/render/cpdf_imagerenderer.cpp
@@ -324,7 +324,7 @@
CFX_Matrix new_matrix = GetDrawMatrix(rect);
CFX_DefaultRenderDevice bitmap_device;
- if (!bitmap_device.Create(rect.Width(), rect.Height(), FXDIB_Format::kArgb)) {
+ if (!bitmap_device.Create(rect.Width(), rect.Height(), FXDIB_Format::kBgra)) {
return true;
}
@@ -372,8 +372,7 @@
CFX_Matrix new_matrix = GetDrawMatrix(rect);
CFX_DefaultRenderDevice bitmap_device;
- if (!bitmap_device.Create(rect.Width(), rect.Height(),
- FXDIB_Format::kRgb32)) {
+ if (!bitmap_device.Create(rect.Width(), rect.Height(), FXDIB_Format::kBgrx)) {
return true;
}
bitmap_device.Clear(0xffffffff);
diff --git a/core/fpdfapi/render/cpdf_rendershading.cpp b/core/fpdfapi/render/cpdf_rendershading.cpp
index d56128e..fd25e29 100644
--- a/core/fpdfapi/render/cpdf_rendershading.cpp
+++ b/core/fpdfapi/render/cpdf_rendershading.cpp
@@ -98,7 +98,7 @@
const std::vector<std::unique_ptr<CPDF_Function>>& funcs,
const RetainPtr<CPDF_ColorSpace>& pCS,
int alpha) {
- DCHECK_EQ(pBitmap->GetFormat(), FXDIB_Format::kArgb);
+ DCHECK_EQ(pBitmap->GetFormat(), FXDIB_Format::kBgra);
const uint32_t total_results = GetValidatedOutputsCount(funcs, pCS);
if (total_results == 0)
@@ -166,7 +166,7 @@
const std::vector<std::unique_ptr<CPDF_Function>>& funcs,
const RetainPtr<CPDF_ColorSpace>& pCS,
int alpha) {
- DCHECK_EQ(pBitmap->GetFormat(), FXDIB_Format::kArgb);
+ DCHECK_EQ(pBitmap->GetFormat(), FXDIB_Format::kBgra);
const uint32_t total_results = GetValidatedOutputsCount(funcs, pCS);
if (total_results == 0)
@@ -265,7 +265,7 @@
const std::vector<std::unique_ptr<CPDF_Function>>& funcs,
const RetainPtr<CPDF_ColorSpace>& pCS,
int alpha) {
- DCHECK_EQ(pBitmap->GetFormat(), FXDIB_Format::kArgb);
+ DCHECK_EQ(pBitmap->GetFormat(), FXDIB_Format::kBgra);
const uint32_t total_results = GetValidatedOutputsCount(funcs, pCS);
if (total_results == 0)
@@ -427,7 +427,7 @@
const std::vector<std::unique_ptr<CPDF_Function>>& funcs,
RetainPtr<CPDF_ColorSpace> pCS,
int alpha) {
- DCHECK_EQ(pBitmap->GetFormat(), FXDIB_Format::kArgb);
+ DCHECK_EQ(pBitmap->GetFormat(), FXDIB_Format::kBgra);
CPDF_MeshStream stream(kFreeFormGouraudTriangleMeshShading, funcs,
std::move(pShadingStream), std::move(pCS));
@@ -466,7 +466,7 @@
const std::vector<std::unique_ptr<CPDF_Function>>& funcs,
RetainPtr<CPDF_ColorSpace> pCS,
int alpha) {
- DCHECK_EQ(pBitmap->GetFormat(), FXDIB_Format::kArgb);
+ DCHECK_EQ(pBitmap->GetFormat(), FXDIB_Format::kBgra);
int row_verts = pShadingStream->GetDict()->GetIntegerFor("VerticesPerRow");
if (row_verts < 2)
@@ -793,7 +793,7 @@
RetainPtr<CPDF_ColorSpace> pCS,
bool bNoPathSmooth,
int alpha) {
- DCHECK_EQ(pBitmap->GetFormat(), FXDIB_Format::kArgb);
+ DCHECK_EQ(pBitmap->GetFormat(), FXDIB_Format::kBgra);
DCHECK(type == kCoonsPatchMeshShading ||
type == kTensorProductPatchMeshShading);
diff --git a/core/fpdfapi/render/cpdf_renderstatus.cpp b/core/fpdfapi/render/cpdf_renderstatus.cpp
index e50d012..02d7d3d 100644
--- a/core/fpdfapi/render/cpdf_renderstatus.cpp
+++ b/core/fpdfapi/render/cpdf_renderstatus.cpp
@@ -133,12 +133,12 @@
if (!is_luminosity)
return FXDIB_Format::k8bppMask;
#if BUILDFLAG(IS_APPLE)
- return FXDIB_Format::kRgb32;
+ return FXDIB_Format::kBgrx;
#else
if (CFX_DefaultRenderDevice::UseSkiaRenderer()) {
- return FXDIB_Format::kRgb32;
+ return FXDIB_Format::kBgrx;
}
- return FXDIB_Format::kRgb;
+ return FXDIB_Format::kBgr;
#endif
}
@@ -750,8 +750,8 @@
auto backdrop = pdfium::MakeRetain<CFX_DIBitmap>();
if (bBackAlphaRequired && !m_bDropObjects) {
// TODO(crbug.com/42271020): Consider adding support for
- // `FXDIB_Format::kArgbPremul`
- if (!backdrop->Create(width, height, FXDIB_Format::kArgb)) {
+ // `FXDIB_Format::kBgraPremul`
+ if (!backdrop->Create(width, height, FXDIB_Format::kBgra)) {
return nullptr;
}
} else {
@@ -989,9 +989,9 @@
CFX_DefaultRenderDevice bitmap_device;
// TODO(crbug.com/42271020): Consider adding support for
- // `FXDIB_Format::kArgbPremul`
+ // `FXDIB_Format::kBgraPremul`
if (!bitmap_device.Create(rect.Width(), rect.Height(),
- FXDIB_Format::kArgb)) {
+ FXDIB_Format::kBgra)) {
return true;
}
CPDF_RenderStatus status(m_pContext, &bitmap_device);
@@ -1367,7 +1367,7 @@
auto new_backdrop = pdfium::MakeRetain<CFX_DIBitmap>();
CHECK(new_backdrop->Create(backdrop->GetWidth(), backdrop->GetHeight(),
- FXDIB_Format::kRgb32));
+ FXDIB_Format::kBgrx));
new_backdrop->Clear(0xffffffff);
new_backdrop->CompositeBitmap(0, 0, new_backdrop->GetWidth(),
new_backdrop->GetHeight(), std::move(backdrop),
@@ -1521,8 +1521,8 @@
FXDIB_Format CPDF_RenderStatus::GetCompatibleArgbFormat() const {
#if defined(PDF_USE_SKIA)
if (m_pDevice->GetDeviceCaps(FXDC_RENDER_CAPS) & FXRC_PREMULTIPLIED_ALPHA) {
- return FXDIB_Format::kArgbPremul;
+ return FXDIB_Format::kBgraPremul;
}
#endif
- return FXDIB_Format::kArgb;
+ return FXDIB_Format::kBgra;
}
diff --git a/core/fpdfapi/render/cpdf_rendertiling.cpp b/core/fpdfapi/render/cpdf_rendertiling.cpp
index 8c88d32..82577a9 100644
--- a/core/fpdfapi/render/cpdf_rendertiling.cpp
+++ b/core/fpdfapi/render/cpdf_rendertiling.cpp
@@ -35,9 +35,9 @@
const CPDF_RenderOptions::Options& draw_options) {
auto pBitmap = pdfium::MakeRetain<CFX_DIBitmap>();
// TODO(crbug.com/42271020): Consider adding support for
- // `FXDIB_Format::kArgbPremul`
+ // `FXDIB_Format::kBgraPremul`
if (!pBitmap->Create(width, height,
- pPattern->colored() ? FXDIB_Format::kArgb
+ pPattern->colored() ? FXDIB_Format::kBgra
: FXDIB_Format::k8bppMask)) {
return nullptr;
}
@@ -198,8 +198,9 @@
int clip_width = clip_box.right - clip_box.left;
int clip_height = clip_box.bottom - clip_box.top;
auto pScreen = pdfium::MakeRetain<CFX_DIBitmap>();
- if (!pScreen->Create(clip_width, clip_height, FXDIB_Format::kArgb))
+ if (!pScreen->Create(clip_width, clip_height, FXDIB_Format::kBgra)) {
return nullptr;
+ }
pdfium::span<const uint8_t> src_buf = pPatternBitmap->GetBuffer();
for (int col = min_col; col <= max_col; col++) {
diff --git a/core/fpdfapi/render/cpdf_scaledrenderbuffer.cpp b/core/fpdfapi/render/cpdf_scaledrenderbuffer.cpp
index ce54ff3..4579b57 100644
--- a/core/fpdfapi/render/cpdf_scaledrenderbuffer.cpp
+++ b/core/fpdfapi/render/cpdf_scaledrenderbuffer.cpp
@@ -35,7 +35,7 @@
/*scale=*/true);
bool bIsAlpha =
!!(device_->GetDeviceCaps(FXDC_RENDER_CAPS) & FXRC_ALPHA_OUTPUT);
- FXDIB_Format dibFormat = bIsAlpha ? FXDIB_Format::kArgb : FXDIB_Format::kRgb;
+ FXDIB_Format dibFormat = bIsAlpha ? FXDIB_Format::kBgra : FXDIB_Format::kBgr;
while (true) {
FX_RECT bitmap_rect =
matrix_.TransformRect(CFX_FloatRect(rect_)).GetOuterRect();
diff --git a/core/fxcodec/progressive_decoder.cpp b/core/fxcodec/progressive_decoder.cpp
index 7c2f924..7befcea 100644
--- a/core/fxcodec/progressive_decoder.cpp
+++ b/core/fxcodec/progressive_decoder.cpp
@@ -115,17 +115,17 @@
case FXDIB_Format::k8bppMask:
case FXDIB_Format::k8bppRgb:
NOTREACHED_NORETURN();
- case FXDIB_Format::kRgb:
+ case FXDIB_Format::kBgr:
*color_type = 2;
break;
- case FXDIB_Format::kRgb32:
- case FXDIB_Format::kArgb:
+ case FXDIB_Format::kBgrx:
+ case FXDIB_Format::kBgra:
*color_type = 6;
break;
#if defined(PDF_USE_SKIA)
- case FXDIB_Format::kArgbPremul:
+ case FXDIB_Format::kBgraPremul:
// TODO(crbug.com/355630556): Consider adding support for
- // `FXDIB_Format::kArgbPremul`
+ // `FXDIB_Format::kBgraPremul`
NOTREACHED_NORETURN();
#endif
}
@@ -136,7 +136,7 @@
uint8_t* ProgressiveDecoder::PngAskScanlineBuf(int line) {
CHECK_GE(line, 0);
CHECK_LT(line, m_SrcHeight);
- CHECK_EQ(m_pDeviceBitmap->GetFormat(), FXDIB_Format::kArgb);
+ CHECK_EQ(m_pDeviceBitmap->GetFormat(), FXDIB_Format::kBgra);
CHECK_EQ(m_SrcFormat, FXCodec_Argb);
pdfium::span<const uint8_t> src_span = m_pDeviceBitmap->GetScanline(line);
pdfium::span<uint8_t> dest_span = pdfium::make_span(m_DecodeBuf);
@@ -151,7 +151,7 @@
return;
}
- CHECK_EQ(m_pDeviceBitmap->GetFormat(), FXDIB_Format::kArgb);
+ CHECK_EQ(m_pDeviceBitmap->GetFormat(), FXDIB_Format::kBgra);
pdfium::span<const uint8_t> src_span = pdfium::make_span(m_DecodeBuf);
pdfium::span<uint8_t> dest_span = m_pDeviceBitmap->GetWritableScanline(line);
const size_t byte_size = Fx2DSizeOrDie(
@@ -334,11 +334,11 @@
break;
case 3:
m_SrcFormat = FXCodec_Rgb;
- format = FXDIB_Format::kRgb;
+ format = FXDIB_Format::kBgr;
break;
case 4:
m_SrcFormat = FXCodec_Rgb32;
- format = FXDIB_Format::kRgb32;
+ format = FXDIB_Format::kBgrx;
break;
default:
m_status = FXCODEC_STATUS::kError;
@@ -660,7 +660,7 @@
return m_status;
}
m_offSet = 0;
- CHECK_EQ(m_pDeviceBitmap->GetFormat(), FXDIB_Format::kArgb);
+ CHECK_EQ(m_pDeviceBitmap->GetFormat(), FXDIB_Format::kBgra);
m_SrcComponents = 4;
m_SrcFormat = FXCodec_Argb;
SetTransMethod();
@@ -728,8 +728,8 @@
FXCODEC_STATUS ProgressiveDecoder::TiffContinueDecode() {
// TODO(crbug.com/355630556): Consider adding support for
- // `FXDIB_Format::kArgbPremul`
- CHECK_EQ(m_pDeviceBitmap->GetFormat(), FXDIB_Format::kArgb);
+ // `FXDIB_Format::kBgraPremul`
+ CHECK_EQ(m_pDeviceBitmap->GetFormat(), FXDIB_Format::kBgra);
m_status =
TiffDecoder::Decode(m_pTiffContext.get(), std::move(m_pDeviceBitmap))
? FXCODEC_STATUS::kDecodeFinished
@@ -891,7 +891,7 @@
case FXDIB_Format::k8bppMask:
case FXDIB_Format::k8bppRgb:
NOTREACHED_NORETURN();
- case FXDIB_Format::kRgb: {
+ case FXDIB_Format::kBgr: {
switch (m_SrcFormat) {
case FXCodec_Invalid:
m_TransMethod = TransformMethod::kInvalid;
@@ -913,8 +913,8 @@
}
break;
}
- case FXDIB_Format::kRgb32:
- case FXDIB_Format::kArgb: {
+ case FXDIB_Format::kBgrx:
+ case FXDIB_Format::kBgra: {
switch (m_SrcFormat) {
case FXCodec_Invalid:
m_TransMethod = TransformMethod::kInvalid;
@@ -923,7 +923,7 @@
m_TransMethod = TransformMethod::k8BppGrayToRgbMaybeAlpha;
break;
case FXCodec_8bppRgb:
- if (m_pDeviceBitmap->GetFormat() == FXDIB_Format::kArgb) {
+ if (m_pDeviceBitmap->GetFormat() == FXDIB_Format::kBgra) {
m_TransMethod = TransformMethod::k8BppRgbToArgb;
} else {
m_TransMethod = TransformMethod::k8BppRgbToRgbNoAlpha;
@@ -943,9 +943,9 @@
break;
}
#if defined(PDF_USE_SKIA)
- case FXDIB_Format::kArgbPremul:
+ case FXDIB_Format::kBgraPremul:
// TODO(crbug.com/355630556): Consider adding support for
- // `FXDIB_Format::kArgbPremul`
+ // `FXDIB_Format::kBgraPremul`
NOTREACHED_NORETURN();
#endif
}
@@ -1137,8 +1137,7 @@
#ifdef PDF_ENABLE_XFA_BMP
case FXCODEC_IMAGE_BMP:
#endif // PDF_ENABLE_XFA_BMP
- return GetBitsPerPixel() <= 24 ? FXDIB_Format::kRgb
- : FXDIB_Format::kRgb32;
+ return GetBitsPerPixel() <= 24 ? FXDIB_Format::kBgr : FXDIB_Format::kBgrx;
#ifdef PDF_ENABLE_XFA_PNG
case FXCODEC_IMAGE_PNG:
#endif // PDF_ENABLE_XFA_PNG
@@ -1147,8 +1146,8 @@
#endif // PDF_ENABLE_XFA_TIFF
default:
// TODO(crbug.com/355630556): Consider adding support for
- // `FXDIB_Format::kArgbPremul`
- return FXDIB_Format::kArgb;
+ // `FXDIB_Format::kBgraPremul`
+ return FXDIB_Format::kBgra;
}
}
@@ -1209,8 +1208,8 @@
CHECK_GT(m_SrcHeight, 0);
const FXDIB_Format format = bitmap->GetFormat();
- CHECK(format == FXDIB_Format::kArgb || format == FXDIB_Format::kRgb ||
- format == FXDIB_Format::kRgb32);
+ CHECK(format == FXDIB_Format::kBgra || format == FXDIB_Format::kBgr ||
+ format == FXDIB_Format::kBgrx);
if (m_status != FXCODEC_STATUS::kDecodeReady) {
return FXCODEC_STATUS::kError;
diff --git a/core/fxcodec/progressive_decoder_unittest.cpp b/core/fxcodec/progressive_decoder_unittest.cpp
index 194ef4d..56f34cf 100644
--- a/core/fxcodec/progressive_decoder_unittest.cpp
+++ b/core/fxcodec/progressive_decoder_unittest.cpp
@@ -101,7 +101,7 @@
ASSERT_EQ(1, decoder.GetWidth());
ASSERT_EQ(1, decoder.GetHeight());
- ASSERT_EQ(FXDIB_Format::kRgb, decoder.GetBitmapFormat());
+ ASSERT_EQ(FXDIB_Format::kBgr, decoder.GetBitmapFormat());
auto bitmap = pdfium::MakeRetain<CFX_DIBitmap>();
ASSERT_TRUE(bitmap->Create(decoder.GetWidth(), decoder.GetHeight(),
@@ -136,7 +136,7 @@
ASSERT_EQ(1, decoder.GetWidth());
ASSERT_EQ(1, decoder.GetHeight());
- ASSERT_EQ(FXDIB_Format::kRgb, decoder.GetBitmapFormat());
+ ASSERT_EQ(FXDIB_Format::kBgr, decoder.GetBitmapFormat());
auto bitmap = pdfium::MakeRetain<CFX_DIBitmap>();
ASSERT_TRUE(bitmap->Create(decoder.GetWidth(), decoder.GetHeight(),
@@ -169,7 +169,7 @@
ASSERT_EQ(1, decoder.GetWidth());
ASSERT_EQ(1, decoder.GetHeight());
- ASSERT_EQ(FXDIB_Format::kRgb, decoder.GetBitmapFormat());
+ ASSERT_EQ(FXDIB_Format::kBgr, decoder.GetBitmapFormat());
auto bitmap = pdfium::MakeRetain<CFX_DIBitmap>();
ASSERT_TRUE(bitmap->Create(decoder.GetWidth(), decoder.GetHeight(),
@@ -203,7 +203,7 @@
ASSERT_EQ(1, decoder.GetWidth());
ASSERT_EQ(1, decoder.GetHeight());
- ASSERT_EQ(FXDIB_Format::kRgb32, decoder.GetBitmapFormat());
+ ASSERT_EQ(FXDIB_Format::kBgrx, decoder.GetBitmapFormat());
auto bitmap = pdfium::MakeRetain<CFX_DIBitmap>();
ASSERT_TRUE(bitmap->Create(decoder.GetWidth(), decoder.GetHeight(),
@@ -237,7 +237,7 @@
ASSERT_EQ(1, decoder.GetWidth());
ASSERT_EQ(1, decoder.GetHeight());
- ASSERT_EQ(FXDIB_Format::kRgb, decoder.GetBitmapFormat());
+ ASSERT_EQ(FXDIB_Format::kBgr, decoder.GetBitmapFormat());
auto bitmap = pdfium::MakeRetain<CFX_DIBitmap>();
ASSERT_TRUE(bitmap->Create(decoder.GetWidth(), decoder.GetHeight(),
@@ -271,7 +271,7 @@
ASSERT_EQ(1, decoder.GetWidth());
ASSERT_EQ(1, decoder.GetHeight());
- ASSERT_EQ(FXDIB_Format::kRgb, decoder.GetBitmapFormat());
+ ASSERT_EQ(FXDIB_Format::kBgr, decoder.GetBitmapFormat());
auto bitmap = pdfium::MakeRetain<CFX_DIBitmap>();
ASSERT_TRUE(bitmap->Create(decoder.GetWidth(), decoder.GetHeight(),
@@ -312,7 +312,7 @@
ASSERT_EQ(kWidth, decoder.GetWidth());
ASSERT_EQ(kHeight, decoder.GetHeight());
- ASSERT_EQ(FXDIB_Format::kRgb, decoder.GetBitmapFormat());
+ ASSERT_EQ(FXDIB_Format::kBgr, decoder.GetBitmapFormat());
auto bitmap = pdfium::MakeRetain<CFX_DIBitmap>();
ASSERT_TRUE(bitmap->Create(decoder.GetWidth(), decoder.GetHeight(),
@@ -358,7 +358,7 @@
ASSERT_EQ(1, decoder.GetWidth());
ASSERT_EQ(1, decoder.GetHeight());
- ASSERT_EQ(FXDIB_Format::kArgb, decoder.GetBitmapFormat());
+ ASSERT_EQ(FXDIB_Format::kBgra, decoder.GetBitmapFormat());
auto bitmap = pdfium::MakeRetain<CFX_DIBitmap>();
ASSERT_TRUE(bitmap->Create(decoder.GetWidth(), decoder.GetHeight(),
@@ -391,7 +391,7 @@
ASSERT_EQ(1, decoder.GetWidth());
ASSERT_EQ(1, decoder.GetHeight());
- ASSERT_EQ(FXDIB_Format::kArgb, decoder.GetBitmapFormat());
+ ASSERT_EQ(FXDIB_Format::kBgra, decoder.GetBitmapFormat());
auto bitmap = pdfium::MakeRetain<CFX_DIBitmap>();
ASSERT_TRUE(bitmap->Create(decoder.GetWidth(), decoder.GetHeight(),
@@ -427,7 +427,7 @@
ASSERT_EQ(1, decoder.GetWidth());
ASSERT_EQ(1, decoder.GetHeight());
- ASSERT_EQ(FXDIB_Format::kArgb, decoder.GetBitmapFormat());
+ ASSERT_EQ(FXDIB_Format::kBgra, decoder.GetBitmapFormat());
auto bitmap = pdfium::MakeRetain<CFX_DIBitmap>();
ASSERT_TRUE(bitmap->Create(decoder.GetWidth(), decoder.GetHeight(),
@@ -460,7 +460,7 @@
ASSERT_EQ(4, decoder.GetWidth());
ASSERT_EQ(2, decoder.GetHeight());
- ASSERT_EQ(FXDIB_Format::kArgb, decoder.GetBitmapFormat());
+ ASSERT_EQ(FXDIB_Format::kBgra, decoder.GetBitmapFormat());
auto bitmap = pdfium::MakeRetain<CFX_DIBitmap>();
ASSERT_TRUE(bitmap->Create(decoder.GetWidth(), decoder.GetHeight(),
@@ -500,7 +500,7 @@
ASSERT_EQ(4, decoder.GetWidth());
ASSERT_EQ(2, decoder.GetHeight());
- ASSERT_EQ(FXDIB_Format::kArgb, decoder.GetBitmapFormat());
+ ASSERT_EQ(FXDIB_Format::kBgra, decoder.GetBitmapFormat());
auto bitmap = pdfium::MakeRetain<CFX_DIBitmap>();
ASSERT_TRUE(bitmap->Create(decoder.GetWidth(), decoder.GetHeight(),
diff --git a/core/fxcodec/tiff/tiff_decoder.cpp b/core/fxcodec/tiff/tiff_decoder.cpp
index c9468e8..668f6f4 100644
--- a/core/fxcodec/tiff/tiff_decoder.cpp
+++ b/core/fxcodec/tiff/tiff_decoder.cpp
@@ -241,8 +241,8 @@
bool CTiffContext::Decode(RetainPtr<CFX_DIBitmap> bitmap) {
// TODO(crbug.com/355630556): Consider adding support for
- // `FXDIB_Format::kArgbPremul`
- CHECK_EQ(bitmap->GetFormat(), FXDIB_Format::kArgb);
+ // `FXDIB_Format::kBgraPremul`
+ CHECK_EQ(bitmap->GetFormat(), FXDIB_Format::kBgra);
const uint32_t img_width = bitmap->GetWidth();
const uint32_t img_height = bitmap->GetHeight();
uint32_t width = 0;
diff --git a/core/fxcodec/tiff/tiff_decoder.h b/core/fxcodec/tiff/tiff_decoder.h
index d8e63be..4b410bf 100644
--- a/core/fxcodec/tiff/tiff_decoder.h
+++ b/core/fxcodec/tiff/tiff_decoder.h
@@ -35,7 +35,7 @@
int32_t* comps,
int32_t* bpc,
CFX_DIBAttribute* pAttribute);
- // `bitmap` must be `FXDIB_Format::kArgb`.
+ // `bitmap` must be `FXDIB_Format::kBgra`.
static bool Decode(ProgressiveDecoderIface::Context* ctx,
RetainPtr<CFX_DIBitmap> bitmap);
diff --git a/core/fxge/agg/cfx_agg_devicedriver.cpp b/core/fxge/agg/cfx_agg_devicedriver.cpp
index 228e8f0..7ca81a4 100644
--- a/core/fxge/agg/cfx_agg_devicedriver.cpp
+++ b/core/fxge/agg/cfx_agg_devicedriver.cpp
@@ -186,7 +186,7 @@
return;
}
- CHECK_EQ(FXDIB_Format::kRgb, src_format);
+ CHECK_EQ(FXDIB_Format::kBgr, src_format);
for (int row = 0; row < height; row++) {
int dest_row = dest_top + row;
auto dest_scan =
@@ -205,8 +205,8 @@
return;
}
- if (dest_format == FXDIB_Format::kRgb) {
- CHECK_EQ(src_format, FXDIB_Format::kRgb32);
+ if (dest_format == FXDIB_Format::kBgr) {
+ CHECK_EQ(src_format, FXDIB_Format::kBgrx);
for (int row = 0; row < height; row++) {
int dest_row = dest_top + row;
auto dest_scan =
@@ -225,9 +225,9 @@
return;
}
- CHECK(dest_format == FXDIB_Format::kArgb ||
- dest_format == FXDIB_Format::kRgb32);
- if (src_format == FXDIB_Format::kRgb) {
+ CHECK(dest_format == FXDIB_Format::kBgra ||
+ dest_format == FXDIB_Format::kBgrx);
+ if (src_format == FXDIB_Format::kBgr) {
for (int row = 0; row < height; row++) {
int dest_row = dest_top + row;
auto dest_scan =
@@ -246,10 +246,10 @@
}
return;
}
- if (src_format != FXDIB_Format::kRgb32) {
+ if (src_format != FXDIB_Format::kBgrx) {
return;
}
- CHECK_EQ(dest_format, FXDIB_Format::kArgb);
+ CHECK_EQ(dest_format, FXDIB_Format::kBgra);
for (int row = 0; row < height; row++) {
int dest_row = dest_top + row;
auto dest_scan =
@@ -414,10 +414,10 @@
return &CFX_AggRenderer::CompositeSpanGray;
}
const FXDIB_Format format = device->GetFormat();
- if (format == FXDIB_Format::kArgb) {
+ if (format == FXDIB_Format::kBgra) {
return &CFX_AggRenderer::CompositeSpanARGB;
}
- CHECK(format == FXDIB_Format::kRgb || format == FXDIB_Format::kRgb32);
+ CHECK(format == FXDIB_Format::kBgr || format == FXDIB_Format::kBgrx);
return &CFX_AggRenderer::CompositeSpanRGB;
}
diff --git a/core/fxge/apple/fx_quartz_device.cpp b/core/fxge/apple/fx_quartz_device.cpp
index 5b60b81..97bf702 100644
--- a/core/fxge/apple/fx_quartz_device.cpp
+++ b/core/fxge/apple/fx_quartz_device.cpp
@@ -28,10 +28,10 @@
return nullptr;
CGBitmapInfo bmpInfo = kCGBitmapByteOrder32Little;
switch (pBitmap->GetFormat()) {
- case FXDIB_Format::kRgb32:
+ case FXDIB_Format::kBgrx:
bmpInfo |= kCGImageAlphaNoneSkipFirst;
break;
- case FXDIB_Format::kArgb:
+ case FXDIB_Format::kBgra:
default:
return nullptr;
}
diff --git a/core/fxge/cfx_defaultrenderdevice_unittest.cpp b/core/fxge/cfx_defaultrenderdevice_unittest.cpp
index 0eb8b43..24b2195 100644
--- a/core/fxge/cfx_defaultrenderdevice_unittest.cpp
+++ b/core/fxge/cfx_defaultrenderdevice_unittest.cpp
@@ -15,7 +15,7 @@
TEST(CFX_DefaultRenderDeviceTest, GetClipBox_Default) {
CFX_DefaultRenderDevice device;
- ASSERT_TRUE(device.Create(/*width=*/16, /*height=*/16, FXDIB_Format::kArgb));
+ ASSERT_TRUE(device.Create(/*width=*/16, /*height=*/16, FXDIB_Format::kBgra));
EXPECT_EQ(FX_RECT(0, 0, 16, 16), device.GetClipBox());
}
@@ -29,7 +29,7 @@
CFX_FillRenderOptions::FillType::kEvenOdd);
CFX_DefaultRenderDevice device;
- ASSERT_TRUE(device.Create(/*width=*/16, /*height=*/16, FXDIB_Format::kArgb));
+ ASSERT_TRUE(device.Create(/*width=*/16, /*height=*/16, FXDIB_Format::kBgra));
CFX_Path path;
path.AppendRect(2, 4, 14, 12);
@@ -46,7 +46,7 @@
const CFX_GraphStateData graphics_state;
CFX_DefaultRenderDevice device;
- ASSERT_TRUE(device.Create(/*width=*/16, /*height=*/16, FXDIB_Format::kArgb));
+ ASSERT_TRUE(device.Create(/*width=*/16, /*height=*/16, FXDIB_Format::kBgra));
CFX_Path path;
path.AppendRect(2, 4, 14, 12);
@@ -58,7 +58,7 @@
TEST(CFX_DefaultRenderDeviceTest, GetClipBox_Rect) {
CFX_DefaultRenderDevice device;
- ASSERT_TRUE(device.Create(/*width=*/16, /*height=*/16, FXDIB_Format::kArgb));
+ ASSERT_TRUE(device.Create(/*width=*/16, /*height=*/16, FXDIB_Format::kBgra));
EXPECT_TRUE(device.SetClip_Rect({2, 4, 14, 12}));
@@ -67,7 +67,7 @@
TEST(CFX_DefaultRenderDeviceTest, GetClipBox_Empty) {
CFX_DefaultRenderDevice device;
- ASSERT_TRUE(device.Create(/*width=*/16, /*height=*/16, FXDIB_Format::kArgb));
+ ASSERT_TRUE(device.Create(/*width=*/16, /*height=*/16, FXDIB_Format::kBgra));
EXPECT_TRUE(device.SetClip_Rect({2, 8, 14, 8}));
diff --git a/core/fxge/cfx_renderdevice.cpp b/core/fxge/cfx_renderdevice.cpp
index 4997c03..2bb4680 100644
--- a/core/fxge/cfx_renderdevice.cpp
+++ b/core/fxge/cfx_renderdevice.cpp
@@ -215,7 +215,7 @@
bool normalize,
int x_subpixel,
const FX_BGRA_STRUCT<uint8_t>& bgra) {
- // TODO(crbug.com/42271020): Add support for `FXDIB_Format::kArgbPremul`.
+ // TODO(crbug.com/42271020): Add support for `FXDIB_Format::kBgraPremul`.
CHECK(!bitmap->IsPremultiplied());
const bool has_alpha = bitmap->IsAlphaFormat();
const int bytes_per_pixel = has_alpha ? 4 : bitmap->GetBPP() / 8;
@@ -477,11 +477,11 @@
}
#if defined(PDF_USE_SKIA)
if (use_argb_premul && (render_caps & FXRC_PREMULTIPLIED_ALPHA)) {
- return FXDIB_Format::kArgbPremul;
+ return FXDIB_Format::kBgraPremul;
}
#endif
if (render_caps & FXRC_ALPHA_OUTPUT) {
- return FXDIB_Format::kArgb;
+ return FXDIB_Format::kBgra;
}
return CFX_DIBBase::kPlatformRGBFormat;
}
@@ -917,7 +917,7 @@
int bg_pixel_height = dest_rect.Height();
auto background = pdfium::MakeRetain<CFX_DIBitmap>();
if (!background->Create(bg_pixel_width, bg_pixel_height,
- FXDIB_Format::kRgb32)) {
+ FXDIB_Format::kBgrx)) {
return false;
}
if (!m_pDeviceDriver->GetDIBits(background, dest_rect.left, dest_rect.top))
@@ -1190,7 +1190,7 @@
return false;
} else {
// TODO(crbug.com/42271020): Switch to CreateCompatibleBitmap() once
- // DrawNormalTextHelper() supports `FXDIB_Format::kArgbPremul`.
+ // DrawNormalTextHelper() supports `FXDIB_Format::kBgraPremul`.
if (!bitmap->Create(pixel_width, pixel_height,
GetCreateCompatibleBitmapFormat(
m_RenderCaps, /*use_argb_premul=*/false))) {
diff --git a/core/fxge/dib/cfx_dibbase.cpp b/core/fxge/dib/cfx_dibbase.cpp
index 0b2fc62..dbefd0f 100644
--- a/core/fxge/dib/cfx_dibbase.cpp
+++ b/core/fxge/dib/cfx_dibbase.cpp
@@ -443,7 +443,7 @@
case 32:
#if defined(PDF_USE_SKIA)
// TODO(crbug.com/42271020): Determine if this ever happens.
- CHECK_NE(pSrcBitmap->GetFormat(), FXDIB_Format::kArgbPremul);
+ CHECK_NE(pSrcBitmap->GetFormat(), FXDIB_Format::kBgraPremul);
#endif
ConvertBuffer_Rgb2Gray(dest_buf, dest_pitch, width, height, pSrcBitmap,
src_left, src_top);
@@ -486,7 +486,7 @@
break;
case 32:
#if defined(PDF_USE_SKIA)
- if (pSrcBitmap->GetFormat() == FXDIB_Format::kArgbPremul) {
+ if (pSrcBitmap->GetFormat() == FXDIB_Format::kBgraPremul) {
ConvertBuffer_ArgbPremulToRgb(dest_buf, dest_pitch, width, height,
pSrcBitmap, src_left, src_top);
break;
@@ -522,7 +522,7 @@
case 32:
#if defined(PDF_USE_SKIA)
// TODO(crbug.com/42271020): Determine if this ever happens.
- CHECK_NE(pSrcBitmap->GetFormat(), FXDIB_Format::kArgbPremul);
+ CHECK_NE(pSrcBitmap->GetFormat(), FXDIB_Format::kBgraPremul);
#endif
ConvertBuffer_Rgb2Rgb32(dest_buf, dest_pitch, width, height, pSrcBitmap,
src_left, src_top);
@@ -792,8 +792,8 @@
RetainPtr<CFX_DIBitmap> CFX_DIBBase::CloneAlphaMask() const {
// TODO(crbug.com/355676038): Consider adding support for
- // `FXDIB_Format::kArgbPremul`
- DCHECK_EQ(GetFormat(), FXDIB_Format::kArgb);
+ // `FXDIB_Format::kBgraPremul`
+ DCHECK_EQ(GetFormat(), FXDIB_Format::kBgra);
auto pMask = pdfium::MakeRetain<CFX_DIBitmap>();
if (!pMask->Create(GetWidth(), GetHeight(), FXDIB_Format::k8bppMask)) {
return nullptr;
@@ -909,7 +909,7 @@
}
RetainPtr<CFX_DIBitmap> CFX_DIBBase::ConvertTo(FXDIB_Format dest_format) const {
- CHECK(dest_format == FXDIB_Format::kRgb ||
+ CHECK(dest_format == FXDIB_Format::kBgr ||
dest_format == FXDIB_Format::k8bppRgb);
CHECK_NE(dest_format, GetFormat());
@@ -1110,19 +1110,19 @@
src_left, src_top);
return {};
}
- case FXDIB_Format::kRgb: {
+ case FXDIB_Format::kBgr: {
ConvertBuffer_Rgb(dest_format, dest_buf, dest_pitch, width, height,
pSrcBitmap, src_left, src_top);
return {};
}
- case FXDIB_Format::kArgb:
- case FXDIB_Format::kRgb32: {
+ case FXDIB_Format::kBgra:
+ case FXDIB_Format::kBgrx: {
ConvertBuffer_Argb(dest_format, dest_buf, dest_pitch, width, height,
pSrcBitmap, src_left, src_top);
return {};
}
#if defined(PDF_USE_SKIA)
- case FXDIB_Format::kArgbPremul: {
+ case FXDIB_Format::kBgraPremul: {
ConvertBuffer_ArgbPremul(dest_buf, dest_pitch, width, height, pSrcBitmap,
src_left, src_top);
return {};
diff --git a/core/fxge/dib/cfx_dibbase.h b/core/fxge/dib/cfx_dibbase.h
index 03eb7ea..f0ff548 100644
--- a/core/fxge/dib/cfx_dibbase.h
+++ b/core/fxge/dib/cfx_dibbase.h
@@ -36,10 +36,10 @@
public:
#if BUILDFLAG(IS_APPLE)
// Matches Apple's kCGBitmapByteOrder32Little in fx_quartz_device.cpp.
- static constexpr FXDIB_Format kPlatformRGBFormat = FXDIB_Format::kRgb32;
+ static constexpr FXDIB_Format kPlatformRGBFormat = FXDIB_Format::kBgrx;
using kPlatformRGBStruct = FX_BGRA_STRUCT<uint8_t>;
#else // BUILDFLAG(IS_APPLE)
- static constexpr FXDIB_Format kPlatformRGBFormat = FXDIB_Format::kRgb;
+ static constexpr FXDIB_Format kPlatformRGBFormat = FXDIB_Format::kBgr;
using kPlatformRGBStruct = FX_BGR_STRUCT<uint8_t>;
#endif // BUILDFLAG(IS_APPLE)
@@ -90,7 +90,7 @@
RetainPtr<CFX_DIBitmap> Realize() const;
RetainPtr<CFX_DIBitmap> ClipTo(const FX_RECT& rect) const;
// `format` must be different from the existing format.
- // Only supports `FXDIB_Format::kRgb` and `FXDIB_Format::k8bppRgb`.
+ // Only supports `FXDIB_Format::kBgr` and `FXDIB_Format::k8bppRgb`.
RetainPtr<CFX_DIBitmap> ConvertTo(FXDIB_Format format) const;
RetainPtr<CFX_DIBitmap> StretchTo(int dest_width,
int dest_height,
@@ -116,7 +116,7 @@
bool IsPremultiplied() const {
#if defined(PDF_USE_SKIA)
- return GetFormat() == FXDIB_Format::kArgbPremul;
+ return GetFormat() == FXDIB_Format::kBgraPremul;
#else
return false;
#endif
diff --git a/core/fxge/dib/cfx_dibitmap.cpp b/core/fxge/dib/cfx_dibitmap.cpp
index 525c7ef..f15b28a 100644
--- a/core/fxge/dib/cfx_dibitmap.cpp
+++ b/core/fxge/dib/cfx_dibitmap.cpp
@@ -166,7 +166,7 @@
case FXDIB_Format::k8bppRgb:
fxcrt::Fill(buffer, FindPalette(color));
break;
- case FXDIB_Format::kRgb: {
+ case FXDIB_Format::kBgr: {
const FX_BGR_STRUCT<uint8_t> bgr = ArgbToBGRStruct(color);
if (bgr.red == bgr.green && bgr.green == bgr.blue) {
fxcrt::Fill(buffer, bgr.red);
@@ -177,20 +177,20 @@
}
break;
}
- case FXDIB_Format::kRgb32:
+ case FXDIB_Format::kBgrx:
if (CFX_DefaultRenderDevice::UseSkiaRenderer()) {
// TODO(crbug.com/pdfium/2016): This is not reliable because alpha may
// be modified outside of this operation.
color |= 0xFF000000;
}
[[fallthrough]];
- case FXDIB_Format::kArgb:
+ case FXDIB_Format::kBgra:
for (int row = 0; row < GetHeight(); row++) {
fxcrt::Fill(GetWritableScanlineAs<uint32_t>(row), color);
}
break;
#if defined(PDF_USE_SKIA)
- case FXDIB_Format::kArgbPremul: {
+ case FXDIB_Format::kBgraPremul: {
CHECK(CFX_DefaultRenderDevice::UseSkiaRenderer());
const FX_BGRA_STRUCT<uint8_t> bgra =
PreMultiplyColor(ArgbToBGRAStruct(color));
@@ -314,7 +314,7 @@
}
void CFX_DIBitmap::SetRedFromAlpha() {
- CHECK_EQ(FXDIB_Format::kArgb, GetFormat());
+ CHECK_EQ(FXDIB_Format::kBgra, GetFormat());
CHECK(m_pBuffer);
for (int row = 0; row < GetHeight(); row++) {
@@ -327,7 +327,7 @@
}
void CFX_DIBitmap::SetUniformOpaqueAlpha() {
- CHECK_EQ(FXDIB_Format::kArgb, GetFormat());
+ CHECK_EQ(FXDIB_Format::kBgra, GetFormat());
CHECK(m_pBuffer);
for (int row = 0; row < GetHeight(); row++) {
@@ -345,10 +345,10 @@
CHECK_EQ(FXDIB_Format::k8bppMask, mask->GetFormat());
CHECK(m_pBuffer);
- if (GetFormat() == FXDIB_Format::kRgb32) {
+ if (GetFormat() == FXDIB_Format::kBgrx) {
// TODO(crbug.com/42271020): Consider adding support for
- // `FXDIB_Format::kArgbPremul`
- if (!ConvertFormat(FXDIB_Format::kArgb)) {
+ // `FXDIB_Format::kBgraPremul`
+ if (!ConvertFormat(FXDIB_Format::kBgra)) {
return false;
}
@@ -365,7 +365,7 @@
return true;
}
- CHECK_EQ(GetFormat(), FXDIB_Format::kArgb);
+ CHECK_EQ(GetFormat(), FXDIB_Format::kBgra);
for (int row = 0; row < GetHeight(); row++) {
auto dest_scan =
GetWritableScanlineAs<FX_BGRA_STRUCT<uint8_t>>(row).first(GetWidth());
@@ -391,8 +391,8 @@
}
// TODO(crbug.com/42271020): Consider adding support for
- // `FXDIB_Format::kArgbPremul`
- if (!ConvertFormat(FXDIB_Format::kArgb)) {
+ // `FXDIB_Format::kBgraPremul`
+ if (!ConvertFormat(FXDIB_Format::kBgra)) {
return false;
}
@@ -440,14 +440,14 @@
case FXDIB_Format::k8bppRgb:
return HasPalette() ? GetPaletteSpan()[*pos]
: ArgbEncode(0xff, *pos, *pos, *pos);
- case FXDIB_Format::kRgb:
- case FXDIB_Format::kRgb32:
+ case FXDIB_Format::kBgr:
+ case FXDIB_Format::kBgrx:
return UNSAFE_TODO(FXARGB_GetDIB(pos) | 0xff000000);
- case FXDIB_Format::kArgb:
+ case FXDIB_Format::kBgra:
return UNSAFE_TODO(FXARGB_GetDIB(pos));
- case FXDIB_Format::kArgbPremul: {
+ case FXDIB_Format::kBgraPremul: {
// TODO(crbug.com/42271020): Consider testing with
- // `FXDIB_Format::kArgbPremul`
+ // `FXDIB_Format::kBgraPremul`
NOTREACHED_NORETURN();
}
}
@@ -799,8 +799,8 @@
// Other formats with alpha have already been handled above.
//
// TODO(crbug.com/42271020): Consider adding support for
- // `FXDIB_Format::kArgbPremul`
- DCHECK_EQ(GetFormat(), FXDIB_Format::kArgb);
+ // `FXDIB_Format::kBgraPremul`
+ DCHECK_EQ(GetFormat(), FXDIB_Format::kBgra);
}
if (src_alpha == 255) {
for (int row = rect.top; row < rect.bottom; row++) {
@@ -874,11 +874,11 @@
bool CFX_DIBitmap::ConvertFormat(FXDIB_Format dest_format) {
static constexpr FXDIB_Format kAllowedDestFormats[] = {
FXDIB_Format::k8bppMask,
- FXDIB_Format::kArgb,
+ FXDIB_Format::kBgra,
#if defined(PDF_USE_SKIA)
- FXDIB_Format::kArgbPremul,
+ FXDIB_Format::kBgraPremul,
#endif
- FXDIB_Format::kRgb,
+ FXDIB_Format::kBgr,
};
CHECK(pdfium::Contains(kAllowedDestFormats, dest_format));
@@ -894,14 +894,14 @@
}
break;
- case FXDIB_Format::kArgb:
- if (GetFormat() == FXDIB_Format::kRgb32) {
- SetFormat(FXDIB_Format::kArgb);
+ case FXDIB_Format::kBgra:
+ if (GetFormat() == FXDIB_Format::kBgrx) {
+ SetFormat(FXDIB_Format::kBgra);
SetUniformOpaqueAlpha();
return true;
}
#if defined(PDF_USE_SKIA)
- if (GetFormat() == FXDIB_Format::kArgbPremul) {
+ if (GetFormat() == FXDIB_Format::kBgraPremul) {
UnPreMultiply();
return true;
}
@@ -909,13 +909,13 @@
break;
#if defined(PDF_USE_SKIA)
- case FXDIB_Format::kArgbPremul:
- if (GetFormat() == FXDIB_Format::kRgb32) {
- SetFormat(FXDIB_Format::kArgbPremul);
+ case FXDIB_Format::kBgraPremul:
+ if (GetFormat() == FXDIB_Format::kBgrx) {
+ SetFormat(FXDIB_Format::kBgraPremul);
SetUniformOpaqueAlpha();
return true;
}
- if (GetFormat() == FXDIB_Format::kArgb) {
+ if (GetFormat() == FXDIB_Format::kBgra) {
PreMultiply();
return true;
}
@@ -946,7 +946,7 @@
// SAFETY: `dest_buf` allocated with `dest_buf_size` bytes above.
auto dest_span =
UNSAFE_BUFFERS(pdfium::make_span(dest_buf.get(), dest_buf_size));
- if (dest_format == FXDIB_Format::kArgb) {
+ if (dest_format == FXDIB_Format::kBgra) {
fxcrt::Fill(dest_span, 0xff);
}
diff --git a/core/fxge/dib/cfx_dibitmap.h b/core/fxge/dib/cfx_dibitmap.h
index b98ae8f..c408932 100644
--- a/core/fxge/dib/cfx_dibitmap.h
+++ b/core/fxge/dib/cfx_dibitmap.h
@@ -94,10 +94,10 @@
uint32_t GetPixelForTesting(int x, int y) const;
#endif // defined(PDF_USE_SKIA)
- // Requires `this` to be of format `FXDIB_Format::kArgb`.
+ // Requires `this` to be of format `FXDIB_Format::kBgra`.
void SetRedFromAlpha();
- // Requires `this` to be of format `FXDIB_Format::kArgb`.
+ // Requires `this` to be of format `FXDIB_Format::kBgra`.
void SetUniformOpaqueAlpha();
// TODO(crbug.com/pdfium/2007): Migrate callers to `CFX_RenderDevice`.
diff --git a/core/fxge/dib/cfx_dibitmap_unittest.cpp b/core/fxge/dib/cfx_dibitmap_unittest.cpp
index e728060..f014632 100644
--- a/core/fxge/dib/cfx_dibitmap_unittest.cpp
+++ b/core/fxge/dib/cfx_dibitmap_unittest.cpp
@@ -30,7 +30,7 @@
TEST(CFXDIBitmapTest, CalculatePitchAndSizeGood) {
// Simple case with no provided pitch.
std::optional<CFX_DIBitmap::PitchAndSize> result =
- CFX_DIBitmap::CalculatePitchAndSize(100, 200, FXDIB_Format::kArgb, 0);
+ CFX_DIBitmap::CalculatePitchAndSize(100, 200, FXDIB_Format::kBgra, 0);
ASSERT_TRUE(result.has_value());
EXPECT_EQ(400u, result.value().pitch);
EXPECT_EQ(80000u, result.value().size);
@@ -44,14 +44,14 @@
// Simple case with provided pitch matching width * bpp.
result =
- CFX_DIBitmap::CalculatePitchAndSize(100, 200, FXDIB_Format::kArgb, 400);
+ CFX_DIBitmap::CalculatePitchAndSize(100, 200, FXDIB_Format::kBgra, 400);
ASSERT_TRUE(result.has_value());
EXPECT_EQ(400u, result.value().pitch);
EXPECT_EQ(80000u, result.value().size);
// Simple case with provided pitch, where pitch exceeds width * bpp.
result =
- CFX_DIBitmap::CalculatePitchAndSize(100, 200, FXDIB_Format::kArgb, 455);
+ CFX_DIBitmap::CalculatePitchAndSize(100, 200, FXDIB_Format::kBgra, 455);
ASSERT_TRUE(result.has_value());
EXPECT_EQ(455u, result.value().pitch);
EXPECT_EQ(91000u, result.value().size);
@@ -65,9 +65,9 @@
};
for (const auto& dimension : kBadDimensions) {
EXPECT_FALSE(CFX_DIBitmap::CalculatePitchAndSize(
- dimension.width, dimension.height, FXDIB_Format::kArgb, 0));
+ dimension.width, dimension.height, FXDIB_Format::kBgra, 0));
EXPECT_FALSE(CFX_DIBitmap::CalculatePitchAndSize(
- dimension.width, dimension.height, FXDIB_Format::kArgb, 1));
+ dimension.width, dimension.height, FXDIB_Format::kBgra, 1));
}
// Bad format.
@@ -78,21 +78,21 @@
// Width too wide for claimed pitch.
EXPECT_FALSE(
- CFX_DIBitmap::CalculatePitchAndSize(101, 200, FXDIB_Format::kArgb, 400));
+ CFX_DIBitmap::CalculatePitchAndSize(101, 200, FXDIB_Format::kBgra, 400));
// Overflow cases with calculated pitch.
EXPECT_FALSE(CFX_DIBitmap::CalculatePitchAndSize(1073747000, 1,
- FXDIB_Format::kArgb, 0));
+ FXDIB_Format::kBgra, 0));
EXPECT_FALSE(CFX_DIBitmap::CalculatePitchAndSize(1048576, 1024,
- FXDIB_Format::kArgb, 0));
+ FXDIB_Format::kBgra, 0));
EXPECT_FALSE(CFX_DIBitmap::CalculatePitchAndSize(4194304, 1024,
FXDIB_Format::k8bppRgb, 0));
// Overflow cases with provided pitch.
EXPECT_FALSE(CFX_DIBitmap::CalculatePitchAndSize(
- 2147484000u, 1, FXDIB_Format::kArgb, 2147484000u));
+ 2147484000u, 1, FXDIB_Format::kBgra, 2147484000u));
EXPECT_FALSE(CFX_DIBitmap::CalculatePitchAndSize(
- 1048576, 1024, FXDIB_Format::kArgb, 4194304));
+ 1048576, 1024, FXDIB_Format::kBgra, 4194304));
EXPECT_FALSE(CFX_DIBitmap::CalculatePitchAndSize(
4194304, 1024, FXDIB_Format::k8bppRgb, 4194304));
}
@@ -120,7 +120,7 @@
TEST(CFXDIBitmapTest, GetScanlineAsWith24Bpp) {
auto bitmap = pdfium::MakeRetain<CFX_DIBitmap>();
- ASSERT_TRUE(bitmap->Create(3, 3, FXDIB_Format::kRgb));
+ ASSERT_TRUE(bitmap->Create(3, 3, FXDIB_Format::kBgr));
EXPECT_EQ(3, bitmap->GetWidth());
EXPECT_EQ(12u, bitmap->GetPitch());
@@ -137,7 +137,7 @@
#if defined(PDF_USE_SKIA)
TEST(CFXDIBitmapTest, UnPreMultiplyFromPreMultiplied) {
auto bitmap = pdfium::MakeRetain<CFX_DIBitmap>();
- ASSERT_TRUE(bitmap->Create(1, 1, FXDIB_Format::kArgbPremul));
+ ASSERT_TRUE(bitmap->Create(1, 1, FXDIB_Format::kBgraPremul));
EXPECT_TRUE(bitmap->IsPremultiplied());
UNSAFE_TODO(FXARGB_SetDIB(bitmap->GetWritableBuffer().data(), 0x7f'7f'7f'7f));
@@ -148,7 +148,7 @@
TEST(CFXDIBitmapTest, UnPreMultiplyFromUnPreMultiplied) {
auto bitmap = pdfium::MakeRetain<CFX_DIBitmap>();
- ASSERT_TRUE(bitmap->Create(1, 1, FXDIB_Format::kArgb));
+ ASSERT_TRUE(bitmap->Create(1, 1, FXDIB_Format::kBgra));
EXPECT_FALSE(bitmap->IsPremultiplied());
UNSAFE_TODO(FXARGB_SetDIB(bitmap->GetWritableBuffer().data(), 0x7f'ff'ff'ff));
@@ -159,7 +159,7 @@
TEST(CFXDIBitmapTest, PreMultiplyFromUnPreMultiplied) {
auto bitmap = pdfium::MakeRetain<CFX_DIBitmap>();
- ASSERT_TRUE(bitmap->Create(1, 1, FXDIB_Format::kArgb));
+ ASSERT_TRUE(bitmap->Create(1, 1, FXDIB_Format::kBgra));
EXPECT_FALSE(bitmap->IsPremultiplied());
UNSAFE_TODO(FXARGB_SetDIB(bitmap->GetWritableBuffer().data(), 0x7f'ff'ff'ff));
@@ -170,7 +170,7 @@
TEST(CFXDIBitmapTest, PreMultiplyFromPreMultiplied) {
auto bitmap = pdfium::MakeRetain<CFX_DIBitmap>();
- ASSERT_TRUE(bitmap->Create(1, 1, FXDIB_Format::kArgbPremul));
+ ASSERT_TRUE(bitmap->Create(1, 1, FXDIB_Format::kBgraPremul));
EXPECT_TRUE(bitmap->IsPremultiplied());
UNSAFE_TODO(FXARGB_SetDIB(bitmap->GetWritableBuffer().data(), 0x7f'7f'7f'7f));
diff --git a/core/fxge/dib/cfx_imagestretcher.cpp b/core/fxge/dib/cfx_imagestretcher.cpp
index 944e40e..7a76f1c 100644
--- a/core/fxge/dib/cfx_imagestretcher.cpp
+++ b/core/fxge/dib/cfx_imagestretcher.cpp
@@ -33,7 +33,7 @@
if (format == FXDIB_Format::k1bppRgb)
return FXDIB_Format::k8bppRgb;
if (format == FXDIB_Format::k8bppRgb && src.HasPalette())
- return FXDIB_Format::kRgb;
+ return FXDIB_Format::kBgr;
return format;
}
diff --git a/core/fxge/dib/cfx_imagetransformer.cpp b/core/fxge/dib/cfx_imagetransformer.cpp
index 0d3bcce..f6c663a 100644
--- a/core/fxge/dib/cfx_imagetransformer.cpp
+++ b/core/fxge/dib/cfx_imagetransformer.cpp
@@ -250,10 +250,10 @@
auto pTransformed = pdfium::MakeRetain<CFX_DIBitmap>();
// TODO(crbug.com/42271020): Consider adding support for
- // `FXDIB_Format::kArgbPremul`
+ // `FXDIB_Format::kBgraPremul`
FXDIB_Format dest_format = m_Stretcher->source()->IsMaskFormat()
? FXDIB_Format::k8bppMask
- : FXDIB_Format::kArgb;
+ : FXDIB_Format::kBgra;
if (!pTransformed->Create(m_result.Width(), m_result.Height(), dest_format)) {
return;
}
@@ -314,7 +314,7 @@
FXDIB_Format dest_format,
int src_bytes_per_pixel) {
DCHECK(dest_format == FXDIB_Format::k8bppMask ||
- dest_format == FXDIB_Format::kArgb);
+ dest_format == FXDIB_Format::kBgra);
const int dest_bytes_per_pixel = calc_data.bitmap->GetBPP() / 8;
if (!m_Storer.GetBitmap()->IsAlphaFormat()) {
auto func = [&calc_data, src_bytes_per_pixel](const BilinearData& data,
@@ -332,7 +332,7 @@
return;
}
- if (dest_format == FXDIB_Format::kArgb) {
+ if (dest_format == FXDIB_Format::kBgra) {
auto func = [&calc_data, src_bytes_per_pixel](const BilinearData& data,
uint8_t* dest) {
uint8_t b =
diff --git a/core/fxge/dib/cfx_scanlinecompositor.cpp b/core/fxge/dib/cfx_scanlinecompositor.cpp
index c9d190a..3983907 100644
--- a/core/fxge/dib/cfx_scanlinecompositor.cpp
+++ b/core/fxge/dib/cfx_scanlinecompositor.cpp
@@ -2276,8 +2276,7 @@
pdfium::span<const uint8_t> src_scan,
int width,
pdfium::span<const uint8_t> clip_scan) const {
- if (m_SrcFormat == FXDIB_Format::kRgb ||
- m_SrcFormat == FXDIB_Format::kRgb32) {
+ if (m_SrcFormat == FXDIB_Format::kBgr || m_SrcFormat == FXDIB_Format::kBgrx) {
CompositeRgbBitmapLineSrcRgbx(dest_scan, src_scan, width, clip_scan);
return;
}
@@ -2289,8 +2288,8 @@
pdfium::span<const uint8_t> src_scan,
int width,
pdfium::span<const uint8_t> clip_scan) const {
- CHECK(m_SrcFormat == FXDIB_Format::kRgb ||
- m_SrcFormat == FXDIB_Format::kRgb32);
+ CHECK(m_SrcFormat == FXDIB_Format::kBgr ||
+ m_SrcFormat == FXDIB_Format::kBgrx);
const int src_Bpp = GetCompsFromFormat(m_SrcFormat);
switch (m_DestFormat) {
@@ -2310,8 +2309,8 @@
CompositeRow_Rgb2Mask(dest_scan, width, clip_scan);
return;
}
- case FXDIB_Format::kRgb:
- case FXDIB_Format::kRgb32: {
+ case FXDIB_Format::kBgr:
+ case FXDIB_Format::kBgrx: {
const int dest_Bpp = GetCompsFromFormat(m_DestFormat);
if (m_bRgbByteOrder) {
if (m_BlendType == BlendMode::kNormal) {
@@ -2354,7 +2353,7 @@
dest_Bpp, src_Bpp);
return;
}
- case FXDIB_Format::kArgb: {
+ case FXDIB_Format::kBgra: {
if (m_bRgbByteOrder) {
if (m_BlendType == BlendMode::kNormal) {
if (!clip_scan.empty()) {
@@ -2396,9 +2395,9 @@
return;
}
#if defined(PDF_USE_SKIA)
- case FXDIB_Format::kArgbPremul: {
+ case FXDIB_Format::kBgraPremul: {
// TODO(crbug.com/42271020): Consider adding support for
- // `FXDIB_Format::kArgbPremul`
+ // `FXDIB_Format::kBgraPremul`
NOTREACHED_NORETURN();
}
#endif
@@ -2410,7 +2409,7 @@
pdfium::span<const uint8_t> src_scan,
int width,
pdfium::span<const uint8_t> clip_scan) const {
- CHECK_EQ(m_SrcFormat, FXDIB_Format::kArgb);
+ CHECK_EQ(m_SrcFormat, FXDIB_Format::kBgra);
auto src_span =
fxcrt::reinterpret_span<const FX_BGRA_STRUCT<uint8_t>>(src_scan).first(
@@ -2432,7 +2431,7 @@
CompositeRowArgb2Mask(src_span, clip_scan, dest_scan);
return;
}
- case FXDIB_Format::kRgb: {
+ case FXDIB_Format::kBgr: {
if (m_bRgbByteOrder) {
auto dest_span =
fxcrt::reinterpret_span<FX_RGB_STRUCT<uint8_t>>(dest_scan);
@@ -2445,7 +2444,7 @@
CompositeRowArgb2Rgb(src_span, clip_scan, dest_span, m_BlendType);
return;
}
- case FXDIB_Format::kRgb32: {
+ case FXDIB_Format::kBgrx: {
if (m_bRgbByteOrder) {
auto dest_span =
fxcrt::reinterpret_span<FX_RGBA_STRUCT<uint8_t>>(dest_scan);
@@ -2458,7 +2457,7 @@
CompositeRowArgb2Rgb(src_span, clip_scan, dest_span, m_BlendType);
return;
}
- case FXDIB_Format::kArgb: {
+ case FXDIB_Format::kBgra: {
if (m_bRgbByteOrder) {
auto dest_span =
fxcrt::reinterpret_span<FX_RGBA_STRUCT<uint8_t>>(dest_scan);
@@ -2471,9 +2470,9 @@
return;
}
#if defined(PDF_USE_SKIA)
- case FXDIB_Format::kArgbPremul: {
+ case FXDIB_Format::kBgraPremul: {
// TODO(crbug.com/42271020): Consider adding support for
- // `FXDIB_Format::kArgbPremul`
+ // `FXDIB_Format::kBgraPremul`
NOTREACHED_NORETURN();
}
#endif
@@ -2521,8 +2520,8 @@
CompositeRow_Rgb2Mask(dest_scan, width, clip_scan);
return;
}
- case FXDIB_Format::kRgb:
- case FXDIB_Format::kRgb32: {
+ case FXDIB_Format::kBgr:
+ case FXDIB_Format::kBgrx: {
if (m_bRgbByteOrder) {
CompositeRow_1bppRgb2Rgb_NoBlend_RgbByteOrder(
dest_scan, src_scan, src_left, m_SrcPalette.Get32BitPalette(),
@@ -2534,7 +2533,7 @@
GetCompsFromFormat(m_DestFormat), clip_scan);
return;
}
- case FXDIB_Format::kArgb: {
+ case FXDIB_Format::kBgra: {
if (m_bRgbByteOrder) {
CompositeRow_1bppRgb2Argb_NoBlend_RgbByteOrder(
dest_scan, src_scan, src_left, width,
@@ -2547,9 +2546,9 @@
return;
}
#if defined(PDF_USE_SKIA)
- case FXDIB_Format::kArgbPremul: {
+ case FXDIB_Format::kBgraPremul: {
// TODO(crbug.com/42271020): Consider adding support for
- // `FXDIB_Format::kArgbPremul`
+ // `FXDIB_Format::kBgraPremul`
NOTREACHED_NORETURN();
}
#endif
@@ -2582,8 +2581,8 @@
CompositeRow_Rgb2Mask(dest_scan, width, clip_scan);
return;
}
- case FXDIB_Format::kRgb:
- case FXDIB_Format::kRgb32: {
+ case FXDIB_Format::kBgr:
+ case FXDIB_Format::kBgrx: {
if (m_bRgbByteOrder) {
CompositeRow_8bppRgb2Rgb_NoBlend_RgbByteOrder(
dest_scan, src_scan, m_SrcPalette.Get32BitPalette().data(), width,
@@ -2595,7 +2594,7 @@
GetCompsFromFormat(m_DestFormat), clip_scan);
return;
}
- case FXDIB_Format::kArgb: {
+ case FXDIB_Format::kBgra: {
if (m_bRgbByteOrder) {
CompositeRow_8bppRgb2Argb_NoBlend_RgbByteOrder(
dest_scan, src_scan, width, m_SrcPalette.Get32BitPalette().data(),
@@ -2608,9 +2607,9 @@
return;
}
#if defined(PDF_USE_SKIA)
- case FXDIB_Format::kArgbPremul: {
+ case FXDIB_Format::kBgraPremul: {
// TODO(crbug.com/42271020): Consider adding support for
- // `FXDIB_Format::kArgbPremul`
+ // `FXDIB_Format::kBgraPremul`
NOTREACHED_NORETURN();
}
#endif
@@ -2642,8 +2641,8 @@
clip_scan);
return;
}
- case FXDIB_Format::kRgb:
- case FXDIB_Format::kRgb32: {
+ case FXDIB_Format::kBgr:
+ case FXDIB_Format::kBgrx: {
if (m_bRgbByteOrder) {
CompositeRow_ByteMask2Rgb_RgbByteOrder(
dest_scan, src_scan, m_MaskAlpha, m_MaskRed, m_MaskGreen,
@@ -2656,7 +2655,7 @@
GetCompsFromFormat(m_DestFormat), clip_scan);
return;
}
- case FXDIB_Format::kArgb: {
+ case FXDIB_Format::kBgra: {
if (m_bRgbByteOrder) {
CompositeRow_ByteMask2Argb_RgbByteOrder(
dest_scan, src_scan, m_MaskAlpha, m_MaskRed, m_MaskGreen,
@@ -2669,9 +2668,9 @@
return;
}
#if defined(PDF_USE_SKIA)
- case FXDIB_Format::kArgbPremul: {
+ case FXDIB_Format::kBgraPremul: {
// TODO(crbug.com/42271020): Consider adding support for
- // `FXDIB_Format::kArgbPremul`
+ // `FXDIB_Format::kBgraPremul`
NOTREACHED_NORETURN();
}
#endif
@@ -2704,8 +2703,8 @@
width, clip_scan);
return;
}
- case FXDIB_Format::kRgb:
- case FXDIB_Format::kRgb32: {
+ case FXDIB_Format::kBgr:
+ case FXDIB_Format::kBgrx: {
if (m_bRgbByteOrder) {
CompositeRow_BitMask2Rgb_RgbByteOrder(
dest_scan, src_scan, m_MaskAlpha, m_MaskRed, m_MaskGreen,
@@ -2719,7 +2718,7 @@
clip_scan);
return;
}
- case FXDIB_Format::kArgb: {
+ case FXDIB_Format::kBgra: {
if (m_bRgbByteOrder) {
CompositeRow_BitMask2Argb_RgbByteOrder(
dest_scan, src_scan, m_MaskAlpha, m_MaskRed, m_MaskGreen,
@@ -2732,9 +2731,9 @@
return;
}
#if defined(PDF_USE_SKIA)
- case FXDIB_Format::kArgbPremul: {
+ case FXDIB_Format::kBgraPremul: {
// TODO(crbug.com/42271020): Consider adding support for
- // `FXDIB_Format::kArgbPremul`
+ // `FXDIB_Format::kBgraPremul`
NOTREACHED_NORETURN();
}
#endif
diff --git a/core/fxge/dib/cstretchengine.cpp b/core/fxge/dib/cstretchengine.cpp
index 0b108ba..1c96a73 100644
--- a/core/fxge/dib/cstretchengine.cpp
+++ b/core/fxge/dib/cstretchengine.cpp
@@ -205,11 +205,11 @@
m_DestClip(clip_rect) {
if (m_bHasAlpha) {
// TODO(crbug.com/42271020): Consider adding support for
- // `FXDIB_Format::kArgbPremul`
- DCHECK_EQ(m_DestFormat, FXDIB_Format::kArgb);
- DCHECK_EQ(m_DestBpp, GetBppFromFormat(FXDIB_Format::kArgb));
- DCHECK_EQ(m_pSource->GetFormat(), FXDIB_Format::kArgb);
- DCHECK_EQ(m_SrcBpp, GetBppFromFormat(FXDIB_Format::kArgb));
+ // `FXDIB_Format::kBgraPremul`
+ DCHECK_EQ(m_DestFormat, FXDIB_Format::kBgra);
+ DCHECK_EQ(m_DestBpp, GetBppFromFormat(FXDIB_Format::kBgra));
+ DCHECK_EQ(m_pSource->GetFormat(), FXDIB_Format::kBgra);
+ DCHECK_EQ(m_SrcBpp, GetBppFromFormat(FXDIB_Format::kBgra));
}
std::optional<uint32_t> maybe_size =
@@ -218,8 +218,9 @@
return;
m_DestScanline.resize(maybe_size.value());
- if (dest_format == FXDIB_Format::kRgb32)
+ if (dest_format == FXDIB_Format::kBgrx) {
std::fill(m_DestScanline.begin(), m_DestScanline.end(), 255);
+ }
m_InterPitch = fxge::CalculatePitch32OrDie(m_DestBpp, m_DestClip.Width());
m_ExtraMaskPitch = fxge::CalculatePitch32OrDie(8, m_DestClip.Width());
if (options.bNoSmoothing) {
@@ -364,7 +365,7 @@
for (int j = pWeights->m_SrcStart; j <= pWeights->m_SrcEnd; ++j) {
uint32_t pixel_weight = pWeights->GetWeightForPosition(j);
FX_ARGB argb = m_pSrcPalette[src_scan[j]];
- if (m_DestFormat == FXDIB_Format::kRgb) {
+ if (m_DestFormat == FXDIB_Format::kBgr) {
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);
diff --git a/core/fxge/dib/fx_dib.h b/core/fxge/dib/fx_dib.h
index fea7565..363d26e 100644
--- a/core/fxge/dib/fx_dib.h
+++ b/core/fxge/dib/fx_dib.h
@@ -22,13 +22,13 @@
kInvalid = 0,
k1bppRgb = 0x001,
k8bppRgb = 0x008,
- kRgb = 0x018,
- kRgb32 = 0x020,
+ kBgr = 0x018,
+ kBgrx = 0x020,
k1bppMask = 0x101,
k8bppMask = 0x108,
- kArgb = 0x220,
+ kBgra = 0x220,
#if defined(PDF_USE_SKIA)
- kArgbPremul = 0x620,
+ kBgraPremul = 0x620,
#endif
};
diff --git a/core/fxge/renderdevicedriver_iface.h b/core/fxge/renderdevicedriver_iface.h
index ccc9ca6..a9aab32 100644
--- a/core/fxge/renderdevicedriver_iface.h
+++ b/core/fxge/renderdevicedriver_iface.h
@@ -146,18 +146,18 @@
// - `this` is bitmap-based and `this` is not of a mask format.
//
// The backing bitmap for `this` will be converted to format
- // `FXDIB_Format::kArgb` on success when `alpha` is not 1.
+ // `FXDIB_Format::kBgra` on success when `alpha` is not 1.
virtual bool MultiplyAlpha(float alpha) = 0;
// Multiplies the device by an alpha mask, returning `true` on success.
// Implementations CHECK the following conditions:
- // - `this` is bitmap-based and of format `FXDIB_Format::kArgb` or
- // `FXDIB_Format::kRgb32`.
+ // - `this` is bitmap-based and of format `FXDIB_Format::kBgra` or
+ // `FXDIB_Format::kBgrx`.
// - `mask` must be of format `FXDIB_Format::k8bppMask`.
// - `mask` must have the same dimensions as `this`.
//
// The backing bitmap for `this` will be converted to format
- // `FXDIB_Format::kArgb` on success.
+ // `FXDIB_Format::kBgra` on success.
virtual bool MultiplyAlphaMask(RetainPtr<const CFX_DIBitmap> mask) = 0;
};
diff --git a/core/fxge/skia/cfx_dibbase_skia.cpp b/core/fxge/skia/cfx_dibbase_skia.cpp
index e1564b8..52e79bd 100644
--- a/core/fxge/skia/cfx_dibbase_skia.cpp
+++ b/core/fxge/skia/cfx_dibbase_skia.cpp
@@ -249,17 +249,17 @@
case 32:
switch (GetFormat()) {
- case FXDIB_Format::kRgb32:
+ case FXDIB_Format::kBgrx:
return CreateSkiaImageFromTransformedDib<
/*source_bits_per_pixel=*/32>(
*this, kBGRA_8888_SkColorType, kOpaque_SkAlphaType,
[](uint8_t red, uint8_t green, uint8_t blue) {
return SkPackARGB32(0xFF, red, green, blue);
});
- case FXDIB_Format::kArgb:
+ case FXDIB_Format::kBgra:
return CreateSkiaImageFromDib(this, kBGRA_8888_SkColorType,
kUnpremul_SkAlphaType);
- case FXDIB_Format::kArgbPremul:
+ case FXDIB_Format::kBgraPremul:
return CreateSkiaImageFromDib(this, kBGRA_8888_SkColorType,
kPremul_SkAlphaType);
default:
diff --git a/core/fxge/skia/fx_skia_device.cpp b/core/fxge/skia/fx_skia_device.cpp
index cd305d5..4260cf4 100644
--- a/core/fxge/skia/fx_skia_device.cpp
+++ b/core/fxge/skia/fx_skia_device.cpp
@@ -623,9 +623,10 @@
RetainPtr<CFX_DIBitmap> MakeDebugBitmap(int width, int height, uint32_t color) {
auto bitmap = pdfium::MakeRetain<CFX_DIBitmap>();
// TODO(crbug.com/42271020): Consider adding support for
- // `FXDIB_Format::kArgbPremul`
- if (!bitmap->Create(width, height, FXDIB_Format::kArgb))
+ // `FXDIB_Format::kBgraPremul`
+ if (!bitmap->Create(width, height, FXDIB_Format::kBgra)) {
return nullptr;
+ }
bitmap->Clear(color);
return bitmap;
@@ -709,7 +710,7 @@
? kAlpha_8_SkColorType
: kGray_8_SkColorType;
} else if (bpp == 24) {
- DCHECK_EQ(m_pBitmap->GetFormat(), FXDIB_Format::kRgb);
+ DCHECK_EQ(m_pBitmap->GetFormat(), FXDIB_Format::kBgr);
// Save the input bitmap as `m_pOriginalBitmap` and save its 32 bpp
// equivalent at `m_pBitmap` for Skia's internal process.
@@ -718,7 +719,7 @@
const int height = m_pOriginalBitmap->GetHeight();
m_pBitmap = pdfium::MakeRetain<CFX_DIBitmap>();
- if (!m_pBitmap->Create(width, height, FXDIB_Format::kArgbPremul) ||
+ if (!m_pBitmap->Create(width, height, FXDIB_Format::kBgraPremul) ||
!m_pBitmap->TransferBitmap(width, height, m_pOriginalBitmap,
/*src_left=*/0, /*src_top=*/0)) {
// Skip creating SkCanvas if the 32-bpp bitmap creation fails.
@@ -735,9 +736,9 @@
DCHECK_EQ(bpp, 32);
color_type = Get32BitSkColorType(bRgbByteOrder);
FXDIB_Format format = m_pBitmap->GetFormat();
- if (format == FXDIB_Format::kRgb32) {
+ if (format == FXDIB_Format::kBgrx) {
alpha_type = kOpaque_SkAlphaType;
- } else if (format == FXDIB_Format::kArgb) {
+ } else if (format == FXDIB_Format::kBgra) {
alpha_type = kUnpremul_SkAlphaType;
}
}
@@ -1462,7 +1463,7 @@
void CFX_DIBitmap::PreMultiply() {
CHECK(CFX_DefaultRenderDevice::UseSkiaRenderer());
- if (GetFormat() != FXDIB_Format::kArgb) {
+ if (GetFormat() != FXDIB_Format::kBgra) {
return;
}
@@ -1471,7 +1472,7 @@
return;
}
- SetFormat(FXDIB_Format::kArgbPremul);
+ SetFormat(FXDIB_Format::kBgraPremul);
int height = GetHeight();
int width = GetWidth();
int row_bytes = GetPitch();
@@ -1486,7 +1487,7 @@
void CFX_DIBitmap::UnPreMultiply() {
CHECK(CFX_DefaultRenderDevice::UseSkiaRenderer());
- if (GetFormat() != FXDIB_Format::kArgbPremul) {
+ if (GetFormat() != FXDIB_Format::kBgraPremul) {
return;
}
@@ -1495,7 +1496,7 @@
return;
}
- SetFormat(FXDIB_Format::kArgb);
+ SetFormat(FXDIB_Format::kBgra);
int height = GetHeight();
int width = GetWidth();
int row_bytes = GetPitch();
@@ -1582,7 +1583,7 @@
int height = m_pOriginalBitmap->GetHeight();
DCHECK_EQ(width, m_pBitmap->GetWidth());
DCHECK_EQ(height, m_pBitmap->GetHeight());
- DCHECK_EQ(FXDIB_Format::kRgb, m_pOriginalBitmap->GetFormat());
+ DCHECK_EQ(FXDIB_Format::kBgr, m_pOriginalBitmap->GetFormat());
m_pOriginalBitmap->TransferBitmap(width, height, m_pBitmap, /*src_left=*/0,
/*src_top=*/0);
}
diff --git a/core/fxge/win32/cfx_psrenderer.cpp b/core/fxge/win32/cfx_psrenderer.cpp
index 7c655b7..c39aa9c 100644
--- a/core/fxge/win32/cfx_psrenderer.cpp
+++ b/core/fxge/win32/cfx_psrenderer.cpp
@@ -560,22 +560,22 @@
} else {
switch (bitmap->GetFormat()) {
case FXDIB_Format::k1bppRgb:
- case FXDIB_Format::kRgb32:
- bitmap = bitmap->ConvertTo(FXDIB_Format::kRgb);
+ case FXDIB_Format::kBgrx:
+ bitmap = bitmap->ConvertTo(FXDIB_Format::kBgr);
break;
case FXDIB_Format::k8bppRgb:
if (bitmap->HasPalette()) {
- bitmap = bitmap->ConvertTo(FXDIB_Format::kRgb);
+ bitmap = bitmap->ConvertTo(FXDIB_Format::kBgr);
}
break;
case FXDIB_Format::kInvalid:
case FXDIB_Format::k1bppMask:
case FXDIB_Format::k8bppMask:
- case FXDIB_Format::kRgb:
+ case FXDIB_Format::kBgr:
break;
- case FXDIB_Format::kArgb:
+ case FXDIB_Format::kBgra:
#if defined(PDF_USE_SKIA)
- case FXDIB_Format::kArgbPremul:
+ case FXDIB_Format::kBgraPremul:
#endif
// Should have returned early due to IsAlphaFormat() check above.
NOTREACHED_NORETURN();
diff --git a/core/fxge/win32/cgdi_display_driver.cpp b/core/fxge/win32/cgdi_display_driver.cpp
index 2475e95..675b95f 100644
--- a/core/fxge/win32/cgdi_display_driver.cpp
+++ b/core/fxge/win32/cgdi_display_driver.cpp
@@ -61,7 +61,7 @@
}
} else {
auto rgb_bitmap = pdfium::MakeRetain<CFX_DIBitmap>();
- if (rgb_bitmap->Create(width, height, FXDIB_Format::kRgb)) {
+ if (rgb_bitmap->Create(width, height, FXDIB_Format::kBgr)) {
bmi.bmiHeader.biBitCount = 24;
::GetDIBits(hDCMemory, hbmp, 0, height,
rgb_bitmap->GetWritableBuffer().data(), &bmi, DIB_RGB_COLORS);
@@ -89,7 +89,7 @@
int alpha = FXARGB_A(color);
if (bitmap->GetBPP() != 1 || alpha != 255) {
auto background = pdfium::MakeRetain<CFX_DIBitmap>();
- if (!background->Create(width, height, FXDIB_Format::kRgb32) ||
+ if (!background->Create(width, height, FXDIB_Format::kBgrx) ||
!GetDIBits(background, left, top) ||
!background->CompositeMask(0, 0, width, height, std::move(bitmap),
color, 0, 0, BlendMode::kNormal, nullptr,
@@ -110,7 +110,7 @@
int height = src_rect.Height();
if (bitmap->IsAlphaFormat()) {
auto rgb_bitmap = pdfium::MakeRetain<CFX_DIBitmap>();
- if (!rgb_bitmap->Create(width, height, FXDIB_Format::kRgb) ||
+ if (!rgb_bitmap->Create(width, height, FXDIB_Format::kBgr) ||
!GetDIBits(rgb_bitmap, left, top) ||
!rgb_bitmap->CompositeBitmap(0, 0, width, height, std::move(bitmap),
src_rect.left, src_rect.top,
@@ -185,7 +185,7 @@
}
auto background = pdfium::MakeRetain<CFX_DIBitmap>();
- if (!background->Create(clip_width, clip_height, FXDIB_Format::kRgb32) ||
+ if (!background->Create(clip_width, clip_height, FXDIB_Format::kBgrx) ||
!GetDIBits(background, image_rect.left + clip_rect.left,
image_rect.top + clip_rect.top) ||
!background->CompositeMask(0, 0, clip_width, clip_height,
diff --git a/core/fxge/win32/cgdi_plus_ext.cpp b/core/fxge/win32/cgdi_plus_ext.cpp
index 8aadda7..c40ca82 100644
--- a/core/fxge/win32/cgdi_plus_ext.cpp
+++ b/core/fxge/win32/cgdi_plus_ext.cpp
@@ -208,7 +208,7 @@
int dest_top,
int dest_width,
int dest_height) {
- CHECK_EQ(FXDIB_Format::kArgb, source->GetFormat());
+ CHECK_EQ(FXDIB_Format::kBgra, source->GetFormat());
const CGdiplusExt& gdi_plus_ext = GetGdiplusExt();
RetainPtr<const CFX_DIBitmap> realized_source = source->RealizeIfNeeded();
diff --git a/fpdfsdk/fpdf_editimg.cpp b/fpdfsdk/fpdf_editimg.cpp
index 1eb2b23..4cf4814 100644
--- a/fpdfsdk/fpdf_editimg.cpp
+++ b/fpdfsdk/fpdf_editimg.cpp
@@ -233,17 +233,17 @@
break;
}
case FXDIB_Format::k1bppRgb: {
- // If there is a palette, then convert to `FXDIB_Format::kRgb` to avoid
+ // If there is a palette, then convert to `FXDIB_Format::kBgr` to avoid
// creating a bitmap with a palette.
op = pSource->HasPalette() ? ConversionOp::kConvertToRgb
: ConversionOp::kConvertTo8bppRgb;
break;
}
case FXDIB_Format::k8bppRgb:
- case FXDIB_Format::kArgb:
- case FXDIB_Format::kRgb:
- case FXDIB_Format::kRgb32: {
- // If there is a palette, then convert to `FXDIB_Format::kRgb` to avoid
+ case FXDIB_Format::kBgra:
+ case FXDIB_Format::kBgr:
+ case FXDIB_Format::kBgrx: {
+ // If there is a palette, then convert to `FXDIB_Format::kBgr` to avoid
// creating a bitmap with a palette.
op = pSource->HasPalette() ? ConversionOp::kConvertToRgb
: ConversionOp::kRealize;
@@ -253,9 +253,9 @@
NOTREACHED_NORETURN();
}
#if defined(PDF_USE_SKIA)
- case FXDIB_Format::kArgbPremul: {
+ case FXDIB_Format::kBgraPremul: {
// TODO(crbug.com/355676038): Consider adding support for
- // `FXDIB_Format::kArgbPremul`
+ // `FXDIB_Format::kBgraPremul`
NOTREACHED_NORETURN();
}
#endif
@@ -270,7 +270,7 @@
pBitmap = pSource->ConvertTo(FXDIB_Format::k8bppRgb);
break;
case ConversionOp::kConvertToRgb:
- pBitmap = pSource->ConvertTo(FXDIB_Format::kRgb);
+ pBitmap = pSource->ConvertTo(FXDIB_Format::kBgr);
break;
}
if (!pBitmap) {
@@ -307,7 +307,7 @@
auto result_bitmap = pdfium::MakeRetain<CFX_DIBitmap>();
if (!result_bitmap->Create(static_cast<int>(output_width),
static_cast<int>(output_height),
- FXDIB_Format::kArgb)) {
+ FXDIB_Format::kBgra)) {
return nullptr;
}
diff --git a/fpdfsdk/fpdf_edittext.cpp b/fpdfsdk/fpdf_edittext.cpp
index 355d3aa..8b2642b 100644
--- a/fpdfsdk/fpdf_edittext.cpp
+++ b/fpdfsdk/fpdf_edittext.cpp
@@ -759,10 +759,12 @@
return nullptr;
// TODO(crbug.com/42271020): Consider adding support for
- // `FXDIB_Format::kArgbPremul`
+ // `FXDIB_Format::kBgraPremul`
auto result_bitmap = pdfium::MakeRetain<CFX_DIBitmap>();
- if (!result_bitmap->Create(rect.Width(), rect.Height(), FXDIB_Format::kArgb))
+ if (!result_bitmap->Create(rect.Width(), rect.Height(),
+ FXDIB_Format::kBgra)) {
return nullptr;
+ }
auto render_context = std::make_unique<CPDF_PageRenderContext>();
CPDF_PageRenderContext* render_context_ptr = render_context.get();
diff --git a/fpdfsdk/fpdf_view.cpp b/fpdfsdk/fpdf_view.cpp
index 2fb04a7..66134d6 100644
--- a/fpdfsdk/fpdf_view.cpp
+++ b/fpdfsdk/fpdf_view.cpp
@@ -533,7 +533,7 @@
// Create a new bitmap to transfer part of the page bitmap to.
RetainPtr<CFX_DIBitmap> pDst = pdfium::MakeRetain<CFX_DIBitmap>();
if (!pDst->Create(bitmap_area->Width(), bitmap_area->Height(),
- FXDIB_Format::kArgb)) {
+ FXDIB_Format::kBgra)) {
return nullptr;
}
pDst->Clear(0x00ffffff);
@@ -552,7 +552,7 @@
// Create a new bitmap from the old one
RetainPtr<CFX_DIBitmap> dest = pdfium::MakeRetain<CFX_DIBitmap>();
- if (!dest->Create(size_x_bm, size_y_bm, FXDIB_Format::kRgb32)) {
+ if (!dest->Create(size_x_bm, size_y_bm, FXDIB_Format::kBgrx)) {
return;
}
@@ -610,7 +610,7 @@
}
RetainPtr<CFX_DIBitmap> pBitmap = pdfium::MakeRetain<CFX_DIBitmap>();
- CHECK(pBitmap->Create(size_x, size_y, FXDIB_Format::kArgb));
+ CHECK(pBitmap->Create(size_x, size_y, FXDIB_Format::kBgra));
if (!CFX_DefaultRenderDevice::UseSkiaRenderer()) {
// Not needed by Skia. Call it for AGG to preserve pre-existing behavior.
pBitmap->Clear(0x00ffffff);
@@ -634,7 +634,7 @@
bool bitsStretched = false;
if (win_dc.GetDeviceType() == DeviceType::kPrinter) {
auto dest_bitmap = pdfium::MakeRetain<CFX_DIBitmap>();
- if (dest_bitmap->Create(size_x, size_y, FXDIB_Format::kRgb32)) {
+ if (dest_bitmap->Create(size_x, size_y, FXDIB_Format::kBgrx)) {
fxcrt::Fill(dest_bitmap->GetWritableBuffer().first(pBitmap->GetPitch() *
size_y),
-1);
@@ -885,7 +885,7 @@
int alpha) {
auto pBitmap = pdfium::MakeRetain<CFX_DIBitmap>();
if (!pBitmap->Create(width, height,
- alpha ? FXDIB_Format::kArgb : FXDIB_Format::kRgb32)) {
+ alpha ? FXDIB_Format::kBgra : FXDIB_Format::kBgrx)) {
return nullptr;
}
@@ -906,13 +906,13 @@
fx_format = FXDIB_Format::k8bppRgb;
break;
case FPDFBitmap_BGR:
- fx_format = FXDIB_Format::kRgb;
+ fx_format = FXDIB_Format::kBgr;
break;
case FPDFBitmap_BGRx:
- fx_format = FXDIB_Format::kRgb32;
+ fx_format = FXDIB_Format::kBgrx;
break;
case FPDFBitmap_BGRA:
- fx_format = FXDIB_Format::kArgb;
+ fx_format = FXDIB_Format::kBgra;
break;
default:
return nullptr;
@@ -941,11 +941,11 @@
case FXDIB_Format::k8bppRgb:
case FXDIB_Format::k8bppMask:
return FPDFBitmap_Gray;
- case FXDIB_Format::kRgb:
+ case FXDIB_Format::kBgr:
return FPDFBitmap_BGR;
- case FXDIB_Format::kRgb32:
+ case FXDIB_Format::kBgrx:
return FPDFBitmap_BGRx;
- case FXDIB_Format::kArgb:
+ case FXDIB_Format::kBgra:
return FPDFBitmap_BGRA;
default:
return FPDFBitmap_Unknown;
diff --git a/fxbarcode/cfx_barcode_unittest.cpp b/fxbarcode/cfx_barcode_unittest.cpp
index 8276109..7cf7f1d 100644
--- a/fxbarcode/cfx_barcode_unittest.cpp
+++ b/fxbarcode/cfx_barcode_unittest.cpp
@@ -24,8 +24,9 @@
auto device = std::make_unique<CFX_DefaultRenderDevice>();
auto bitmap = pdfium::MakeRetain<CFX_DIBitmap>();
- if (bitmap->Create(640, 480, FXDIB_Format::kRgb32))
+ if (bitmap->Create(640, 480, FXDIB_Format::kBgrx)) {
bitmap_ = bitmap;
+ }
ASSERT_TRUE(bitmap_);
ASSERT_TRUE(device->Attach(bitmap_));
device_ = std::move(device);
diff --git a/testing/fuzzers/pdf_jpx_fuzzer.cc b/testing/fuzzers/pdf_jpx_fuzzer.cc
index 3fc45ef..798c492 100644
--- a/testing/fuzzers/pdf_jpx_fuzzer.cc
+++ b/testing/fuzzers/pdf_jpx_fuzzer.cc
@@ -62,12 +62,12 @@
if (image_info.channels == 1) {
format = FXDIB_Format::k8bppRgb;
} else if (image_info.channels <= 3) {
- format = FXDIB_Format::kRgb;
+ format = FXDIB_Format::kBgr;
} else if (image_info.channels == 4) {
- format = FXDIB_Format::kRgb32;
+ format = FXDIB_Format::kBgrx;
} else {
image_info.width = (image_info.width * image_info.channels + 2) / 3;
- format = FXDIB_Format::kRgb;
+ format = FXDIB_Format::kBgr;
}
auto bitmap = pdfium::MakeRetain<CFX_DIBitmap>();
if (!bitmap->Create(image_info.width, image_info.height, format))
diff --git a/testing/fuzzers/pdf_scanlinecompositor_fuzzer.cc b/testing/fuzzers/pdf_scanlinecompositor_fuzzer.cc
index 3714578..c054587 100644
--- a/testing/fuzzers/pdf_scanlinecompositor_fuzzer.cc
+++ b/testing/fuzzers/pdf_scanlinecompositor_fuzzer.cc
@@ -20,13 +20,13 @@
FXDIB_Format::kInvalid,
FXDIB_Format::k1bppRgb,
FXDIB_Format::k8bppRgb,
- FXDIB_Format::kRgb,
- FXDIB_Format::kRgb32,
+ FXDIB_Format::kBgr,
+ FXDIB_Format::kBgrx,
FXDIB_Format::k1bppMask,
FXDIB_Format::k8bppMask,
FXDIB_Format::kInvalid /* Was FXDIB_Format::k8bppRgba */,
- FXDIB_Format::kInvalid /* Was FXDIB_Format::kRgba */,
- FXDIB_Format::kArgb,
+ FXDIB_Format::kInvalid /* Was FXDIB_Format::kBgra */,
+ FXDIB_Format::kBgra,
FXDIB_Format::kInvalid /* Was FXDIB_Format::k1bppCmyk */,
FXDIB_Format::kInvalid /* Was FXDIB_Format::k8bppCmyk */,
FXDIB_Format::kInvalid /* Was FXDIB_Format::kCmyk */,
diff --git a/xfa/fde/cfde_textout_unittest.cpp b/xfa/fde/cfde_textout_unittest.cpp
index f598f08..b0a014d 100644
--- a/xfa/fde/cfde_textout_unittest.cpp
+++ b/xfa/fde/cfde_textout_unittest.cpp
@@ -35,7 +35,7 @@
CFX_Size bitmap_size = GetBitmapSize();
bitmap_ = MakeRetain<CFX_DIBitmap>();
ASSERT_TRUE(bitmap_->Create(bitmap_size.width, bitmap_size.height,
- FXDIB_Format::kArgb));
+ FXDIB_Format::kBgra));
device_ = std::make_unique<CFX_DefaultRenderDevice>();
device_->Attach(bitmap_);
diff --git a/xfa/fgas/graphics/cfgas_gegraphics.cpp b/xfa/fgas/graphics/cfgas_gegraphics.cpp
index 64cc5d4..128b6b4 100644
--- a/xfa/fgas/graphics/cfgas_gegraphics.cpp
+++ b/xfa/fgas/graphics/cfgas_gegraphics.cpp
@@ -249,8 +249,8 @@
int32_t height = bitmap->GetHeight();
auto bmp = pdfium::MakeRetain<CFX_DIBitmap>();
// TODO(crbug.com/355630556): Consider adding support for
- // `FXDIB_Format::kArgbPremul`
- CHECK(bmp->Create(width, height, FXDIB_Format::kArgb));
+ // `FXDIB_Format::kBgraPremul`
+ CHECK(bmp->Create(width, height, FXDIB_Format::kBgra));
m_renderDevice->GetDIBits(bmp, 0, 0);
CFGAS_GEPattern::HatchStyle hatchStyle =
@@ -294,8 +294,8 @@
float end_y = m_info.fillColor.GetShading()->GetEndPoint().y;
auto bmp = pdfium::MakeRetain<CFX_DIBitmap>();
// TODO(crbug.com/355630556): Consider adding support for
- // `FXDIB_Format::kArgbPremul`
- CHECK(bmp->Create(width, height, FXDIB_Format::kArgb));
+ // `FXDIB_Format::kBgraPremul`
+ CHECK(bmp->Create(width, height, FXDIB_Format::kBgra));
m_renderDevice->GetDIBits(bmp, 0, 0);
bool result = false;
switch (m_info.fillColor.GetShading()->GetType()) {