Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(808)

Unified Diff: core/src/fxge/skia/fx_skia_device.cpp

Issue 1520063002: Get rid of most instance of 'foo == NULL' (Closed) Base URL: https://pdfium.googlesource.com/pdfium@bstr_isnull
Patch Set: rebase Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « core/src/fxge/skia/fx_skia_blitter_new.cpp ('k') | core/src/fxge/win32/fx_win32_device.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/src/fxge/skia/fx_skia_device.cpp
diff --git a/core/src/fxge/skia/fx_skia_device.cpp b/core/src/fxge/skia/fx_skia_device.cpp
index 8e012c82e003cf38b8b1824699e6f146c58ed2ea..2e0371f3128d1c42185e3c91831a7f9e63d79f19 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(
« no previous file with comments | « core/src/fxge/skia/fx_skia_blitter_new.cpp ('k') | core/src/fxge/win32/fx_win32_device.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698