From 725a49f7a64a3537c081cd23cf7d5d6578efdfa1 Mon Sep 17 00:00:00 2001 From: caryclark Date: Thu, 14 Apr 2016 09:09:44 -0700 Subject: skia bugs found with first test pdf The first PDF attempted by the Skia infra team uncovered three bugs. This gets past those bugs crashing; more work to do to get the correct output. R=rmistry@google.com,dsinclair@chromium.org BUG=skia:5183 Review URL: https://codereview.chromium.org/1887073002 --- core/fxge/skia/fx_skia_device.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/core/fxge/skia/fx_skia_device.cpp b/core/fxge/skia/fx_skia_device.cpp index e617630bdc..b00bc8e5c5 100644 --- a/core/fxge/skia/fx_skia_device.cpp +++ b/core/fxge/skia/fx_skia_device.cpp @@ -723,7 +723,11 @@ FX_BOOL CFX_SkiaDeviceDriver::DrawPath( SkIRect rect; rect.set(0, 0, GetDeviceCaps(FXDC_PIXEL_WIDTH), GetDeviceCaps(FXDC_PIXEL_HEIGHT)); - SkMatrix skMatrix = ToSkMatrix(*pObject2Device); + SkMatrix skMatrix; + if (pObject2Device) + skMatrix = ToSkMatrix(*pObject2Device); + else + skMatrix.setIdentity(); SkPaint skPaint; skPaint.setAntiAlias(true); int stroke_alpha = FXGETFLAG_COLORTYPE(alpha_flag) @@ -933,7 +937,7 @@ FX_BOOL CFX_SkiaDeviceDriver::GetDIBits(CFX_DIBitmap* pBitmap, int top, void* pIccTransform, FX_BOOL bDEdge) { - if (!m_pBitmap->GetBuffer()) + if (!m_pBitmap || !m_pBitmap->GetBuffer()) return TRUE; if (bDEdge) { if (m_bRgbByteOrder) { @@ -982,7 +986,7 @@ FX_BOOL CFX_SkiaDeviceDriver::SetDIBits(const CFX_DIBSource* pBitmap, int blend_type, int alpha_flag, void* pIccTransform) { - if (!m_pBitmap->GetBuffer()) + if (!m_pBitmap || !m_pBitmap->GetBuffer()) return TRUE; if (pBitmap->IsAlphaMask()) { return m_pBitmap->CompositeMask( @@ -1065,6 +1069,9 @@ FX_BOOL CFX_SkiaDeviceDriver::StartDIBits(const CFX_DIBSource* pSource, rowBytes = width; colorType = SkColorType::kGray_8_SkColorType; } break; + case 8: + colorType = SkColorType::kGray_8_SkColorType; + break; case 24: { dst32Storage.reset(FX_Alloc2D(uint32_t, width, height)); uint32_t* dst32Pixels = dst32Storage.get(); -- cgit v1.2.3