diff options
author | Lei Zhang <thestig@chromium.org> | 2015-12-14 18:34:00 -0800 |
---|---|---|
committer | Lei Zhang <thestig@chromium.org> | 2015-12-14 18:34:00 -0800 |
commit | 412e908082a361d0fd9591eab939e96a882212f1 (patch) | |
tree | 11726052ae08f13dc5a05a82cbce870758580aeb /core/src/fxge/skia/fx_skia_device.cpp | |
parent | 96660d6f382204339d6b1aadc3913303d436e252 (diff) | |
download | pdfium-412e908082a361d0fd9591eab939e96a882212f1.tar.xz |
Merge to XFA: Get rid of most instance of 'foo == NULL'
TBR=tsepez@chromium.org
Review URL: https://codereview.chromium.org/1520063002 .
(cherry picked from commit e385244f8cd6ae376f6b3cf1265a0795d5d30eff)
Review URL: https://codereview.chromium.org/1528763003 .
Diffstat (limited to 'core/src/fxge/skia/fx_skia_device.cpp')
-rw-r--r-- | core/src/fxge/skia/fx_skia_device.cpp | 38 |
1 files changed, 20 insertions, 18 deletions
diff --git a/core/src/fxge/skia/fx_skia_device.cpp b/core/src/fxge/skia/fx_skia_device.cpp index 8e012c82e0..2e0371f312 100644 --- a/core/src/fxge/skia/fx_skia_device.cpp +++ b/core/src/fxge/skia/fx_skia_device.cpp @@ -212,20 +212,7 @@ static void SkRasterizeStroke(SkPaint& spaint, if (width <= unit) width = unit; - if (pGraphState->m_DashArray == NULL) { - SkStroke stroker; - stroker.setCap(cap); - stroker.setJoin(join); - stroker.setMiterLimit(pGraphState->m_MiterLimit); - stroker.setWidth(width); - stroker.setDoFill(FALSE); - stroker.strokePath(path_data, dstPathData); - SkMatrix smatrix; - smatrix.setAll(pObject2Device->a, pObject2Device->c, pObject2Device->e, - pObject2Device->b, pObject2Device->d, pObject2Device->f, 0, - 0, 1); - dstPathData->transform(smatrix); - } else { + if (pGraphState->m_DashArray) { int count = (pGraphState->m_DashCount + 1) / 2; SkScalar* intervals = FX_Alloc2D(SkScalar, count, sizeof(SkScalar)); // Set dash pattern @@ -255,6 +242,19 @@ static void SkRasterizeStroke(SkPaint& spaint, 0, 1); dstPathData->transform(smatrix); FX_Free(intervals); + } else { + SkStroke stroker; + stroker.setCap(cap); + stroker.setJoin(join); + stroker.setMiterLimit(pGraphState->m_MiterLimit); + stroker.setWidth(width); + stroker.setDoFill(FALSE); + stroker.strokePath(path_data, dstPathData); + SkMatrix smatrix; + smatrix.setAll(pObject2Device->a, pObject2Device->c, pObject2Device->e, + pObject2Device->b, pObject2Device->d, pObject2Device->f, 0, + 0, 1); + dstPathData->transform(smatrix); } } @@ -331,9 +331,10 @@ FX_BOOL CFX_SkiaDeviceDriver::SetClip_PathFill( const CFX_Matrix* pObject2Device, // optional transformation int fill_mode // fill mode, WINDING or ALTERNATE ) { - if (m_pAggDriver->m_pClipRgn == NULL) + if (!m_pAggDriver->m_pClipRgn) { m_pAggDriver->m_pClipRgn = new CFX_ClipRgn( GetDeviceCaps(FXDC_PIXEL_WIDTH), GetDeviceCaps(FXDC_PIXEL_HEIGHT)); + } if (pPathData->GetPointCount() == 5 || pPathData->GetPointCount() == 4) { CFX_FloatRect rectf; @@ -368,9 +369,10 @@ FX_BOOL CFX_SkiaDeviceDriver::SetClip_PathStroke( const CFX_Matrix* pObject2Device, // optional transformation const CFX_GraphStateData* pGraphState // graphic state, for pen attributes ) { - if (m_pAggDriver->m_pClipRgn == NULL) + if (!m_pAggDriver->m_pClipRgn) { m_pAggDriver->m_pClipRgn = new CFX_ClipRgn( GetDeviceCaps(FXDC_PIXEL_WIDTH), GetDeviceCaps(FXDC_PIXEL_HEIGHT)); + } // build path data CSkia_PathData path_data; @@ -432,7 +434,7 @@ FX_BOOL CFX_SkiaDeviceDriver::DrawPath( int fill_mode, // fill mode, WINDING or ALTERNATE. 0 for not filled int alpha_flag, void* pIccTransform) { - if (GetBuffer() == NULL) + if (!GetBuffer()) return TRUE; FOXIT_DEBUG1("CFX_SkiaDeviceDriver::DrawPath: entering"); SkIRect rect; @@ -592,7 +594,7 @@ FX_BOOL CFX_SkiaDevice::Attach(CFX_DIBitmap* pBitmap, FX_BOOL bRgbByteOrder, CFX_DIBitmap* pOriDevice, FX_BOOL bGroupKnockout) { - if (pBitmap == NULL) + if (!pBitmap) return FALSE; SetBitmap(pBitmap); CFX_SkiaDeviceDriver* pDriver = new CFX_SkiaDeviceDriver( |