[Skia] Fix the issue that images' transparency level is ignored
Currently the graphic state (GS) transparency level of a non-mask
image object is ignored by Skia when painting its bitmap. This CL
makes sure such transparency level is applied to the Skia painting
process.
Bug: pdfium:1790,pdfium:1807
Change-Id: I50ef48eaa57d70884f2e5d5435981d66c7d0e028
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/96812
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Nigi <nigi@chromium.org>
diff --git a/DEPS b/DEPS
index 906e786..18cdf7f 100644
--- a/DEPS
+++ b/DEPS
@@ -122,7 +122,7 @@
# Three lines of non-changing comments so that
# the commit queue can handle CLs rolling pdfium_tests
# and whatever else without interference from each other.
- 'pdfium_tests_revision': 'df57549d76bdd644427d463d0e5b8ec0fc3dd7be',
+ 'pdfium_tests_revision': '1274a9786d49642d86ed351d268b87f4afcf1cf2',
# Three lines of non-changing comments so that
# the commit queue can handle CLs rolling skia
# and whatever else without interference from each other.
diff --git a/core/fxge/skia/fx_skia_device.cpp b/core/fxge/skia/fx_skia_device.cpp
index f26dc1c..1b0c7e8 100644
--- a/core/fxge/skia/fx_skia_device.cpp
+++ b/core/fxge/skia/fx_skia_device.cpp
@@ -626,11 +626,17 @@
void SetBitmapPaint(bool is_mask,
bool anti_alias,
+ int bitmap_alpha,
uint32_t argb,
BlendMode blend_type,
SkPaint* paint) {
+ DCHECK_GE(bitmap_alpha, 0);
+ DCHECK_LE(bitmap_alpha, 255);
+
if (is_mask)
paint->setColor(argb);
+ else if (bitmap_alpha != 255)
+ paint->setAlpha(bitmap_alpha);
paint->setAntiAlias(anti_alias);
paint->setBlendMode(GetSkiaBlendMode(blend_type));
@@ -2551,8 +2557,8 @@
SetBitmapMatrix(matrix, width, height, &skMatrix);
m_pCanvas->concat(skMatrix);
SkPaint paint;
- SetBitmapPaint(pSource->IsMaskFormat(), !m_FillOptions.aliased_path, argb,
- blend_type, &paint);
+ SetBitmapPaint(pSource->IsMaskFormat(), !m_FillOptions.aliased_path,
+ bitmap_alpha, argb, blend_type, &paint);
// TODO(caryclark) Once Skia supports 8 bit src to 8 bit dst remove this
if (m_pBitmap && m_pBitmap->GetBPP() == 8 && pSource->GetBPP() == 8) {
SkMatrix inv;
diff --git a/testing/SUPPRESSIONS b/testing/SUPPRESSIONS
index 0a84379..1312b1b 100644
--- a/testing/SUPPRESSIONS
+++ b/testing/SUPPRESSIONS
@@ -50,9 +50,6 @@
3_4_textbox.pdf * * * *
-# TODO(pdfium:1790): Remove after associated bug is fixed
-3_interpolate_image.pdf * * * skia
-
3_interpolate_image.pdf mac * * *
3bigpreview.pdf mac * * *
@@ -277,7 +274,7 @@
example_024.pdf mac * * *
example_025.pdf mac * * *
-# TODO(pdfium:1807, pdfium:1808): Remove after associated bug is fixed
+# TODO(pdfium:1808): Remove after associated bug is fixed
example_025.pdf * * * skia,skiapaths
example_026.pdf mac * * *