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

Side by Side Diff: core/src/fpdfdoc/doc_annot.cpp

Issue 1512763013: Get rid of most instance of 'foo != NULL' (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 6
7 #include "core/include/fpdfapi/fpdf_pageobj.h" 7 #include "core/include/fpdfapi/fpdf_pageobj.h"
8 #include "core/include/fpdfdoc/fpdf_doc.h" 8 #include "core/include/fpdfdoc/fpdf_doc.h"
9 #include "third_party/base/nonstd_unique_ptr.h" 9 #include "third_party/base/nonstd_unique_ptr.h"
10 10
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 CFX_ByteString style = pBS->GetString("S"); 301 CFX_ByteString style = pBS->GetString("S");
302 pDashArray = pBS->GetArray("D"); 302 pDashArray = pBS->GetArray("D");
303 style_char = style[1]; 303 style_char = style[1];
304 width = pBS->GetNumber("W"); 304 width = pBS->GetNumber("W");
305 } 305 }
306 if (width <= 0) { 306 if (width <= 0) {
307 return; 307 return;
308 } 308 }
309 CPDF_Array* pColor = m_pAnnotDict->GetArray("C"); 309 CPDF_Array* pColor = m_pAnnotDict->GetArray("C");
310 FX_DWORD argb = 0xff000000; 310 FX_DWORD argb = 0xff000000;
311 if (pColor != NULL) { 311 if (pColor) {
312 int R = (int32_t)(pColor->GetNumber(0) * 255); 312 int R = (int32_t)(pColor->GetNumber(0) * 255);
313 int G = (int32_t)(pColor->GetNumber(1) * 255); 313 int G = (int32_t)(pColor->GetNumber(1) * 255);
314 int B = (int32_t)(pColor->GetNumber(2) * 255); 314 int B = (int32_t)(pColor->GetNumber(2) * 255);
315 argb = ArgbEncode(0xff, R, G, B); 315 argb = ArgbEncode(0xff, R, G, B);
316 } 316 }
317 CPDF_GraphStateData graph_state; 317 CPDF_GraphStateData graph_state;
318 graph_state.m_LineWidth = width; 318 graph_state.m_LineWidth = width;
319 if (style_char == 'D') { 319 if (style_char == 'D') {
320 if (pDashArray) { 320 if (pDashArray) {
321 FX_DWORD dash_count = pDashArray->GetCount(); 321 FX_DWORD dash_count = pDashArray->GetCount();
(...skipping 20 matching lines...) Expand all
342 CPDF_PathData path; 342 CPDF_PathData path;
343 width /= 2; 343 width /= 2;
344 path.AppendRect(rect.left + width, rect.bottom + width, rect.right - width, 344 path.AppendRect(rect.left + width, rect.bottom + width, rect.right - width,
345 rect.top - width); 345 rect.top - width);
346 int fill_type = 0; 346 int fill_type = 0;
347 if (pOptions && (pOptions->m_Flags & RENDER_NOPATHSMOOTH)) { 347 if (pOptions && (pOptions->m_Flags & RENDER_NOPATHSMOOTH)) {
348 fill_type |= FXFILL_NOPATHSMOOTH; 348 fill_type |= FXFILL_NOPATHSMOOTH;
349 } 349 }
350 pDevice->DrawPath(&path, pUser2Device, &graph_state, argb, argb, fill_type); 350 pDevice->DrawPath(&path, pUser2Device, &graph_state, argb, argb, fill_type);
351 } 351 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698