Chromium Code Reviews| Index: core/fxge/skia/fx_skia_device.cpp |
| diff --git a/core/fxge/skia/fx_skia_device.cpp b/core/fxge/skia/fx_skia_device.cpp |
| index 973c4f2b34635335224a1c5b5c9df6647ab19bda..99817c7960295cefe371a953bca025eeb635329a 100644 |
| --- a/core/fxge/skia/fx_skia_device.cpp |
| +++ b/core/fxge/skia/fx_skia_device.cpp |
| @@ -1175,7 +1175,7 @@ bool CFX_SkiaDeviceDriver::DrawDeviceText(int nChars, |
| m_pCanvas->restore(); |
| #ifdef _SKIA_SUPPORT_PATHS_ |
| - if (FXARGB_A(color) < 255) { |
| + if (m_pBitmap->GetBPP() == 32) { |
| m_pBitmap->MarkForUnPreMultiply(true); |
| } |
| #endif // _SKIA_SUPPORT_PATHS_ |
| @@ -1461,8 +1461,7 @@ bool CFX_SkiaDeviceDriver::DrawPath( |
| } |
| m_pCanvas->restore(); |
| #ifdef _SKIA_SUPPORT_PATHS_ |
| - if ((fill_mode & 3 && FXARGB_A(fill_color) < 255) || |
| - (pGraphState && stroke_alpha < 255)) { |
| + if (m_pBitmap->GetBPP() == 32) { |
| m_pBitmap->MarkForUnPreMultiply(true); |
| } |
| #endif // _SKIA_SUPPORT_PATHS_ |
| @@ -1866,7 +1865,7 @@ bool CFX_SkiaDeviceDriver::ContinueDIBits(void* handle, IFX_Pause* pPause) { |
| #endif // _SKIA_SUPPORT_PATHS_ |
| } |
| -#ifdef _SKIA_SUPPORT_ |
| +#if defined _SKIA_SUPPORT_ |
| void CFX_SkiaDeviceDriver::PreMultiply(CFX_DIBitmap* pDIBitmap) { |
| void* buffer = pDIBitmap->GetBuffer(); |
| if (!buffer) |
| @@ -1890,18 +1889,22 @@ void CFX_SkiaDeviceDriver::PreMultiply(CFX_DIBitmap* pDIBitmap) { |
| #ifdef _SKIA_SUPPORT_PATHS_ |
| void CFX_SkiaDeviceDriver::UnPreMultiply(CFX_DIBitmap* pDIBitmap) { |
| - if (!pDIBitmap->IsMarkedForUnPreMultiply()) |
| + pDIBitmap->UnPreMultiply(); |
| +} |
| + |
| +void CFX_DIBitmap::UnPreMultiply() { |
| + if (!this->IsMarkedForUnPreMultiply()) |
|
dsinclair
2016/11/21 22:01:49
Drop the this-> as it isn't needed.
|
| return; |
| - pDIBitmap->DebugVerifyBitmapIsPreMultiplied(); |
| - void* buffer = pDIBitmap->GetBuffer(); |
| + this->DebugVerifyBitmapIsPreMultiplied(); |
| + void* buffer = this->GetBuffer(); |
| if (!buffer) |
| return; |
| - if (pDIBitmap->GetBPP() != 32) { |
| + if (this->GetBPP() != 32) { |
| return; |
| } |
| - int height = pDIBitmap->GetHeight(); |
| - int width = pDIBitmap->GetWidth(); |
| - int rowBytes = pDIBitmap->GetPitch(); |
| + int height = this->GetHeight(); |
| + int width = this->GetWidth(); |
| + int rowBytes = this->GetPitch(); |
| SkImageInfo premultipliedInfo = |
| SkImageInfo::Make(width, height, kN32_SkColorType, kPremul_SkAlphaType); |
| SkPixmap premultiplied(premultipliedInfo, buffer, rowBytes); |
| @@ -1909,7 +1912,7 @@ void CFX_SkiaDeviceDriver::UnPreMultiply(CFX_DIBitmap* pDIBitmap) { |
| SkImageInfo::Make(width, height, kN32_SkColorType, kUnpremul_SkAlphaType); |
| SkPixmap unpremultiplied(unpremultipliedInfo, buffer, rowBytes); |
| premultiplied.readPixels(unpremultiplied); |
| - pDIBitmap->MarkForUnPreMultiply(false); |
| + this->MarkForUnPreMultiply(false); |
| } |
| #endif // _SKIA_SUPPORT_PATHS_ |
| @@ -1977,10 +1980,10 @@ void CFX_SkiaDeviceDriver::Clear(uint32_t color) { |
| #endif // _SKIA_SUPPORT_ |
| void CFX_SkiaDeviceDriver::Dump() const { |
| -#if SHOW_SKIA_PATH |
| +#if SHOW_SKIA_PATH && defined _SKIA_SUPPORT_ |
| if (m_pCache) |
| m_pCache->Dump(this); |
| -#endif // SHOW_SKIA_PATH |
| +#endif // SHOW_SKIA_PATH && defined _SKIA_SUPPORT_ |
| } |
| #ifdef _SKIA_SUPPORT_ |
| @@ -1992,7 +1995,8 @@ void CFX_SkiaDeviceDriver::DebugVerifyBitmapIsPreMultiplied() const { |
| #ifdef _SKIA_SUPPORT_PATHS_ |
| void CFX_SkiaDeviceDriver::UnPreMultiplyDevice() { |
| - UnPreMultiply(m_pBitmap); |
| + if (!m_pBitmap->IsOffscreen()) |
| + UnPreMultiply(m_pBitmap); |
| } |
| #endif // _SKIA_SUPPORT_PATHS_ |