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

Side by Side Diff: fpdfsdk/src/pdfwindow/PWL_Edit.cpp

Issue 1145843005: Revert "Remove FX_Alloc() null checks now that it can't return NULL." (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 5 years, 7 months 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
« no previous file with comments | « fpdfsdk/src/fsdk_baseform.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "../../include/pdfwindow/PDFWindow.h" 7 #include "../../include/pdfwindow/PDFWindow.h"
8 #include "../../include/pdfwindow/PWL_Wnd.h" 8 #include "../../include/pdfwindow/PWL_Wnd.h"
9 #include "../../include/pdfwindow/PWL_EditCtrl.h" 9 #include "../../include/pdfwindow/PWL_EditCtrl.h"
10 #include "../../include/pdfwindow/PWL_Edit.h" 10 #include "../../include/pdfwindow/PWL_Edit.h"
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after
419 if (nCharArray > 0 && nCharArraySafe.IsValid()) 419 if (nCharArray > 0 && nCharArraySafe.IsValid())
420 { 420 {
421 switch (GetBorderStyle()) 421 switch (GetBorderStyle())
422 { 422 {
423 case PBS_SOLID: 423 case PBS_SOLID:
424 { 424 {
425 CFX_GraphStateData gsd; 425 CFX_GraphStateData gsd;
426 gsd.m_LineWidth = (FX_FLOAT)GetBorderWidth(); 426 gsd.m_LineWidth = (FX_FLOAT)GetBorderWidth();
427 427
428 CFX_PathData path; 428 CFX_PathData path;
429 » » » » path.SetPointCount(nCharArraySafe.ValueOrDie()); 429 » » » » if (!path.SetPointCount(nCharArraySafe.ValueOrDi e())) {
430 430 » » » » » return;
431 » » » » }
432 » » » »
431 for (FX_INT32 i=0; i<nCharArray-1; i++) 433 for (FX_INT32 i=0; i<nCharArray-1; i++)
432 » » » » { 434 » » » » {» » » » »
433 » » » » » path.SetPoint(i*2, rcClient.left + ((rcC lient.right - rcClient.left)/nCharArray)*(i+1), 435 » » » » » path.SetPoint(i*2, rcClient.left + ((rcC lient.right - rcClient.left)/nCharArray)*(i+1),
434 rcClient.bottom, FXPT_MOVETO); 436 rcClient.bottom, FXPT_MOVETO);
435 path.SetPoint(i*2+1, rcClient.left + ((r cClient.right - rcClient.left)/nCharArray)*(i+1), 437 path.SetPoint(i*2+1, rcClient.left + ((r cClient.right - rcClient.left)/nCharArray)*(i+1),
436 » » » » » » rcClient.top, FXPT_LINETO); 438 » » » » » » rcClient.top, FXPT_LINETO);» » » » » » » » » » »
437 » » » » } 439 » » » » }» » »
438 if (path.GetPointCount() > 0) 440 if (path.GetPointCount() > 0)
439 pDevice->DrawPath(&path, pUser2Device, & gsd,0, 441 pDevice->DrawPath(&path, pUser2Device, & gsd,0,
440 CPWL_Utils::PWLColorToFXColor(Ge tBorderColor(),255), FXFILL_ALTERNATE); 442 CPWL_Utils::PWLColorToFXColor(Ge tBorderColor(),255), FXFILL_ALTERNATE);
441 } 443 }
442 break; 444 break;
443 case PBS_DASH: 445 case PBS_DASH:
444 { 446 {
445 CFX_GraphStateData gsd; 447 CFX_GraphStateData gsd;
446 gsd.m_LineWidth = (FX_FLOAT)GetBorderWidth(); 448 gsd.m_LineWidth = (FX_FLOAT)GetBorderWidth();
447 449
448 gsd.SetDashCount(2); 450 gsd.SetDashCount(2);
449 gsd.m_DashArray[0] = (FX_FLOAT)GetBorderDash().n Dash; 451 gsd.m_DashArray[0] = (FX_FLOAT)GetBorderDash().n Dash;
450 gsd.m_DashArray[1] = (FX_FLOAT)GetBorderDash().n Gap; 452 gsd.m_DashArray[1] = (FX_FLOAT)GetBorderDash().n Gap;
451 gsd.m_DashPhase = (FX_FLOAT)GetBorderDash().nPha se; 453 gsd.m_DashPhase = (FX_FLOAT)GetBorderDash().nPha se;
452 454
453 CFX_PathData path; 455 CFX_PathData path;
454 » » » » path.SetPointCount(nCharArraySafe.ValueOrDie()); 456 » » » » if (!path.SetPointCount(nCharArraySafe.ValueOrDi e())) {
455 457 » » » » » return;
458 » » » » }
459 » » » »
456 for (FX_INT32 i=0; i<nCharArray-1; i++) 460 for (FX_INT32 i=0; i<nCharArray-1; i++)
457 » » » » { 461 » » » » {» » » » »
458 » » » » » path.SetPoint(i*2, rcClient.left + ((rcC lient.right - rcClient.left)/nCharArray)*(i+1), 462 » » » » » path.SetPoint(i*2, rcClient.left + ((rcC lient.right - rcClient.left)/nCharArray)*(i+1),
459 rcClient.bottom, FXPT_MOVETO); 463 rcClient.bottom, FXPT_MOVETO);
460 path.SetPoint(i*2+1, rcClient.left + ((r cClient.right - rcClient.left)/nCharArray)*(i+1), 464 path.SetPoint(i*2+1, rcClient.left + ((r cClient.right - rcClient.left)/nCharArray)*(i+1),
461 » » » » » » rcClient.top, FXPT_LINETO); 465 » » » » » » rcClient.top, FXPT_LINETO);» » » » » » » » » » »
462 » » » » } 466 » » » » }» »
463 if (path.GetPointCount() > 0) 467 if (path.GetPointCount() > 0)
464 » » » » » pDevice->DrawPath(&path, pUser2Device, & gsd,0, 468 » » » » » pDevice->DrawPath(&path, pUser2Device, & gsd,0,
465 CPWL_Utils::PWLColorToFXColor(Ge tBorderColor(),255), FXFILL_ALTERNATE); 469 CPWL_Utils::PWLColorToFXColor(Ge tBorderColor(),255), FXFILL_ALTERNATE);
466 } 470 }
467 break; 471 break;
468 } 472 }
469 } 473 }
470 474
471 CPDF_Rect rcClip; 475 CPDF_Rect rcClip;
472 CPVT_WordRange wrRange = m_pEdit->GetVisibleWordRange(); 476 CPVT_WordRange wrRange = m_pEdit->GetVisibleWordRange();
473 CPVT_WordRange* pRange = NULL; 477 CPVT_WordRange* pRange = NULL;
474 478
(...skipping 836 matching lines...) Expand 10 before | Expand all | Expand 10 after
1311 IFX_Edit::GeneratePageObjects(pPageObjects, m_pEdit, ptOffset, NULL, CPW L_Utils::PWLColorToFXColor(GetTextColor(),GetTransparency()), ObjArray); 1315 IFX_Edit::GeneratePageObjects(pPageObjects, m_pEdit, ptOffset, NULL, CPW L_Utils::PWLColorToFXColor(GetTextColor(),GetTransparency()), ObjArray);
1312 } 1316 }
1313 1317
1314 void CPWL_Edit::GeneratePageObjects(CPDF_PageObjects* pPageObjects, 1318 void CPWL_Edit::GeneratePageObjects(CPDF_PageObjects* pPageObjects,
1315 const CP DF_Point& ptOffset) 1319 const CP DF_Point& ptOffset)
1316 { 1320 {
1317 CFX_ArrayTemplate<CPDF_TextObject*> ObjArray; 1321 CFX_ArrayTemplate<CPDF_TextObject*> ObjArray;
1318 IFX_Edit::GeneratePageObjects(pPageObjects, m_pEdit, ptOffset, NULL, CPW L_Utils::PWLColorToFXColor(GetTextColor(),GetTransparency()), ObjArray); 1322 IFX_Edit::GeneratePageObjects(pPageObjects, m_pEdit, ptOffset, NULL, CPW L_Utils::PWLColorToFXColor(GetTextColor(),GetTransparency()), ObjArray);
1319 } 1323 }
1320 1324
OLDNEW
« no previous file with comments | « fpdfsdk/src/fsdk_baseform.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698