From 36e258b475702bdb1a95a88fcebd78b51069c532 Mon Sep 17 00:00:00 2001 From: caryclark Date: Thu, 2 Jun 2016 08:59:20 -0700 Subject: The PDFium source in core/fxge/dib implements a bit-blitting backend. This code has several disadvantages over a more modern graphics engine: - no SIMD support - no GPU support - limited quality Further, calling this code locks in the perceived resolution, so that the output cannot be scaled without additional loss. By directing all bitmap drawing through CFX_SkiaDeviceDriver::StartDIBits, Skia can handle all appropriate bitmap optimizations. To that end, SetDIBits and StretchDIBits now call StartDIBits. Other changes: Skia's bitmaps are premultiplied. PDF contains bitmaps that are unpremultiplied. PDFium appears to use premultiplied bitmaps sometimes, and unpremultiplied bitmaps elsewhere. Add a debug check for unpremultiplied bits in Skia's driver, and add a utility to premultiply PDFium's bitmaps' bits. PDFium supports a 24 bit RGB bitmap padded to a 32 bit word. Set the high byte so that Skia can treat this as an ARGB bitmap. Defer the application of the alpha value to the draw call rather than calling MultiplyAlpha where possible. Allow the destination bitmap to be alpha 8 or argb 32. Review-Url: https://codereview.chromium.org/2025043002 --- core/fxge/dib/fx_dib_main.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'core/fxge/dib') diff --git a/core/fxge/dib/fx_dib_main.cpp b/core/fxge/dib/fx_dib_main.cpp index 85df71e11d..896551401a 100644 --- a/core/fxge/dib/fx_dib_main.cpp +++ b/core/fxge/dib/fx_dib_main.cpp @@ -344,6 +344,11 @@ void CFX_DIBitmap::Clear(uint32_t color) { case FXDIB_Rgb32: case FXDIB_Argb: { color = IsCmykImage() ? FXCMYK_TODIB(color) : FXARGB_TODIB(color); +#ifdef _SKIA_SUPPORT_ + if (FXDIB_Rgb32 == GetFormat() && !IsCmykImage()) { + color |= 0xFF000000; + } +#endif for (int i = 0; i < m_Width; i++) { ((uint32_t*)m_pBuffer)[i] = color; } -- cgit v1.2.3